|
@@ -2,12 +2,13 @@
|
|
|
<md-field-group class="register_submit">
|
|
<md-field-group class="register_submit">
|
|
|
<md-field v-model="code" icon="mobile" placeholder="请输入验证码">
|
|
<md-field v-model="code" icon="mobile" placeholder="请输入验证码">
|
|
|
<div slot="rightIcon" @click="getCode" class="getCode red">
|
|
<div slot="rightIcon" @click="getCode" class="getCode red">
|
|
|
- <countdown v-if="counting" :time="60000" @end="countdownend">
|
|
|
|
|
|
|
+ <countdown v-if="counting" :time="60000" @end="countDownEnd">
|
|
|
<template slot-scope="props">{{ +props.seconds || 60 }}秒后获取</template>
|
|
<template slot-scope="props">{{ +props.seconds || 60 }}秒后获取</template>
|
|
|
</countdown>
|
|
</countdown>
|
|
|
<span v-else>获取验证码</span>
|
|
<span v-else>获取验证码</span>
|
|
|
</div>
|
|
</div>
|
|
|
</md-field>
|
|
</md-field>
|
|
|
|
|
+ <md-field v-model="username" icon="username" placeholder="请输入用户名"/>
|
|
|
<md-field v-model="password" icon="lock" placeholder="请输入密码"/>
|
|
<md-field v-model="password" icon="lock" placeholder="请输入密码"/>
|
|
|
<md-field v-model="repeatPassword" icon="lock" placeholder="请再次确认密码"/>
|
|
<md-field v-model="repeatPassword" icon="lock" placeholder="请再次确认密码"/>
|
|
|
|
|
|
|
@@ -20,29 +21,83 @@
|
|
|
<script>
|
|
<script>
|
|
|
import field from '@/components/field/';
|
|
import field from '@/components/field/';
|
|
|
import fieldGroup from '@/components/field-group/';
|
|
import fieldGroup from '@/components/field-group/';
|
|
|
|
|
+import { authRegisterCaptcha } from '@/api/api';
|
|
|
|
|
+import { authRegister } from '@/api/api';
|
|
|
|
|
+import {Toast} from "vant";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
- data() {
|
|
|
|
|
- return {
|
|
|
|
|
- counting: true,
|
|
|
|
|
- code: '',
|
|
|
|
|
- password: '',
|
|
|
|
|
- repeatPassword: ''
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ props: {
|
|
|
|
|
+ phone: String
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ counting: true,
|
|
|
|
|
+ code: '',
|
|
|
|
|
+ username: '',
|
|
|
|
|
+ password: '',
|
|
|
|
|
+ repeatPassword: ''
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted:function(){
|
|
|
|
|
+ this.getCode();
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
registerSubmit() {
|
|
registerSubmit() {
|
|
|
- this.$router.push({
|
|
|
|
|
- name: 'registerStatus',
|
|
|
|
|
- params: { status: 'success' }
|
|
|
|
|
|
|
+ if(this.username === '' || this.code === ''){
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if(this.password === '' || this.repeatPassword === ''){
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if(this.password !== this.repeatPassword){
|
|
|
|
|
+ this.password = ''
|
|
|
|
|
+ this.repeatPassword = ''
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ let data = this.getRegisterData();
|
|
|
|
|
+ authRegister(data).then(res => {
|
|
|
|
|
+ this.$router.push({
|
|
|
|
|
+ name: 'registerStatus',
|
|
|
|
|
+ params: { status: 'success' }
|
|
|
|
|
+ });
|
|
|
|
|
+ }).catch (error => {
|
|
|
|
|
+ Toast.fail(error.data.errmsg);
|
|
|
|
|
+ if (error.data.errno == 705) {
|
|
|
|
|
+ window.location = '#/login/';
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
getCode() {
|
|
getCode() {
|
|
|
this.counting = true;
|
|
this.counting = true;
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ mobile: this.phone
|
|
|
|
|
+ };
|
|
|
|
|
+ authRegisterCaptcha(data).then(res => {
|
|
|
|
|
+ this.counting = true;
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ alert(error.data.errmsg);
|
|
|
|
|
+ this.counting = true;
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
- countdownend() {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ getRegisterData() {
|
|
|
|
|
+ const password = this.password;
|
|
|
|
|
+ const code = this.code;
|
|
|
|
|
+ const repeatPassword = this.repeatPassword;
|
|
|
|
|
+ const mobile = this.phone;
|
|
|
|
|
+ const username = this.username;
|
|
|
|
|
+ return {
|
|
|
|
|
+ code: code,
|
|
|
|
|
+ username: username,
|
|
|
|
|
+ password: password,
|
|
|
|
|
+ repeatPassword: repeatPassword,
|
|
|
|
|
+ mobile: mobile
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ countDownEnd() {
|
|
|
this.counting = false;
|
|
this.counting = false;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|