新增跟修改完成
							parent
							
								
									a54f37416c
								
							
						
					
					
						commit
						43c5803e38
					
				
							
								
								
									
										23
									
								
								App.vue
								
								
								
								
							
							
						
						
									
										23
									
								
								App.vue
								
								
								
								
							| 
						 | 
					@ -6,29 +6,6 @@
 | 
				
			||||||
			lng:''  ,// 公司地址经度
 | 
								lng:''  ,// 公司地址经度
 | 
				
			||||||
			hostapi:'https://building.scdxtc.cn' // 域名配置
 | 
								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>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,18 +11,27 @@
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		onShow() {
 | 
							onShow() {
 | 
				
			||||||
			if(uni.getStorageSync('worker_role')==2){
 | 
								// 获取用户信息
 | 
				
			||||||
				uni.reLaunch({
 | 
								this.getUserInfo();
 | 
				
			||||||
					url:'/pages/worker/sign/sign?userType=director'
 | 
					 | 
				
			||||||
				})
 | 
					 | 
				
			||||||
			}else{
 | 
					 | 
				
			||||||
				uni.reLaunch({
 | 
					 | 
				
			||||||
					url:'/pages/worker/sign/sign?userType=worker'
 | 
					 | 
				
			||||||
				})
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		methods: {
 | 
							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>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -120,6 +120,8 @@
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// 改变状态栏
 | 
								// 改变状态栏
 | 
				
			||||||
			this.changeStatusNav();
 | 
								this.changeStatusNav();
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							onShow() {
 | 
				
			||||||
			// 获取用户信息
 | 
								// 获取用户信息
 | 
				
			||||||
			this.getUserInfo();
 | 
								this.getUserInfo();
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
| 
						 | 
					@ -136,6 +138,14 @@
 | 
				
			||||||
				this.$requst.post('/api/v1/user/info').then(res=>{
 | 
									this.$requst.post('/api/v1/user/info').then(res=>{
 | 
				
			||||||
					if(res.code==0){
 | 
										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)
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
						uni.setStorageSync('baseWorksiteId',res.data.worksite_id)
 | 
											uni.setStorageSync('baseWorksiteId',res.data.worksite_id)
 | 
				
			||||||
						if(res.data.role==0){
 | 
											if(res.data.role==0){
 | 
				
			||||||
							this.showList = [0,1,5,6,8];
 | 
												this.showList = [0,1,5,6,8];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -396,9 +396,13 @@
 | 
				
			||||||
				this.$requst.post('/api/v1/user/info').then(res=>{
 | 
									this.$requst.post('/api/v1/user/info').then(res=>{
 | 
				
			||||||
					if(res.code==0){
 | 
										if(res.code==0){
 | 
				
			||||||
						console.log(res,'用户信息');
 | 
											console.log(res,'用户信息');
 | 
				
			||||||
						if(res.data.role!==uni.setStorageSync('worker_role',res.data.role)){
 | 
											if(res.data.role!==uni.getStorageSync('worker_role')){
 | 
				
			||||||
							// 缓存工人状态
 | 
												this.$toolAll.tools.showToast('身份已变更,正在切换');
 | 
				
			||||||
							uni.setStorageSync('worker_role',res.data.role);
 | 
												setTimeout(()=>{
 | 
				
			||||||
 | 
													uni.reLaunch({
 | 
				
			||||||
 | 
														url:'/pages/pagehome/pagehome'
 | 
				
			||||||
 | 
													})
 | 
				
			||||||
 | 
												},2000)
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						this.userInfo = res.data;
 | 
											this.userInfo = res.data;
 | 
				
			||||||
						if(this.userInfo.worksite_id==0){
 | 
											if(this.userInfo.worksite_id==0){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,15 @@
 | 
				
			||||||
			getUserInfo(){
 | 
								getUserInfo(){
 | 
				
			||||||
				this.$requst.post('/api/v1/user/info').then(res=>{
 | 
									this.$requst.post('/api/v1/user/info').then(res=>{
 | 
				
			||||||
					if(res.code==0){
 | 
										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.userInfo = res.data;
 | 
				
			||||||
						this.isLoding = true;
 | 
											this.isLoding = true;
 | 
				
			||||||
						this.positionIndex =  this.positionList.findIndex(item=> item.id === res.data.position);
 | 
											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__) {
 | 
					/***/ (function(module, exports, __webpack_require__) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
/* WEBPACK VAR INJECTION */(function(uni) {
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Object.defineProperty(exports, "__esModule", {
 | 
					Object.defineProperty(exports, "__esModule", {
 | 
				
			||||||
  value: true
 | 
					  value: true
 | 
				
			||||||
| 
						 | 
					@ -139,33 +139,9 @@ var _default = {
 | 
				
			||||||
    lng: '',
 | 
					    lng: '',
 | 
				
			||||||
    // 公司地址经度
 | 
					    // 公司地址经度
 | 
				
			||||||
    hostapi: 'https://building.scdxtc.cn' // 域名配置
 | 
					    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;
 | 
					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 */
 | 
					/* 阿里巴巴矢量图标库 start */
 | 
				
			||||||
@font-face {
 | 
					@font-face {
 | 
				
			||||||
  font-family: "iconfont"; /* Project id 3180711 */
 | 
					  font-family: "iconfont"; /* Project id 3180711 */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,17 +149,28 @@ var _default = {
 | 
				
			||||||
    return {};
 | 
					    return {};
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  onShow: function onShow() {
 | 
					  onShow: function onShow() {
 | 
				
			||||||
    if (uni.getStorageSync('worker_role') == 2) {
 | 
					    // 获取用户信息
 | 
				
			||||||
      uni.reLaunch({
 | 
					    this.getUserInfo();
 | 
				
			||||||
        url: '/pages/worker/sign/sign?userType=director'
 | 
					  },
 | 
				
			||||||
      });
 | 
					  methods: {
 | 
				
			||||||
    } else {
 | 
					    // 获取用户信息
 | 
				
			||||||
      uni.reLaunch({
 | 
					    getUserInfo: function getUserInfo() {
 | 
				
			||||||
        url: '/pages/worker/sign/sign?userType=worker'
 | 
					      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;
 | 
					exports.default = _default;
 | 
				
			||||||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["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();
 | 
					    this.changeStatusNav();
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  onShow: function onShow() {
 | 
				
			||||||
    // 获取用户信息
 | 
					    // 获取用户信息
 | 
				
			||||||
    this.getUserInfo();
 | 
					    this.getUserInfo();
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					@ -355,6 +357,14 @@ var _default = {
 | 
				
			||||||
      this.$requst.post('/api/v1/user/info').then(function (res) {
 | 
					      this.$requst.post('/api/v1/user/info').then(function (res) {
 | 
				
			||||||
        if (res.code == 0) {
 | 
					        if (res.code == 0) {
 | 
				
			||||||
          console.log(res, '用户信息');
 | 
					          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);
 | 
					          uni.setStorageSync('baseWorksiteId', res.data.worksite_id);
 | 
				
			||||||
          if (res.data.role == 0) {
 | 
					          if (res.data.role == 0) {
 | 
				
			||||||
            _this.showList = [0, 1, 5, 6, 8];
 | 
					            _this.showList = [0, 1, 5, 6, 8];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -380,9 +380,13 @@ var _default = {
 | 
				
			||||||
      this.$requst.post('/api/v1/user/info').then(function (res) {
 | 
					      this.$requst.post('/api/v1/user/info').then(function (res) {
 | 
				
			||||||
        if (res.code == 0) {
 | 
					        if (res.code == 0) {
 | 
				
			||||||
          console.log(res, '用户信息');
 | 
					          console.log(res, '用户信息');
 | 
				
			||||||
          if (res.data.role !== uni.setStorageSync('worker_role', res.data.role)) {
 | 
					          if (res.data.role !== uni.getStorageSync('worker_role')) {
 | 
				
			||||||
            // 缓存工人状态
 | 
					            _this.$toolAll.tools.showToast('身份已变更,正在切换');
 | 
				
			||||||
            uni.setStorageSync('worker_role', res.data.role);
 | 
					            setTimeout(function () {
 | 
				
			||||||
 | 
					              uni.reLaunch({
 | 
				
			||||||
 | 
					                url: '/pages/pagehome/pagehome'
 | 
				
			||||||
 | 
					              });
 | 
				
			||||||
 | 
					            }, 2000);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          _this.userInfo = res.data;
 | 
					          _this.userInfo = res.data;
 | 
				
			||||||
          if (_this.userInfo.worksite_id == 0) {
 | 
					          if (_this.userInfo.worksite_id == 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -210,6 +210,14 @@ var _default = {
 | 
				
			||||||
      this.$requst.post('/api/v1/user/info').then(function (res) {
 | 
					      this.$requst.post('/api/v1/user/info').then(function (res) {
 | 
				
			||||||
        if (res.code == 0) {
 | 
					        if (res.code == 0) {
 | 
				
			||||||
          console.log(res, '用户信息');
 | 
					          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.userInfo = res.data;
 | 
				
			||||||
          _this.isLoding = true;
 | 
					          _this.isLoding = true;
 | 
				
			||||||
          _this.positionIndex = _this.positionList.findIndex(function (item) {
 | 
					          _this.positionIndex = _this.positionList.findIndex(function (item) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue