yuwenjun1997 2 роки тому
батько
коміт
4ebb0d10d8

+ 1 - 0
package.json

@@ -35,6 +35,7 @@
     "screenfull": "4.2.0",
     "script-loader": "0.7.2",
     "sortablejs": "1.8.4",
+    "three-dots": "^0.3.2",
     "tui-editor": "1.3.3",
     "vue": "2.6.10",
     "vue-count-to": "1.0.13",

+ 12 - 4
pnpm-lock.yaml

@@ -47,6 +47,7 @@ specifiers:
   sortablejs: 1.8.4
   svg-sprite-loader: ^6.0.11
   svgo: ^3.0.2
+  three-dots: ^0.3.2
   tui-editor: 1.3.3
   vue: 2.6.10
   vue-count-to: 1.0.13
@@ -78,6 +79,7 @@ dependencies:
   screenfull: registry.npmmirror.com/screenfull/4.2.0
   script-loader: registry.npmmirror.com/script-loader/0.7.2
   sortablejs: registry.npmmirror.com/sortablejs/1.8.4
+  three-dots: registry.npmmirror.com/three-dots/0.3.2
   tui-editor: registry.npmmirror.com/tui-editor/1.3.3
   vue: registry.npmmirror.com/vue/2.6.10
   vue-count-to: registry.npmmirror.com/vue-count-to/1.0.13
@@ -119,7 +121,7 @@ devDependencies:
 packages:
 
   github.com/adobe-webplatform/eve/eef80ed:
-    resolution: {commit: eef80ed, repo: git+ssh://git@github.com/adobe-webplatform/eve.git, type: git}
+    resolution: {tarball: https://codeload.github.com/adobe-webplatform/eve/tar.gz/eef80ed}
     name: eve
     version: 0.4.1
     dev: false
@@ -2118,7 +2120,7 @@ packages:
     version: 3.7.4
     dependencies:
       '@types/eslint': registry.npmmirror.com/@types/eslint/8.21.1
-      '@types/estree': registry.npmmirror.com/@types/estree/0.0.45
+      '@types/estree': registry.npmmirror.com/@types/estree/1.0.0
     dev: true
 
   registry.npmmirror.com/@types/eslint/8.21.1:
@@ -2126,7 +2128,7 @@ packages:
     name: '@types/eslint'
     version: 8.21.1
     dependencies:
-      '@types/estree': registry.npmmirror.com/@types/estree/0.0.45
+      '@types/estree': registry.npmmirror.com/@types/estree/1.0.0
       '@types/json-schema': registry.npmmirror.com/@types/json-schema/7.0.11
     dev: true
 
@@ -2140,7 +2142,6 @@ packages:
     resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@types/estree/-/estree-1.0.0.tgz}
     name: '@types/estree'
     version: 1.0.0
-    dev: false
 
   registry.npmmirror.com/@types/glob/7.2.0:
     resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@types/glob/-/glob-7.2.0.tgz}
@@ -16132,6 +16133,13 @@ packages:
       webpack: registry.npmmirror.com/webpack/4.46.0
     dev: true
 
+  registry.npmmirror.com/three-dots/0.3.2:
+    resolution: {integrity: sha512-N7JMhoCX+4mhgGWy4Hqy4PZ27shKwLRvaADn3YsK9+bImK5U/xA/woCUavehoHGrkNG3yyAzwQ6UnuFH0/yLVQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/three-dots/-/three-dots-0.3.2.tgz}
+    name: three-dots
+    version: 0.3.2
+    engines: {node: '>=14'}
+    dev: false
+
   registry.npmmirror.com/throat/4.1.0:
     resolution: {integrity: sha512-wCVxLDcFxw7ujDxaeJC6nfl2XfHJNYs8yUYJnvMgtPEFlttP9tHSfRUv2vBe6C4hkVFPWoP1P6ZccbYjmSEkKA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/throat/-/throat-4.1.0.tgz}
     name: throat

+ 3 - 1
public/index.html

@@ -12,7 +12,9 @@
     <title><%= webpackConfig.name %></title>
   </head>
   <body>
-    <div id="app"></div>
+    <div id="app">
+      <div id="app-loading"></div>
+    </div>
     <!-- built files will be auto injected -->
   </body>
 </html>

+ 52 - 0
src/components/AppLoading/index.vue

