From e4f3af4e18e8d37a80339c93393201172b42d421 Mon Sep 17 00:00:00 2001 From: weiwei Date: Tue, 8 Apr 2025 19:10:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=97=E7=94=BB=E6=89=AB=E7=A0=81=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/tabbar/my.vue | 52 +++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index 6da63f7..b1872c1 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -42,8 +42,6 @@ 切换角色 - 11{{ JSON.stringify(aaa) }} - 11{{ JSON.stringify(bbb) }} @@ -137,10 +135,10 @@ const login = { const zhengdingResult = login.zhengdingLogin() if (zhengdingResult) return - uni.showToast({ title: "当前登录环境未知" }) + uni.showToast({ title: "当前登录环境未知", icon: "none" }) } catch (error) { console.error("登录失败:", error) - uni.showToast({ title: "登录失败" }) + uni.showToast({ title: "登录失败", icon: "none" }) } }, @@ -151,7 +149,7 @@ const login = { const userInfo = await (window as any).CP2.getUserInfo() if (userInfo.code == 0) { - uni.showToast({ title: "获取诗画用户信息失败" }) + uni.showToast({ title: "获取诗画用户信息失败", icon: "none" }) return false } else { const { accountId, sessionId } = userInfo.data @@ -183,14 +181,14 @@ const login = { if (response.code == 0) { storage.saveToken({ accessToken: response.data.accessToken }) uni.hideLoading() - uni.showToast({ title: "登录成功" }) + uni.showToast({ title: "登录成功", icon: "none" }) const { data: userData } = await userApi.userInfo() storage.saveUserInfo(userData) } else { uni.hideLoading() storage.clearUserStorage() - uni.showToast({ title: "登录失败" }) + uni.showToast({ title: "登录失败", icon: "none" }) } break @@ -203,20 +201,20 @@ const login = { if (res.code == 0) { storage.saveToken(res.data) uni.hideLoading() - uni.showToast({ title: "登录成功" }) + uni.showToast({ title: "登录成功", icon: "none" }) const { data: userData } = await userApi.userInfo() storage.saveUserInfo(userData) } else { storage.clearUserStorage() if (res.msg == "token已失效") { - uni.showToast({ title: "用户凭证已失效,请退出并重新进入智慧后勤应用", duration: 6000 }) + uni.showToast({ title: "用户凭证已失效,请退出并重新进入智慧后勤应用", icon: "none", duration: 6000 }) } else { - uni.showToast(res.msg || "登录失败") + uni.showToast({ title: res.msg || "登录失败", icon: "none" }) } } } catch (error) { - uni.showToast({ title: "登录错误" }) + uni.showToast({ title: "登录错误", icon: "none" }) } finally { uni.hideLoading() } @@ -224,7 +222,7 @@ const login = { break default: - uni.showToast({ title: "当前登录环境未知" }) + uni.showToast({ title: "当前登录环境未知", icon: "none" }) } }, @@ -236,7 +234,7 @@ const login = { uni.showLoading({ title: "退出登录中...", mask: true }) storage.clearUserStorage() uni.hideLoading() - uni.showToast({ title: "退出登录成功" }) + uni.showToast({ title: "退出登录成功", icon: "none" }) }, // 切换角色 @@ -246,8 +244,6 @@ const login = { }, } -const aaa = ref("") -const bbb = ref("") const scanCode = { // 扫一扫 scan: async () => { @@ -255,16 +251,14 @@ const scanCode = { try { const decodedString = await scanCode.getScanResult() - if (state.appInfo == "dd") { - if (decodedString) { - scanCode.processScanResult(decodedString) - } else { - uni.showToast({ title: "无效的二维码" }) - } + if (decodedString) { + scanCode.processScanResult(decodedString) + } else { + uni.showToast({ title: "无效的二维码", icon: "none" }) } } catch (error: any) { if (error) { - uni.showToast({ title: error }) + uni.showToast({ title: error, icon: "none" }) } } }, @@ -275,7 +269,7 @@ const scanCode = { // 开发环境模拟扫码 // const testQrCode = "eyJpZCI6IjE4OTYxNTcyMDc2NDQwNTM1MDYiLCJuYW1lIjoi5rWL6K+V5ZWG5oi3In0=" // 线上-测试超市-收款码 const testQrCode = "eyJpZCI6IjE5MDU4MTY3NTEwNDM0NTI5MzAiLCJuYW1lIjoi5paw5Y6/5bqc6LaF5biCIn0=" // 测试环境-邓本地-新县府超市-收款码 - uni.showToast({ title: "开发环境不是浙政钉环境,扫码仅供测试,收款商家为测试商户超市" }) + uni.showToast({ title: "开发环境不是浙政钉环境,扫码仅供测试,收款商家为测试商户超市", icon: "none" }) return scanCode.decodeBase64(testQrCode) } else if (state.appInfo == "dd") { // 浙政钉扫码 @@ -284,11 +278,9 @@ const scanCode = { } else if (state.appInfo == "sh") { // 诗画扫码 const res = await (window as any).CP2.showScanQr({ needResult: 1 }) - aaa.value = res.data - bbb.value = scanCode.decodeBase64(res.data) - // return scanCode.decodeBase64(res.data) + if (res.code == 0) return scanCode.decodeBase64(res.data.qrCode) } else { - uni.showToast({ title: "当前环境未知" }) + uni.showToast({ title: "当前环境未知", icon: "none" }) } }, @@ -300,10 +292,10 @@ const scanCode = { usePayStore().setPayData(decodedJson) router.jump("/pages/pay/scanPay") } else { - uni.showToast({ title: "无效的二维码" }) + uni.showToast({ title: "无效的二维码", icon: "none" }) } } catch (error) { - uni.showToast({ title: "无效的二维码内容" }) + uni.showToast({ title: "无效的二维码内容", icon: "none" }) } }, @@ -321,7 +313,7 @@ const scanCode = { return decodedString } catch (error) { console.error("Base64 解码失败:", error) - uni.showToast({ title: "解码失败,无效的二维码" }) + uni.showToast({ title: "无效的二维码", icon: "none" }) return undefined } },