"use strict"; const common_vendor = require("./vendor.js"); const common_config = require("./config.js"); const pages = [ { path: "pages/furniture_reception/furniture_reception", style: { navigationStyle: "custom" } }, { path: "pages/ucenter/ucenter", style: { navigationStyle: "custom" } }, { path: "pages/team/team", style: { navigationStyle: "custom" } }, { path: "pages/furniture_reception/common_begin_reception", style: { navigationStyle: "custom" } }, { path: "pages/furniture_customer/furniture_customer", style: { navigationStyle: "custom" } }, { path: "pages/ai_analysis/ai_analysis", style: { navigationStyle: "custom" }, componentPlaceholder: { QualityCoveragePopup: "pages-subpackage/ai_features/quality_coverage/quality-coverage-popup" } } ]; const subPackages = [ { root: "uni_modules/uni-feedback", pages: [ { path: "pages/opendb-feedback/opendb-feedback", style: { navigationBarTitleText: "意见反馈", enablePullDownRefresh: false } } ] }, { root: "uni_modules/uni-id-pages", pages: [ { path: "pages/userinfo/userinfo", style: { navigationBarTitleText: "个人资料" } }, { path: "pages/userinfo/realname-verify/realname-verify", style: { enablePullDownRefresh: false, navigationBarTitleText: "实名认证" } }, { path: "pages/login/login-withoutpwd" }, { path: "pages/login/login-withpwd" }, { path: "pages/userinfo/deactivate/deactivate", style: { navigationBarTitleText: "注销账号" } }, { path: "pages/userinfo/bind-mobile/bind-mobile", style: { navigationBarTitleText: "绑定手机号码" } }, { path: "pages/login/login-smscode", style: { navigationBarTitleText: "手机验证码登录" } }, { path: "pages/register/register", style: { navigationBarTitleText: "注册" } }, { path: "pages/retrieve/retrieve", style: { navigationBarTitleText: "重置密码" } }, { path: "pages/common/webview/webview", style: { enablePullDownRefresh: false, navigationBarTitleText: "" } }, { path: "pages/userinfo/change_pwd/change_pwd", style: { enablePullDownRefresh: false, navigationBarTitleText: "修改密码" } }, { path: "pages/register/register-by-email", style: { navigationBarTitleText: "邮箱验证码注册" } }, { path: "pages/retrieve/retrieve-by-email", style: { navigationBarTitleText: "通过邮箱重置密码" } }, { path: "pages/userinfo/set-pwd/set-pwd", style: { enablePullDownRefresh: false, navigationBarTitleText: "设置密码" } } ] }, { root: "pages-subpackage", pages: [ { path: "champion/champion", style: { navigationStyle: "custom" } }, { path: "list/list", style: { enablePullDownRefresh: true, navigationStyle: "custom" } }, { path: "grid/grid", style: {} }, { path: "list/search/search", style: { navigationBarTitleText: "搜索" } }, { path: "list/detail", style: { "app-plus": { titleNView: { buttons: [ { type: "share" } ], type: "transparent" } }, h5: { titleNView: { type: "transparent" } }, navigationBarTitleText: "文章详情" } }, { path: "meeting_summary/meeting_summary", style: { navigationStyle: "custom" } }, { path: "workspace/workspace", style: { navigationStyle: "custom" } }, { path: "workspace/scene-detail", style: { navigationStyle: "custom" } }, { path: "bluetooth-recorder/bluetooth-recorder", style: { navigationBarTitleText: "蓝牙录音设备", navigationStyle: "custom" } }, { path: "reception/reception", style: { navigationStyle: "custom" } }, { path: "customer/customer", style: { navigationStyle: "custom" } }, { path: "uni-agree/uni-agree", style: { navigationStyle: "custom", "app-plus": { popGesture: "none" } } }, { path: "ucenter/settings/settings", style: { navigationBarTitleText: "设置" } }, { path: "ucenter/read-news-log/read-news-log", style: { navigationBarTitleText: "阅读记录", enablePullDownRefresh: true } }, { path: "ai_features/speech_rating/speech_rating", style: { navigationStyle: "custom" } }, { path: "ai_features/intent_level/intent_level", style: { navigationStyle: "custom" } }, { path: "ai_features/deal_attribution/deal_attribution", style: { navigationStyle: "custom" } }, { path: "ai_features/recording_duration/recording_duration", style: { navigationStyle: "custom" } }, { path: "ai_features/customer_count/customer_count", style: { navigationStyle: "custom" } }, { path: "ai_features/opening_rate/opening_rate", style: { navigationStyle: "custom" } }, { path: "ai_features/over_commitment/over_commitment", style: { navigationStyle: "custom" } }, { path: "ai_features/red_line_touch/red_line_touch", style: { navigationStyle: "custom" } } ] } ]; const globalStyle = { navigationBarTextStyle: "black", navigationBarTitleText: "移多旺科技", navigationBarBackgroundColor: "#FFFFFF", backgroundColor: "#F8F8F8", enablePullDownRefresh: false, rpxCalcMaxDeviceWidth: 375, rpxCalcBaseDeviceWidth: 375 }; const condition = { list: [ { path: "pages-subpackage/reception/reception" }, { path: "pages-subpackage/customer/customer" }, { path: "pages-subpackage/list/detail" }, { path: "pages-subpackage/ucenter/settings/settings" } ], current: 1 }; const tabBar = { custom: false, color: "#7A7E83", selectedColor: "#007AFF", borderStyle: "black", backgroundColor: "#FFFFFF", list: [ { pagePath: "pages/furniture_reception/furniture_reception", iconPath: "static/tabbar/reception.png", selectedIconPath: "static/tabbar/reception_active.png", text: "接待" }, { pagePath: "pages/furniture_customer/furniture_customer", iconPath: "static/tabbar/customer.png", selectedIconPath: "static/tabbar/customer_active.png", text: "客户" }, { pagePath: "pages/ai_analysis/ai_analysis", iconPath: "static/tabbar/ai_analysis.png", selectedIconPath: "static/tabbar/ai_analysis_active.png", text: "AI分析" }, { pagePath: "pages/ucenter/ucenter", iconPath: "static/tabbar/me.png", selectedIconPath: "static/tabbar/me_active.png", text: "我的" } ] }; const uniIdRouter = { loginPage: "uni_modules/uni-id-pages/pages/login/login-withpwd", needLogin: [ "/uni_modules/uni-id-pages/pages/userinfo/userinfo" ], resToLogin: true }; const easycom = { autoscan: true, custom: { "^cloud-image$": "@/uni_modules/uni-id-pages/components/cloud-image/cloud-image.vue" } }; const pagesJson = { pages, subPackages, globalStyle, condition, tabBar, uniIdRouter, easycom }; function getHostUserInfo() { try { if (typeof common_vendor.index !== "undefined" && common_vendor.index && typeof common_vendor.index.getStorageSync === "function") { const storedUserInfo = common_vendor.index.getStorageSync("uni-id-pages-userInfo") || {}; return storedUserInfo; } } catch (e) { } return {}; } const initialUserInfo = getHostUserInfo() || {}; const data = { userInfo: initialUserInfo, hasLogin: Object.keys(initialUserInfo).length != 0 }; const mutations = { // 更新用户信息(简化版,不使用数据库) async updateUserInfo(data2 = false) { if (data2) { this.setUserInfo(data2); if (typeof common_vendor.index !== "undefined" && common_vendor.index.showToast) { common_vendor.index.showToast({ title: "更新成功", icon: "none", duration: 3e3 }); } } }, /** * 从本地存储中重新加载用户信息到store * 用于解决store初始化时uni未准备好导致的问题 */ syncUserInfoFromStorage() { try { if (typeof common_vendor.index !== "undefined" && common_vendor.index && typeof common_vendor.index.getStorageSync === "function") { const storedUserInfo = common_vendor.index.getStorageSync("uni-id-pages-userInfo") || {}; if (Object.keys(storedUserInfo).length > 0) { this.setUserInfo(storedUserInfo, { cover: true }); return true; } } } catch (e) { } return false; }, setUserInfo(data2, { cover } = { cover: false }) { const safeData = data2 && typeof data2 === "object" ? data2 : {}; let userInfo = cover ? safeData : Object.assign({}, store.userInfo || {}, safeData); store.userInfo = Object.assign({}, userInfo); store.hasLogin = Object.keys(store.userInfo).length != 0; if (typeof common_vendor.index !== "undefined" && common_vendor.index && typeof common_vendor.index.setStorageSync === "function") { try { common_vendor.index.setStorageSync("uni-id-pages-userInfo", store.userInfo); } catch (e) { } } return safeData; }, async logout() { if (typeof common_vendor.index === "undefined") { common_vendor.index.__f__("warn", "at common/store.js:93", "uni API not available for logout"); return; } const backendUserId = common_vendor.index.getStorageSync("backend-user-id"); if (backendUserId) { try { await common_vendor.index.request({ url: common_config.getApiUrl("/api/sys/auth/logout"), method: "POST", header: { "Content-Type": "application/x-www-form-urlencoded" }, data: { userId: backendUserId } }); } catch (e) { common_vendor.index.__f__("error", "at common/store.js:112", "后端登出接口调用失败:", e); } } common_vendor.index.removeStorageSync("backend-token"); common_vendor.index.removeStorageSync("backend-login-response"); common_vendor.index.removeStorageSync("backend-user-id"); common_vendor.index.removeStorageSync("backend-tenant-id"); common_vendor.index.removeStorageSync("uni_id_token"); common_vendor.index.setStorageSync("uni_id_token_expired", 0); this.setUserInfo({}, { cover: true }); common_vendor.index.$emit("uni-id-pages-logout"); common_vendor.index.redirectTo({ url: `/${pagesJson.uniIdRouter && pagesJson.uniIdRouter.loginPage ? pagesJson.uniIdRouter.loginPage : "uni_modules/uni-id-pages/pages/login/login-withoutpwd"}` }); }, loginBack(e = {}) { if (typeof common_vendor.index === "undefined") { common_vendor.index.__f__("warn", "at common/store.js:132", "uni API not available for loginBack"); return; } const { uniIdRedirectUrl = "" } = e; let delta = 0; let pages2 = getCurrentPages(); pages2.forEach((page, index) => { if (pages2[pages2.length - index - 1].route.split("/")[3] == "login") { delta++; } }); if (uniIdRedirectUrl) { return common_vendor.index.redirectTo({ url: uniIdRedirectUrl, fail: (err1) => { common_vendor.index.switchTab({ url: uniIdRedirectUrl, fail: (err2) => { common_vendor.index.__f__("log", "at common/store.js:153", err1, err2); } }); } }); } if (delta) { const page = pagesJson.pages[0]; return common_vendor.index.reLaunch({ url: `/${page.path}` }); } common_vendor.index.navigateBack({ delta }); }, loginSuccess(e = {}) { const { showToast = true, toastText = "登录成功", autoBack = true, uniIdRedirectUrl = "", passwordConfirmed } = e; if (typeof common_vendor.index === "undefined") { common_vendor.index.__f__("warn", "at common/store.js:185", "uni API not available for loginSuccess"); return; } if (showToast) { common_vendor.index.showToast({ title: toastText, icon: "none", duration: 3e3 }); } this.updateUserInfo(); common_vendor.index.$emit("uni-id-pages-login-success"); if (autoBack) { this.loginBack({ uniIdRedirectUrl }); } } }; const store = data; exports.mutations = mutations; exports.pagesJson = pagesJson; exports.store = store; //# sourceMappingURL=../../.sourcemap/mp-weixin/common/store.js.map