修改登录

This commit is contained in:
ctw committed 2025-01-25 15:37:20 +08:00
1 parent 8b14195c63
commit 56d21c3a2b
5 files changed
+45 -9

No files matched your search

+3 -3
View File
@@ -20,11 +20,11 @@ VITE_OAUTH2_APP_CLIENT='mini:mini'
#VITE_IMAGE_BASE_PATH = http://localhost:9999
# VITE_IMAGE_BASE_PATH = http://192.168.101.29:9999 # 邓-本地
# VITE_IMAGE_BASE_PATH = http://192.168.101.37:9999 # 邓-本地
VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上
VITE_IMAGE_BASE_PATH = https://123.156.230.15:8089/api # 线上
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc # 张
# VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api # 信创线上
# ******************** start 开发环境 start ****************
# ******************** start 开发环境 start ********************
# VITE_APP_DEV_SERVICE = http://59.202.170.152:81/api # 信创线上
# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/app-api
# VITE_APP_DEV_SERVICE = http://192.168.101.29:9999 # 邓-本地
@@ -39,5 +39,5 @@ VITE_APP_DEV_SERVICE = http://123.156.230.15:8089/api/ # 线上
#VITE_APP_PROD_SERVICE = http://59.202.170.152:81/api
VITE_APP_PROD_SERVICE = https://stgl.pj.gov.cn/api
# ******************** end 生产环境 end ********************
#VITE_DEV_ENV = dev
# VITE_DEV_ENV = dev
VITE_DEV_ENV = prod
+1 -1
View File
@@ -269,7 +269,7 @@
"list": [
{
"pagePath": "pages/tabbar/home",
"text": "首页1",
"text": "首页",
"iconPath": "static/tabbar/home.png",
"selectedIconPath": "static/tabbar/home-select.png"
},
+1 -1
View File
@@ -48,7 +48,7 @@ const doDel = (id: string) => {
</script>
<template>
<crud-layout title="人脸管理一下" bg="/static/page/blue-bg.png">
<crud-layout title="人脸管理" bg="/static/page/blue-bg.png">
<z-paging
ref="pageRef"
height="100%"
+19 -2
View File
@@ -66,9 +66,26 @@ const getUserInfo = () => {
const userStorage = uni.getStorageSync(userInfoKey)
if (!isEmpty(userStorage)) {
state.userInfo = userStorage
} else {
state.userInfo = {}
}
}
// {
// "accessToken": {
// "tokenValue": "06d43795-a3ef-4019-a70f-25830e7183a4",
// "issuedAt": "2025-01-24T11:10:30.423604599Z",
// "expiresAt": "2025-01-25T11:10:30.423604599Z",
// "tokenType": {
// "value": "Bearer"
// },
// "scopes": []
// },
// "refreshToken": {
// "tokenValue": "FmRVP4l3d7t3263h9LeKnV8hdU0lPasMuI1wank_EbylRQPNLm7XP4_OtUV-zH9AbMZc9f14Qk2IXhw-33fWMGGKipVY8crbvVyWV5DeAcfeU8fYyQuNDh9rw3Dq0w75",
// "issuedAt": "2025-01-24T11:10:30.423699280Z",
// "expiresAt": "2025-01-31T11:10:30.423699280Z"
// }
// }
const doLogin = async (loginType, token, accountId, sessionId) => {
const tokenKey = constant.storageConstant.TOKEN
const userInfoKey = constant.storageConstant.USERINFO
@@ -190,7 +207,7 @@ const onTabLogin = () => {
</view>
</view>
<view class="flex-col-center m-t-40rpx m-x-30rpx">
<view v-if="isDevEnv()" class="flex-col-center m-t-40rpx m-x-30rpx">
<view
class="w-full text-center sub-text-28 p-y-20rpx rounded-40rpx border-solid border border-#0094ff"
@tap="doLogout"
+21 -2
View File
@@ -55,9 +55,26 @@ http.interceptors.request.use(
config_header["CLIENT-TOC"] = "Y"
}
config_header["TENANT-ID"] = "1"
if (config.url != "/sys/auth/refresh-token" && tokenStorage && tokenStorage.access_token && config_header) {
if (
config.url != "/sys/auth/refresh-token" &&
tokenStorage &&
tokenStorage.access_token &&
config_header &&
isDevEnv()
) {
config_header.Authorization = `Bearer ${tokenStorage.access_token}`
}
if (
config.url != "/sys/auth/refresh-token" &&
tokenStorage &&
tokenStorage.accessToken &&
config_header &&
!isDevEnv()
) {
console.log("aaaa", tokenStorage)
config_header.Authorization = `Bearer ${tokenStorage.accessToken.tokenValue}`
}
if (config.custom && config.custom.showLoading) {
LoadingInstance.count++
LoadingInstance.count === 1 &&
@@ -146,9 +163,11 @@ http.interceptors.response.use(
return Promise.resolve(response.data)
},
(error) => {
if (error.statusCode == 424) {
if (error.statusCode == 424 && isDevEnv()) {
const tokenKey = constant.storageConstant.TOKEN
const userInfoKey = constant.storageConstant.USERINFO
uni.removeStorageSync(tokenKey)
uni.removeStorageSync(userInfoKey)
uni.showToast({ title: "登录已过期,请重新登录", icon: "none" })
isDevEnv() ? router.jump("/pages/test/login") : undefined
return false