202 lines
6.0 KiB
JavaScript
202 lines
6.0 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
if (!Array) {
|
|
const _component_cu_custom = common_vendor.resolveComponent("cu-custom");
|
|
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
|
const _easycom_up_form_item2 = common_vendor.resolveComponent("up-form-item");
|
|
const _easycom_up_form2 = common_vendor.resolveComponent("up-form");
|
|
(_component_cu_custom + _easycom_up_input2 + _easycom_up_form_item2 + _easycom_up_form2)();
|
|
}
|
|
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
|
const _easycom_up_form_item = () => "../../uni_modules/uview-plus/components/u-form-item/u-form-item.js";
|
|
const _easycom_up_form = () => "../../uni_modules/uview-plus/components/u-form/u-form.js";
|
|
if (!Math) {
|
|
(_easycom_up_input + _easycom_up_form_item + _easycom_up_form)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "reg",
|
|
setup(__props) {
|
|
const phone = common_vendor.ref("");
|
|
const password = common_vendor.ref("");
|
|
const code = common_vendor.ref("");
|
|
const invitation = common_vendor.ref("");
|
|
const second = common_vendor.ref(0);
|
|
common_vendor.ref(false);
|
|
const state = common_vendor.reactive({
|
|
showSex: false,
|
|
model1: {
|
|
userInfo: {
|
|
name: "uview-plus UI",
|
|
sex: ""
|
|
}
|
|
},
|
|
rules: {
|
|
"userInfo.name": {
|
|
type: "string",
|
|
required: true,
|
|
message: "请填写姓名",
|
|
trigger: ["blur", "change"]
|
|
}
|
|
}
|
|
});
|
|
common_vendor.computed(() => {
|
|
if (second.value === 0) {
|
|
return "获取验证码";
|
|
} else {
|
|
const secondStr = second.value < 10 ? `0${second.value}` : second.value;
|
|
return `重新获取${secondStr}`;
|
|
}
|
|
});
|
|
const handleRegister = () => {
|
|
if (phone.value.length !== 11) {
|
|
common_vendor.index.showToast({
|
|
icon: "none",
|
|
title: "手机号不正确"
|
|
});
|
|
return;
|
|
}
|
|
if (password.value.length < 6) {
|
|
common_vendor.index.showToast({
|
|
icon: "none",
|
|
title: "密码不正确"
|
|
});
|
|
return;
|
|
}
|
|
if (code.value.length !== 4) {
|
|
common_vendor.index.showToast({
|
|
icon: "none",
|
|
title: "验证码不正确"
|
|
});
|
|
return;
|
|
}
|
|
common_vendor.index.request({
|
|
url: "http://example.com/api/register",
|
|
data: {
|
|
phone: phone.value,
|
|
password: password.value,
|
|
code: code.value,
|
|
invitation: invitation.value
|
|
},
|
|
method: "POST",
|
|
dataType: "json",
|
|
success: (res) => {
|
|
if (res.data.code != 200) {
|
|
common_vendor.index.showToast({
|
|
title: res.data.msg || "注册失败",
|
|
icon: "none"
|
|
});
|
|
} else {
|
|
common_vendor.index.showToast({
|
|
title: res.data.msg || "注册成功"
|
|
});
|
|
setTimeout(() => {
|
|
common_vendor.index.navigateBack();
|
|
}, 1500);
|
|
}
|
|
},
|
|
fail: () => {
|
|
common_vendor.index.showToast({
|
|
title: "网络请求失败",
|
|
icon: "none"
|
|
});
|
|
}
|
|
});
|
|
};
|
|
common_vendor.onUnmounted(() => {
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.p({
|
|
isBack: true
|
|
}),
|
|
b: common_vendor.p({
|
|
border: "none",
|
|
placeholder: "请输入企业名称",
|
|
inputAlign: "right"
|
|
}),
|
|
c: common_vendor.sr("item1", "561d431d-2,561d431d-1"),
|
|
d: common_vendor.p({
|
|
label: "加入企业",
|
|
prop: "userInfo.name",
|
|
borderBottom: true,
|
|
["label-width"]: "90"
|
|
}),
|
|
e: common_vendor.p({
|
|
border: "none",
|
|
placeholder: "请输入",
|
|
inputAlign: "right"
|
|
}),
|
|
f: common_vendor.sr("item1", "561d431d-4,561d431d-1"),
|
|
g: common_vendor.p({
|
|
required: true,
|
|
label: "真实姓名",
|
|
prop: "userInfo.name",
|
|
borderBottom: true,
|
|
["label-width"]: "90"
|
|
}),
|
|
h: common_vendor.p({
|
|
border: "none",
|
|
placeholder: "选择",
|
|
inputAlign: "right"
|
|
}),
|
|
i: common_vendor.sr("item1", "561d431d-6,561d431d-1"),
|
|
j: common_vendor.p({
|
|
required: true,
|
|
label: "选择分组/部门",
|
|
prop: "userInfo.name",
|
|
borderBottom: true,
|
|
["label-width"]: "120"
|
|
}),
|
|
k: common_vendor.p({
|
|
border: "none",
|
|
placeholder: "请输入手机号码",
|
|
inputAlign: "right"
|
|
}),
|
|
l: common_vendor.sr("item1", "561d431d-8,561d431d-1"),
|
|
m: common_vendor.p({
|
|
required: true,
|
|
label: "手机号码",
|
|
prop: "userInfo.name",
|
|
borderBottom: true,
|
|
["label-width"]: "90"
|
|
}),
|
|
n: common_vendor.p({
|
|
border: "none",
|
|
placeholder: "请输入密码",
|
|
inputAlign: "right"
|
|
}),
|
|
o: common_vendor.sr("item1", "561d431d-10,561d431d-1"),
|
|
p: common_vendor.p({
|
|
required: true,
|
|
label: "密码",
|
|
prop: "userInfo.name",
|
|
borderBottom: true,
|
|
["label-width"]: "90"
|
|
}),
|
|
q: common_vendor.p({
|
|
border: "none",
|
|
placeholder: "请输入密码",
|
|
inputAlign: "right"
|
|
}),
|
|
r: common_vendor.sr("item1", "561d431d-12,561d431d-1"),
|
|
s: common_vendor.p({
|
|
required: true,
|
|
label: "确认密码",
|
|
prop: "userInfo.name",
|
|
borderBottom: true,
|
|
["label-width"]: "90"
|
|
}),
|
|
t: common_vendor.sr("form1", "561d431d-1"),
|
|
v: common_vendor.p({
|
|
labelPosition: "left",
|
|
model: state.model1,
|
|
rules: state.rules
|
|
}),
|
|
w: common_vendor.o(handleRegister)
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-561d431d"]]);
|
|
wx.createPage(MiniProgramPage);
|