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