测试诗画登录

This commit is contained in:
weiwei committed 2025-04-08 15:30:45 +08:00
1 parent 2f34b15cb1
commit a2ee2f402c
5 files changed
+494 -394

No files matched your search

+17 -2
View File
@@ -37,6 +37,11 @@
退出登录
</view>
</view>
<view v-if="state.appInfo == 'sh'" class="flex-col-center m-t-40rpx m-x-30rpx">
<view class="w-full text-center sub-text-28 p-y-20rpx rounded-40rpx border-solid border border-#0094ff" @tap="doChangeRole">
切换角色
</view>
</view>
</crud-layout>
</template>
@@ -45,6 +50,7 @@ import { reactive } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { isEmpty } from "radash"
import { filePath } from "@@/utils/file"
import { getAppInfo } from "@@/utils/getAppInfo"
import { hooks, router, constant } from "@@/index"
import { userApi } from "@@/api"
import isDevEnv from "@/sheep/utils/isDevEnv"
@@ -57,7 +63,7 @@ interface MenuItem {
router: string
}
const state = reactive<{ wallet: any; userInfo: any; menuList: MenuItem[] }>({
const state = reactive<{ wallet: any; userInfo: any; menuList: MenuItem[]; appInfo: string }>({
wallet: [],
userInfo: {},
menuList: [
@@ -67,6 +73,7 @@ const state = reactive<{ wallet: any; userInfo: any; menuList: MenuItem[] }>({
// { text: "跨单位就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/stride-list" },
{ text: "人脸管理", icon: "/static/icon/service_5.png", router: "/pages/human-face/list" },
],
appInfo: "",
})
const onTabLogin = () => (isDevEnv() ? router.jump("/pages/test/login") : checkAppInfo())
@@ -190,6 +197,12 @@ const doLogout = async () => {
uni.showToast({ title: "退出登录成功", icon: "none" })
}
// 切换角色
const doChangeRole = () => {
uni.removeStorageSync("userRole")
router.jump("/pages/user/userRole")
}
// 扫一扫
const doScanCode = async () => {
usePayStore().setPayData({})
@@ -279,7 +292,7 @@ const getStorageUserInfo = () => {
}
}
onLoad(() => {
onLoad(async () => {
const app = getApp()
app._initTabbar()
@@ -301,6 +314,8 @@ onLoad(() => {
router: "",
})
: ""
state.appInfo = await getAppInfo()
})
onShow(() => {
getStorageUserInfo()
+2 -2
View File
@@ -48,7 +48,7 @@ const selectRole = (role: "user" | "merchant") => (userRole.value = role)
// 确认选择
const confirmRole = () => {
uni.setStorageSync("userRole", userRole.value)
if (userRole.value === "user") uni.switchTab({ url: "/pages/tabbar/coopMerchant" })
if (userRole.value === "merchant") uni.switchTab({ url: "/pages/tabbar/individualOrder" })
if (userRole.value === "user") uni.reLaunch({ url: "/pages/tabbar/coopMerchant" })
if (userRole.value === "merchant") uni.reLaunch({ url: "/pages/tabbar/individualOrder" })
}
</script>