Bladeren bron

修改无公司隐藏下拉

ccjgmwz 3 jaren geleden
bovenliggende
commit
a203dc2c42
1 gewijzigde bestanden met toevoegingen van 12 en 2 verwijderingen
  1. 12 2
      pages/user/user.vue

+ 12 - 2
pages/user/user.vue

@@ -11,8 +11,10 @@
 				<view class="personal">
 					<view @click="toLogin" class="information">{{hasLogin? username : '立即登录' }}</view>
 					<view style='font-size:13px;color:#8F97AB;' class="information">{{starUserphone}}</view>
-					<view v-if='hasLogin' @click='show=true' class="company"><image class='icon' style='width:19px;height:19px;' src="../../static/img/icon_qiye@3x.png" mode=""></image> {{compName}}></view>
-					<u-picker @confirm='compconfirm' mode="selector" v-model="show"   :range="companyList" range-key="compName"></u-picker>
+					<view v-if="haveCompany">
+						<view v-if='hasLogin' @click='show=true' class="company"><image class='icon' style='width:19px;height:19px;' src="../../static/img/icon_qiye@3x.png" mode=""></image> {{compName}}></view>
+						<u-picker @confirm='compconfirm' mode="selector" v-model="show"   :range="companyList" range-key="compName"></u-picker>
+					</view>
 				</view>
 			</view>
 
@@ -92,6 +94,7 @@
 		},
 		data() {
 			return {
+				haveCompany:false,
 				scrollTop: 0,
 				inputShow: false,
 				modalName: '',
@@ -264,6 +267,11 @@
 			this.scrollTop = e.scrollTop;
 		},
 		onShow() {
+			if(uni.getStorageSync('compName')){
+				this.haveCompany =true
+			}else{
+				this.haveCompany =false
+			}
 			this.isShow();
 			uni.hideKeyboard()
 			uni.showTabBar()
@@ -307,6 +315,7 @@
 						// });
 					}
 				})
+				debugger
 				if(!uni.getStorageSync('compName')){
 					this.$api.doRequest('get', '/commonUser/getCompOwn', {
 				phone: this.userInfo.phone
@@ -316,6 +325,7 @@
 							if(this.companyList.length>0){
 								this.compName=this.companyList[0].compName
 								uni.setStorageSync('compName', this.companyList[0].compName)
+								this.haveCompany = true
 							}
 						}
 					})