560 lines
18 KiB
JavaScript
Executable File
560 lines
18 KiB
JavaScript
Executable File
// ============================================
|
|
// 反编译后的可读版本
|
|
// 原文件: pages-sub-pages-login-register.90ee3c46.js
|
|
// 页面: 注册页面
|
|
// ============================================
|
|
|
|
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([
|
|
["pages-sub-pages-login-register"],
|
|
{
|
|
// ==================== 模块 5b14: 页面逻辑 ====================
|
|
"5b14": function(module, exports, require) {
|
|
"use strict";
|
|
require("6a54");
|
|
|
|
var asyncToGenerator = require("f5bd").default;
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
var objectSpread = asyncToGenerator(require("9b1b"));
|
|
var regeneratorRuntime = asyncToGenerator(require("2634"));
|
|
var _asyncToGenerator = asyncToGenerator(require("2fdc"));
|
|
|
|
require("5c47");
|
|
require("0506");
|
|
|
|
// 表单初始值
|
|
var formInitialData = {
|
|
mobile: "", // 手机号
|
|
code: "", // 验证码
|
|
invite: "", // 邀请码
|
|
password: "" // 密码
|
|
};
|
|
|
|
// 表单验证规则
|
|
var formRules = {
|
|
mobile: [
|
|
{
|
|
required: true,
|
|
message: "请输入手机号",
|
|
trigger: ["blur", "change"]
|
|
},
|
|
{
|
|
validator: function(rule, value, callback) {
|
|
return uni.$u.test.mobile(value);
|
|
},
|
|
message: "手机号码不正确",
|
|
trigger: ["change", "blur"]
|
|
}
|
|
],
|
|
code: [
|
|
{
|
|
required: true,
|
|
message: "请输入验证码",
|
|
trigger: ["blur", "change"]
|
|
}
|
|
],
|
|
invite: [
|
|
{
|
|
required: true,
|
|
message: "请输入邀请码",
|
|
trigger: ["blur", "change"]
|
|
}
|
|
],
|
|
password: [
|
|
{
|
|
required: true,
|
|
message: "请输入密码",
|
|
trigger: ["blur", "change"]
|
|
}
|
|
]
|
|
};
|
|
|
|
// Vue组件配置
|
|
var component = {
|
|
// 数据
|
|
data: function() {
|
|
return {
|
|
formRules: formRules,
|
|
form: formInitialData,
|
|
isAgree: true, // 是否同意协议
|
|
codeText: "", // 验证码按钮文字
|
|
seconds: 60 // 倒计时秒数
|
|
};
|
|
},
|
|
|
|
// 页面准备完成
|
|
onReady: function() {
|
|
// 设置表单验证规则
|
|
this.$refs.uForm.setRules(this.formRules);
|
|
},
|
|
|
|
// 页面加载
|
|
onLoad: function() {
|
|
var queryInvite, routeQuery;
|
|
|
|
// 从路由参数中获取邀请码
|
|
routeQuery = this.$Route.query;
|
|
queryInvite = null !== (routeQuery = null === routeQuery || void 0 === routeQuery ?
|
|
void 0 : routeQuery.invite) && void 0 !== routeQuery ?
|
|
routeQuery : "";
|
|
|
|
this.form.invite = queryInvite;
|
|
},
|
|
|
|
// 方法
|
|
methods: {
|
|
// 验证码变化回调
|
|
codeChange: function(text) {
|
|
this.codeText = text;
|
|
},
|
|
|
|
// 获取验证码
|
|
getCode: function() {
|
|
var self = this;
|
|
return (0, _asyncToGenerator.default)(
|
|
(0, regeneratorRuntime.default)().mark((function asyncFunc() {
|
|
var mobile;
|
|
return (0, regeneratorRuntime.default)().wrap((function(context) {
|
|
while (1) {
|
|
switch (context.prev = context.next) {
|
|
case 0:
|
|
mobile = self.form.mobile;
|
|
|
|
// 验证手机号
|
|
if (mobile) {
|
|
context.next = 4;
|
|
break;
|
|
}
|
|
self.$u.toast("手机号不能为空");
|
|
return context.abrupt("return");
|
|
|
|
case 4:
|
|
// 检查是否可以发送验证码
|
|
if (self.$refs.uCode.canGetCode) {
|
|
self.$u.toast("验证码已发送");
|
|
self.sendSms();
|
|
} else {
|
|
self.$u.toast("倒计时结束后再发送");
|
|
}
|
|
|
|
case 5:
|
|
case "end":
|
|
return context.stop();
|
|
}
|
|
}
|
|
}), asyncFunc);
|
|
}))
|
|
)();
|
|
},
|
|
|
|
// 发送短信验证码
|
|
sendSms: function() {
|
|
var self = this;
|
|
return (0, _asyncToGenerator.default)(
|
|
(0, regeneratorRuntime.default)().mark((function asyncFunc() {
|
|
var params, response;
|
|
return (0, regeneratorRuntime.default)().wrap((function(context) {
|
|
while (1) {
|
|
switch (context.prev = context.next) {
|
|
case 0:
|
|
// 构建请求参数
|
|
params = {
|
|
mobile: self.form.mobile,
|
|
event: "register" // 注册事件
|
|
};
|
|
|
|
// 调用发送短信API
|
|
return context.next = 3, self.$api.smsSend(params);
|
|
|
|
case 3:
|
|
response = context.sent;
|
|
|
|
// 发送成功
|
|
if (0 == response.code) {
|
|
uni.hideLoading();
|
|
self.$u.toast(response.msg);
|
|
// 开始倒计时
|
|
self.$refs.uCode.start();
|
|
}
|
|
|
|
case 5:
|
|
case "end":
|
|
return context.stop();
|
|
}
|
|
}
|
|
}), asyncFunc);
|
|
}))
|
|
)();
|
|
},
|
|
|
|
// 点击注册按钮
|
|
clickRegister: function() {
|
|
var self = this;
|
|
|
|
// 检查是否同意协议
|
|
if (this.isAgree) {
|
|
// 表单验证
|
|
this.$refs.uForm.validate((function(valid) {
|
|
if (valid) {
|
|
console.log("验证通过");
|
|
// 使用节流函数防止重复提交
|
|
self.$u.throttle(self.register, 1000);
|
|
} else {
|
|
console.log("验证失败");
|
|
}
|
|
}));
|
|
} else {
|
|
this.$u.toast("请勾选用户协议和购买委托代卖协议");
|
|
}
|
|
},
|
|
|
|
// 执行注册
|
|
register: function() {
|
|
var self = this;
|
|
return (0, _asyncToGenerator.default)(
|
|
(0, regeneratorRuntime.default)().mark((function asyncFunc() {
|
|
var params, response;
|
|
return (0, regeneratorRuntime.default)().wrap((function(context) {
|
|
while (1) {
|
|
switch (context.prev = context.next) {
|
|
case 0:
|
|
// 构建请求参数
|
|
params = (0, objectSpread.default)(
|
|
(0, objectSpread.default)({}, self.form),
|
|
{},
|
|
{ loading: true }
|
|
);
|
|
|
|
// 调用注册API
|
|
return context.next = 3, self.$api.register(params);
|
|
|
|
case 3:
|
|
response = context.sent;
|
|
|
|
// 注册成功
|
|
if (0 == response.code) {
|
|
// 重置表单
|
|
self.$refs.uForm.resetFields();
|
|
// 显示成功提示并跳转
|
|
self.$u.toast(response.msg, (function() {
|
|
return self.toPageTabAll("/pages/index/index");
|
|
}));
|
|
}
|
|
|
|
case 5:
|
|
case "end":
|
|
return context.stop();
|
|
}
|
|
}
|
|
}), asyncFunc);
|
|
}))
|
|
)();
|
|
}
|
|
}
|
|
};
|
|
|
|
exports.default = component;
|
|
},
|
|
|
|
// ==================== 模块 6ad2: 渲染函数 ====================
|
|
"6ad2": function(module, exports, require) {
|
|
"use strict";
|
|
|
|
require.d(exports, "b", (function() {
|
|
return render;
|
|
}));
|
|
|
|
require.d(exports, "c", (function() {
|
|
return staticRenderFns;
|
|
}));
|
|
|
|
require.d(exports, "a", (function() {
|
|
return components;
|
|
}));
|
|
|
|
// 组件依赖
|
|
var components = {
|
|
uForm: require("e8a2").default,
|
|
uFormItem: require("dd75").default,
|
|
uInput: require("106a").default,
|
|
uVerificationCode: require("1142").default
|
|
};
|
|
|
|
// 渲染函数
|
|
var render = function() {
|
|
var vm = this;
|
|
var createElement = vm.$createElement;
|
|
var createVNode = vm._self._c || createElement;
|
|
|
|
return createVNode("v-uni-view", {
|
|
staticClass: "content page-bg white-bg"
|
|
}, [
|
|
// 头部区域
|
|
createVNode("v-uni-view", {
|
|
staticClass: "head"
|
|
}, [
|
|
createVNode("v-uni-view", {
|
|
staticClass: "b-text-42 pb-30 b-text-B-d"
|
|
}, [vm._v("创建您的账号")])
|
|
], 1),
|
|
|
|
// 主体区域
|
|
createVNode("v-uni-view", {
|
|
staticClass: "main"
|
|
}, [
|
|
// 表单
|
|
createVNode("u-form", {
|
|
ref: "uForm",
|
|
staticClass: "u-form u-m-b-30",
|
|
attrs: {
|
|
model: vm.form,
|
|
"error-type": ["toast", "border-bottom"]
|
|
}
|
|
}, [
|
|
// 手机号输入框
|
|
createVNode("u-form-item", {
|
|
staticClass: "flex-column u-m-b-20",
|
|
attrs: {
|
|
prop: "mobile"
|
|
}
|
|
}, [
|
|
createVNode("v-uni-view", {
|
|
staticClass: "line-default"
|
|
}, [
|
|
createVNode("v-uni-text", {
|
|
staticClass: "b-icon icon-phone"
|
|
}),
|
|
createVNode("v-uni-text", {}, [vm._v("手机号")])
|
|
], 1),
|
|
|
|
createVNode("u-input", {
|
|
staticClass: "w-full",
|
|
attrs: {
|
|
type: "number",
|
|
clearable: false,
|
|
placeholder: "请输入您的手机号"
|
|
},
|
|
model: {
|
|
value: vm.form.mobile,
|
|
callback: function(value) {
|
|
vm.$set(vm.form, "mobile", value);
|
|
},
|
|
expression: "form.mobile"
|
|
}
|
|
})
|
|
], 1),
|
|
|
|
// 验证码输入框
|
|
createVNode("u-form-item", {
|
|
staticClass: "flex-column u-m-b-20",
|
|
attrs: {
|
|
prop: "code"
|
|
}
|
|
}, [
|
|
createVNode("v-uni-view", {
|
|
staticClass: "line-default"
|
|
}, [
|
|
createVNode("v-uni-text", {
|
|
staticClass: "b-icon icon-safetycertificate"
|
|
}),
|
|
createVNode("v-uni-text", {}, [vm._v("验证码")])
|
|
], 1),
|
|
|
|
createVNode("v-uni-view", {
|
|
staticClass: "b-flex-x b-flex-space w-full"
|
|
}, [
|
|
createVNode("u-input", {
|
|
staticClass: "w-full",
|
|
attrs: {
|
|
clearable: false,
|
|
placeholder: "请输入验证码"
|
|
},
|
|
model: {
|
|
value: vm.form.code,
|
|
callback: function(value) {
|
|
vm.$set(vm.form, "code", value);
|
|
},
|
|
expression: "form.code"
|
|
}
|
|
}),
|
|
|
|
// 获取验证码按钮
|
|
createVNode("v-uni-view", {
|
|
staticClass: "b-flex-shrink b-text-theme-d",
|
|
on: {
|
|
click: function(event) {
|
|
arguments[0] = event = vm.$handleEvent(event);
|
|
vm.getCode.apply(void 0, arguments);
|
|
}
|
|
}
|
|
}, [vm._v(vm._s(vm.codeText))])
|
|
], 1)
|
|
], 1),
|
|
|
|
// 邀请码输入框
|
|
createVNode("u-form-item", {
|
|
staticClass: "flex-column u-m-b-20",
|
|
attrs: {
|
|
prop: "invite"
|
|
}
|
|
}, [
|
|
createVNode("v-uni-view", {
|
|
staticClass: "line-default"
|
|
}, [
|
|
createVNode("v-uni-text", {
|
|
staticClass: "b-icon icon-qrcode"
|
|
}),
|
|
createVNode("v-uni-text", {}, [vm._v("邀请码")])
|
|
], 1),
|
|
|
|
createVNode("u-input", {
|
|
staticClass: "w-full",
|
|
attrs: {
|
|
clearable: false,
|
|
placeholder: "请输入邀请码 (必填)"
|
|
},
|
|
model: {
|
|
value: vm.form.invite,
|
|
callback: function(value) {
|
|
vm.$set(vm.form, "invite", value);
|
|
},
|
|
expression: "form.invite"
|
|
}
|
|
})
|
|
], 1),
|
|
|
|
// 密码输入框
|
|
createVNode("u-form-item", {
|
|
staticClass: "flex-column u-m-b-20",
|
|
attrs: {
|
|
prop: "password"
|
|
}
|
|
}, [
|
|
createVNode("v-uni-view", {
|
|
staticClass: "line-default"
|
|
}, [
|
|
createVNode("v-uni-text", {
|
|
staticClass: "b-icon icon-lock"
|
|
}),
|
|
createVNode("v-uni-text", {}, [vm._v("登录密码")])
|
|
], 1),
|
|
|
|
createVNode("u-input", {
|
|
staticClass: "w-full",
|
|
attrs: {
|
|
clearable: false,
|
|
type: "password",
|
|
placeholder: "请输入登录密码"
|
|
},
|
|
model: {
|
|
value: vm.form.password,
|
|
callback: function(value) {
|
|
vm.$set(vm.form, "password", value);
|
|
},
|
|
expression: "form.password"
|
|
}
|
|
})
|
|
], 1)
|
|
], 1),
|
|
|
|
// 协议勾选
|
|
createVNode("v-uni-view", {
|
|
staticClass: "b-flex-x u-m-b-40"
|
|
}, [
|
|
// 复选框
|
|
createVNode("v-uni-view", {
|
|
staticClass: "check-box shape u-m-r-10",
|
|
on: {
|
|
click: function(event) {
|
|
arguments[0] = event = vm.$handleEvent(event);
|
|
vm.isAgree = !vm.isAgree;
|
|
}
|
|
}
|
|
}, [
|
|
createVNode("v-uni-text", {
|
|
directives: [{
|
|
name: "show",
|
|
rawName: "v-show",
|
|
value: vm.isAgree,
|
|
expression: "isAgree"
|
|
}],
|
|
staticClass: "b-icon icon-check-circle-fill theme-text"
|
|
})
|
|
], 1),
|
|
|
|
// 协议文字
|
|
createVNode("v-uni-view", {
|
|
staticClass: "b-text-black-dd b-text-24"
|
|
}, [
|
|
vm._v("同意"),
|
|
|
|
// 用户协议链接
|
|
createVNode("v-uni-text", {
|
|
staticClass: "link-text",
|
|
on: {
|
|
click: function(event) {
|
|
arguments[0] = event = vm.$handleEvent(event);
|
|
vm.toAgreement("用户协议");
|
|
}
|
|
}
|
|
}, [vm._v("《用户协议》")]),
|
|
|
|
vm._v("和"),
|
|
|
|
// 购买委托代卖协议链接
|
|
createVNode("v-uni-text", {
|
|
staticClass: "link-text",
|
|
on: {
|
|
click: function(event) {
|
|
arguments[0] = event = vm.$handleEvent(event);
|
|
vm.toAgreement("购买委托代卖协议");
|
|
}
|
|
}
|
|
}, [vm._v("《购买委托代卖协议》")]),
|
|
|
|
vm._v("登录平台")
|
|
], 1)
|
|
], 1),
|
|
|
|
// 注册按钮
|
|
createVNode("v-uni-button", {
|
|
staticClass: "b-btn b-btn-block b-btn-round disable_btn mt-10 mb-50",
|
|
on: {
|
|
click: function(event) {
|
|
arguments[0] = event = vm.$handleEvent(event);
|
|
vm.clickRegister.apply(void 0, arguments);
|
|
}
|
|
}
|
|
}, [vm._v("注册")])
|
|
], 1),
|
|
|
|
// 验证码组件
|
|
createVNode("u-verification-code", {
|
|
ref: "uCode",
|
|
attrs: {
|
|
seconds: vm.seconds
|
|
},
|
|
on: {
|
|
change: function(event) {
|
|
arguments[0] = event = vm.$handleEvent(event);
|
|
vm.codeChange.apply(void 0, arguments);
|
|
}
|
|
}
|
|
})
|
|
], 1);
|
|
};
|
|
|
|
var staticRenderFns = [];
|
|
},
|
|
|
|
// ==================== 其他模块(样式等)====================
|
|
// ... 省略样式相关模块
|
|
}
|
|
]);
|
|
|
|
|
|
|