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,165 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_http = require("../../common/http.js");
const _sfc_main = {
data() {
return {
form: {
shopName: "",
name: "",
phone: "",
password: "",
confirmPassword: ""
},
shopNameFocused: false,
nameFocused: false,
phoneFocused: false,
passwordFocused: false,
confirmPasswordFocused: false
};
},
methods: {
validate() {
const phone = String(this.form.phone || "").trim();
const ok = /^1[3-9]\d{9}$/.test(phone);
if (!ok) {
common_vendor.index.showToast({ title: "请输入正确的手机号", icon: "none" });
return false;
}
if (!this.form.password) {
common_vendor.index.showToast({ title: "请输入密码", icon: "none" });
return false;
}
if (this.form.password.length < 6) {
common_vendor.index.showToast({ title: "密码至少6位", icon: "none" });
return false;
}
if (!this.form.confirmPassword) {
common_vendor.index.showToast({ title: "请确认密码", icon: "none" });
return false;
}
if (this.form.password !== this.form.confirmPassword) {
common_vendor.index.showToast({ title: "两次密码不一致", icon: "none" });
return false;
}
return true;
},
async onRegister() {
if (!this.validate())
return;
const phone = String(this.form.phone || "").trim();
const name = String(this.form.name || "").trim();
const password = String(this.form.password || "");
try {
const data = await common_http.post("/api/auth/register", { phone, name: name || void 0, password });
if (data && data.token) {
common_vendor.index.setStorageSync("TOKEN", data.token);
if (data.user && data.user.phone)
common_vendor.index.setStorageSync("USER_MOBILE", data.user.phone);
common_vendor.index.showToast({ title: "注册成功", icon: "none" });
setTimeout(() => {
common_vendor.index.reLaunch({ url: "/pages/index/index" });
}, 300);
}
} catch (e) {
const msg = e && e.message || "注册失败";
common_vendor.index.showToast({ title: msg, icon: "none" });
}
},
onGoLogin() {
common_vendor.index.navigateTo({
url: "/pages/auth/login"
});
}
}
};
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: "M12,3L2,12H5V20H19V12H22L12,3M12,8.75A2.25,2.25 0 0,1 14.25,11A2.25,2.25 0 0,1 12,13.25A2.25,2.25 0 0,1 9.75,11A2.25,2.25 0 0,1 12,8.75Z"
}),
d: common_vendor.p({
viewBox: "0 0 24 24"
}),
e: common_vendor.o(($event) => $data.shopNameFocused = true),
f: common_vendor.o(($event) => $data.shopNameFocused = false),
g: $data.form.shopName,
h: common_vendor.o(common_vendor.m(($event) => $data.form.shopName = $event.detail.value, {
trim: true
})),
i: $data.shopNameFocused ? 1 : "",
j: $data.form.shopName ? 1 : "",
k: common_vendor.p({
d: "M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"
}),
l: common_vendor.p({
viewBox: "0 0 24 24"
}),
m: common_vendor.o(($event) => $data.nameFocused = true),
n: common_vendor.o(($event) => $data.nameFocused = false),
o: $data.form.name,
p: common_vendor.o(common_vendor.m(($event) => $data.form.name = $event.detail.value, {
trim: true
})),
q: $data.nameFocused ? 1 : "",
r: $data.form.name ? 1 : "",
s: 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"
}),
t: common_vendor.p({
viewBox: "0 0 24 24"
}),
v: common_vendor.o(($event) => $data.phoneFocused = true),
w: common_vendor.o(($event) => $data.phoneFocused = false),
x: $data.form.phone,
y: common_vendor.o(common_vendor.m(($event) => $data.form.phone = $event.detail.value, {
trim: true
})),
z: $data.phoneFocused ? 1 : "",
A: $data.form.phone ? 1 : "",
B: 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"
}),
C: common_vendor.p({
viewBox: "0 0 24 24"
}),
D: common_vendor.o(($event) => $data.passwordFocused = true),
E: common_vendor.o(($event) => $data.passwordFocused = false),
F: $data.form.password,
G: common_vendor.o(common_vendor.m(($event) => $data.form.password = $event.detail.value, {
trim: true
})),
H: $data.passwordFocused ? 1 : "",
I: $data.form.password ? 1 : "",
J: 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"
}),
K: common_vendor.p({
viewBox: "0 0 24 24"
}),
L: common_vendor.o(($event) => $data.confirmPasswordFocused = true),
M: common_vendor.o(($event) => $data.confirmPasswordFocused = false),
N: $data.form.confirmPassword,
O: common_vendor.o(common_vendor.m(($event) => $data.form.confirmPassword = $event.detail.value, {
trim: true
})),
P: $data.confirmPasswordFocused ? 1 : "",
Q: $data.form.confirmPassword ? 1 : "",
R: common_vendor.o((...args) => $options.onRegister && $options.onRegister(...args)),
S: common_vendor.o((...args) => $options.onGoLogin && $options.onGoLogin(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/auth/register.js.map