"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api = require("../../api.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const _sfc_main = common_vendor.defineComponent({
|
|
data() {
|
|
return {
|
|
username: "",
|
|
password: "",
|
|
isModalVisible: false,
|
|
modalTitle: "",
|
|
modalContent: "",
|
|
popupNoCancelShow: false,
|
|
popupNoCancelShow1: false,
|
|
checked: false,
|
|
agreement: "",
|
|
privacy: ""
|
|
};
|
|
},
|
|
mounted() {
|
|
api.getInfoList().then((res = null) => {
|
|
getApp().aboutUs = res.result[0].aboutUs;
|
|
this.privacy = res.result[0].privacy;
|
|
this.agreement = res.result[0].agreement;
|
|
});
|
|
},
|
|
methods: {
|
|
// 处理登录逻辑
|
|
handleLogin() {
|
|
if (!this.username || !this.password) {
|
|
common_vendor.index.showToast({ title: "请输入账号和密码", icon: "none" });
|
|
return null;
|
|
} else {
|
|
if (this.checked) {
|
|
let usr = new UTSJSONObject({
|
|
"username": this.username,
|
|
"password": this.password
|
|
});
|
|
api.login(usr).then((res = null) => {
|
|
common_vendor.index.setStorageSync("token", res.result.token);
|
|
getApp().usrInfo = res.result.userInfo;
|
|
if (res.success) {
|
|
common_vendor.index.showToast({
|
|
title: "登录成功",
|
|
icon: "success",
|
|
success: (res2) => {
|
|
common_vendor.index.switchTab({ url: "/pages/home/home" });
|
|
}
|
|
});
|
|
}
|
|
}).catch((err = null) => {
|
|
common_vendor.index.showToast({ title: "账号或密码错误,请重新输入!", icon: "none" });
|
|
});
|
|
} else {
|
|
common_vendor.index.showToast({ title: "请勾选服务协议", icon: "none" });
|
|
}
|
|
}
|
|
},
|
|
// 显示弹窗
|
|
showModal() {
|
|
this.popupNoCancelShow = true;
|
|
},
|
|
showModals() {
|
|
this.popupNoCancelShow1 = true;
|
|
},
|
|
// 关闭弹窗
|
|
closeModal() {
|
|
this.popupNoCancelShow = false;
|
|
},
|
|
closeModals() {
|
|
this.popupNoCancelShow1 = false;
|
|
},
|
|
change(e = null) {
|
|
},
|
|
changeCK() {
|
|
if (this.checked) {
|
|
this.checked = false;
|
|
} else {
|
|
this.checked = true;
|
|
}
|
|
},
|
|
// 处理选中事件
|
|
getConfirm() {
|
|
if (this.checked) {
|
|
this.checked = this.checked;
|
|
} else {
|
|
this.checked = true;
|
|
}
|
|
this.popupNoCancelShow = false;
|
|
},
|
|
getConfirms() {
|
|
if (this.checked) {
|
|
this.checked = this.checked;
|
|
} else {
|
|
this.checked = true;
|
|
}
|
|
this.popupNoCancelShow1 = false;
|
|
}
|
|
}
|
|
});
|
|
if (!Array) {
|
|
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
|
|
const _easycom_mosowe_confirm_popup2 = common_vendor.resolveComponent("mosowe-confirm-popup");
|
|
(_easycom_uni_easyinput2 + _easycom_mosowe_confirm_popup2)();
|
|
}
|
|
const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
|
|
const _easycom_mosowe_confirm_popup = () => "../../uni_modules/mosowe-confirm-popup/components/mosowe-confirm-popup/mosowe-confirm-popup.js";
|
|
if (!Math) {
|
|
(_easycom_uni_easyinput + _easycom_mosowe_confirm_popup)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_assets._imports_0,
|
|
b: common_vendor.o(($event) => $data.username = $event),
|
|
c: common_vendor.p({
|
|
prefixIcon: "person",
|
|
placeholder: "请输入您的账号",
|
|
inputBorder: false,
|
|
clearable: false,
|
|
modelValue: $data.username
|
|
}),
|
|
d: common_vendor.o(($event) => $data.password = $event),
|
|
e: common_vendor.p({
|
|
prefixIcon: "locked",
|
|
type: "password",
|
|
placeholder: "请输入您的密码",
|
|
inputBorder: false,
|
|
passwordIcon: false,
|
|
clearable: false,
|
|
modelValue: $data.password
|
|
}),
|
|
f: $data.checked,
|
|
g: common_vendor.o((...args) => $options.changeCK && $options.changeCK(...args)),
|
|
h: common_vendor.o((...args) => $options.showModals && $options.showModals(...args)),
|
|
i: common_vendor.o((...args) => $options.showModal && $options.showModal(...args)),
|
|
j: common_vendor.o((...args) => $options.handleLogin && $options.handleLogin(...args)),
|
|
k: $data.privacy,
|
|
l: common_vendor.o((...args) => $options.closeModal && $options.closeModal(...args)),
|
|
m: common_vendor.o((...args) => $options.getConfirm && $options.getConfirm(...args)),
|
|
n: common_vendor.o(($event) => $data.popupNoCancelShow = $event),
|
|
o: common_vendor.p({
|
|
title: "服务协议和隐私政策",
|
|
confirmText: true,
|
|
cancelText: true,
|
|
modelValue: $data.popupNoCancelShow
|
|
}),
|
|
p: $data.agreement,
|
|
q: common_vendor.o((...args) => $options.closeModals && $options.closeModals(...args)),
|
|
r: common_vendor.o((...args) => $options.getConfirms && $options.getConfirms(...args)),
|
|
s: common_vendor.o(($event) => $data.popupNoCancelShow1 = $event),
|
|
t: common_vendor.p({
|
|
title: "用户协议",
|
|
confirmText: true,
|
|
cancelText: true,
|
|
modelValue: $data.popupNoCancelShow1
|
|
}),
|
|
v: common_vendor.sei(_ctx.virtualHostId, "view")
|
|
};
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/login.js.map
|