unbindPhone.vue
6.01 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<template>
<div class="container">
<el-container>
<el-header>
<el-row>解绑手机</el-row>
</el-header>
<el-main>
<el-row>
<el-col :span="24">
<el-steps :space="450" :active="active" align-center>
<el-step title="身份验证"></el-step>
<el-step title="完成"></el-step>
</el-steps>
</el-col>
</el-row>
<div v-if="active == 0">
<el-row class="mar-top-30">
<el-col :span="8" :offset="9">
<span>已绑定的手机号码:{{ phone }}</span>
</el-col>
</el-row>
<el-row class="mar-top-30">
<el-col class="flex-row-plus" :span="5" :offset="8">
<el-input class="codeipt" v-model="code" placeholder="验证码"></el-input>
</el-col>
<el-col class="flex-row-plus" :span="3">
<el-button
v-if="isCodeShow"
class="codebut"
type="primary"
@click="getCode"
>{{ codeText }}</el-button
>
<el-button v-else class="codebut">{{
codeText
}}</el-button>
</el-col>
</el-row>
<el-row class="mar-top-30">
<el-col class="flex-row-plus" :span="4" :offset="10">
<el-button class="submitBut" @click="relievePhone"
>提交</el-button
>
</el-col>
</el-row>
</div>
<div v-if="active == 1" style="margin:70px 0">
<el-row>
<el-col :span="8" :offset="8" style="text-align:center;margin-bottom:20px;">
<img class="finishImg" src="../../../../static/image/wancheng@2x.png" />
</el-col>
</el-row>
<el-row>
<el-col :span="8" :offset="8" style="text-align:center;">
<span>恭喜您,已成功解绑手机!</span>
</el-col>
</el-row>
</div>
</el-main>
<el-footer class="mar-top-50">
<el-row class="flex-column-plus mar-20-30">
<span class="fs8">安全服务提示</span>
<span class="mar-top-20 fs7 font-color-9A9"
>•
绑定手机可提高帐号安全性,您也可以使用已绑定手机快速找回支付密码等</span
>
<span class="mar-top-10 fs7 font-color-9A9"
>• 一个手机号只能绑定一个帐号</span
>
</el-row>
</el-footer>
</el-container>
</div>
</template>
<script>
import {mapGetters} from 'vuex'
import {
getTheCode
} from '@/api/login.js'
import {
freedPhone
} from '@/api/user/user.js'
export default {
data () {
return {
active: 0,
iphoneNum: '',
code: '',
codeText: '获取验证码',
time: 60,
isCodeShow: true,
verifyIphone: '',
phone: ''
}
},
computed: {
...mapGetters([
'userInfo' // 用户信息
])
},
created () {
this.verifyIphone = this.userInfo.phone
this.phone = this.verifyIphone.substr(0, 3) + '****' + this.verifyIphone.substr(7, this.verifyIphone.split('').length)
},
methods: {
// 获取验证码
async getCode () {
const response = await getTheCode({ phone: this.verifyIphone })
const res = response.data
if (res.code === '200') {
this.$message({
message: '验证码获取成功',
type: 'success'
})
this.timer()
}
},
// 解绑手机号
async relievePhone () {
const response = await freedPhone({
phone: this.verifyIphone,
verificationCode: this.code
})
const res = response.data
if (res.code === '200') {
this.active = 1
}
},
timer () {
if (this.time > 0) {
this.time--
this.codeText = this.time + 's'
setTimeout(this.timer, 1000)
this.isCodeShow = false
} else {
this.time = 0
this.codeText = '获取验证码'
this.isCodeShow = true
}
}
}
}
</script>
<style lang="scss" scoped>
.container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
background-color: #ffffff;
border: 1px solid #E5E5E5;
padding: 30px;
box-sizing: border-box;
.el-header{
padding: 0;
}
.submitBut {
width: 160px;
background-color: #FF7800;
border-radius: 0;
color: #FFFFFF;
}
.codebut {
width: 100%;
text-align: center;
background-color: #DDDDDD;
border-radius: 0;
padding: 13px 20px;
color: #333333;
}
>>>.codeipt{
.el-input__inner{
border-radius: 0;
}
}
.bottom-box {
background-color: #eeeeee;
}
.finishImg {
width: 66px;
height: 66px;
border-radius: 50%;
}
>>>.el-footer{
background-color: #eee;
height: auto !important;
}
.el-steps {
max-width: 900px;
margin: 0 auto;
/deep/ {
.el-step__description {
padding-top: 12px;
}
.el-step__icon {
width: 36px;
height: 36px;
}
.el-step__title {
font-size: 16px;
line-height: 1em;
margin-top: 14px;
}
.el-step__line {
height: 6px;
background-color: #ddd;
top: 15px;
left: 0;
.el-step__line-inner{
border-style: none;
}
}
.el-step:first-of-type .el-step__line {
width: 50%;
left: auto;
right: 0;
}
.el-step:last-of-type .el-step__line {
display: block;
width: 50%;
}
.is-finish,
.is-process {
color: #666;
.el-step__line {
background-color: #FF7800;
}
.el-step__icon {
color: #fff;
background-color: #FF7800;
border-color: #FF7800;
}
}
.is-wait {
color: #dddddd;
.el-step__icon {
color: #fff;
background-color: #dddddd;
border-color: #dddddd;
}
}
}
}
}
</style>