"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_assets = require("../../utils/assets.js");
const _sfc_main = {
data() {
return {
assets: utils_assets.assets,
isAgreed: false,
activeModal: "",
userAvatar: "",
userName: "微信用户",
redirectUrl: "",
currentProtocol: { title: "", content: "" },
protocols: {
user: { title: "用户服务协议", content: '
服务内容
欢迎使用ERP系统,我们将为您提供高效的下单管理服务。本协议旨在明确双方权利与义务...
' },
privacy: { title: "隐私政策", content: '隐私保护
我们非常重视您的个人信息保护。我们会按照法律法规要求,采取相应的安全保护措施...
' }
}
};
},
onLoad(options) {
if (options.redirect) {
this.redirectUrl = decodeURIComponent(options.redirect);
}
},
methods: {
toggleAgreed() {
this.isAgreed = !this.isAgreed;
},
startLoginFlow() {
if (!this.isAgreed)
this.activeModal = "confirm";
else
this.activeModal = "profile";
},
agreeAndClose() {
this.isAgreed = true;
this.activeModal = "";
},
completeLogin() {
common_vendor.index.showLoading({ title: "登录中..." });
common_vendor.index.setStorageSync("isLogin", true);
setTimeout(() => {
common_vendor.index.hideLoading();
this.activeModal = "";
const targetUrl = this.redirectUrl || "/pages/index/index";
common_vendor.index.reLaunch({ url: targetUrl });
}, 1e3);
},
onChooseAvatar(e) {
this.userAvatar = e.detail.avatarUrl;
},
onNicknameBlur(e) {
this.userName = e.detail.value;
},
onNicknameChange(e) {
this.userName = e.detail.value;
},
showProtocol(type) {
this.currentProtocol = this.protocols[type];
this.activeModal = "protocol";
},
closeAllModals() {
this.activeModal = "";
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.assets.logo,
b: $data.assets.wechat,
c: common_vendor.o((...args) => $options.startLoginFlow && $options.startLoginFlow(...args)),
d: $data.isAgreed,
e: common_vendor.o(($event) => $options.showProtocol("user")),
f: common_vendor.o(($event) => $options.showProtocol("privacy")),
g: common_vendor.o((...args) => $options.toggleAgreed && $options.toggleAgreed(...args)),
h: $data.activeModal
}, $data.activeModal ? {
i: common_vendor.o((...args) => $options.closeAllModals && $options.closeAllModals(...args))
} : {}, {
j: $data.activeModal === "confirm"
}, $data.activeModal === "confirm" ? {
k: common_vendor.o(($event) => $data.activeModal = ""),
l: common_vendor.o((...args) => $options.agreeAndClose && $options.agreeAndClose(...args))
} : {}, {
m: $data.activeModal === "profile"
}, $data.activeModal === "profile" ? {
n: common_vendor.o(($event) => $data.activeModal = ""),
o: common_vendor.o(($event) => $data.activeModal = "phone"),
p: $data.userAvatar || "https://img.icons8.com/color/144/user.png",
q: common_vendor.o((...args) => $options.onChooseAvatar && $options.onChooseAvatar(...args)),
r: $data.userName,
s: common_vendor.o((...args) => $options.onNicknameBlur && $options.onNicknameBlur(...args)),
t: common_vendor.o((...args) => $options.onNicknameChange && $options.onNicknameChange(...args)),
v: common_vendor.o(($event) => $data.activeModal = "phone")
} : {}, {
w: $data.activeModal === "phone"
}, $data.activeModal === "phone" ? {
x: $data.assets.logo,
y: common_vendor.o(($event) => $data.activeModal = ""),
z: common_vendor.o((...args) => $options.completeLogin && $options.completeLogin(...args))
} : {}, {
A: $data.activeModal === "protocol"
}, $data.activeModal === "protocol" ? {
B: common_vendor.t($data.currentProtocol.title),
C: common_vendor.o(($event) => $data.activeModal = ""),
D: $data.currentProtocol.content,
E: common_vendor.o(($event) => $data.activeModal = "")
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e4e4508d"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/login.js.map