测试商户身份切换

This commit is contained in:
weiwei committed 2025-04-08 20:06:29 +08:00
1 parent 3daf1e1f20
commit 6c656b6f03
2 files changed
+8 -14

No files matched your search

+6 -12
View File
@@ -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" })
// }
}
},
+2 -2
View File
@@ -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" })