新增跟修改完成
parent
a54f37416c
commit
43c5803e38
23
App.vue
23
App.vue
|
@ -6,29 +6,6 @@
|
|||
lng:'' ,// 公司地址经度
|
||||
hostapi:'https://building.scdxtc.cn' // 域名配置
|
||||
},
|
||||
onShow() {
|
||||
uni.request({
|
||||
url:`https://building.scdxtc.cn/api/v1/user/info`,
|
||||
method:'POST',
|
||||
header:{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: (res) => {
|
||||
if(res.data.code==0){
|
||||
console.log(res,'用户信息');
|
||||
if(res.data.role!==uni.setStorageSync('worker_role',res.data.role)){
|
||||
// 缓存工人状态
|
||||
uni.setStorageSync('worker_role',res.data.role);
|
||||
// 跳转到进入页面
|
||||
uni.reLaunch({
|
||||
url:'/pages//pagehome/pagehome'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -11,7 +11,16 @@
|
|||
}
|
||||
},
|
||||
onShow() {
|
||||
if(uni.getStorageSync('worker_role')==2){
|
||||
// 获取用户信息
|
||||
this.getUserInfo();
|
||||
},
|
||||
methods: {
|
||||
// 获取用户信息
|
||||
getUserInfo(){
|
||||
this.$requst.post('/api/v1/user/info').then(res=>{
|
||||
if(res.code==0){
|
||||
console.log(res,'用户信息');
|
||||
if(res.data.role==2){
|
||||
uni.reLaunch({
|
||||
url:'/pages/worker/sign/sign?userType=director'
|
||||
})
|
||||
|
@ -20,9 +29,9 @@
|
|||
url:'/pages/worker/sign/sign?userType=worker'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -120,6 +120,8 @@
|
|||
}
|
||||
// 改变状态栏
|
||||
this.changeStatusNav();
|
||||
},
|
||||
onShow() {
|
||||
// 获取用户信息
|
||||
this.getUserInfo();
|
||||
},
|
||||
|
@ -136,6 +138,14 @@
|
|||
this.$requst.post('/api/v1/user/info').then(res=>{
|
||||
if(res.code==0){
|
||||
console.log(res,'用户信息');
|
||||
if(res.data.role!==uni.getStorageSync('worker_role')){
|
||||
this.$toolAll.tools.showToast('身份已变更,正在切换');
|
||||
setTimeout(()=>{
|
||||
uni.reLaunch({
|
||||
url:'/pages/pagehome/pagehome'
|
||||
})
|
||||
},2000)
|
||||
}
|
||||
uni.setStorageSync('baseWorksiteId',res.data.worksite_id)
|
||||
if(res.data.role==0){
|
||||
this.showList = [0,1,5,6,8];
|
||||
|
|
|
@ -396,9 +396,13 @@
|
|||
this.$requst.post('/api/v1/user/info').then(res=>{
|
||||
if(res.code==0){
|
||||
console.log(res,'用户信息');
|
||||
if(res.data.role!==uni.setStorageSync('worker_role',res.data.role)){
|
||||
// 缓存工人状态
|
||||
uni.setStorageSync('worker_role',res.data.role);
|
||||
if(res.data.role!==uni.getStorageSync('worker_role')){
|
||||
this.$toolAll.tools.showToast('身份已变更,正在切换');
|
||||
setTimeout(()=>{
|
||||
uni.reLaunch({
|
||||
url:'/pages/pagehome/pagehome'
|
||||
})
|
||||
},2000)
|
||||
}
|
||||
this.userInfo = res.data;
|
||||
if(this.userInfo.worksite_id==0){
|
||||
|
|
|
@ -193,6 +193,14 @@
|
|||
this.$requst.post('/api/v1/user/info').then(res=>{
|
||||
if(res.code==0){
|
||||
console.log(res,'用户信息');
|
||||
if(res.data.role!==uni.getStorageSync('worker_role')){
|
||||
this.$toolAll.tools.showToast('身份已变更,正在切换');
|
||||
setTimeout(()=>{
|
||||
uni.reLaunch({
|
||||
url:'/pages/pagehome/pagehome'
|
||||
})
|
||||
},2000)
|
||||
}
|
||||
this.userInfo = res.data;
|
||||
this.isLoding = true;
|
||||
this.positionIndex = this.positionList.findIndex(item=> item.id === res.data.position);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -124,7 +124,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* WEBPACK VAR INJECTION */(function(uni) {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
|
@ -139,33 +139,9 @@ var _default = {
|
|||
lng: '',
|
||||
// 公司地址经度
|
||||
hostapi: 'https://building.scdxtc.cn' // 域名配置
|
||||
},
|
||||
onShow: function onShow() {
|
||||
uni.request({
|
||||
url: "https://building.scdxtc.cn/api/v1/user/info",
|
||||
method: 'POST',
|
||||
header: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Bearer ' + uni.getStorageSync('token') || false
|
||||
},
|
||||
success: function success(res) {
|
||||
if (res.data.code == 0) {
|
||||
console.log(res, '用户信息');
|
||||
if (res.data.role !== uni.setStorageSync('worker_role', res.data.role)) {
|
||||
// 缓存工人状态
|
||||
uni.setStorageSync('worker_role', res.data.role);
|
||||
// 跳转到进入页面
|
||||
uni.reLaunch({
|
||||
url: '/pages//pagehome/pagehome'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
|
|
@ -10,29 +10,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* 阿里巴巴矢量图标库 start */
|
||||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 3180711 */
|
||||
|
|
|
@ -149,7 +149,16 @@ var _default = {
|
|||
return {};
|
||||
},
|
||||
onShow: function onShow() {
|
||||
if (uni.getStorageSync('worker_role') == 2) {
|
||||
// 获取用户信息
|
||||
this.getUserInfo();
|
||||
},
|
||||
methods: {
|
||||
// 获取用户信息
|
||||
getUserInfo: function getUserInfo() {
|
||||
this.$requst.post('/api/v1/user/info').then(function (res) {
|
||||
if (res.code == 0) {
|
||||
console.log(res, '用户信息');
|
||||
if (res.data.role == 2) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/worker/sign/sign?userType=director'
|
||||
});
|
||||
|
@ -158,8 +167,10 @@ var _default = {
|
|||
url: '/pages/worker/sign/sign?userType=worker'
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
|
||||
|
|
|
@ -338,6 +338,8 @@ var _default = {
|
|||
}
|
||||
// 改变状态栏
|
||||
this.changeStatusNav();
|
||||
},
|
||||
onShow: function onShow() {
|
||||
// 获取用户信息
|
||||
this.getUserInfo();
|
||||
},
|
||||
|
@ -355,6 +357,14 @@ var _default = {
|
|||
this.$requst.post('/api/v1/user/info').then(function (res) {
|
||||
if (res.code == 0) {
|
||||
console.log(res, '用户信息');
|
||||
if (res.data.role !== uni.getStorageSync('worker_role')) {
|
||||
_this.$toolAll.tools.showToast('身份已变更,正在切换');
|
||||
setTimeout(function () {
|
||||
uni.reLaunch({
|
||||
url: '/pages/pagehome/pagehome'
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
uni.setStorageSync('baseWorksiteId', res.data.worksite_id);
|
||||
if (res.data.role == 0) {
|
||||
_this.showList = [0, 1, 5, 6, 8];
|
||||
|
|
|
@ -380,9 +380,13 @@ var _default = {
|
|||
this.$requst.post('/api/v1/user/info').then(function (res) {
|
||||
if (res.code == 0) {
|
||||
console.log(res, '用户信息');
|
||||
if (res.data.role !== uni.setStorageSync('worker_role', res.data.role)) {
|
||||
// 缓存工人状态
|
||||
uni.setStorageSync('worker_role', res.data.role);
|
||||
if (res.data.role !== uni.getStorageSync('worker_role')) {
|
||||
_this.$toolAll.tools.showToast('身份已变更,正在切换');
|
||||
setTimeout(function () {
|
||||
uni.reLaunch({
|
||||
url: '/pages/pagehome/pagehome'
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
_this.userInfo = res.data;
|
||||
if (_this.userInfo.worksite_id == 0) {
|
||||
|
|
|
@ -210,6 +210,14 @@ var _default = {
|
|||
this.$requst.post('/api/v1/user/info').then(function (res) {
|
||||
if (res.code == 0) {
|
||||
console.log(res, '用户信息');
|
||||
if (res.data.role !== uni.getStorageSync('worker_role')) {
|
||||
_this.$toolAll.tools.showToast('身份已变更,正在切换');
|
||||
setTimeout(function () {
|
||||
uni.reLaunch({
|
||||
url: '/pages/pagehome/pagehome'
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
_this.userInfo = res.data;
|
||||
_this.isLoding = true;
|
||||
_this.positionIndex = _this.positionList.findIndex(function (item) {
|
||||
|
|
Loading…
Reference in New Issue