"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/appointment/index.js"; "./pages/login/Login.js"; "./pages/login/Register.js"; "./pages/my/index.js"; "./pages/vaccine/index.js"; "./pages/vaccine/book.js"; "./pages/appointment/doctor.js"; "./pages/appointment/schedule.js"; "./pages/appointment/record.js"; "./pages/payment/index.js"; "./pages/department/index.js"; "./pages/department/guide.js"; "./pages/department/list.js"; "./pages/department/detail.js"; "./pages/department/search.js"; "./pages/hospital/detail.js"; "./pages/records/medical.js"; "./pages/records/detail.js"; "./pages/records/report.js"; "./pages/my/cases.js"; "./pages/my/case-detail.js"; "./pages/records/reports.js"; "./pages/records/report-detail.js"; "./pages/appointment/patient.js"; "./pages/appointment/confirm.js"; "./pages/vaccine/list.js"; "./pages/vaccine/detail.js"; "./pages/vaccine/record.js"; "./pages/case/index.js"; "./pages/case/CaseDetails.js"; "./pages/case/CaseInfo.js"; "./pages/case/transfer.js"; "./pages/case/transferinfo.js"; "./pages/payment/record.js"; "./pages/payment/detail.js"; "./pages/payment/result.js"; "./pages/payment/refund.js"; "./pages/payment/invoice.js"; "./pages/patient/list.js"; "./pages/patient/add.js"; "./pages/patient/edit.js"; "./pages/my/payment-method.js"; "./pages/my/add-bank-card.js"; "./pages/my/notification.js"; "./pages/search/index.js"; "./pages/doctor/detail.js"; "./pages/disease/detail.js"; "./pages/appointment/department.js"; "./pages/news/list.js"; "./pages/news/detail.js"; "./pages/featured/tcm.js"; "./pages/featured/project.js"; "./pages/featured/case.js"; "./pages/featured/index.js"; "./pages/featured/cross-border.js"; "./pages/featured/expert.js"; "./pages/featured/all.js"; "./pages/featured/bay-area.js"; "./pages/my/profile.js"; "./pages/consultation/index.js"; "./pages/ethicalReview/ethicalInfo.js"; "./pages/ethicalReview/index.js"; "./pages/consultation/chat.js"; "./pages/consultation/ai.js"; "./pages/my/health-records.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