Browse Source

微信模板消过来如果已经存在权限不请求权限列表

wgl 4 years ago
parent
commit
18436b7fa6
2 changed files with 32 additions and 24 deletions
  1. 16 12
      src/projects/business/main.js
  2. 16 12
      src/projects/pension/main.js

+ 16 - 12
src/projects/business/main.js

@@ -138,21 +138,25 @@ const checkFun = (to, from, next) => {
 	//如果funlist不存在,在更新版本号清空后,先重新请求再判断
 	var token = to.query.token;
 	if (token) {
-		//这里token一定要存在,从微信模板消息带过来的
-		API_User.getAllFunList(token).then(response => {
+		if (store.state.fun_list) {
+			checkAuth(to, from, next);
+		} else {
+			//这里token一定要存在,从微信模板消息带过来的
+			API_User.getAllFunList(token).then(response => {
 
-			if (response && response.allIcon) {
-				var allIcon = response.allIcon;
-				store.commit('SET_FUN_LIST', allIcon);
+				if (response && response.allIcon) {
+					var allIcon = response.allIcon;
+					store.commit('SET_FUN_LIST', allIcon);
 
-				checkAuth(to, from, next);
-			} else {
-				mui.toast('token已过期');
-			}
+					checkAuth(to, from, next);
+				} else {
+					mui.toast('链接已过期');
+				}
 
-		}).catch(error => {
-			mui.toast(error);
-		})
+			}).catch(error => {
+				mui.toast(error);
+			})
+		}
 	} else {
 		checkAuth(to, from, next);
 	}

+ 16 - 12
src/projects/pension/main.js

@@ -116,21 +116,25 @@ const checkFun = (to, from, next) => {
 	//如果funlist不存在,在更新版本号清空后,先重新请求再判断
 	var token = to.query.token;
 	if (token) {
-		//这里token一定要存在,从微信模板消息带过来的
-		API_User.getAllFunList(token).then(response => {
+		if (store.state.fun_list) {
+			checkAuth(to, from, next);
+		} else {
+			//这里token一定要存在,从微信模板消息带过来的
+			API_User.getAllFunList(token).then(response => {
 
-			if (response && response.allIcon) {
-				var allIcon = response.allIcon;
-				store.commit('SET_FUN_LIST', allIcon);
+				if (response && response.allIcon) {
+					var allIcon = response.allIcon;
+					store.commit('SET_FUN_LIST', allIcon);
 
-				checkAuth(to, from, next);
-			} else {
-				mui.toast('token已过期');
-			}
+					checkAuth(to, from, next);
+				} else {
+					mui.toast('链接已过期');
+				}
 
-		}).catch(error => {
-			mui.toast(error);
-		})
+			}).catch(error => {
+				mui.toast(error);
+			})
+		}
 	} else {
 		checkAuth(to, from, next);
 	}