YZProjectCloud/yanzhu-ui-app/permission.js

45 lines
898 B
JavaScript

import {
getToken
} from '@/utils/auth'
// 登录页面
const loginPage = "/pages/login"
// 登录失效页面
const loginFail = "/pages/login"
// 页面白名单
const whiteList = [ ]
// 检查地址白名单
// function checkWhite(url) {
// const path = url.split('?')[0]
// //console.log(path+"全连接")
// return whiteList.indexOf(path) !== -1
// }
// 页面跳转验证拦截器
// let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"]
// list.forEach(item => {
// uni.addInterceptor(item, {
// invoke(to) {
// if (getToken()) {
// if (to.url === loginFail) {
// uni.reLaunch({
// url: "/"
// })
// }
// return true
// } else {
// if (checkWhite(to.url)) {
// return true
// }
// uni.reLaunch({
// url: "/"
// })
// return false
// }
// },
// fail(err) {
// //console.log(err)
// }
// })
// })