checkName.vue
3.0 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
<template>
<view v-if="showCheckName">
<view class="topLine"></view>
<view class="phoneWrap">
<view class="phoneItem">
<view class="phoneLeft">
姓名
</view>
<view class="phoneCenter">
<input v-if="userInfo.id_no == ''" type="text" v-model="param.name" placeholder="请输入完整姓名" placeholder-class="centerInp"/>
<text v-if="userInfo.id_no != ''">{{userInfo.name | hideStar}}</text>
</view>
</view>
<view class="phoneItem">
<view class="phoneLeft">
身份证号
</view>
<view class="phoneCenter">
<input v-if="userInfo.id_no == ''" type="text" v-model="param.id_no" placeholder="请输入身份证号" placeholder-class="centerInp"/>
<text v-if="userInfo.id_no != ''">{{userInfo.id_no | hideStar}}</text>
</view>
</view>
</view>
<view class="bottomBtnWrap" v-if="userInfo.id_no == ''">
<view class="bottomBtn" @click="checkName">
完成认证
</view>
</view>
</view>
</template>
<script>
export default{
data(){
return{
showCheckName:false,
userInfo:{},
param:{
name:'',
id_no:''
}
}
},
filters:{
hideStar(data){
if(data.length == 18){
return data.substring(0,4)+'****'+data.substring(data.length-4,data.length)
}else{
return '*'+data.substring(1,data.length)
}
}
},
onLoad() {
//获取用户信息
this.$request('/user/info').then((res)=>{
this.userInfo = res.data
this.showCheckName = true
})
},
methods:{
checkName(){
if(this.param.name == ''){
uni.showToast({
title:'请输入完整姓名',
icon:'none'
})
return
}
if(this.param.id_no == ''){
uni.showToast({
title:'请输入身份证号',
icon:'none'
})
return
}
this.$request('/user/certification',this.param).then((res)=>{
console.log('实名认证',res)
if(res.code == 1){
uni.navigateBack({
delta:1
})
setTimeout(()=>{
uni.showToast({
title:'认证成功'
})
},500)
}else{
uni.showToast({
title:res.msg,
icon:'none'
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
page{background: #f8f8f9;}
.topLine{height: 2rpx;background: rgba(25,24,51,0.06);}
.phoneWrap{
padding: 0 32rpx;
font-size: 28rpx;
background: #fff;
.phoneItem{
display: flex;
justify-content: space-between;
align-items: center;
height: 88rpx;
.phoneLeft{
width: 180rpx;
}
.phoneCenter{
flex: 1;
display: flex;
justify-content: flex-end;
input{
text-align: end;
}
.centerInp{
font-size: 28rpx;
}
}
}
}
.bottomBtnWrap{
width: 100%;
height: 138rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0rpx -14rpx 44rpx 0rpx rgba(85,123,218,0.08);
.bottomBtn{
width: 200rpx;
height:75rpx;
background: #35655f;
text-align: center;
line-height: 75rpx;
color: #fff;
border-radius: 50rpx;
font-size: 28rpx;
}
}
</style>