112 lines
3.2 KiB
JavaScript
112 lines
3.2 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const request_api = require("../../request/api.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
contentTop: "",
|
|
isAgree: false
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.contentTop = common_vendor.inject("navHeight") + 230 / 750 * common_vendor.inject("windowWidth");
|
|
},
|
|
methods: {
|
|
/**
|
|
* 点击一键登录
|
|
*/
|
|
clickOneClickLogin() {
|
|
if (!this.isAgree) {
|
|
common_vendor.index.showToast({
|
|
title: "请阅读并同意我们的《用户服务协议》和《隐私政策》",
|
|
icon: "none"
|
|
});
|
|
return;
|
|
}
|
|
common_vendor.index.login({
|
|
provider: "weixin",
|
|
success(res) {
|
|
common_vendor.index.__f__("log", "at pages/login/login.vue:49", res.code);
|
|
let param = { code: res.code, isJson: 1 };
|
|
request_api.loginByWx(param).then((res2) => {
|
|
if (res2.code == 200) {
|
|
common_vendor.index.showToast({
|
|
title: res2.message
|
|
});
|
|
common_vendor.index.setStorageSync("token", res2.data.token);
|
|
setTimeout(function() {
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/index/index"
|
|
});
|
|
}, 1e3);
|
|
} else
|
|
common_vendor.index.showToast({
|
|
title: res2.message,
|
|
icon: "none"
|
|
});
|
|
}).catch((error) => {
|
|
});
|
|
},
|
|
fail() {
|
|
}
|
|
});
|
|
},
|
|
/**
|
|
* 点击验证码登录
|
|
*/
|
|
clickCodeLogin() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/login/codeLogin/codeLogin"
|
|
});
|
|
},
|
|
/**
|
|
* 点击同意
|
|
*/
|
|
clickAgree() {
|
|
this.isAgree = !this.isAgree;
|
|
},
|
|
/**
|
|
* 点击查看协议
|
|
*/
|
|
clickProtocol(type) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/mine/web/web?type=" + type
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
|
|
_easycom_navBar2();
|
|
}
|
|
const _easycom_navBar = () => "../../components/navBar/navBar.js";
|
|
if (!Math) {
|
|
_easycom_navBar();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: common_vendor.p({
|
|
leftText: "登录",
|
|
hideNavBg: true,
|
|
backBlack: true
|
|
}),
|
|
b: common_vendor.s("margin-top:" + $data.contentTop + "px;"),
|
|
c: common_assets._imports_0$1,
|
|
d: common_vendor.o(($event) => $options.clickOneClickLogin()),
|
|
e: common_vendor.o(($event) => $options.clickCodeLogin()),
|
|
f: $data.isAgree
|
|
}, $data.isAgree ? {
|
|
g: common_assets._imports_3$5
|
|
} : {
|
|
h: common_assets._imports_4$4
|
|
}, {
|
|
i: common_vendor.o(($event) => $options.clickAgree()),
|
|
j: common_vendor.o(($event) => $options.clickProtocol(2)),
|
|
k: common_vendor.o(($event) => $options.clickProtocol(3))
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/login.js.map
|