@@ -0,0 +1,52 @@
+<template>
+  <div class="app-container">
+    <img src="/favicon.svg" alt="">
+    <div class="dot-wrapper dot-carousel" />
+    <h2>采美管理系统</h2>
+  </div>
+</template>
+<script>
+export default {
+  data() {
+    return {}
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+@use 'three-dots' with (
+  $dot-width: 16px,
+  $dot-height: 16px,
+  $dot-color: #e95504
+);
+
+.app-container {
+  width: 100vw;
+  height: 100vh;
+  position: absolute;
+  left: 0;
+  top: 0;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+  user-select: none;
+
+  .dot-wrapper {
+    margin: 32px 0;
+  }
+
+  img {
+    width: 128px;
+    height: 128px;
+    display: block;
+  }
+
+  h2 {
+    font-size: 32px;
+    font-weight: normal;
+    color: #666;
+    margin: 0;
+  }
+}
+</style>

+ 11 - 6
src/layout/components/Sidebar/index.vue

@@ -1,13 +1,14 @@
 <template>
-  <div :class="{'has-logo':showLogo}">
+  <div :class="{ 'has-logo': showLogo }">
     <logo v-if="showLogo" :collapse="isCollapse" />
     <el-scrollbar wrap-class="scrollbar-wrapper">
       <el-menu
+        ref="menu"
         :default-active="activeMenu"
         :collapse="isCollapse"
         :background-color="variables.menuBg"
         :text-color="variables.menuText"
-        :unique-opened="false"
+        :unique-opened="true"
         :active-text-color="variables.menuActiveText"
         :collapse-transition="false"
         mode="vertical"
@@ -27,10 +28,7 @@ import variables from '@/styles/variables.scss'
 export default {
   components: { SidebarItem, Logo },
   computed: {
-    ...mapGetters([
-      'permission_routes',
-      'sidebar'
-    ]),
+    ...mapGetters(['permission_routes', 'sidebar']),
     activeMenu() {
       const route = this.$route
       const { meta, path } = route
@@ -38,6 +36,13 @@ export default {
       if (meta.activeMenu) {
         return meta.activeMenu
       }
+      if (meta.hidden && route.redirectedFrom) {
+        return route.redirectedFrom
+      }
+      if (meta.hidden) {
+        const item = route.matched && route.matched.find((item) => item.redirect === route.path)
+        if (item) return item.path
+      }
       return path
     },
     showLogo() {

+ 9 - 4
src/main.js

@@ -11,6 +11,7 @@ import './styles/element-variables.scss'
 import '@/styles/index.scss' // global css
 
 import App from './App'
+import AppLoading from './components/AppLoading'
 import store from './store'
 import router from './router'
 
@@ -37,6 +38,12 @@ import permission from './directive/permission'
 //   mockXHR()
 // }
 
+Vue.config.productionTip = false
+
+// app loading
+const appLoading = new Vue({ render: (h) => h(AppLoading) })
+appLoading.$mount('#app-loading')
+
 Vue.use(Element, {
   size: Cookies.get('size') || 'medium' //, // set element-ui default size
   // locale: enLang // 如果使用中文,无需设置,请删除
@@ -50,11 +57,9 @@ Object.keys(filters).forEach((key) => {
   Vue.filter(key, filters[key])
 })
 
-Vue.config.productionTip = false
-
-new Vue({
-  el: '#app',
+const app = new Vue({
   router,
   store,
   render: (h) => h(App)
 })
+app.$mount('#app')

+ 5 - 0
src/permission.js

@@ -18,6 +18,11 @@ router.beforeEach(async(to, from, next) => {
   document.title = getPageTitle(to.meta.title)
 
   // determine whether the user has logged in
+  if (to.query.token) {
+    store.commit('user/SET_TOKEN', to.query.token)
+    delete to.query.token
+    next({ ...to })
+  }
   const hasToken = getToken()
 
   if (hasToken) {

+ 2 - 2
src/router/modules/finance.js

@@ -10,7 +10,7 @@ const financeRouter = {
   children: [
     {
       path: 'receipt',
-      component: () => import('@/views/finance/index'),
+      component: () => import('@/views/index'),
       redirect: '/finance/receipt/list',
       name: 'ReceiptManage',
       meta: { title: '收款列表', icon: 'documentation' },
@@ -33,7 +33,7 @@ const financeRouter = {
     },
     {
       path: 'receipts',
-      component: () => import('@/views/finance/index'),
+      component: () => import('@/views/index'),
       redirect: '/finance/receipts/users',
       name: 'ReceiptUserManage',
       meta: { title: '收款人权限', icon: 'documentation' },

+ 2 - 2
src/router/modules/keywordLibrary.js

@@ -14,7 +14,7 @@ const keywordLibraryRouter = {
       path: 'keyword',
       name: 'KeywordMenu',
       redirect: '/library/keyword/list',
-      component: () => import('@/views/library/index'),
+      component: () => import('@/views/index'),
       meta: { title: '关键词统计' },
       children: [
         {
@@ -35,7 +35,7 @@ const keywordLibraryRouter = {
       path: 'tag',
       name: 'TagMenu',
       redirect: '/library/tag/list',
-      component: () => import('@/views/library/index'),
+      component: () => import('@/views/index'),
       meta: { title: '标签库', useDefault: true },
       children: [
         {

+ 2 - 2
src/router/modules/product.js

@@ -10,7 +10,7 @@ const productRouter = {
   children: [
     {
       path: 'product',
-      component: () => import('@/views/product/index'),
+      component: () => import('@/views/index'),
       redirect: '/product/product/list',
       name: 'ProductManage',
       meta: { title: '商品管理', icon: 'documentation' },
@@ -40,7 +40,7 @@ const productRouter = {
     },
     {
       path: 'classify',
-      component: () => import('@/views/product/index'),
+      component: () => import('@/views/index'),
       redirect: '/product/classify/list',
       name: 'ClassifyManage',
       meta: { title: '分类管理', icon: 'documentation' },

+ 3 - 3
src/router/modules/sys.js

@@ -12,7 +12,7 @@ const sysRouter = {
   children: [
     {
       path: 'menus',
-      component: () => import('@/views/sys/menus/index'),
+      component: () => import('@/views/index'),
       redirect: '/sys/menus/list',
       name: 'SysMenus',
       meta: { title: '菜单管理', icon: 'el-icon-menu' },
@@ -42,7 +42,7 @@ const sysRouter = {
     },
     {
       path: 'roles',
-      component: () => import('@/views/sys/roles/index'),
+      component: () => import('@/views/index'),
       redirect: '/sys/roles/list',
       name: 'SysRoles',
       meta: { title: '角色管理', icon: 'lock' },
@@ -72,7 +72,7 @@ const sysRouter = {
     },
     {
       path: 'users',
-      component: () => import('@/views/sys/users/index'),
+      component: () => import('@/views/index'),
       redirect: '/sys/users/list',
       name: 'SysUsers',
       meta: { title: '用户管理', icon: 'user' },

+ 2 - 2
src/router/modules/webPage.js

@@ -10,7 +10,7 @@ const webPageRouter = {
   children: [
     {
       path: 'page',
-      component: () => import('@/views/web/index'),
+      component: () => import('@/views/index'),
       redirect: '/web/page/list',
       name: 'WebPages',
       meta: { title: '页面管理', icon: 'documentation' },
@@ -40,7 +40,7 @@ const webPageRouter = {
     },
     {
       path: 'help',
-      component: () => import('@/views/web/index'),
+      component: () => import('@/views/index'),
       redirect: '/web/help/list',
       name: 'HelpPages',
       meta: { title: '帮助页设置', icon: 'documentation' },

+ 10 - 10
src/router/modules/wechat.js

@@ -12,14 +12,14 @@ const wechatRouter = {
   children: [
     {
       path: 'caimei',
-      component: () => import('@/views/wechat/caimei/index'),
+      component: () => import('@/views/index'),
       redirect: '/wechat/caimei/menus',
       name: 'WeChatCaimei',
       meta: { title: '采美网公众号', icon: 'component' },
       children: [
         {
           path: 'menus',
-          component: () => import('@/views/wechat/caimei/menus/index'),
+          component: () => import('@/views/index'),
           redirect: '/wechat/caimei/menus/list',
           name: 'WeChatCmMenus',
           meta: { title: '菜单管理' },
@@ -49,7 +49,7 @@ const wechatRouter = {
         },
         {
           path: 'reply',
-          component: () => import('@/views/wechat/caimei/reply/index'),
+          component: () => import('@/views/index'),
           redirect: '/wechat/caimei/reply/list',
           name: 'WeChatCmReply',
           meta: { title: '回复配置' },
@@ -79,7 +79,7 @@ const wechatRouter = {
         },
         {
           path: 'text',
-          component: () => import('@/views/wechat/caimei/text/index'),
+          component: () => import('@/views/index'),
           redirect: '/wechat/caimei/text/list',
           name: 'WeChatCmText',
           meta: { title: '文本素材管理' },
@@ -109,7 +109,7 @@ const wechatRouter = {
         },
         {
           path: 'article',
-          component: () => import('@/views/wechat/caimei/article/index'),
+          component: () => import('@/views/index'),
           redirect: '/wechat/caimei/article/list',
           name: 'WeChatCmArticle',
           meta: { title: '图文素材管理' },
@@ -141,14 +141,14 @@ const wechatRouter = {
     },
     {
       path: 'hehe',
-      component: () => import('@/views/wechat/hehe/index'),
+      component: () => import('@/views/index'),
       redirect: '/wechat/hehe/menus',
       name: 'WeChatHehe',
       meta: { title: '呵呵商城公众号', icon: 'component' },
       children: [
         {
           path: 'menus',
-          component: () => import('@/views/wechat/hehe/menus/index'),
+          component: () => import('@/views/index'),
           redirect: '/wechat/hehe/menus/list',
           name: 'WeChatHeMenus',
           meta: { title: '菜单管理' },
@@ -178,7 +178,7 @@ const wechatRouter = {
         },
         {
           path: 'reply',
-          component: () => import('@/views/wechat/hehe/reply/index'),
+          component: () => import('@/views/index'),
           redirect: '/wechat/hehe/reply/list',
           name: 'WeChatHeReply',
           meta: { title: '回复配置' },
@@ -208,7 +208,7 @@ const wechatRouter = {
         },
         {
           path: 'text',
-          component: () => import('@/views/wechat/hehe/text/index'),
+          component: () => import('@/views/index'),
           redirect: '/wechat/hehe/text/list',
           name: 'WeChatHeText',
           meta: { title: '文本素材管理' },
@@ -238,7 +238,7 @@ const wechatRouter = {
         },
         {
           path: 'article',
-          component: () => import('@/views/wechat/hehe/article/index'),
+          component: () => import('@/views/index'),
           redirect: '/wechat/hehe/article/list',
           name: 'WeChatHeArticle',
           meta: { title: '图文素材管理' },

+ 2 - 0
src/store/modules/permission.js

@@ -33,6 +33,8 @@ export function filterAsyncRoutes(routes, menus) {
       if (!tmp.hidden) {
         tmp.meta.title = meun.title
         tmp.sort = meun.sort
+      } else {
+        tmp.meta.hidden = true
       }
       if (meun.icon) {
         tmp.meta.icon = meun.icon

+ 1 - 1
src/store/modules/user.js

@@ -15,6 +15,7 @@ const state = {
 const mutations = {
   SET_TOKEN: (state, token) => {
     state.token = token
+    setToken(token)
   },
   SET_USERID: (state, userId) => {
     state.userId = userId
@@ -54,7 +55,6 @@ const actions = {
         .then(response => {
           const { data } = response
           commit('SET_TOKEN', data.token)
-          setToken(data.token)
           resolve()
         })
         .catch(error => {

+ 0 - 0
src/views/finance/index.vue → src/views/index.vue


+ 0 - 3
src/views/library/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 1 - 1
src/views/library/keyword/list.vue

@@ -45,7 +45,7 @@
       <el-table-column width="140" label="标签库状态" align="center">
         <template>未添加</template>
       </el-table-column>
-      <el-table-column label="操作" align="center">
+      <el-table-column label="操作" align="center" width="240">
         <template slot-scope="{ row }">
           <el-button v-permission="'keyword:list:join'" type="primary" size="mini" @click="handleAddLibrary(row)">
             加入标签库

+ 0 - 3
src/views/product/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/sys/menus/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/sys/roles/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/sys/users/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/web/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/caimei/article/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/caimei/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/caimei/menus/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/caimei/reply/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/caimei/text/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/hehe/article/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/hehe/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/hehe/menus/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/hehe/reply/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>

+ 0 - 3
src/views/wechat/hehe/text/index.vue

@@ -1,3 +0,0 @@
-<template>
-  <router-view />
-</template>