Commit afb3e2b7 authored by 乐宝呗666's avatar 乐宝呗666

修改大屏 token问题

parent 35d58fdb
...@@ -79,9 +79,10 @@ const router = new VueRouter({ ...@@ -79,9 +79,10 @@ const router = new VueRouter({
routes: routes, routes: routes,
mode: "history" mode: "history"
}) })
const whiteList =['/login','/success','/screen']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
let user = localStorage.getItem("token"); let user = localStorage.getItem("token");
if (!user && to.path !=='/login' && to.path !=='/success') { // 通过vuex state获取当前的token是否存在 if (!user && !whiteList.includes(to.path)) { // 通过vuex state获取当前的token是否存在
next({ next({
path: '/login', path: '/login',
}) })
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<van-collapse v-model="activeNames"> <van-collapse v-model="activeNames">
<van-collapse-item :name="item.id"> <van-collapse-item :name="item.id">
<template #title> <template #title>
<div>{{item.name||'妹纸'}}<span class="author">{{item.username}}</span> <div>{{item.boardName}}<span class="author">{{item.username}}</span>
</div> </div>
</template> </template>
<div class="content"> <div class="content">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment