diff --git a/src/permission.js b/src/permission.js
index 6bb0a1f..37fa9a9 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -25,9 +25,18 @@ router.beforeEach((to, from, next) => {
store.dispatch('GetInfo').then(() => {
isRelogin.show = false
store.dispatch('GenerateRoutes').then(accessRoutes => {
+ // 自动跳转到根路由
+ let root = accessRoutes.find(item => item.path === '/')
+ let _to
+ if (root && root.children.find(item => item.path.endsWith('index'))) {
+ root.redirect = root.children.find(item => item.path.endsWith('/index')).path
+ _to = { ...to, replace: true, path: root.redirect }
+ } else {
+ _to = { ...to, replace: true }
+ }
// 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
- next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
+ next(_to) // hack方法 确保addRoutes已完成
})
}).catch(err => {
store.dispatch('LogOut').then(() => {
diff --git a/src/router/index.js b/src/router/index.js
index d3d358e..87e9b58 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,11 +1,10 @@
-import Vue from "vue";
-import Router from "vue-router";
+import Vue from 'vue'
+import Router from 'vue-router'
+/* Layout */
+import Layout from '@/layout'
Vue.use(Router);
-/* Layout */
-import Layout from "@/layout";
-
/**
* Note: 路由配置项
*
@@ -61,19 +60,6 @@ export const constantRoutes = [
component: () => import("@/views/error/401"),
hidden: true,
},
- {
- path: "",
- component: Layout,
- redirect: "index",
- children: [
- {
- path: "index",
- component: () => import("@/views/index"),
- name: "Index",
- meta: { title: "数据面板", icon: "dashboard", affix: true },
- },
- ],
- },
{
path: "/user",
component: Layout,
diff --git a/src/views/platform/index.vue b/src/views/platform/index.vue
new file mode 100644
index 0000000..c1a5e22
--- /dev/null
+++ b/src/views/platform/index.vue
@@ -0,0 +1,323 @@
+
+
+
{{ $route.meta.title }}
+
+
+ 今日核心数据
+
+
+ 新用户
+ 569
+ 同比上周8.63%
+
+
+
+ 新用户
+ 569
+ 同比上周8.63%
+
+
+
+ 新用户
+ 569
+ 同比上周8.63%
+
+
+
+
+ 近7日UV
+ 569
+
+
+
+ 近30日UV
+ 569
+
+
+
+
+
+
+ 全部订单
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 569
+ 今日订单数
+
+
+
+
+ 569.00
+ 今日总收入
+
+
+
+
+
+
+ 月销售趋势
+
+
+
+
+
+
+
商品销售TOP5
+
+
+ 近7天
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+