146 lines
3.4 KiB
Vue
146 lines
3.4 KiB
Vue
<template name="my">
|
||
<view>
|
||
<cu-custom bgColor="bg-gradual-blueness">
|
||
<block slot="content">我的</block>
|
||
</cu-custom>
|
||
<view class="my-avatar">
|
||
<view class="cu-avatar xl round margin-left" :style="'background-image: url('+userPhoto+');'"></view>
|
||
<view class="right">
|
||
<view class="f30 text-bold">{{loginUser.NAME}}</view>
|
||
<view class="mt10">
|
||
<text class="text-grey">手机号:</text>
|
||
<text class="text-grey">{{loginUser.USERNAME}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="cu-list menu margin-top">
|
||
<view class="cu-item arrow">
|
||
<navigator class="content" v-if="isRest=='1'" hover-class="none" url="../" @click="showRest()">
|
||
<text class="text-semi">离岗</text>
|
||
</navigator>
|
||
<navigator class="content" v-else hover-class="none" url="/pages/my/offduty/offduty-detail">
|
||
<text class="text-semi">离岗</text>
|
||
</navigator>
|
||
</view>
|
||
<view class="cu-item arrow">
|
||
<navigator class="content" hover-class="none" url="/pages/my/set/set">
|
||
<text class="text-semi">设置</text>
|
||
</navigator>
|
||
</view>
|
||
<view class="cu-item arrow">
|
||
<navigator class="content" hover-class="none" url="/pages/my/feedback/feedback">
|
||
<text class="text-semi">问题反馈</text>
|
||
</navigator>
|
||
</view>
|
||
<view class="cu-item arrow">
|
||
<navigator class="content" hover-class="none" url="/pages/my/about/about">
|
||
<text class="text-semi">关于</text>
|
||
</navigator>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
basePath,loginUser,baseImgPath,isRest,corpinfoId,setIsRest
|
||
} from '@/common/tool.js';
|
||
export default {
|
||
data() {
|
||
return {
|
||
loginUser :'',
|
||
userPhoto :'',
|
||
isRest :''
|
||
};
|
||
},
|
||
mounted() {
|
||
this.getData();
|
||
this.loginUser = loginUser;
|
||
this.isRest = isRest;
|
||
if(this.loginUser.USERNAME){
|
||
this.getUserInfo();
|
||
}
|
||
|
||
},
|
||
methods: {
|
||
showRest(){
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: "您已经处于离岗状态中",
|
||
duration: 2000
|
||
});
|
||
},
|
||
getData(){
|
||
var _this = this;
|
||
// 查看是否离岗
|
||
uni.request({
|
||
url: basePath+'/app/offduty/isRest',
|
||
method: 'POST',
|
||
dataType: 'json',
|
||
header:{
|
||
'Content-type':'application/x-www-form-urlencoded'
|
||
},
|
||
data: {
|
||
CORPINFO_ID:corpinfoId,
|
||
USER_ID:loginUser.USER_ID,
|
||
},
|
||
success: (res) => {
|
||
if (res.data.ISREST != null) {
|
||
setIsRest(res.data.ISREST);
|
||
_this.isRest = res.data.ISREST;
|
||
}
|
||
_this.$forceUpdate();
|
||
},
|
||
fail: (res) => {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: "服务器正在升级,请稍后再试。",
|
||
duration: 2000
|
||
});
|
||
}
|
||
});
|
||
},
|
||
getUserInfo(){
|
||
var _this = this;
|
||
uni.request({
|
||
url: basePath+"/app/user/getUserPhoto", //提交接口
|
||
method: 'POST',
|
||
dataType:'json',
|
||
header:{
|
||
'Content-type':'application/x-www-form-urlencoded'
|
||
},
|
||
data: {
|
||
USERNAME:this.loginUser.USERNAME,
|
||
},
|
||
success: (res) => {
|
||
if('success' == res.data.result){
|
||
_this.userPhoto =basePath +"/"+ res.data.userPhoto;
|
||
}else{
|
||
uni.showToast({
|
||
title: res.data.message,
|
||
duration: 2000
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.my-avatar{
|
||
background-color: #fff;
|
||
padding: 40upx 20upx;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.my-avatar .right{
|
||
margin-left: 30upx;
|
||
}
|
||
.cu-list.menu>.cu-item.arrow {
|
||
padding-right: 35px;
|
||
}
|
||
</style>
|