WXL
11 小时以前 05c363fdd7ab04e3bd9a753e2c5d5bfff04d681c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
"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