register.vue
3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
<div class="register_container">
<img src="@/assets/icon/bg_login_2.png" />
<div class="login_box">
<NafmHeader navClass="nafmii-head-bg1" />
</div>
<div class="login_content">
<div class="login_form_box">
<div class="login_form">
<van-field v-model.trim="phone" clearable type="tel" maxlength="11" :left-icon="phoneIcon" placeholder="请输入手机号" />
<van-field v-model.trim="verification" clearable label="" type="tel" maxlength="6" :left-icon="VerificationIcon" placeholder="请输入验证码">
<template #button>
<SendVerificationCode :phone="phone" :data="objParams" />
</template>
</van-field>
<van-field v-model.trim="password" clearable type="password" maxlength="16" :left-icon="passwordIcon" placeholder="请输入6-16位密码" />
<van-field v-model.trim="aginPassword" clearable type="password" maxlength="16" :left-icon="emptyIcon" placeholder="再次输入6-16位密码" />
<div class="login_btn" :class="{loginActive:isBothValue}" @click="handleRegister">注 册</div>
<div class="go_login_btn " @click="jumpLoginPage">有账号去登录</div>
</div>
</div>
</div>
</div>
</template>
<script>
import SendVerificationCode from '@/components/SendVerificationCode'
import utils from "@/utils/";
export default {
name: 'Register',
components: {
SendVerificationCode
},
data() {
return {
phone: null,
verification: "",
password: "",
aginPassword: "",
objParams: {
type: 'phone'
},
type: 'phone',
phoneIcon: require('@/assets/icon/user.png'),
VerificationIcon: require('@/assets/icon/verification.png'),
passwordIcon: require('@/assets/icon/password.png'),
emptyIcon: require('@/assets/icon/empty.png'),
}
},
computed: {
isBothValue() {
if (this.phone && this.verification && this.password && this.aginPassword) {
return true
} else {
return false
}
},
},
mounted() {
// this.
},
methods: {
// 注册操作
handleRegister() {
if (!this.phone) {
Toast('请输入手机号')
return
}
if (!utils.phoneRegCheck(this.phone)) {
Toast("请输入正确的手机号码!");
return
}
if (!this.verification) {
Toast('请输入验证码')
return
}
if (!this.password) {
Toast('请输入密码')
return
}
if (!this.aginPassword) {
Toast('请再次输入密码')
return
}
if (this.password != this.aginPassword) {
Toast('两次密码输入不一致,请重新输入')
return
}
// todo 请求接口
console.log(1)
},
// 跳转到登录页面
jumpLoginPage() {
const { source } = this.$route.query
if (source == 'phone' || source == 'username') {
this.$router.back()
} else {
this.$router.push({
path: '/user/login/phone'
})
}
}
}
}
</script>
<style lang="less" scoped>
@import "./less/login.less";
.register_container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.go_login_btn {
margin-top: 10px;
display: flex;
justify-content:center ;
color: #106ABC;
font-size: 13px;
}
</style>