sendVerification.vue
2.78 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
123
124
125
126
127
128
129
130
131
132
133
<template>
<div class="verification_container">
<NafmHeader navClass="nafmii-head-bg3" />
<div class="verification">
<h2>输入短信验证码</h2>
<p>已经向您的手机<span>{{shortPhone}}</span>发送验证码</p>
<van-field v-model.trim="password" clearable label="" type="tel" maxlength="6" placeholder="请输入验证码">
<template #button>
<SendVerificationCode :phone="phone" :data="objParams" />
</template>
</van-field>
<div class="login_btn" :class="{loginActive:isBothValue}" @click="handleFinish">{{type=='wechat'?'完 成':'下一步'}}</div>
</div>
</div>
</template>
<script>
import SendVerificationCode from '@/components/SendVerificationCode'
export default {
name: 'SendVerification',
components: {
SendVerificationCode
},
data() {
return {
phone: '',
shortPhone: '',
password: '',
objParams: {
type: 'phone'
},
type: ''
}
},
computed: {
isBothValue() {
if (this.password) {
return true
} else {
return false
}
}
},
mounted() {
const { phone, type } = this.$route.query;
this.type = type
this.phone = phone
if (this.phone) {
const phoneArr = this.phone.split('');
this.shortPhone = phoneArr.splice(7, 11).join("")
}
},
methods: {
handleFinish() {
const { type } = this.$route.query
if (!this.password) {
Toast(this.$t('toast.verification'))
return
}
if (type == 'wechat') {
// todo wechat api
Toast(this.$t('toast.unbindingSuccess'))
this.$router.push({
path: '/user/setting'
})
} else {
// 重置密码
this.$router.push({
path: '/user/resetPassword',
query: {
source: 'mine'
}
})
}
}
}
}
</script>
<style lang="less" scoped>
.verification {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
width: 384px;
margin: 0 auto;
h2 {
font-size: 24px;
color: #333;
margin-top: 16px;
}
p {
font-size: 12px;
color: #333;
margin-top: 8px;
margin-bottom: 50px;
span {
color: #106abc;
}
}
}
.login_btn {
width: 100%;
border-radius: 5px;
text-align: center;
height: 45px;
line-height: 45px;
color: #fff;
font-size: 16px;
margin-top: 40px;
background-image: linear-gradient(to right, #25a3df, #106abc);
opacity: 0.3;
}
.loginActive {
opacity: 1;
}
/deep/ .van-cell:not(:last-child)::after {
border-bottom: 1px solid #efefef;
}
/deep/ .van-cell {
padding-right: 0 !important;
padding-left: 0 !important;
border-bottom: 1px solid #ebedf0;
}
/deep/ .van-cell:not(:last-child)::after {
border: none;
}
</style>