|
@@ -36,7 +36,36 @@ Vue.use(directived);
|
|
|
Vue.use(ElementUI, {
|
|
|
size: 'small'
|
|
|
});
|
|
|
+router.beforeEach((to, from, next) => {
|
|
|
|
|
|
+ new Promise((resolve) => {
|
|
|
+
|
|
|
+ http.get('/sc-user-center/user/findUserMenu', { appId: '1012' }).then(({ status, data, msg }) => {
|
|
|
+ if (0 == status) {
|
|
|
+ store.commit('setMenuList', data[0].children);
|
|
|
+ resolve && resolve(true);
|
|
|
+ } else {
|
|
|
+ next('/403')
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }).then(() => {
|
|
|
+ const findMen = (arr, indexPath) => {
|
|
|
+ let isShow = false;
|
|
|
+ arr.map(v => {
|
|
|
+ if ('/' + v.linkPath == indexPath) {
|
|
|
+ isShow = true
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return isShow
|
|
|
+ }
|
|
|
+ if (findMen(store.state.menuList, to.path) || to.path == '/403') {
|
|
|
+ next()
|
|
|
+ } else {
|
|
|
+ to.path !== '/' ? next('/403') : next()
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+});
|
|
|
new Vue({
|
|
|
router,
|
|
|
store,
|