ccj 2 年之前
父節點
當前提交
5a3349ad8a
共有 1 個文件被更改,包括 12 次插入2 次删除
  1. 12 2
      pages/user/user.vue

+ 12 - 2
pages/user/user.vue

@@ -103,6 +103,7 @@
 		},
 		data() {
 			return {
+				pcUserInfo:{},
 				isShowAlert: false,
 				content: '您尚未登录,是否立即登录?',
 				haveCompany: false,
@@ -398,7 +399,8 @@
 		},
 		onShow() {
 			// console.log(111111111)
-			if (uni.getStorageSync('pcUserInfo')) {
+			this.pcUserInfo = uni.getStorageSync('pcUserInfo')
+			if (this.pcUserInfo) {
 				// console.log(2222222)
 				for (var i = 0; i < this.gridList1.length; i++) {
 					if (this.gridList1[i].num == 0 || this.gridList1[i].num == 1 || this.gridList1[i].num == 3 || this
@@ -484,12 +486,20 @@
 
 				// 	}
 				// });
-				that.compName = uni.getStorageSync('compName1')
 				that.$api.doRequest('get', '/commonUser/getCompOwn', {
 					phone: that.userInfo.phone
 				}).then(res => {
 					if (res.data.data) {
 						that.companyList = res.data.data
+						if(that.pcUserInfo){
+							for(let i=0;i<that.companyList.length;i++){
+								if(that.pcUserInfo.compId == that.companyList[i].compId){
+									uni.setStorageSync('compName1',that.companyList[i].compName)
+									that.compName = that.companyList[i].compName
+								}
+								
+							}
+						}
 						console.log("that.3333")
 						console.log(that.companyList)
 						if (that.companyList.length > 0) {