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" })