根据启动参数控制页面路由

This commit is contained in:
weiwei committed 2025-03-31 16:09:19 +08:00
1 parent 142b5dc049
commit aa0fad8350
3 files changed
+33 -34

No files matched your search

+1 -26
View File
@@ -47,7 +47,7 @@ const http = new Request({
},
})
// 处理请求头 Authorization
// 读取token 处理Authorization请求头
const getAuthHeader = (tokenStorage: any) => {
if (isDevEnv()) {
return tokenStorage?.access_token ? `Bearer ${tokenStorage.access_token}` : null
@@ -64,31 +64,6 @@ const checkAndRefreshToken = async (tokenStorage: any) => {
// console.log("现在的时间大于过期时间吗:", new Date().getTime() >= expiresDate)
if (new Date().getTime() >= expiresDate) {
// try {
// const refreshData: any = await request({
// url: "/auth/oauth2/token",
// method: "POST",
// params: { grant_type: "refresh_token" },
// data: JSON.stringify({
// scope: "server",
// refresh_token: tokenStorage.refreshToken.tokenValue,
// }),
// header: {
// skipToken: true,
// Authorization: "Basic " + window.btoa(import.meta.env.VITE_OAUTH2_APP_CLIENT),
// "content-type": "application/x-www-form-urlencoded",
// },
// })
// if (refreshData.code === 0 && !isEmpty(refreshData.data)) {
// console.log("refreshData.data", refreshData.data)
// // 刷新成功,更新token并重试请求
// uni.setStorageSync(TOKEN_KEY, refreshData.data)
// }
// } catch (refreshError) {
// console.error("Token refresh failed:", refreshError)
// }
try {
uni.showLoading({ title: "加载中...", mask: true })
const params = new URL(window.location.href).searchParams