瀏覽代碼

bug 修复

lilei 2 年之前
父節點
當前提交
6263907c1f
共有 4 個文件被更改,包括 11 次插入9 次删除
  1. 2 2
      App.vue
  2. 2 1
      main.js
  3. 5 5
      pages/index/index.vue
  4. 2 1
      store/index.js

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.0.103:9110/saas/clz/', // 本地
-			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
+			baseUrl: 'http://192.168.0.215:9110/saas/clz/', // 本地
+			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {

+ 2 - 1
main.js

@@ -16,7 +16,8 @@ App.mpType = 'mini'
  */
 Vue.prototype.$hasPermissions = function (value) {
  let isExist = false;
- if(!store.state.hasLogin){
+ // 没有登录 或 是游客
+ if(!store.state.hasLogin || store.state.vuex_userInfo.sysUserFlag == '0'){
  	 return true
  }
  let permissionsStr = uni.getStorageSync('permCodes');

+ 5 - 5
pages/index/index.vue

@@ -37,7 +37,7 @@
 							请点击登录
 						</view>
 						<view v-else>
-							<view class="user-name">{{userInfo.userNameCN || '游客'}}</view>
+							<view class="user-name">{{userInfo.userNameCN || userInfo.mobile}}</view>
 							<view>{{userInfo.orgName}}</view>
 						</view>
 					</view>
@@ -176,7 +176,7 @@
 		methods: {
 			pageInit(){
 				if(this.hasLogin){
-					this.avatarUrl = this.userInfo.extInfo.userExtInfo ? this.userInfo.extInfo.userExtInfo.headImage : ''
+					this.avatarUrl = this.userInfo.extInfo&&this.userInfo.extInfo.userExtInfo ? this.userInfo.extInfo.userExtInfo.headImage : ''
 					// 获取扫描记录
 					this.getVinLog()
 					
@@ -189,10 +189,10 @@
 						this.$store.dispatch("getScanNums")
 						// 获取最大扫描次数
 						this.getMaxQty()
+						// 查询门店认证信息
+						this.findLastApply()
 					}
 					
-					// 查询门店认证信息
-					this.findLastApply()
 				}else{
 					uni.removeStorageSync('token')
 				}
@@ -272,7 +272,7 @@
 				this.status = "loading"
 				// VISITOR:游客,EMPLOYEE:雇员
 				getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
-					this.vinList = res.data.list || []
+					this.vinList = res.data&&res.data.list || []
 					this.vinList = this.vinList.filter(item => item.vinCode)
 					this.status = 'nomore'
 				})

+ 2 - 1
store/index.js

@@ -71,9 +71,10 @@ const store = new Vuex.Store({
 			// VISITOR:游客,EMPLOYEE:雇员
 			data.auth_user['identifyType'] = data.sysUserFlag == '0' ? 'VISITOR' : 'EMPLOYEE';
 			data.auth_user['sysUserFlag'] = data.sysUserFlag;
-			const permCodes = data.auth_user.permCodes.filter(item => item.indexOf("_mini")>=0);
 			uni.setStorageSync('token', data.access_token);
 			uni.setStorageSync('userInfo', data.auth_user);
+			// 权限码,游客没有
+			const permCodes = data.sysUserFlag == '0' ? null : data.auth_user.permCodes.filter(item => item.indexOf("_mini")>=0);
 			state.vuex_permCodes = permCodes;
 			uni.setStorageSync('permCodes', permCodes);
         },