Bläddra i källkod

fix:趋势输入框失焦触发、权限增加admin权限判断

zhangxin 1 månad sedan
förälder
incheckning
d4f5fd5e05
4 ändrade filer med 41 tillägg och 23 borttagningar
  1. 3 0
      pages/clue/mixins/clue.js
  2. 1 1
      pages/publicClue/index.vue
  3. 29 19
      pages/setting/index.vue
  4. 8 3
      store/modules/user.js

+ 3 - 0
pages/clue/mixins/clue.js

@@ -223,6 +223,9 @@ export default {
223 223
 					}).then(res => {
224 224
 						if(res.data.length == 0){
225 225
 							uni.$u.toast("暂无数据")
226
+							this.minPrice = []
227
+							this.maxPrice = []
228
+							this.chartShow = false
226 229
 							return
227 230
 						}
228 231
 						const response = res.data

+ 1 - 1
pages/publicClue/index.vue

@@ -50,7 +50,7 @@
50 50
 			@confirm="handleClueTagConfirm"></group-select>
51 51
 		<u-modal :show="trendModal" title="价格趋势" @confirm="handleTrendConfirm" confirmText="关闭弹窗">
52 52
 			<view class="trend_modal">
53
-				<u-search placeholder="请输入型号" v-model="model" @custom="searchTrend"></u-search>
53
+				<u-search placeholder="请输入型号" v-model="model" @blur="searchTrend" @custom="searchTrend"></u-search>
54 54
 				<view class="charts_box" v-if="chartShow">
55 55
 					<u--text type="primary" :text="`最大价格:${Math.max(...maxPrice)}元`"></u--text>
56 56
 					<u--text type="warning" :text="`最小价格:${Math.min(...minPrice)}元`"></u--text>

+ 29 - 19
pages/setting/index.vue

@@ -71,25 +71,35 @@
71 71
 		},
72 72
 		methods: {
73 73
 			handleSwitchRole(){
74
-				this.columns = [];
75
-				const availableRoles = this.$store.state.user.availableRoles;
76
-				const roleOptions = [];
77
-				availableRoles.forEach(role => {
78
-					switch (role) {
79
-						case 'SALESMAN':
80
-							roleOptions.push({ label: '销售权限', value: 'SALESMAN' });
81
-							break;
82
-						case 'WAREHOUSER':
83
-							roleOptions.push({ label: '仓库权限', value: 'WAREHOUSER' });
84
-							break;
85
-						case 'CRM':
86
-							roleOptions.push({ label: 'CRM权限', value: 'CRM' });
87
-							break;
74
+					this.columns = [];
75
+					let availableRoles = this.$store.state.user.availableRoles;
76
+					let roleOptions = [];
77
+					
78
+					if (availableRoles.includes('admin')) {
79
+						roleOptions.push(
80
+							{ label: 'CRM权限', value: 'CRM' },
81
+							{ label: '仓库权限', value: 'WAREHOUSER' },
82
+							{ label: '销售权限', value: 'SALESMAN' },
83
+						);
84
+					} else {
85
+						availableRoles.forEach(role => {
86
+							switch (role) {
87
+								case 'SALESMAN':
88
+									roleOptions.push({ label: '销售权限', value: 'SALESMAN' });
89
+									break;
90
+								case 'WAREHOUSER':
91
+									roleOptions.push({ label: '仓库权限', value: 'WAREHOUSER' });
92
+									break;
93
+								case 'CRM':
94
+									roleOptions.push({ label: 'CRM权限', value: 'CRM' });
95
+									break;
96
+							}
97
+						});
88 98
 					}
89
-				});
90
-				this.columns = [roleOptions];
91
-				this.showSwitchRole = true;
92
-			},
99
+					
100
+					this.columns = [roleOptions];
101
+					this.showSwitchRole = true;
102
+				},
93 103
 			handleEditPassword(){
94 104
 				uni.navigateTo({
95 105
 					url : "/pages/changePw/index"
@@ -127,7 +137,7 @@
127 137
 					this.$store.commit('user/SET_CURRENT_ROLE_INDEX', e.indexs[0]);
128 138
 					setTimeout(()=>{
129 139
 						this.$store.commit('user/SWITCH_ROLE', e.value[0]);
130
-					},100)
140
+					},50)
131 141
 				})
132 142
 			}
133 143
 		}

+ 8 - 3
store/modules/user.js

@@ -29,8 +29,8 @@ export default {
29 29
 		netConfig: {
30 30
 			// http://59.42.9.166:9520/proxy
31 31
 			// http://10.0.7.100:9500
32
-			ip: "https://crm.nanjingshiyu.com/prod-api", // ip
33
-			// ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
32
+			// ip: "https://crm.nanjingshiyu.com/prod-api", // ip
33
+			ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
34 34
 			// ip : "/api", // 测试环境ip
35 35
 			// ip : "http://47.113.184.101", // 测试环境ip
36 36
 			// ip: "http://172.16.7.200", // ip
@@ -74,8 +74,13 @@ export default {
74 74
 			if (hasCrmRole) {
75 75
 				validRoles.push('CRM');
76 76
 			}
77
+
78
+			const hasAdminRole = roles.some(role => role.roleKey === 'admin');
79
+			if (hasAdminRole) {
80
+				validRoles.push('admin');
81
+			}
77 82
 			
78
-			const showSwitch = validRoles.length >= 2;
83
+			const showSwitch = validRoles.length >= 2 || roles.some(role => role.roleKey == 'admin');
79 84
 			state.showRoleSwitch = showSwitch;
80 85
 			state.availableRoles = validRoles;
81 86
 			state.currentRoleIndex = 0;