Przeglądaj źródła

【Add】内部账号可以修改城市

liuxiangxin 5 miesięcy temu
rodzic
commit
283a4ae086
3 zmienionych plików z 33 dodań i 2 usunięć
  1. 8 1
      pages/index/index.vue
  2. 11 0
      pages/user/info.vue
  3. 14 1
      utils/checkaccess.js

+ 8 - 1
pages/index/index.vue

@@ -33,7 +33,10 @@
 		</view>
 		<view class="search_fixed" >
 			<view class="search_box">
-				<view class="city_name" v-if="!toSelectedCity">{{cityName}}</view>
+				<view class="city_name" v-if="!toSelectedCity">
+					<navigator url="/pages/user/info" v-if="isManager" >{{cityName}}</navigator>
+					<text v-if="!isManager" >{{cityName}}</text>
+				</view>
 				<navigator url="/pages/user/info" v-if="toSelectedCity" class="city_name uncheck">选城市</navigator>
 				<input class="search_input" type="text" v-model="requestParam.name" @input="searchChange" placeholder="请输入产品名称搜索" />
 				<button class="search_btn" @click.stop="searchOpen()"  data-eventsync="true"> 搜索</button>
@@ -66,6 +69,8 @@
 				cityName:"选城市",
 				// 选择城市
 				toSelectedCity:false,
+				// 是否是管理员
+				isManager:false,
 			}
 		},
 		onLoad() {
@@ -106,6 +111,8 @@
 			this.cityName			= this.cityName ? this.cityName : "选城市",
 			// 登录并且未选择城市,才可以选择城市
 			this.toSelectedCity 	= !this.$checkAccess.getCity() ? true : false;
+			// 数据
+			this.isManager			= this.$checkAccess.isManager();
 			// 没有数据的话,或者请求中,不允许刷新
 			if( this.isReqing )		return ;
 			// 获取列表

+ 11 - 0
pages/user/info.vue

@@ -47,6 +47,17 @@
 		onShow(){
 			// 登录信息
 			if( !this.$checkAccess.alterLogin() ) return ;
+			// 授权成功以后,调用绑定
+			this.$http.request('api/custom/get_city',{},'get').then((re)=>{
+				// 成功的话
+				if( re.code != 'success' ){
+					// 跳转
+					uni.showToast({title: re.msg,icon:"none"});
+					return;
+				}
+				this.requestParam.province	= re.data.province;
+				this.requestParam.city 		= re.data.city;
+			});
 		},
 		methods: {
 			toApply(){

+ 14 - 1
utils/checkaccess.js

@@ -63,6 +63,19 @@ const getCity	= ()=>{
 	return userInfo.city_id;
 }
 
+// 检查城市ID
+const isManager	= ()=>{
+	// 获取登录标识
+	let userInfo   	= uni.getStorageSync('userInfo');
+	// 如果不存在的话
+	if( !userInfo )	return false;
+	// 资质ID不存在的话
+	if( !userInfo.is_manager ) return false;
+	// 登录成功
+	return 			true;
+}
+
+
 // 是否要求填写城市
 const alertCity	= ()=>{
 	// 获取登录标识
@@ -117,4 +130,4 @@ const getFollowLinkUrl	= ()=>{
 }
 
 
-export default {checkLogin:checkLogin,alterLogin:alterLogin,checkShowPrice:checkShowPrice,alertCity:alertCity,getFollowQrcode:getFollowQrcode,getFollowLinkUrl:getFollowLinkUrl,getCity:getCity}
+export default {checkLogin:checkLogin,alterLogin:alterLogin,checkShowPrice:checkShowPrice,alertCity:alertCity,getFollowQrcode:getFollowQrcode,getFollowLinkUrl:getFollowLinkUrl,getCity:getCity,isManager:isManager}