提示修改

This commit is contained in:
weiwei committed 2025-04-07 11:10:29 +08:00
1 parent 4d85e7f6cc
commit 04164a1b28
1 file changed
+26 -20
+26 -20
View File
@@ -71,6 +71,23 @@ const state = reactive<{ wallet: any; userInfo: any; menuList: MenuItem[] }>({
const onTabLogin = () => (isDevEnv() ? router.jump("/pages/test/login") : checkAppInfo())
// 检查应用环境并登录
const checkAppInfo = async () => {
try {
// 先尝试诗画登录
const shihuaResult = await loginMethods.shihuaLogin()
if (shihuaResult) return
// 尝试浙政钉登录
const zhengdingResult = loginMethods.zhengdingLogin()
if (zhengdingResult) return
uni.showToast({ title: "当前登录环境未知", icon: "none" })
} catch (error) {
console.error("登录失败:", error)
uni.showToast({ title: "登录失败", icon: "none" })
}
}
// 登录相关方法
const loginMethods = {
// 诗画环境登录
@@ -98,23 +115,6 @@ const loginMethods = {
},
}
// 检查应用环境并登录
const checkAppInfo = async () => {
try {
// 先尝试诗画登录
const shihuaResult = await loginMethods.shihuaLogin()
if (shihuaResult) return
// 尝试浙政钉登录
const zhengdingResult = loginMethods.zhengdingLogin()
if (zhengdingResult) return
uni.showToast({ title: "当前登录环境未知", icon: "none" })
} catch (error) {
console.error("登录失败:", error)
uni.showToast({ title: "登录失败", icon: "none" })
}
}
// loginType 1:诗画登录 2:浙政钉登录
const doLogin = async (loginType: number, token: string, accountId: string, sessionId: string) => {
const tokenKey = constant.storageConstant.TOKEN
@@ -152,12 +152,18 @@ const doLogin = async (loginType: number, token: string, accountId: string, sess
uni.setStorageSync(userInfoKey, userData)
getStorageUserInfo()
} else {
uni.hideLoading()
uni.showToast({ title: "获取浙政钉用户信息失败", icon: "none" })
uni.removeStorageSync(tokenKey)
uni.removeStorageSync(userInfoKey)
if (res.msg == "token已失效") {
uni.showToast({ title: "用户凭证已失效,请退出并重新进入智慧后勤应用", icon: "none", duration: 6000 })
} else {
uni.showToast({ title: res.msg || "登录失败", icon: "none" })
}
}
} catch (error) {
uni.showToast({ title: "登录错误", icon: "none" })
} finally {
uni.hideLoading()
uni.showToast({ title: "错误", icon: "none" })
}
}
break