From 6c656b6f032bac4132163e42e072e9ce74248065 Mon Sep 17 00:00:00 2001 From: weiwei Date: Tue, 8 Apr 2025 20:06:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=95=86=E6=88=B7=E8=BA=AB?= =?UTF-8?q?=E4=BB=BD=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/tabbar/my.vue | 18 ++++++------------ src/pages/user/userRole.vue | 4 ++-- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index de1dec3..082693d 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -83,7 +83,6 @@ const state = reactive<{ const STORAGE_KEYS = { TOKEN: constant.storageConstant.TOKEN, USER_INFO: constant.storageConstant.USERINFO, - USER_ROLE: constant.storageConstant.USERROLE, } const storage = { @@ -116,11 +115,6 @@ const storage = { uni.removeStorageSync(STORAGE_KEYS.USER_INFO) state.userInfo = {} }, - - // 清除用户角色存储 - clearUserRole: () => { - uni.removeStorageSync(STORAGE_KEYS.USER_ROLE) - }, } const login = { @@ -239,7 +233,6 @@ const login = { // 切换角色 changeRole: () => { - storage.clearUserRole() router.jump("/pages/user/userRole") }, } @@ -253,13 +246,14 @@ const scanCode = { if (decodedString) { scanCode.processScanResult(decodedString) - } else { - uni.showToast({ title: "无效的二维码", icon: "none" }) } + // else { + // uni.showToast({ title: "无效的二维码", icon: "none" }) + // } } catch (error: any) { - if (error) { - uni.showToast({ title: error, icon: "none" }) - } + // if (error) { + // uni.showToast({ title: error, icon: "none" }) + // } } }, diff --git a/src/pages/user/userRole.vue b/src/pages/user/userRole.vue index 12178e5..c9bb653 100644 --- a/src/pages/user/userRole.vue +++ b/src/pages/user/userRole.vue @@ -50,7 +50,7 @@ const selectRole = (role: "user" | "merchant") => (userRole.value = role) const confirmRole = async () => { if (userRole.value === "user") { uni.setStorageSync("userRole", userRole.value) - uni.redirectTo({ url: "/pages/tabbar/coopMerchant" }) + uni.reLaunch({ url: "/pages/tabbar/coopMerchant" }) return } if (userRole.value === "merchant") { @@ -59,7 +59,7 @@ const confirmRole = async () => { if (res.code == 0) { if (res.data) { uni.setStorageSync("userRole", userRole.value) - uni.redirectTo({ url: "/pages/tabbar/individualOrder" }) + uni.reLaunch({ url: "/pages/tabbar/individualOrder" }) return } else { uni.showToast({ title: "您不是商户", icon: "none" })