Commit 3dd01d04 authored by 刘怀志's avatar 刘怀志

feat(我的): 模块完成

parent c3a4a5ff
......@@ -8,3 +8,10 @@ export function listBaseConfig(query) {
params: query
})
}
// 根据字典类型查询字典数据信息
export function getDicts(dictType) {
return request({
url: '/system/dict/data/type/' + dictType,
method: 'get'
})
}
\ No newline at end of file
......@@ -81,3 +81,13 @@ export function getQRById(id) {
responseType: 'arraybuffer'
})
}
/**
* 根据id查询员工详情
* @returns {*}
*/
export function getUserById(userId) {
return request({
url: '/staff/getUserById/' +userId,
method: 'get'
})
}
\ No newline at end of file
......@@ -238,6 +238,7 @@ export default {
<style lang="scss" scoped>
.mine-navbar {
padding-top: 88rpx;
background-clip: border-box;
height: 440rpx;
background: url("/static/images/top-background.png") center/cover no-repeat;
......
......@@ -326,7 +326,7 @@ export default {
this.$modal.confirmLogout('是否立即退出登录').then(() => {
this.$store.commit('SET_LOGOUT_BTN', true)
this.$store.dispatch('LogOut').then(() => {
this.$tab.reLaunch('/pages/index')
this.$tab.reLaunch('/pages/login')
})
})
},
......@@ -616,7 +616,8 @@ page {
}
.mine-container {
background-color: #FFFFFF;
background-color: #F9F9F9;
overflow-y: hidden;
.nav-bar {
height: 100%;
......
......@@ -20,12 +20,12 @@
<img class="user-img" :src="headImg" />
<view class="use-info">
<view class="user-name">
<text class="name-text-left">张三</text>
<text class="name-text-left">{{userInfoConsole.idmName}}</text>
<text class="name-text">·</text>
<text class="name-text-right">品质担当</text>
<text class="name-text-right">{{userInfoConsole.productionRoleName}}</text>
</view>
<view class="dept">
<text>发动机装配科</text>
<text>{{userInfoConsole.deptName}}</text>
</view>
</view>
</view>
......@@ -39,7 +39,7 @@
<text>员工ID</text>
</view>
<view class="info-value">
<text>fef82ng328df29213</text>
<text>{{userDetail.businessId}}</text>
</view>
</view>
<view class="info-item has-border">
......@@ -47,7 +47,7 @@
<text>员工招聘号</text>
</view>
<view class="info-value">
<text>fef82ng328df29213</text>
<text>{{userDetail.recruitNum}}</text>
</view>
</view>
<view class="info-item has-border">
......@@ -55,7 +55,7 @@
<text>职级</text>
</view>
<view class="info-value">
<text>担当级</text>
<text>{{getLabelByValue(jobDistList, userDetail.staffLevel)}}</text>
</view>
</view>
<view class="info-item has-border">
......@@ -63,17 +63,29 @@
<text>用户名</text>
</view>
<view class="info-value">
<text>chenhaiyi001</text>
<text>{{userDetail.username}}</text>
</view>
</view>
<view class="info-item">
<view class="info-label">
<text>所属产线</text>
<div v-if="userDetail.proLineUserList > 0" >
<view class="info-item" v-for="(item,key) in userDetail.proLineUserList" :key="item.proLineId">
<view class="info-label">
<text>所属产线</text>
</view>
<view class="info-value">
<text>{{item.proLineInfoName}}</text>
</view>
</view>
<view class="info-value">
<text>AE 2#产线</text>
</view>
</view>
</div>
<div v-else>
<view class="info-item">
<view class="info-label">
<text>所属产线</text>
</view>
<view class="info-value">
<text>-</text>
</view>
</view>
</div>
</view>
</view>
<!-- 二维码弹出层-->
......@@ -102,7 +114,10 @@
</template>
<script>
import drawQrcode from '../../utils/dist_weapp.qrcode.esm'
import {mapGetters} from 'vuex'
import {getUserInfoConsole} from "../../api/login";
import {getDicts} from "../../api/system/baseConfig";
import {getUserById} from "../../api/system/user";
/**
* @property {String} title 导航栏标题,如设置为空字符,将会隐藏标题占位区域
* @property {String | Number} titleWidth 导航栏标题的最大宽度,内容超出会以省略号隐藏
......@@ -172,6 +187,9 @@ export default {
},
data() {
return {
jobDistList: [],
userDetail: {},
userInfoConsole: {},
form: {},
popStyle: {
background: 'url("/static/images/popBackground.png") center/contain no-repeat',
......@@ -180,13 +198,14 @@ export default {
height: '860rpx'
},
showCode: false,
headImg: require('../../static/images/profile.jpg'),
headImg: require('../../static/images/home-avatar.svg'),
qrImg: require('../../static/images/qrImg.png'),
iconClose: require('../../static/images/iconClose.png'),
headIcon: require('../../static/images/headIcon.png')
}
},
computed: {
...mapGetters(['userInfo']),
totalHeight() {
return uni.$u.addUnit(uni.$u.getPx(this.height) + uni.$u.sys().statusBarHeight, 'px')
}
......@@ -195,64 +214,48 @@ export default {
},
created() {
this.getList()
},
mounted() {
this.getDetail()
this.getUserInfo()
},
methods: {
// 创建二维码
createQrcode: function() {
var that = this
const query = wx.createSelectorQuery()
query.select('#myQrcode')
.fields({
node: true,
size: true
})
.exec((res) => {
var canvas = res[0].node
// 调用方法drawQrcode生成二维码
drawQrcode({
canvas: canvas,
canvasId: 'myQrcode',
width: 260,
padding: 30,
background: '#ffffff',
foreground: '#000000',
text: that.form.ownersId
})
// 获取临时路径(得到之后,想干嘛就干嘛了)
wx.canvasToTempFilePath({
canvasId: 'myQrcode',
canvas: canvas,
x: 0,
y: 0,
width: 260,
height: 260,
destWidth: 260,
destHeight: 260,
success(res) {
console.log('二维码临时路径:', res.tempFilePath)
},
fail(res) {
console.error(res)
}
})
})
/**
* 指定列表,根据值,取label
*/
getLabelByValue (list, value, key = 'value', label = 'label') {
const item = list.find(item => item[key] === value)
return item ? item[label] : '-'
},
close() {
this.showCode = false
/** 查询字典数据列表 */
getList() {
getDicts('sys_job_level').then(response => {
// console.log("查询数据字段狗",response)
const jobList = response.data
for (const item of jobList) {
const result = {
value: item.dictValue,
label: item.dictLabel
}
this.jobDistList.push(result)
}
})
},
// 点击二维码
viewCode() {
this.createQrcode()
this.showCode = true
getUserInfo() {
getUserInfoConsole().then(res => {
console.log('获取用户信息', res)
this.userInfoConsole = res.data
})
},
getDetail() {
getUserById(this.userInfo.businessId).then(res => {
if (res.code === 200) {
this.userDetail = res.data
}
})
}
}
}
</script>
......@@ -268,7 +271,7 @@ export default {
top: 0;
z-index: 11;
.bar-detail{
margin-left: 32rpx;
margin: 0 32rpx;
.title{
margin-left: 8rpx;
font-family: PingFangSC, PingFang SC;
......
......@@ -104,17 +104,13 @@ const user = {
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
commit('SET_USER_INFO', '')
removeToken()
storage.clean()
resolve()
}).catch(error => {
reject(error)
})
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
commit('SET_USER_INFO', '')
removeToken()
storage.clean()
resolve()
})
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment