底部导航

This commit is contained in:
18631081161 2026-03-12 18:18:46 +08:00
parent a3177737db
commit 1bc7e4a098
12 changed files with 18 additions and 29 deletions

View File

@ -1,31 +1,24 @@
<script>
export default {
onLaunch: function() {
//
//
const token = uni.getStorageSync('token')
if (!token) {
//
uni.reLaunch({ url: '/pages/login/login' })
return
}
if (!token) return
// JWT
try {
const parts = token.split('.')
if (parts.length === 3) {
const payload = JSON.parse(atob(parts[1]))
if (payload.exp && payload.exp * 1000 < Date.now()) {
// token
// token
uni.removeStorageSync('token')
uni.removeStorageSync('userInfo')
uni.reLaunch({ url: '/pages/login/login' })
}
}
} catch (e) {
// token
uni.removeStorageSync('token')
uni.removeStorageSync('userInfo')
uni.reLaunch({ url: '/pages/login/login' })
}
},
onShow: function() {},

View File

@ -178,26 +178,26 @@
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/tab/home.png",
"selectedIconPath": "static/tab/home-active.png"
"iconPath": "static/tab/ic_home.png",
"selectedIconPath": "static/tab/ic_home_s.png"
},
{
"pagePath": "pages/order-hall/order-hall",
"text": "订单大厅",
"iconPath": "static/tab/hall.png",
"selectedIconPath": "static/tab/hall-active.png"
"iconPath": "static/tab/ic_orders.png",
"selectedIconPath": "static/tab/ic_orders_s.png"
},
{
"pagePath": "pages/message/message",
"text": "消息",
"iconPath": "static/tab/message.png",
"selectedIconPath": "static/tab/message-active.png"
"iconPath": "static/tab/ic_message.png",
"selectedIconPath": "static/tab/ic_message_s.png"
},
{
"pagePath": "pages/mine/mine",
"text": "我的",
"iconPath": "static/tab/mine.png",
"selectedIconPath": "static/tab/mine-active.png"
"iconPath": "static/tab/ic_me.png",
"selectedIconPath": "static/tab/ic_me_s.png"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -38,15 +38,11 @@ export const useUserStore = defineStore('user', () => {
}
/**
* 检查登录状态未登录则跳转登录页
* 检查登录状态
* @returns {boolean} 是否已登录
*/
function checkLogin() {
if (!isLoggedIn.value) {
uni.reLaunch({ url: '/pages/login/login' })
return false
}
return true
return isLoggedIn.value
}
return {

View File

@ -65,10 +65,10 @@ function request(options) {
return
}
// 未登录或 token 过期,跳转登录页
// 未登录或 token 过期,静默清除凭证,不自动跳转
if (statusCode === 401) {
redirectToLogin()
reject(new Error('登录已过期,请重新登录'))
clearAuth()
reject(new Error('未登录或登录已过期'))
return
}
@ -113,8 +113,8 @@ function uploadFile(filePath, url = '/api/upload/image') {
header,
success: (res) => {
if (res.statusCode === 401) {
redirectToLogin()
reject(new Error('登录已过期,请重新登录'))
clearAuth()
reject(new Error('未登录或登录已过期'))
return
}
const data = JSON.parse(res.data)