app.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. "use strict";
  2. Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
  3. const common_vendor = require("./common/vendor.js");
  4. const api_services_auth = require("./api/services/auth.js");
  5. const utils_filters = require("./utils/filters.js");
  6. const store_index = require("./store/index.js");
  7. const config_config = require("./config/config.js");
  8. if (!Math) {
  9. "./pages/dashboard/index.js";
  10. "./pages/login/index.js";
  11. "./pages/userInfo/index.js";
  12. "./pages/activity/index.js";
  13. "./pages/device/index.js";
  14. "./pages/knowledge/index.js";
  15. "./pages/user/index.js";
  16. "./pages/machine/index.js";
  17. "./pages/ai-chat/index.js";
  18. "./pages/field/index.js";
  19. "./pages/more/index.js";
  20. "./pages/settings/index.js";
  21. "./pages/about/index.js";
  22. "./pages/privacy/index.js";
  23. }
  24. const _sfc_main = {
  25. onLaunch: function() {
  26. console.log("App Launch");
  27. this.checkLoginStatus();
  28. },
  29. onShow: function() {
  30. console.log("App Show");
  31. },
  32. onHide: function() {
  33. console.log("App Hide");
  34. },
  35. methods: {
  36. checkLoginStatus() {
  37. const pages = ["pages/dashboard/index", "pages/user/index", "pages/activity/index", "pages/device/index"];
  38. common_vendor.index.addInterceptor("navigateTo", {
  39. invoke(e) {
  40. const url = e.url;
  41. const needLogin = pages.some((page) => url.indexOf(page) > -1);
  42. if (needLogin && !api_services_auth.isLoggedIn()) {
  43. common_vendor.index.navigateTo({
  44. url: "/pages/login/index"
  45. });
  46. return false;
  47. }
  48. return true;
  49. }
  50. });
  51. common_vendor.index.addInterceptor("switchTab", {
  52. invoke(e) {
  53. const url = e.url;
  54. const needLogin = pages.some((page) => url.indexOf(page) > -1);
  55. if (needLogin && !api_services_auth.isLoggedIn()) {
  56. common_vendor.index.navigateTo({
  57. url: "/pages/login/index"
  58. });
  59. return false;
  60. }
  61. return true;
  62. }
  63. });
  64. }
  65. }
  66. };
  67. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  68. return {};
  69. }
  70. const App = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  71. function createApp() {
  72. const app = common_vendor.createSSRApp(App);
  73. app.config.globalProperties.$filters = {};
  74. Object.keys(utils_filters.filters).forEach((key) => {
  75. app.config.globalProperties.$filters[key] = utils_filters.filters[key];
  76. });
  77. app.config.globalProperties.$mainColor = config_config.config.mainColor;
  78. app.config.globalProperties.$lightColor = config_config.config.lightColor;
  79. app.config.globalProperties.$aiderLightColor = config_config.config.aiderLightColor;
  80. app.use(store_index.store);
  81. return {
  82. app
  83. };
  84. }
  85. createApp().app.mount("#app");
  86. exports.createApp = createApp;