"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const common_vendor = require("./common/vendor.js"); const utils_auth = require("./utils/auth.js"); const stores_user = require("./stores/user.js"); const i18n = require("./i18n.js"); const uni_modules_uviewPlus_index = require("./uni_modules/uview-plus/index.js"); require("./utils/request.js"); if (!Math) { "./pages/index/index.js"; "./pages/login/Login.js"; "./pages/login/Register.js"; "./pages/my/index.js"; "./pagesSub/case/index.js"; "./pagesSub/case/CaseDetails.js"; "./pagesSub/case/CaseInfo.js"; "./pagesSub/case/transfer.js"; "./pagesSub/case/transferinfo.js"; "./pagesSub/ethicalReview/ethicalInfo.js"; "./pagesSub/ethicalReview/index.js"; "./pagesSub/my/notification.js"; "./pagesSub/my/profile.js"; "./pagesSub/my/health-records.js"; "./pagesSub/common/search/index.js"; "./pagesSub/common/news/list.js"; "./pagesSub/common/news/detail.js"; } const _sfc_main = { __name: "App", setup(__props) { const pageWhiteList = ["pages/login/Login", "pages/login/DingTalkLogin"]; const isPageInWhiteList = (currentPage) => pageWhiteList.some((path) => currentPage.includes(path)); let isProcessingSSO = false; common_vendor.onLaunch(() => { common_vendor.index.__f__("log", "at App.vue:13", "App Launch"); const launchOptions = common_vendor.index.getLaunchOptionsSync(); const currentPage = launchOptions.path || ""; const query = launchOptions.query || {}; common_vendor.index.__f__("log", "at App.vue:17", "启动参数:", { currentPage, query }); if (query.code) { common_vendor.index.__f__("log", "at App.vue:21", "检测到免登码(code),准备跳转登录页"); if (currentPage.includes("login/Login")) { common_vendor.index.__f__("log", "at App.vue:23", "当前已在登录页,等待login.vue处理"); return; } if (isProcessingSSO) return; isProcessingSSO = true; common_vendor.index.__isSSOHandling = true; const queryParams = []; if (currentPage) { queryParams.push(`redirect=${encodeURIComponent("/" + currentPage)}`); } queryParams.push(`code=${encodeURIComponent(query.code)}`); common_vendor.index.__f__("log", "at App.vue:38", "跳转到登录页,参数:", queryParams); setTimeout(() => { common_vendor.index.redirectTo({ url: `/pages/login/Login?${queryParams.join("&")}`, success: () => { setTimeout(() => { common_vendor.index.__isSSOHandling = false; isProcessingSSO = false; }, 500); }, fail: () => { common_vendor.index.__isSSOHandling = false; isProcessingSSO = false; } }); }, 200); return; } handleTokenCheck(); }); const handleTokenCheck = async () => { const userStore = stores_user.useUserStore(); const token = utils_auth.getToken(); const launchOptions = common_vendor.index.getLaunchOptionsSync(); const currentPage = launchOptions.path || ""; const query = launchOptions.query || {}; common_vendor.index.__f__("log", "at App.vue:68", "token检查:", { hasToken: !!token, currentPage }); if (!token) { if (!isPageInWhiteList(currentPage)) { common_vendor.index.__f__("log", "at App.vue:73", "无token且不在白名单,跳转登录页"); let loginUrl = "/pages/login/Login"; if (currentPage) { const queryParams = []; queryParams.push(`redirect=${encodeURIComponent("/" + currentPage)}`); for (const key in query) { if (query[key]) { queryParams.push(`${key}=${encodeURIComponent(query[key])}`); } } if (queryParams.length > 0) { loginUrl += `?${queryParams.join("&")}`; } } setTimeout(() => { common_vendor.index.redirectTo({ url: loginUrl }); }, 100); } return; } try { const current = await common_vendor.index.$uapi.get("/getInfo"); if (current && current.user) { userStore.setUserInfo(current.user); if (current.roles) userStore.setroleKey(current.roles); if (isPageInWhiteList(currentPage)) { common_vendor.index.switchTab({ url: "/pages/index/index" }); } } else { common_vendor.index.__f__("error", "at App.vue:103", "token无效"); userStore.clearUser(); if (!isPageInWhiteList(currentPage)) { common_vendor.index.redirectTo({ url: "/pages/login/Login" }); } } } catch (error) { common_vendor.index.__f__("error", "at App.vue:110", "初始化失败:", error); userStore.clearUser(); if (!isPageInWhiteList(currentPage)) { common_vendor.index.redirectTo({ url: "/pages/login/Login" }); } } }; return () => { }; } }; function createApp() { const app = common_vendor.createSSRApp(_sfc_main); const pinia = common_vendor.createPinia(); app.use(i18n.i18n); app.use(pinia); app.use(uni_modules_uviewPlus_index.uviewPlus); app.config.globalProperties.$t = i18n.i18n.global.t; return { app, i18n: i18n.i18n, pinia }; } createApp().app.mount("#app"); exports.createApp = createApp; //# sourceMappingURL=../.sourcemap/mp-weixin/app.js.map