新增跟修改完成

master
Lee 2023-01-14 12:28:31 +08:00
parent a54f37416c
commit 43c5803e38
16 changed files with 96 additions and 102 deletions

23
App.vue
View File

@ -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>

View File

@ -11,18 +11,27 @@
}
},
onShow() {
if(uni.getStorageSync('worker_role')==2){
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=director'
})
}else{
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=worker'
})
}
//
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'
})
}else{
uni.reLaunch({
url:'/pages/worker/sign/sign?userType=worker'
})
}
}
})
},
}
}
</script>

View File

@ -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];

View File

@ -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){

View File

@ -192,7 +192,15 @@
getUserInfo(){
this.$requst.post('/api/v1/user/info').then(res=>{
if(res.code==0){
console.log(res,'用户信息');
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

View File

@ -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"]))
/***/ }),

View File

@ -10,29 +10,6 @@
/* 阿里巴巴矢量图标库 start */
@font-face {
font-family: "iconfont"; /* Project id 3180711 */

View File

@ -149,17 +149,28 @@ var _default = {
return {};
},
onShow: function onShow() {
if (uni.getStorageSync('worker_role') == 2) {
uni.reLaunch({
url: '/pages/worker/sign/sign?userType=director'
});
} else {
uni.reLaunch({
url: '/pages/worker/sign/sign?userType=worker'
// 获取用户信息
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'
});
} else {
uni.reLaunch({
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"]))

View File

@ -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];

View File

@ -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) {

View File

@ -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) {