"use strict"; const common_vendor = require("../../common/vendor.js"); const utils_enumUtils = require("../../utils/enumUtils.js"); const api_common = require("../../api/common.js"); const api_auth = require("../../api/auth.js"); const utils_auth = require("../../utils/auth.js"); const _sfc_main = { data() { return { form: { mobile: null, smsCode: null, // 验证码 loginPassword: null, loginPassword2: null, transactionCode: null, // 交易密码 referralCode: null // 推荐码 }, inputCss: { "height": "80rpx", "background": "#F3F3F3FF", "border-radius": "30rpx", "border": "0rpx", "padding-left": "16px" }, countdown: false, // 清空倒计时 loginPasswordIsShow: false, loginPassword2IsShow: false, transactionCodeIsShow: false, // 交易密码 isPolicy: false, butLoading: false }; }, methods: { async registerFun() { const form = this.form; if (!form.mobile) { this.$refs.uToastRef.show({ type: "error", message: "请输入手机号" }); return; } if (!form.smsCode) { this.$refs.uToastRef.show({ type: "error", message: "请输入验证码" }); return; } if (!form.loginPassword) { this.$refs.uToastRef.show({ type: "error", message: "请输入登录密码" }); return; } if (!form.loginPassword2) { this.$refs.uToastRef.show({ type: "error", message: "请输入二次确认密码" }); return; } if (form.loginPassword !== form.loginPassword2) { this.$refs.uToastRef.show({ type: "error", message: "两次输入的登录密码不一致" }); return; } if (!form.referralCode) { this.$refs.uToastRef.show({ type: "error", message: "请输入推荐码" }); return; } if (!this.isPolicy) { this.$refs.uToastRef.show({ type: "error", message: "请阅读完相关协议以及政策,并且勾选同意选项" }); return; } this.butLoading = true; const params = { mobile: form.mobile, smsCode: form.smsCode, password: form.loginPassword, inviteCode: form.referralCode }; const resp = await api_auth.register(params); if (resp && resp.bizcode === 100) { const data = resp.data; utils_auth.setStorageFun(utils_auth.TOKEN_NAME, data.token); utils_auth.setStorageFun(utils_auth.USER_KEY, ""); const userInfo = { avatar: data.avatarUrl, name: data.name, userId: data.userId, grade: data.grade, inviteCode: data.inviteCode }; utils_auth.setStorageFun(utils_auth.USER_DATA, userInfo); let currentTimeStamp = (/* @__PURE__ */ new Date()).getTime(); utils_auth.setStorageFun(utils_auth.USER_LOGIN_TIME, currentTimeStamp); this.$refs.uToastRef.show({ type: "success", message: resp.msg }); setTimeout(() => { common_vendor.index.switchTab({ url: "/pages/home/home" }); }, 2e3); } this.butLoading = false; }, /** * 获取手机验证码 */ async getMobileCode() { const form = this.form; if (!form.mobile) { this.$refs.uToastRef.show({ type: "error", message: "请输入手机号码" }); return; } this.countdown = true; const params = { mobile: form.mobile, type: utils_enumUtils.SMS_TYPE.REGISTER }; const response = await api_common.getUserList(params); if (response && response.bizcode === 100) { this.$refs.uToastRef.show({ type: "success", message: response.msg }); } else { this.countdown = false; } } } }; if (!Array) { const _easycom_up_input2 = common_vendor.resolveComponent("up-input"); const _easycom_up_count_down2 = common_vendor.resolveComponent("up-count-down"); const _easycom_up_image2 = common_vendor.resolveComponent("up-image"); const _easycom_up_checkbox2 = common_vendor.resolveComponent("up-checkbox"); const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast"); (_easycom_up_input2 + _easycom_up_count_down2 + _easycom_up_image2 + _easycom_up_checkbox2 + _easycom_up_toast2)(); } const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js"; const _easycom_up_count_down = () => "../../uni_modules/uview-plus/components/u-count-down/u-count-down.js"; const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js"; const _easycom_up_checkbox = () => "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox.js"; const _easycom_up_toast = () => "../../uni_modules/uview-plus/components/u-toast/u-toast.js"; if (!Math) { (_easycom_up_input + _easycom_up_count_down + _easycom_up_image + _easycom_up_checkbox + _easycom_up_toast)(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: common_vendor.o(($event) => $data.form.mobile = $event), b: common_vendor.p({ placeholder: "请输入手机号", border: "surround", customStyle: $data.inputCss, modelValue: $data.form.mobile }), c: $data.countdown }, $data.countdown ? { d: common_vendor.o(($event) => $data.countdown = false), e: common_vendor.p({ time: 60 * 1e3, format: "ss" }) } : { f: common_vendor.o((...args) => $options.getMobileCode && $options.getMobileCode(...args)) }, { g: common_vendor.o(($event) => $data.form.smsCode = $event), h: common_vendor.p({ placeholder: "请输入验证码", border: "surround", customStyle: $data.inputCss, modelValue: $data.form.smsCode }), i: $data.loginPasswordIsShow }, $data.loginPasswordIsShow ? { j: common_vendor.o(($event) => { $data.loginPasswordIsShow = false; }), k: common_vendor.p({ src: "/static/login/show.png", width: "20", height: "20", bgColor: "#f1f6ff00" }) } : { l: common_vendor.o(($event) => { $data.loginPasswordIsShow = true; }), m: common_vendor.p({ src: "/static/login/hidden.png", width: "20", height: "20", bgColor: "#f1f6ff00" }) }, { n: common_vendor.o(($event) => $data.form.loginPassword = $event), o: common_vendor.p({ placeholder: "请输入登录密码", border: "surround", customStyle: $data.inputCss, type: $data.loginPasswordIsShow ? "text" : "password", modelValue: $data.form.loginPassword }), p: $data.loginPassword2IsShow }, $data.loginPassword2IsShow ? { q: common_vendor.o(($event) => { $data.loginPassword2IsShow = false; }), r: common_vendor.p({ src: "/static/login/show.png", width: "20", height: "20", bgColor: "#f1f6ff00" }) } : { s: common_vendor.o(($event) => { $data.loginPassword2IsShow = true; }), t: common_vendor.p({ src: "/static/login/hidden.png", width: "20", height: "20", bgColor: "#f1f6ff00" }) }, { v: common_vendor.o(($event) => $data.form.loginPassword2 = $event), w: common_vendor.p({ placeholder: "再次输入登录密码", border: "surround", customStyle: $data.inputCss, type: $data.loginPassword2IsShow ? "text" : "password", modelValue: $data.form.loginPassword2 }), x: common_vendor.o(($event) => $data.form.referralCode = $event), y: common_vendor.p({ placeholder: "推荐码", border: "surround", customStyle: $data.inputCss, modelValue: $data.form.referralCode }), z: common_vendor.o((...args) => $options.registerFun && $options.registerFun(...args)), A: $data.butLoading, B: common_vendor.o(($event) => $data.isPolicy = $event), C: common_vendor.p({ name: "isCheck", usedAlone: true, shape: "circle", activeColor: "#FF7C41", size: "19", iconSize: "18", checked: $data.isPolicy }), D: common_vendor.sr("uToastRef", "6cfc9b6b-11") }); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/register/register.js.map