init project

This commit is contained in:
tao
2025-11-17 10:01:33 +08:00
commit 77c123408d
1018 changed files with 136951 additions and 0 deletions

51
permission.js Normal file
View File

@@ -0,0 +1,51 @@
import {
getToken
} from '@/utils/auth'
import store from '@/store'
// 登录页面
const loginPage = "/pages/login"
// 页面白名单
const whiteList = [
'/pages/login', '/pages/common/webview/index', '/pages/work/esop', '/pages/work/ipc'
]
// 检查地址白名单
function checkWhite(url) {
const path = url.split('?')[0]
return whiteList.indexOf(path) !== -1
}
store.dispatch("GetAreaOptions");
store.dispatch("GetShelvesOptions");
store.dispatch("GetLocationOptions");
store.dispatch("GetWarehouseOptions");
// 页面跳转验证拦截器
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"]
list.forEach(item => {
uni.addInterceptor(item, {
invoke(to) {
if (getToken()) {
if (to.path === loginPage) {
uni.reLaunch({
url: "/"
})
}
return true
} else {
if (checkWhite(to.url)) {
return true
}
uni.reLaunch({
url: loginPage
})
return false
}
},
fail(err) {
console.log(err)
}
})
})