122 lines
4.1 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_button2 = common_vendor.resolveComponent("hs-button");
const _easycom_hs_private_policy2 = common_vendor.resolveComponent("hs-private-policy");
2025-07-09 00:34:00 +08:00
(_easycom_hs_button2 + _easycom_hs_private_policy2)();
2025-07-08 16:49:39 +08:00
}
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) {
2025-07-09 00:34:00 +08:00
(_easycom_hs_button + _easycom_hs_private_policy)();
2025-07-08 16:49:39 +08:00
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "login",
setup(__props) {
2025-07-16 09:34:46 +08:00
common_vendor.ref("");
2025-07-09 00:34:00 +08:00
common_vendor.ref({
2025-07-08 16:49:39 +08:00
username: "",
password: ""
});
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
let CheckedVal = common_vendor.ref(false);
2025-07-16 09:34:46 +08:00
const handleGetPhoneNumberWxwork = () => {
if (!privacyToast()) {
return;
}
common_vendor.index.showLoading({
title: "正在登录...",
mask: true
});
common_vendor.index.qy.getMobile({
success: function(res) {
console.log(res, "res");
if ((res == null ? void 0 : res.errMsg) === "qy__getMobile:ok") {
auth == null ? void 0 : auth.handleUserLoginWxwork(res);
} else {
common_vendor.index.showToast({
title: "获取手机号失败",
icon: "none"
});
}
}
});
};
2025-07-09 00:34:00 +08:00
const handleGetPhoneNumber = async (data) => {
if (!CheckedVal.value) {
2025-07-08 16:49:39 +08:00
return false;
}
2025-07-09 00:34:00 +08:00
common_vendor.index.showLoading({
title: "正在登录...",
mask: true
});
auth == null ? void 0 : auth.handleUserLogin({ code: data.detail.code });
2025-07-08 16:49:39 +08:00
};
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({
2025-07-09 00:34:00 +08:00
url: "",
2025-07-08 16:49:39 +08:00
success: function(e) {
const filePath = e.tempFilePath;
common_vendor.index.hideLoading();
common_vendor.index.openDocument({
filePath,
showMenu: true
});
}
});
};
2025-07-16 09:34:46 +08:00
common_vendor.onShow(() => {
console.log(auth == null ? void 0 : auth.data, "res");
});
2025-07-08 16:49:39 +08:00
return (_ctx, _cache) => {
2025-07-16 09:34:46 +08:00
var _a, _b, _c, _d;
return common_vendor.e({
a: ((_b = (_a = common_vendor.unref(auth)) == null ? void 0 : _a.data) == null ? void 0 : _b.environment) === "wxwork"
}, ((_d = (_c = common_vendor.unref(auth)) == null ? void 0 : _c.data) == null ? void 0 : _d.environment) === "wxwork" ? {
b: common_vendor.o(handleGetPhoneNumberWxwork),
2025-07-09 00:34:00 +08:00
c: common_vendor.p({
type: "primary",
size: "md",
2025-07-16 09:34:46 +08:00
label: "快捷登录1"
})
} : {
d: common_vendor.o(handleGetPhoneNumber),
e: common_vendor.o(privacyToast),
2025-07-08 16:49:39 +08:00
f: common_vendor.p({
2025-07-16 09:34:46 +08:00
type: "primary",
size: "md",
label: "快捷登录2",
openType: common_vendor.unref(CheckedVal) ? "getPhoneNumber" : ""
})
}, {
g: common_vendor.o(previewPdf),
h: common_vendor.o(($event) => common_vendor.isRef(CheckedVal) ? CheckedVal.value = $event : CheckedVal = $event),
i: common_vendor.p({
2025-07-08 16:49:39 +08:00
policyName: "《用户协议》",
isAgree: common_vendor.unref(CheckedVal)
})
2025-07-16 09:34:46 +08:00
});
2025-07-08 16:49:39 +08:00
};
}
});
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);