完成大体功能和样式

This commit is contained in:
2026-01-15 17:18:24 +08:00
parent 036eb3a206
commit 44a4b33502
211 changed files with 5480 additions and 7826 deletions

38
common/utils/auth.js Normal file
View File

@@ -0,0 +1,38 @@
export function getToken() {
const lifeData = uni.getStorageSync('lifeData') || {}
const token = lifeData.vuex_token
return token;
}
export function checkToken(token) {
if (!token || (typeof token === 'object' && Object.keys(token).length === 0)) {
uni.reLaunch({
url: '/pages-biz/login/login'
})
return Promise.reject('no token')
}
return new Promise((resolve, reject) => {
uni.$u.get('/login/checkExpiration', {}, {
WT: token
}).then(res => {
if (res.data) {
uni.reLaunch({
url: '/pages-biz/login/login'
})
reject('token expired')
} else {
resolve(true)
}
}).catch(err => {
uni.reLaunch({
url: '/pages-biz/login/login'
})
})
})
}
export function getUserType(){
let userInfo = uni.getStorageSync('userInfo')
return userInfo.userType
}