"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const common_vendor = require("./common/vendor.js"); const common_appInit = require("./common/appInit.js"); require("./common/openApp.js"); const common_uniIdPagesInit = require("./common/uni-id-pages-init.js"); const common_store = require("./common/store.js"); const lang_i18n = require("./lang/i18n.js"); if (!Math) { "./pages/furniture_reception/furniture_reception.js"; "./pages/ucenter/ucenter.js"; "./pages/team/team.js"; "./pages/furniture_reception/common_begin_reception.js"; "./pages/furniture_customer/furniture_customer.js"; "./pages/furniture_top_sales/furniture_top_sales.js"; "./uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.js"; "./uni_modules/uni-id-pages/pages/userinfo/userinfo.js"; "./uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.js"; "./uni_modules/uni-id-pages/pages/login/login-withoutpwd.js"; "./uni_modules/uni-id-pages/pages/login/login-withpwd.js"; "./uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate.js"; "./uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile.js"; "./uni_modules/uni-id-pages/pages/login/login-smscode.js"; "./uni_modules/uni-id-pages/pages/register/register.js"; "./uni_modules/uni-id-pages/pages/retrieve/retrieve.js"; "./uni_modules/uni-id-pages/pages/common/webview/webview.js"; "./uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd.js"; "./uni_modules/uni-id-pages/pages/register/register-by-email.js"; "./uni_modules/uni-id-pages/pages/retrieve/retrieve-by-email.js"; "./uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd.js"; "./pages-subpackage/champion/champion.js"; "./pages-subpackage/list/list.js"; "./pages-subpackage/grid/grid.js"; "./pages-subpackage/list/search/search.js"; "./pages-subpackage/list/detail.js"; "./pages-subpackage/meeting_summary/meeting_summary.js"; "./pages-subpackage/workspace/workspace.js"; "./pages-subpackage/workspace/scene-detail.js"; "./pages-subpackage/bluetooth-recorder/bluetooth-recorder.js"; "./pages-subpackage/reception/reception.js"; "./pages-subpackage/customer/customer.js"; "./pages-subpackage/uni-agree/uni-agree.js"; "./pages-subpackage/ucenter/settings/settings.js"; "./pages-subpackage/ucenter/read-news-log/read-news-log.js"; } const _sfc_main = { globalData: { searchText: "", appVersion: {}, config: {}, $i18n: {}, $t: {} }, data() { return {}; }, onLaunch: async function() { common_vendor.index.__f__("log", "at App.vue:37", "App Launch"); this.setGlobalRoleInfo(); this.updateCurrentPath(); try { if (this.$i18n) { this.globalData.$i18n = this.$i18n; } else { setTimeout(() => { try { if (this.$i18n) { this.globalData.$i18n = this.$i18n; } } catch (e) { common_vendor.index.__f__("warn", "at App.vue:58", "[App] i18n 初始化延迟设置失败:", e); } }, 100); } } catch (e) { common_vendor.index.__f__("warn", "at App.vue:63", "[App] i18n 初始化失败:", e); } this.globalData.$t = (str) => { try { return this.$t ? this.$t(str) : str; } catch (e) { return str; } }; common_appInit.initApp(); await common_uniIdPagesInit.uniIdPageInit(); this.setupRouteInterceptor(); setTimeout(() => { if (!this.isLoggedIn()) { this.redirectToLogin(); } else { this.checkCurrentPageLogin(); } }, 300); }, onShow: function() { common_vendor.index.__f__("log", "at App.vue:124", "App Show"); this.checkCurrentPageLogin(); }, onHide: function() { common_vendor.index.__f__("log", "at App.vue:129", "App Hide"); this.stopTabBarMonitor(); }, methods: { /** * 设置全局路由拦截 */ setupRouteInterceptor() { const app = this; common_vendor.index.addInterceptor("navigateTo", { invoke: (options) => { if (app.shouldRedirectToLogin(options.url)) { app.redirectToLogin(); return false; } } }); common_vendor.index.addInterceptor("redirectTo", { invoke: (options) => { if (app.shouldRedirectToLogin(options.url)) { app.redirectToLogin(); return false; } } }); common_vendor.index.addInterceptor("switchTab", { invoke: (options) => { if (app.shouldRedirectToLogin(options.url)) { app.redirectToLogin(); return false; } } }); common_vendor.index.addInterceptor("reLaunch", { invoke: (options) => { if (app.shouldRedirectToLogin(options.url)) { app.redirectToLogin(); return false; } } }); }, /** * 判断是否需要跳转到登录页 */ shouldRedirectToLogin(url) { if (!url) return false; const excludePaths = [ "/uni_modules/uni-id-pages/pages/login", "/uni_modules/uni-id-pages/pages/register", "/uni_modules/uni-id-pages/pages/retrieve" ]; for (let excludePath of excludePaths) { if (url.includes(excludePath)) { return false; } } return !this.isLoggedIn(); }, /** * 检查是否已登录 */ isLoggedIn() { const backendToken = common_vendor.index.getStorageSync("backend-token"); if (backendToken) { return true; } return common_store.store.hasLogin; }, /** * 跳转到登录页 */ redirectToLogin() { const loginPage = "/uni_modules/uni-id-pages/pages/login/login-withpwd"; const pages = getCurrentPages(); if (pages.length > 0) { const currentPage = pages[pages.length - 1]; if (currentPage.route && currentPage.route.includes("login")) { return; } } common_vendor.index.reLaunch({ url: loginPage, success: () => { common_vendor.index.__f__("log", "at App.vue:240", "跳转登录页成功"); }, fail: (err) => { common_vendor.index.__f__("error", "at App.vue:243", "跳转登录页失败:", err); const loginPageWithoutSlash = loginPage.startsWith("/") ? loginPage.substring(1) : loginPage; common_vendor.index.reLaunch({ url: loginPageWithoutSlash, fail: (err2) => { common_vendor.index.__f__("error", "at App.vue:249", "跳转登录页失败(重试):", err2); } }); } }); }, /** * 检查当前页面是否需要登录 */ setGlobalRoleInfo() { try { const tokenData = common_vendor.index.getStorageSync("uni_id_token"); if (tokenData && tokenData.roles) { common_vendor.index.__f__("log", "at App.vue:275", "[App] Setting global role info:", tokenData.roles); this.globalData.roles = tokenData.roles; this.globalData.roleName = tokenData.roleName || ""; const tabBar = getApp().globalData.tabBarInstance; if (tabBar) { tabBar.refreshRole(); } } } catch (e) { common_vendor.index.__f__("warn", "at App.vue:286", "[App] Failed to set global role info:", e); } }, checkCurrentPageLogin() { const pages = getCurrentPages(); if (pages.length === 0) { setTimeout(() => { this.checkCurrentPageLogin(); }, 200); return; } const currentPage = pages[pages.length - 1]; if (!currentPage || !currentPage.route) { setTimeout(() => { this.checkCurrentPageLogin(); }, 200); return; } const currentRoute = "/" + currentPage.route; if (currentRoute.includes("/uni_modules/uni-id-pages/pages/login") || currentRoute.includes("/uni_modules/uni-id-pages/pages/register") || currentRoute.includes("/uni_modules/uni-id-pages/pages/retrieve")) { return; } if (!this.isLoggedIn()) { setTimeout(() => { this.redirectToLogin(); }, 100); } } } }; if (!Array) { const _component_router_view = common_vendor.resolveComponent("router-view"); _component_router_view(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return {}; } const App = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); function createApp() { const app = common_vendor.createSSRApp(App); app.use(lang_i18n.i18n); return { app }; } createApp().app.mount("#app"); exports.createApp = createApp; //# sourceMappingURL=../.sourcemap/mp-weixin/app.js.map