This commit is contained in:
2025-09-24 20:35:15 +08:00
parent 39679f7330
commit 8a458ff0a4
12033 changed files with 1537546 additions and 13292 deletions

View File

@@ -0,0 +1,96 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_http = require("../../common/http.js");
const _sfc_main = {
data() {
return {
form: { phone: "", password: "" },
phoneFocused: false,
passwordFocused: false
};
},
methods: {
validate() {
const p = String(this.form.phone || "").trim();
const okPhone = /^1[3-9]\d{9}$/.test(p);
if (!okPhone) {
common_vendor.index.showToast({ title: "请输入正确的手机号", icon: "none" });
return false;
}
return true;
},
async onLogin() {
if (!this.validate())
return;
try {
const phone = String(this.form.phone || "").trim();
const password = String(this.form.password || "");
const res = await common_http.post("/api/auth/password/login", { phone, password });
if (res && res.token) {
common_vendor.index.setStorageSync("TOKEN", res.token);
if (res.user && res.user.phone)
common_vendor.index.setStorageSync("USER_MOBILE", res.user.phone);
common_vendor.index.showToast({ title: "登录成功", icon: "none" });
setTimeout(() => {
common_vendor.index.reLaunch({ url: "/pages/index/index" });
}, 200);
}
} catch (e) {
common_vendor.index.showToast({ title: e && e.message || "登录失败", icon: "none" });
}
},
onGoRegister() {
common_vendor.index.navigateTo({
url: "/pages/auth/register"
});
}
}
};
if (!Array) {
const _component_path = common_vendor.resolveComponent("path");
const _component_svg = common_vendor.resolveComponent("svg");
(_component_path + _component_svg)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
d: "M12 2C13.1 2 14 2.9 14 4C14 5.1 13.1 6 12 6C10.9 6 10 5.1 10 4C10 2.9 10.9 2 12 2ZM21 9V7L15 4V6C15 7.66 13.66 9 12 9S9 7.66 9 6V4L3 7V9C3 10.1 3.9 11 5 11V17C5 18.1 5.9 19 7 19H9C9 20.1 9.9 21 11 21H13C14.1 21 15 20.1 15 19H17C18.1 19 19 18.1 19 17V11C20.1 11 21 10.1 21 9Z"
}),
b: common_vendor.p({
viewBox: "0 0 24 24"
}),
c: common_vendor.p({
d: "M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z"
}),
d: common_vendor.p({
viewBox: "0 0 24 24"
}),
e: common_vendor.o(($event) => $data.phoneFocused = true),
f: common_vendor.o(($event) => $data.phoneFocused = false),
g: $data.form.phone,
h: common_vendor.o(common_vendor.m(($event) => $data.form.phone = $event.detail.value, {
trim: true
})),
i: $data.phoneFocused ? 1 : "",
j: $data.form.phone ? 1 : "",
k: common_vendor.p({
d: "M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z"
}),
l: common_vendor.p({
viewBox: "0 0 24 24"
}),
m: common_vendor.o(($event) => $data.passwordFocused = true),
n: common_vendor.o(($event) => $data.passwordFocused = false),
o: $data.form.password,
p: common_vendor.o(common_vendor.m(($event) => $data.form.password = $event.detail.value, {
trim: true
})),
q: $data.passwordFocused ? 1 : "",
r: $data.form.password ? 1 : "",
s: common_vendor.o((...args) => $options.onLogin && $options.onLogin(...args)),
t: common_vendor.o((...args) => $options.onGoRegister && $options.onGoRegister(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/auth/login.js.map