59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
const common_vendor = require("./common/vendor.js");
|
|
const utils_login = require("./utils/login.js");
|
|
const utils_http = require("./utils/http.js");
|
|
if (!Math) {
|
|
"./pages/home/home.js";
|
|
"./pages/category/category.js";
|
|
"./pages/personal/personal.js";
|
|
"./pages/detail/detail.js";
|
|
}
|
|
const _sfc_main = {
|
|
onLaunch: function() {
|
|
console.log("App Launch");
|
|
this.initLoginStatus();
|
|
},
|
|
onShow: function() {
|
|
console.log("App Show");
|
|
},
|
|
onHide: function() {
|
|
},
|
|
methods: {
|
|
async initLoginStatus() {
|
|
try {
|
|
if (utils_login.checkLoginStatus()) {
|
|
console.log("登录状态初始化成功");
|
|
return;
|
|
}
|
|
const success = await utils_login.initLogin();
|
|
if (success) {
|
|
console.log("登录状态初始化成功");
|
|
} else {
|
|
throw new Error("登录状态初始化失败");
|
|
}
|
|
} catch (error) {
|
|
common_vendor.index.showToast({
|
|
title: "自动登录失败,请手动登录",
|
|
icon: "none"
|
|
});
|
|
} finally {
|
|
common_vendor.index.hideLoading();
|
|
}
|
|
}
|
|
}
|
|
};
|
|
common_vendor.dayjs.extend(common_vendor.utc);
|
|
common_vendor.dayjs.extend(common_vendor.timezone);
|
|
common_vendor.dayjs.tz.setDefault("Asia/Shanghai");
|
|
common_vendor.index.$http = utils_http.http;
|
|
function createApp() {
|
|
const app = common_vendor.createSSRApp(_sfc_main);
|
|
app.config.globalProperties.$http = utils_http.http;
|
|
return {
|
|
app
|
|
};
|
|
}
|
|
createApp().app.mount("#app");
|
|
exports.createApp = createApp;
|