100 lines
3.5 KiB
JavaScript
Raw Normal View History

2025-07-08 16:49:39 +08:00
"use strict";
const common_vendor = require("../common/vendor.js");
require("../common/libraries/request.js");
const common_store_useWeAppAuthStore = require("../common/store/useWeAppAuthStore.js");
require("../gen/Apis.js");
require("../common/libraries/apiLoading.js");
if (!Array) {
const _easycom_hs_input2 = common_vendor.resolveComponent("hs-input");
const _easycom_hs_button2 = common_vendor.resolveComponent("hs-button");
const _easycom_hs_private_policy2 = common_vendor.resolveComponent("hs-private-policy");
(_easycom_hs_input2 + _easycom_hs_button2 + _easycom_hs_private_policy2)();
}
const _easycom_hs_input = () => "../components/hs-input/hs-input.js";
const _easycom_hs_button = () => "../components/hs-button/hs-button.js";
const _easycom_hs_private_policy = () => "../components/hs-private-policy/hs-private-policy.js";
if (!Math) {
(_easycom_hs_input + _easycom_hs_button + _easycom_hs_private_policy)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "login",
setup(__props) {
const from_data = common_vendor.ref({
username: "",
password: ""
});
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
let CheckedVal = common_vendor.ref(false);
const onSubmit = () => {
if (!privacyToast()) {
return false;
}
if (!from_data.value.username || !from_data.value.password) {
common_vendor.index.showToast({
title: "请输入帐号和密码!",
icon: "none"
});
return;
}
auth.handleUserLogin(from_data.value);
};
const privacyToast = () => {
if (!CheckedVal.value) {
common_vendor.index.showToast({
title: "请阅读并勾选隐私政策!",
icon: "none"
});
return false;
}
return true;
};
const previewPdf = () => {
common_vendor.index.showLoading({
title: "加载中...",
mask: true
});
common_vendor.index.downloadFile({
url: "https://nchl-dev.oss-cn-shenzhen.aliyuncs.com/uploads/cs-test/01JTM6CBGHTYPB7E4D4XENA2P7.pdf",
success: function(e) {
const filePath = e.tempFilePath;
common_vendor.index.hideLoading();
common_vendor.index.openDocument({
filePath,
showMenu: true
});
}
});
};
return (_ctx, _cache) => {
return {
a: common_vendor.o(($event) => from_data.value.username = $event),
b: common_vendor.p({
placeholder: "请输入帐号",
textAlign: "left",
valueModel: from_data.value.username
}),
c: common_vendor.o(($event) => from_data.value.password = $event),
d: common_vendor.p({
placeholder: "请输入密码",
textAlign: "left",
password: true,
valueModel: from_data.value.password
}),
e: common_vendor.o(onSubmit),
f: common_vendor.p({
label: "登录",
size: "md"
}),
g: common_vendor.o(previewPdf),
h: common_vendor.o(($event) => common_vendor.isRef(CheckedVal) ? CheckedVal.value = $event : CheckedVal = $event),
i: common_vendor.p({
policyName: "《用户协议》",
isAgree: common_vendor.unref(CheckedVal)
})
};
};
}
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/pages/login.vue"]]);
wx.createPage(MiniProgramPage);