"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const common_vendor = require("./common/vendor.js");
const modules_Config = require("./modules/Config.js");
const locale_index = require("./locale/index.js");
if (!Math) {
  "./pages/index/index.js";
  "./pages/login/login-page.js";
  "./pages/appointment/appointment-page.js";
  "./pages/me/me-page.js";
  "./pages/index/reserve-details-page.js";
  "./pages/appointment/airfare-info-entry-page.js";
  "./pages/me/notification-page.js";
  "./pages/me/contact-us-page.js";
  "./pages/me/invite-reward-page.js";
  "./pages/service-detail/service-detail.js";
  "./pages/me/profile-edit-page.js";
  "./pages/me/my-appointments-page.js";
  "./pages/me/about-us-page.js";
  "./pages/me/user-agreement-page.js";
  "./pages/me/privacy-policy-page.js";
  "./pages/appointment/vip-lounge-page.js";
  "./pages/appointment/airport-transfer-page.js";
  "./pages/appointment/rail-ticket-page.js";
  "./pages/appointment/hotel-reservation-page.js";
  "./pages/appointment/unaccompanied-minor-page.js";
  "./pages/appointment/medical-consultation-page.js";
  "./pages/appointment/special-needs-page.js";
  "./pages/appointment/pet-transportation-page.js";
  "./pages/appointment/guide-translation-page.js";
  "./pages/appointment/visa-consultation-page.js";
  "./pages/appointment/exhibition-service-page.js";
  "./pages/appointment/insurance-consultation-page.js";
  "./pages/appointment/air-logistics-page.js";
  "./pages/appointment/sea-freight-page.js";
  "./pages/appointment/travel-planning-page.js";
}
const _sfc_main = {
  globalData: {
    token: "",
    user: null,
    shouldRefresh: false,
    loginTime: 0,
    config: null
    // 应用配置（从后端获取）
  },
  onLaunch: function() {
    common_vendor.index.__f__("log", "at App.vue:13", "App Launch");
    this.initGlobalData();
    this.loadAppConfig();
    this.setTabBarText();
  },
  onShow: function() {
    common_vendor.index.__f__("log", "at App.vue:24", "App Show");
    this.setTabBarText();
  },
  onHide: function() {
    common_vendor.index.__f__("log", "at App.vue:28", "App Hide");
  },
  methods: {
    /**
     * 初始化全局数据
     */
    initGlobalData() {
      try {
        const token = common_vendor.index.getStorageSync("token");
        if (token) {
          this.globalData.token = token;
        }
        const userStr = common_vendor.index.getStorageSync("user");
        if (userStr) {
          try {
            this.globalData.user = JSON.parse(userStr);
          } catch (e) {
            common_vendor.index.__f__("error", "at App.vue:48", "解析用户信息失败:", e);
          }
        }
      } catch (e) {
        common_vendor.index.__f__("error", "at App.vue:52", "初始化全局数据失败:", e);
      }
    },
    setTabBarText() {
      const pages = getCurrentPages();
      if (pages.length > 0) {
        const currentPage = pages[pages.length - 1];
        const tabBarPages = ["pages/index/index", "pages/appointment/appointment-page", "pages/me/me-page"];
        const currentRoute = currentPage.route || "";
        if (!tabBarPages.includes(currentRoute)) {
          return;
        }
        if (currentPage.$vm && currentPage.$vm.$t) {
          common_vendor.index.setTabBarItem({
            index: 0,
            text: currentPage.$vm.$t("tabbar.home")
          });
          common_vendor.index.setTabBarItem({
            index: 1,
            text: currentPage.$vm.$t("tabbar.appointment")
          });
          common_vendor.index.setTabBarItem({
            index: 2,
            text: currentPage.$vm.$t("tabbar.me")
          });
        }
      }
    },
    /**
     * 加载应用配置
     */
    async loadAppConfig() {
      try {
        const config = await modules_Config.Config.getPublicConfig();
        if (config) {
          this.globalData.config = config;
          common_vendor.index.__f__("log", "at App.vue:92", "应用配置已加载到globalData:", config);
        }
      } catch (error) {
        common_vendor.index.__f__("error", "at App.vue:95", "加载应用配置失败:", error);
      }
    },
    /**
     * 获取配置项
     * @param {String} key 配置键名
     * @param {*} defaultValue 默认值
     */
    getConfig(key, defaultValue = "") {
      if (this.globalData.config && this.globalData.config[key]) {
        return this.globalData.config[key];
      }
      return defaultValue;
    },
    /**
     * 获取配置图片的完整URL
     * @param {String} key 配置键名
     */
    getConfigImageUrl(key) {
      const value = this.getConfig(key);
      if (value) {
        return modules_Config.Config.getImageUrl(value);
      }
      return "";
    }
  },
  watch: {
    "$i18n.locale"() {
      this.setTabBarText();
    }
  }
};
function createApp() {
  const app = common_vendor.createSSRApp(_sfc_main);
  app.use(common_vendor.uviewPlus);
  app.use(locale_index.i18n);
  return {
    app
  };
}
createApp().app.mount("#app");
exports.createApp = createApp;
//# sourceMappingURL=../.sourcemap/mp-weixin/app.js.map
