From 6d886b366089d0f98e59b4fccc8e44a80dd21e07 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Tue, 22 Feb 2022 11:41:04 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E5=AE=9E=E9=AA=8C=E5=8F=B0?=
 =?UTF-8?q?=E7=AD=89=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/layouts/navbar/index.vue     | 11 ++++++----
 src/pages/index/list/index.vue   |  4 ++--
 src/pages/station/list/index.vue | 17 +++++++++++++++
 src/router/permission.js         |  4 ++--
 src/setting.js                   | 37 ++------------------------------
 5 files changed, 30 insertions(+), 43 deletions(-)

diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue
index 1331858..55c245d 100644
--- a/src/layouts/navbar/index.vue
+++ b/src/layouts/navbar/index.vue
@@ -64,17 +64,20 @@ export default {
         };
     },
     mounted() {
-        this.menus = util.local.get(Setting.tokenKey) ? this.loginedMenu : this.touristMenu
+        const path = this.$route.path
+        this.menus = Setting.whiteList.find(e => e === path) ? this.touristMenu : this.loginedMenu
     },
     methods: {
         jump(item) {
-            // 如果未登录且跳转的是登录后才有的菜单,或者登录了但是跳转的是游客才有的菜单,则刷新
-            if ((!util.local.get(Setting.tokenKey) && this.loginedMenu.find(e => e.index === item.index)) || util.local.get(Setting.tokenKey) && this.touristMenu.find(e => e.index === item.index)) {
+            const token = util.local.get(Setting.tokenKey)
+            // 如果未登录且跳转的是登录后才有的菜单
+            if (!token && this.loginedMenu.find(e => e.index === item.index)) {
                 location.reload()
             } else {
                 this.active = item.index
                 this.$router.push(item.index).catch(err => {})
-            }
+                token !== this.token && location.reload() // 如果登录后再返回该页面,浏览器里会存有token,但是这个页面里的token是刚进到页面时获取的,应该是空,如果是这个情况,则刷新,否则右上角还会显示为登录按钮
+            } 
         }
     }
 };
diff --git a/src/pages/index/list/index.vue b/src/pages/index/list/index.vue
index fe1afc6..1390b44 100644
--- a/src/pages/index/list/index.vue
+++ b/src/pages/index/list/index.vue
@@ -28,7 +28,7 @@
                 <img src="@/assets/img/index/index1.png" alt="">
                 <div class="text">
                     <h6>平台概览</h6>
-                    <p class="desc">专业打造,满足开展虚拟实验教学的多样性需</p>
+                    <p class="desc">专业打造,满足开展虚拟实验教学的多样性需求</p>
                 </div>
             </li>
             <li class="wow fadeInUp" :class="{active: active === 2}" data-wow-delay="0.2s" @click="toPart(2)">
@@ -324,7 +324,7 @@ export default {
         }
         .list{
             display: flex;
-            height: 370px;
+            height: 390px;
             li{
                 width: 33.33%;
                 padding: 107px 35px 0;
diff --git a/src/pages/station/list/index.vue b/src/pages/station/list/index.vue
index ce6d49e..6c36868 100644
--- a/src/pages/station/list/index.vue
+++ b/src/pages/station/list/index.vue
@@ -13,6 +13,7 @@
                 <template v-for="(item,index) in curriculumList">
                     <a class="item" @click="goPreview(item)" :key="index" v-if="!keyword || item.curriculumName.includes(keyword)">
                         <img :src="item.coverUrl" alt="">
+                        <p class="text" :title="item.curriculumName"><span>{{ item.curriculumName }}</span></p>
                     </a>
                 </template>
             </div>
@@ -92,6 +93,7 @@ export default {
         margin: 0 auto;
     }
     .item {
+        position: relative;
         width: 256px;
         height: 195px;
         margin: 0 6px 4px;
@@ -103,6 +105,21 @@ export default {
             width: 100%;
             height: 100%;
         }
+        .text {
+            position: absolute;
+            bottom: 14px;
+            left: 25px;
+            display: flex;
+            align-items: center;
+            width: 130px;
+            height: 50px;
+            font-size: 12px;
+            line-height: 1.6;
+            overflow: hidden;
+            span {
+                @include mul-ellipsis(2);
+            }
+        }
     }
 }
 </style>
\ No newline at end of file
diff --git a/src/router/permission.js b/src/router/permission.js
index 126781c..aa85ef4 100644
--- a/src/router/permission.js
+++ b/src/router/permission.js
@@ -2,13 +2,13 @@ import router from "./index";
 import Setting from "@/setting";
 import util from "@/libs/util";
 
-const whiteList = ['/login', '/index/list', '/cityPartner/list', '/devPlatform/list'] // 白名单
+const whiteList = Setting.whiteList // 白名单
 router.beforeEach((to, from, next) => {
     document.title = Setting.titleSuffix;
     const role = util.local.get(Setting.tokenKey);
     if (!role && !whiteList.includes(to.path)) {
         next('/index/list')
-    } else if(role && whiteList.includes(to.path)) {
+    } else if(role && to.path === '/login') {
         next('/station')
     } else {
         next()
diff --git a/src/setting.js b/src/setting.js
index 64685db..a8921bc 100644
--- a/src/setting.js
+++ b/src/setting.js
@@ -66,42 +66,9 @@ const Setting = {
     storeKey: "oc_client_store", // localStorage里保存的vuex的key
     initialPassword: "111aaa", // 默认密码
     /**
-     * python子系统
+     * 路由白名单
      * */
-    pythonList: [
-        {
-            id: 1,
-            path: 'pyTrials'
-        },
-        {
-            id: 4,
-            path: 'pyFinance'
-        },
-        {
-            id: 5,
-            path: 'pyProjects'
-        },
-        {
-            id: 6,
-            path: 'pyRandom'
-        },
-        {
-            id: 7,
-            path: 'pyQuantification'
-        },
-        {
-            id: 8,
-            path: 'pyAnalysis'
-        },
-        {
-            id: 9,
-            path: 'pyDataclean'
-        },
-        {
-            id: 10,
-            path: 'pyAcquisition'
-        }
-    ],
+    whiteList: ['/login', '/index/list', '/cityPartner/list', '/devPlatform/list'],
     /**
      * 多语言配置
      * */