diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index ad28c77..975e007 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -2,9 +2,7 @@ import { reactive } from "vue" import { onLoad, onShow } from "@dcloudio/uni-app" import { isEmpty } from "radash" - import { filePath } from "@@/utils/file" - import { hooks, router, constant } from "@@/index" import { merchantApi, userApi, walletApi } from "@@/api" import isDevEnv from "@/sheep/utils/isDevEnv" @@ -25,7 +23,6 @@ const DEFAULT_SERVICES: ServiceItem[] = [ { text: "人脸管理", icon: "/static/icon/service_5.png", router: "/pages/human-face/list" }, ] -// 状态管理 const state = reactive({ wallet: [], userInfo: {}, @@ -66,8 +63,13 @@ const checkAppInfo = async () => { const zhengdingResult = await loginMethods.zhengdingLogin() if (zhengdingResult) return + const tokenKey = constant.storageConstant.TOKEN + const userInfoKey = constant.storageConstant.USERINFO + const tokenStorage = uni.getStorageSync(tokenKey) + const userStorage = uni.getStorageSync(userInfoKey) + // 开发环境下跳转到测试登录页 - if (isDevEnv()) { + if ((isDevEnv() && isEmpty(tokenStorage)) || isEmpty(userStorage)) { router.jump("/pages/test/login") } } catch (error) { diff --git a/src/sheep/utils/isDevEnv.ts b/src/sheep/utils/isDevEnv.ts index 9e624c5..b5bdee1 100644 --- a/src/sheep/utils/isDevEnv.ts +++ b/src/sheep/utils/isDevEnv.ts @@ -1 +1,2 @@ export default () => import.meta.env.VITE_DEV_ENV === "dev" +// export default () => process.env.NODE_ENV === "development"