|
@@ -1,28 +1,28 @@
|
|
|
<template>
|
|
|
<view class="step3">
|
|
|
- <view class="login-from">
|
|
|
+ <view class="login-form">
|
|
|
<view class="title">填写资料</view>
|
|
|
<view class="input-item">
|
|
|
<label for="">
|
|
|
<text>中国(+86)</text>
|
|
|
</label>
|
|
|
- <input type="number" placeholder="请输入手机号">
|
|
|
+ <input type="number" placeholder="请输入手机号" v-model="form.mobile">
|
|
|
</view>
|
|
|
<view class="input-item">
|
|
|
<label for="">
|
|
|
<text>验证码</text>
|
|
|
</label>
|
|
|
- <input type="number" placeholder="" maxlength="6">
|
|
|
- <button class="send-vcode">获取验证码</button>
|
|
|
+ <input type="number" placeholder="" maxlength="6" v-model="form.code">
|
|
|
+ <button class="send-vcode" @tap="sendSms()" :disabled="!sendable">{{sendable?'获取验证码':countdown+'秒'}}</button>
|
|
|
</view>
|
|
|
<view class="input-item">
|
|
|
<label for="">
|
|
|
<text>密码</text>
|
|
|
</label>
|
|
|
- <input type="password" placeholder="请输入密码">
|
|
|
+ <input type="password" placeholder="请输入密码" v-model="form.password">
|
|
|
</view>
|
|
|
<view class="button-item" style="margin-top: 80upx;">
|
|
|
- <button class="confirm">注册</button>
|
|
|
+ <button class="confirm" @tap="register()">注册</button>
|
|
|
</view>
|
|
|
<view class="agreement">
|
|
|
<view>
|
|
@@ -41,14 +41,87 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ let timeInterval = null;
|
|
|
+ const time = 120
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
+ sendable: true,
|
|
|
+ countdown: time,
|
|
|
+ form: {
|
|
|
+ username: "",
|
|
|
+ mobile: "",
|
|
|
+ code: "",
|
|
|
+ password: "",
|
|
|
+ user_type: 3,
|
|
|
+ invite_code: "",
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ register() {
|
|
|
+ if (this.$verified.mobile(this.form.mobile) &&
|
|
|
+ this.$verified.required(this.form.code, "请输入手机验证码") &&
|
|
|
+ this.$verified.required(this.form.password, "请输入密码")) {
|
|
|
+ this.form.username = this.form.mobile;
|
|
|
+ this.$http.post({
|
|
|
+ url: "/user/register",
|
|
|
+ data: this.form,
|
|
|
+ success(res) {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.data.msg,
|
|
|
+ icon: "none",
|
|
|
+ success: () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 999,
|
|
|
+ animationType:'none'
|
|
|
+ })
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/user/login'
|
|
|
+ })
|
|
|
+ }, 1500)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sendSms() {
|
|
|
+ if (this.sendable && this.$verified.mobile(this.form.mobile)) {
|
|
|
+ this.sendable = false;
|
|
|
+
|
|
|
+ this.$http.get({
|
|
|
+ url: '/sms/send',
|
|
|
+ data: {
|
|
|
+ mobile: this.form.mobile,
|
|
|
+ event: "register"
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.data.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ timeInterval = setInterval(() => {
|
|
|
+ if (this.countdown-- === 0) {
|
|
|
+ clearInterval(timeInterval)
|
|
|
+ this.countdown = time;
|
|
|
+ this.sendable = true;
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ this.sendable = true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
+ },
|
|
|
+ onLoad: function(option) {
|
|
|
+ this.form.invite_code = option.invite_code;
|
|
|
+ this.form.user_type = option.user_type;
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -61,7 +134,7 @@
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
|
|
|
- .login-from {
|
|
|
+ .login-form {
|
|
|
margin: auto;
|
|
|
width: 600upx;
|
|
|
height: 700upx;
|
|
@@ -101,6 +174,7 @@
|
|
|
position: relative;
|
|
|
margin-bottom: 30upx;
|
|
|
border-bottom: 2upx solid $primary-color;
|
|
|
+ align-items: center;
|
|
|
|
|
|
label {
|
|
|
width: 158upx;
|
|
@@ -110,7 +184,7 @@
|
|
|
|
|
|
input {
|
|
|
flex-grow: 1;
|
|
|
- padding: 5upx;
|
|
|
+ padding: 10upx 5upx;
|
|
|
font-size: 30upx;
|
|
|
}
|
|
|
}
|
|
@@ -138,7 +212,7 @@
|
|
|
width: 160upx;
|
|
|
line-height: normal;
|
|
|
right: 0upx;
|
|
|
- top: -5upx;
|
|
|
+ top: 10upx;
|
|
|
}
|
|
|
|
|
|
.agreement {
|