|
@@ -47,19 +47,12 @@ Vue.use(VueDirectiveImagePreviewer, {
|
|
|
})
|
|
|
|
|
|
//获取纯权限路由数组,由函数每次获取
|
|
|
-function getFunList() {
|
|
|
+function getAuthFunList() {
|
|
|
let funList = [];
|
|
|
- let fun_list = store.state.fun_list;
|
|
|
+ let fun_list = store.state.auth_fun_list;
|
|
|
if (fun_list && fun_list.length > 0) {
|
|
|
fun_list.forEach(function(item) {
|
|
|
- item.list.forEach(function(iten) {
|
|
|
- funList.push(iten.iconRoute);
|
|
|
- if (iten.iconSubRouteList) {
|
|
|
- iten.iconSubRouteList.forEach(function(iteb) {
|
|
|
- funList.push(iteb)
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ funList.push(item)
|
|
|
})
|
|
|
}
|
|
|
return funList;
|
|
@@ -68,11 +61,11 @@ function getFunList() {
|
|
|
|
|
|
const checkAuth = (to, from, next) => {
|
|
|
if (to.meta != null && to.meta.requireAuth) {
|
|
|
- if (store.state.person_data || store.state.fun_list) {
|
|
|
+ if (store.state.person_data || store.state.auth_fun_list) {
|
|
|
|
|
|
if ((to.meta.form != null && to.meta.form) || (to.meta.mode != null && to.meta.mode)) {
|
|
|
|
|
|
- let funList = getFunList();
|
|
|
+ let funList = getAuthFunList();
|
|
|
//验证
|
|
|
if (funList.indexOf(to.name) > -1) {
|
|
|
next();
|
|
@@ -116,21 +109,21 @@ const checkFun = (to, from, next) => {
|
|
|
//如果funlist不存在,在更新版本号清空后,先重新请求再判断
|
|
|
var token = to.query.token;
|
|
|
if (token) {
|
|
|
- if (store.state.fun_list) {
|
|
|
+ if (store.state.auth_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);
|
|
|
-
|
|
|
+ API_User.getAuthFunList(token).then(response => {
|
|
|
+
|
|
|
+ if (response && response.allIconRoute) {
|
|
|
+ var allIconRoute = response.allIconRoute;
|
|
|
+ store.commit('SET_AUTH_FUN_LIST', allIconRoute);
|
|
|
+
|
|
|
checkAuth(to, from, next);
|
|
|
} else {
|
|
|
mui.toast('链接已失效,请登录小鹏管家查看');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}).catch(error => {
|
|
|
mui.toast(error);
|
|
|
})
|