mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-06-07 22:53:25 +08:00
公众号登录调试
This commit is contained in:
@@ -2,8 +2,8 @@ import { BACK_URL } from '@/enums/cacheEnums'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import cache from '@/utils/cache'
|
||||
import { generateRoutes } from './transformPages'
|
||||
export const routes = generateRoutes()
|
||||
import { routes } from './routes'
|
||||
|
||||
const whiteList = ['register', 'login', 'forget_pwd']
|
||||
const list = ['navigateTo', 'redirectTo', 'reLaunch', 'switchTab']
|
||||
list.forEach((item) => {
|
||||
@@ -34,12 +34,11 @@ export function setupRouter() {
|
||||
// #ifdef H5
|
||||
const app = getApp()
|
||||
app.$router.afterEach((to: any, from: any) => {
|
||||
console.log(to, from)
|
||||
const index = whiteList.findIndex((item) => to.path.includes(item))
|
||||
const index = whiteList.findIndex((item) => from.path.includes(item) || from.path === '/')
|
||||
const userStore = useUserStore()
|
||||
if (index == -1 && !userStore.isLogin) {
|
||||
//保存登录前的路径
|
||||
cache.set(BACK_URL, to.fullPath)
|
||||
cache.set(BACK_URL, from.fullPath)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -43,3 +43,5 @@ function getSubPackagesRoutes(pagesJson: any) {
|
||||
export function generateRoutes() {
|
||||
return getPagesRoutes(PagesJSON.pages).concat(getSubPackagesRoutes(PagesJSON))
|
||||
}
|
||||
|
||||
export const routes = generateRoutes()
|
||||
Reference in New Issue
Block a user