371 lines
12 KiB
JavaScript
371 lines
12 KiB
JavaScript
"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/ai_analysis/ai_analysis.js";
|
||
"./pages/ai_qa/ai_qa.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/workspace/workspace.js";
|
||
"./pages-subpackage/workspace/scene-detail.js";
|
||
"./pages-subpackage/bluetooth-recorder/bluetooth-recorder.js";
|
||
"./pages-subpackage/uni-agree/uni-agree.js";
|
||
"./pages-subpackage/ucenter/settings/settings.js";
|
||
"./pages-subpackage/ucenter/read-news-log/read-news-log.js";
|
||
"./pages-subpackage/ai_features/speech_rating/speech_rating.js";
|
||
"./pages-subpackage/ai_features/intent_level/intent_level.js";
|
||
"./pages-subpackage/ai_features/deal_attribution/deal_attribution.js";
|
||
"./pages-subpackage/ai_features/recording_duration/recording_duration.js";
|
||
"./pages-subpackage/ai_features/customer_count/customer_count.js";
|
||
"./pages-subpackage/ai_features/opening_rate/opening_rate.js";
|
||
"./pages-subpackage/ai_features/over_commitment/over_commitment.js";
|
||
"./pages-subpackage/ai_features/red_line_touch/red_line_touch.js";
|
||
"./pages-subpackage/ai_qa/general_qa/general_qa.js";
|
||
"./pages-subpackage/ai_qa/demand_qa/demand_qa.js";
|
||
"./pages-subpackage/ai_qa/price_qa/price_qa.js";
|
||
"./pages-subpackage/ai_qa/trust_qa/trust_qa.js";
|
||
"./pages-subpackage/ai_qa/decision_qa/decision_qa.js";
|
||
"./pages-subpackage/ai_qa/competitor_qa/competitor_qa.js";
|
||
"./pages-subpackage/ai_qa/objection_qa/objection_qa.js";
|
||
"./pages-subpackage/ai_qa/sharp_qa/sharp_qa.js";
|
||
"./pages-subpackage/ai_qa/after_sales_qa/after_sales_qa.js";
|
||
}
|
||
const _sfc_main = {
|
||
globalData: {
|
||
searchText: "",
|
||
appVersion: {},
|
||
config: {},
|
||
$i18n: {},
|
||
$t: {}
|
||
},
|
||
data() {
|
||
return {
|
||
showLoading: true
|
||
// 初始显示加载状态
|
||
};
|
||
},
|
||
onLaunch: async function() {
|
||
common_vendor.index.__f__("log", "at App.vue:45", "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:66", "[App] i18n 初始化延迟设置失败:", e);
|
||
}
|
||
}, 100);
|
||
}
|
||
} catch (e) {
|
||
common_vendor.index.__f__("warn", "at App.vue:71", "[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(() => {
|
||
const checkPageLoaded = () => {
|
||
const pages = getCurrentPages();
|
||
if (pages.length > 0 && pages[pages.length - 1].route) {
|
||
if (!this.isLoggedIn()) {
|
||
this.showLoading = false;
|
||
this.redirectToLogin();
|
||
} else {
|
||
this.checkCurrentPageLogin();
|
||
setTimeout(() => {
|
||
this.showLoading = false;
|
||
}, 200);
|
||
}
|
||
} else {
|
||
setTimeout(checkPageLoaded, 100);
|
||
}
|
||
};
|
||
checkPageLoaded();
|
||
}, 500);
|
||
},
|
||
onShow: function() {
|
||
common_vendor.index.__f__("log", "at App.vue:149", "App Show");
|
||
try {
|
||
common_store.mutations.syncUserInfoFromStorage();
|
||
} catch (e) {
|
||
}
|
||
this.checkCurrentPageLogin();
|
||
},
|
||
onHide: function() {
|
||
common_vendor.index.__f__("log", "at App.vue:174", "App Hide");
|
||
this.stopTabBarMonitor();
|
||
if (this.urlProtectionInterval) {
|
||
clearInterval(this.urlProtectionInterval);
|
||
this.urlProtectionInterval = null;
|
||
}
|
||
},
|
||
onError: function(msg) {
|
||
common_vendor.index.__f__("error", "at App.vue:186", "[App Global Error]:", msg);
|
||
},
|
||
methods: {
|
||
/**
|
||
* 完美的URL隐藏系统 - 专为uni-app H5设计
|
||
*/
|
||
setupPerfectUrlHiding() {
|
||
},
|
||
/**
|
||
* 初始化URL隐藏功能
|
||
*/
|
||
initializeUrlHiding() {
|
||
},
|
||
/**
|
||
* 隐藏当前页面的URL显示
|
||
*/
|
||
hideCurrentPageUrl(retryCount = 0) {
|
||
},
|
||
/**
|
||
* 设置页面切换监听器
|
||
*/
|
||
setupPageChangeListener() {
|
||
},
|
||
/**
|
||
* 处理URL变化(在history模式下)
|
||
*/
|
||
handleUrlChange() {
|
||
},
|
||
/**
|
||
* 设置浏览器导航监听器
|
||
*/
|
||
setupBrowserNavigationListener() {
|
||
},
|
||
/**
|
||
* 设置URL保护机制(防止意外的URL变化)
|
||
*/
|
||
setupUrlProtection() {
|
||
},
|
||
/**
|
||
* 设置全局路由拦截
|
||
*/
|
||
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:524", "跳转登录页成功");
|
||
},
|
||
fail: (err) => {
|
||
common_vendor.index.__f__("error", "at App.vue:527", "跳转登录页失败:", 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:533", "跳转登录页失败(重试):", err2);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
},
|
||
/**
|
||
* 更新当前页面路径(用于更新 tabBar 等)
|
||
*/
|
||
updateCurrentPath() {
|
||
try {
|
||
const pages = getCurrentPages();
|
||
if (pages.length > 0) {
|
||
const currentPage = pages[pages.length - 1];
|
||
if (currentPage && currentPage.route) {
|
||
const currentPath = `/${currentPage.route}`;
|
||
try {
|
||
const app = getApp({ allowDefault: true });
|
||
if (app && app.globalData) {
|
||
const tabBar = app.globalData.tabBarInstance;
|
||
if (tabBar && typeof tabBar.updateCurrentPath === "function") {
|
||
tabBar.updateCurrentPath(currentPath);
|
||
}
|
||
}
|
||
} catch (e) {
|
||
}
|
||
}
|
||
}
|
||
} catch (e) {
|
||
}
|
||
},
|
||
/**
|
||
* 检查当前页面是否需要登录
|
||
*/
|
||
setGlobalRoleInfo() {
|
||
try {
|
||
const tokenData = common_vendor.index.getStorageSync("uni_id_token");
|
||
if (tokenData && tokenData.roles) {
|
||
common_vendor.index.__f__("log", "at App.vue:588", "[App] Setting global role info:", tokenData.roles);
|
||
this.globalData.roles = tokenData.roles;
|
||
this.globalData.roleName = tokenData.roleName || "";
|
||
try {
|
||
const app = getApp({ allowDefault: true });
|
||
if (app && app.globalData) {
|
||
const tabBar = app.globalData.tabBarInstance;
|
||
if (tabBar) {
|
||
tabBar.refreshRole();
|
||
}
|
||
}
|
||
} catch (e) {
|
||
}
|
||
}
|
||
} catch (e) {
|
||
common_vendor.index.__f__("warn", "at App.vue:606", "[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 common_vendor.e({
|
||
a: $data.showLoading
|
||
}, $data.showLoading ? {} : {});
|
||
}
|
||
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
|