refactor(api): 重构API请求头添加token认证 feat(auth): 实现微信静默登录功能 docs: 删除冗余的API文档文件 chore: 更新.gitignore文件 style: 调整mock数据中的货币单位显示
64 lines
2.2 KiB
JavaScript
64 lines
2.2 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
const common_vendor = require("./common/vendor.js");
|
|
const utils_api = require("./utils/api.js");
|
|
if (!Math) {
|
|
"./pages/index/index.js";
|
|
"./pages/strategies/strategies.js";
|
|
"./pages/me/me.js";
|
|
"./pages/detail/detail.js";
|
|
"./pages/config/config.js";
|
|
"./pages/strategies/edit/edit.js";
|
|
}
|
|
const _sfc_main = {
|
|
onLaunch: function() {
|
|
common_vendor.index.__f__("log", "at App.vue:5", "App Launch");
|
|
this.wechatSilentLogin();
|
|
},
|
|
onShow: function() {
|
|
common_vendor.index.__f__("log", "at App.vue:10", "App Show");
|
|
},
|
|
onHide: function() {
|
|
common_vendor.index.__f__("log", "at App.vue:13", "App Hide");
|
|
},
|
|
methods: {
|
|
// 微信静默登录
|
|
wechatSilentLogin() {
|
|
if (common_vendor.index.getSystemInfoSync().platform === "devtools" || common_vendor.index.getSystemInfoSync().platform === "mp-weixin") {
|
|
common_vendor.index.login({
|
|
provider: "weixin",
|
|
success: (loginRes) => {
|
|
if (loginRes.code) {
|
|
utils_api.api.auth.wechatLogin(loginRes.code).then((res) => {
|
|
if (res.code === 200) {
|
|
common_vendor.index.setStorageSync("token", res.data.token);
|
|
common_vendor.index.setStorageSync("userInfo", res.data.userInfo);
|
|
common_vendor.index.__f__("log", "at App.vue:32", "微信静默登录成功");
|
|
} else {
|
|
common_vendor.index.__f__("log", "at App.vue:34", "微信静默登录失败:", res.message);
|
|
}
|
|
}).catch((err) => {
|
|
common_vendor.index.__f__("log", "at App.vue:38", "微信登录API调用失败:", err);
|
|
});
|
|
} else {
|
|
common_vendor.index.__f__("log", "at App.vue:41", "获取微信登录code失败:", loginRes.errMsg);
|
|
}
|
|
},
|
|
fail: (err) => {
|
|
common_vendor.index.__f__("log", "at App.vue:45", "微信登录失败:", err);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function createApp() {
|
|
const app = common_vendor.createSSRApp(_sfc_main);
|
|
return {
|
|
app
|
|
};
|
|
}
|
|
createApp().app.mount("#app");
|
|
exports.createApp = createApp;
|
|
//# sourceMappingURL=../.sourcemap/mp-weixin/app.js.map
|