diff --git a/src/App.vue b/src/App.vue index 7614e6e..73eca76 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,6 @@ - - - - diff --git a/src/pages/wallet/detail.vue b/src/pages/wallet/detail.vue index 14238af..234e88b 100644 --- a/src/pages/wallet/detail.vue +++ b/src/pages/wallet/detail.vue @@ -85,5 +85,3 @@ const doTab = (e: any) => { - - diff --git a/src/pages/tabbar/tabSearch.vue b/src/sheep/components/tabSearch.vue similarity index 100% rename from src/pages/tabbar/tabSearch.vue rename to src/sheep/components/tabSearch.vue diff --git a/src/sheep/constant/img-constant.ts b/src/sheep/constant/img-constant.ts deleted file mode 100644 index 2d52e58..0000000 --- a/src/sheep/constant/img-constant.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default { - logo: "/static/constant/logo.png" -} \ No newline at end of file diff --git a/src/sheep/constant/index.ts b/src/sheep/constant/index.ts index 949adc3..534ff66 100644 --- a/src/sheep/constant/index.ts +++ b/src/sheep/constant/index.ts @@ -1,5 +1,3 @@ -export { default as imgConstant } from "./img-constant"; +export { default as serviceEnum } from "./service-enum" -export { default as serviceEnum } from "./service-enum"; - -export { default as storageConstant } from "./storage-constant"; +export { default as storageConstant } from "./storage-constant" diff --git a/src/sheep/hooks/use-token.ts b/src/sheep/hooks/use-token.ts index 7af2191..d55b76b 100644 --- a/src/sheep/hooks/use-token.ts +++ b/src/sheep/hooks/use-token.ts @@ -1,6 +1,6 @@ import storageConstant from "../constant/storage-constant" import { jump } from "../router/index" -import isDevEnv from "../utils/isDevEnv" +import { isDevEnv } from "../utils/app" export const useToken = () => { const tokenKey = storageConstant.TOKEN diff --git a/src/sheep/utils/app.ts b/src/sheep/utils/app.ts new file mode 100644 index 0000000..3fd5d82 --- /dev/null +++ b/src/sheep/utils/app.ts @@ -0,0 +1,26 @@ +// app运行环境 +// export default () => import.meta.env.VITE_DEV_ENV === "dev" +export const isDevEnv = (): boolean => process.env.NODE_ENV === "development" + +// 获取启动参数 +export const getLaunchParam = (): "canteen" | "selfMerchant" | "coopMerchant" | "thirdApp" | null => { + return new URL(window.location.href).searchParams.get("launchParam") as "canteen" | "selfMerchant" | "coopMerchant" | "thirdApp" | null +} + +// 检测app信息判断运行环境 +export const getAppInfo = async (): Promise => { + try { + const res = await (window as any).CP2.getAppInfo() + // 浙政钉环境 + if (res.code === 0) { + console.log("环境:zzd") + return "zzd" + } else { + // 诗画环境 + console.log("环境:sh") + return "sh" + } + } catch (error) { + return "unknown" + } +} diff --git a/src/sheep/utils/file.ts b/src/sheep/utils/file.ts index ff8384e..12e7aa1 100644 --- a/src/sheep/utils/file.ts +++ b/src/sheep/utils/file.ts @@ -1,4 +1,4 @@ -import isDevEnv from "./isDevEnv" +import { isDevEnv } from "./app" export const filePath = (path?: string) => { const imageBaseUrl = isDevEnv() ? import.meta.env.VITE_IMAGE_DEV_PATH : import.meta.env.VITE_APP_PROD_IMAGE diff --git a/src/sheep/utils/getAppInfo.ts b/src/sheep/utils/getAppInfo.ts deleted file mode 100644 index 9e23f22..0000000 --- a/src/sheep/utils/getAppInfo.ts +++ /dev/null @@ -1,17 +0,0 @@ -// 检测app信息判断运行环境 -export const getAppInfo = async (): Promise => { - try { - const res = await (window as any).CP2.getAppInfo() - // 浙政钉环境 - if (res.code === 0) { - console.log("环境:zzd") - return "zzd" - } else { - // 诗画环境 - console.log("环境:sh") - return "sh" - } - } catch (error) { - return "unknown" - } -} diff --git a/src/sheep/utils/getLaunchParam.ts b/src/sheep/utils/getLaunchParam.ts deleted file mode 100644 index ac5c39e..0000000 --- a/src/sheep/utils/getLaunchParam.ts +++ /dev/null @@ -1,6 +0,0 @@ -// 获取启动参数 -const getLaunchParam = (): "canteen" | "selfMerchant" | "coopMerchant" | "thirdApp" | null => { - return new URL(window.location.href).searchParams.get("launchParam") as "canteen" | "selfMerchant" | "coopMerchant" | "thirdApp" | null -} - -export default getLaunchParam diff --git a/src/sheep/utils/isDevEnv.ts b/src/sheep/utils/isDevEnv.ts deleted file mode 100644 index a081bbe..0000000 --- a/src/sheep/utils/isDevEnv.ts +++ /dev/null @@ -1,2 +0,0 @@ -// export default () => import.meta.env.VITE_DEV_ENV === "dev" -export default () => process.env.NODE_ENV === "development" diff --git a/src/sheep/utils/request.ts b/src/sheep/utils/request.ts index e1af5c6..7ea9932 100644 --- a/src/sheep/utils/request.ts +++ b/src/sheep/utils/request.ts @@ -2,8 +2,8 @@ import Request from "luch-request" import { router, constant } from "@@/index" import { userApi } from "../api" import { isEmpty } from "radash" -import isDevEnv from "./isDevEnv" -import { getAppInfo } from "@@/utils/getAppInfo" +import { isDevEnv } from "./app" +import { getAppInfo } from "@@/utils/app" import showVerifyDeviceImpModel from "../components/verifyDeviceImpModel/verifyDeviceImpModel" const TOKEN_KEY = constant.storageConstant.TOKEN @@ -78,15 +78,15 @@ async function handleShLogin(): Promise { try { uni.showLoading({ title: "登录中...", mask: true }) - const userInfo = await (window as any).CP2.getUserInfo() - if (userInfo.code == 0 || !userInfo.data.accountId || !userInfo.data.sessionId) { - uni.showToast({ title: "获取诗画用户信息失败", icon: "none" }) - return false - } + // const userInfo = await (window as any).CP2.getUserInfo() + // if (userInfo.code == 0 || !userInfo.data.accountId || !userInfo.data.sessionId) { + // uni.showToast({ title: "获取诗画用户信息失败", icon: "none" }) + // return false + // } - const { accountId, sessionId } = userInfo.data - const response = await userApi.authsh({ accountId, sessionId }) - // const response = await userApi.authsh({ accountId: "67e790d6a95d5a7b507e53dd", sessionId: "68215b03a95d5a4899d20cb4" }) // 测试 + // const { accountId, sessionId } = userInfo.data + // const response = await userApi.authsh({ accountId, sessionId }) + const response = await userApi.authsh({ accountId: "67e790d6a95d5a7b507e53dd", sessionId: "68215b03a95d5a4899d20cb4" }) // 测试 if (response.code == 0) { uni.setStorageSync(TOKEN_KEY, { accessToken: response.data.accessToken }) @@ -274,7 +274,7 @@ http.interceptors.response.use( uni.removeStorageSync(TOKEN_KEY) uni.removeStorageSync(USER_INFO_KEY) uni.showToast({ title: "登录已过期,请重新登录", icon: "none" }) - router.jump("/pages/test/login") + router.jump("/pages/user/login") } else { try { const newTokenStorage = await refreshToken()