瀏覽代碼

admin登录首页菜单显示异常问题处理

lph 1 年之前
父節點
當前提交
388f0eed1b

+ 1 - 1
zkqy-ui/src/permission.js

@@ -22,7 +22,7 @@ router.beforeEach((to, from, next) => {
       if (store.getters.roles.length === 0) {
         isRelogin.show = true
         // 判断当前用户是否已拉取完user_info信息
-        store.dispatch('GetInfo').then(() => {
+        store.dispatch('GetInfo').then((res) => {
           isRelogin.show = false
           store.dispatch('GenerateRoutes').then(accessRoutes => {
             // 根据roles权限生成可访问的路由表

+ 18 - 7
zkqy-ui/src/router/index.js

@@ -1,6 +1,8 @@
 import Vue from 'vue'
 import Router from 'vue-router'
 import { getQueryParams } from '@/utils/other'
+// import { name } from '@/store/getters'
+import store from '@/store'
 
 Vue.use(Router)
 
@@ -203,16 +205,25 @@ export const constantRoutes = [
     children: [
       {
         path: 'index',
-        component: () => import('@/views/index'),
+        component: () => {
+          console.log(store);
+          let isAdmin = store.state.user.name == 'admin';
+          if (isAdmin) {
+            return import('@/views/indexOld')
+          } else {
+            return import('@/views/index')
+
+          }
+        },
         name: 'Index',
         meta: { title: '首页', icon: 'dashboard', affix: true }
       },
-      {
-        path: 'indexOld',
-        component: () => import('@/views/indexOld'),
-        name: 'IndexOld',
-        meta: { title: '首页', icon: 'dashboard', affix: true }
-      },
+      // {
+      //   path: 'indexOld',
+      //   component: () => import('@/views/indexOld'),
+      //   name: 'IndexOld',
+      //   meta: { title: '首页1', icon: 'dashboard', affix: true }
+      // },
       {
         path: '/asEditor',
         component: Layout,

+ 1 - 0
zkqy-ui/src/store/modules/permission.js

@@ -5,6 +5,7 @@ import Layout from '@/layout/index'
 import ParentView from '@/components/ParentView'
 import InnerLink from '@/layout/components/InnerLink'
 
+
 const permission = {
   state: {
     routes: [],

+ 1 - 1
zkqy-ui/src/views/adminLogin.vue

@@ -258,7 +258,7 @@ export default {
             .dispatch("adminLogin", this.loginForm)
             .then(() => {
               changeDatasource(); //切换数据源
-              this.$router.push("/indexOld").catch(() => {});
+              this.$router.push("/index").catch(() => {});
             })
             .catch(() => {
               this.loading = false;

+ 1 - 0
zkqy-ui/src/views/indexOld.vue

@@ -70,6 +70,7 @@ export default {
   name: "Index",
   data() {
     return {
+      title: "",
       // 用户导入参数
       upload: {
         // 是否显示弹出层(用户导入)