连云港陪玩陪聊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chunwan/pages/users/renzheng/zhenren.vue

162 lines
3.5 KiB

<template>
<view class="phone">
<view class="phone-bd">
<view class="item">
<image v-if="userInfo.faceFlag == 1" src="/static/renzheng-shibai.png"></image>
<image v-else src="/static/renzheng-zhong.png"></image>
</view>
</view>
<!-- <view class="title">真人认证失败</view> -->
<view class="title">请拍照</view>
<!-- <view class="title">头像认证中,请稍后</view> -->
<view class="tips"><text>提示:真人认证我们会比对实名认证的活体采集与头像\n信息是否匹配,若匹配,认证通过;\n若不匹配,认证失败</text></view>
<view class="phone-fd">
<view class="btn" @click="toNext">上传头像</view>
<!-- <view class="btn" v-if="userInfo.faceFlag == 1">确定</view> -->
</view>
</view>
</template>
<script>
export default {
data() {
return {
userInfo: {},
};
},
onReady() {
// 监听从裁剪页发布的事件,获得裁剪结果
uni.$on('uAvatarCropper1', path => {
const that = this;
// 可以在此上传到服务端
uni.uploadFile({
url: that.$baseUrl+'/prod-api/api/user/uploadOSSFile',
filePath: path,
name: 'file',
formData: {
"userId": uni.getStorageSync("userInfo").id
},
complete: (res) => {
if(res.statusCode == 200){
const {code, data, msg} = JSON.parse(res.data);
if(code == 200){
uni.showToast({
title: "上传成功"
})
that.toReg(data)
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}else{
uni.showToast({
icon: "error",
title: "上传失败"
})
}
}
});
})
},
methods: {
toNext() {
const that = this;
that.$u.route({
// 关于此路径,请见下方"注意事项"
url: '/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-shiming',
// 内部已设置以下默认参数值,可不传这些参数
params: {
// 输出图片宽度,高等于宽,单位px
destWidth: 700,
// 裁剪框宽度,高等于宽,单位px
rectWidth: 300,
// 输出的图片类型,如果'png'类型发现裁剪的图片太大,改成"jpg"即可
fileType: 'jpg',
}
})
},
//去登录
async toReg(faceImage) {
const {code, data, msg} = await this.$api.detectLivingFace({
userId: uni.getStorageSync("userInfo").id,
faceImage
})
if(code == 200){
uni.showToast({
title: "提交成功"
})
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
},2000)
}else{
uni.showToast({
icon: "none",
position: "bottom",
title: msg
})
}
}
},
onUnload() {
uni.$off('uAvatarCropper1');
},
}
</script>
<style scoped lang="scss">
page{
background-color: #FFFFFF;
}
.phone{
padding: 25rpx;
overflow: hidden;
&-fd{
width: 100%;
position: fixed;
left: 0;
bottom: 50rpx;
z-index: 22;
.btn{
width: 700rpx;
line-height: 98rpx;
background: linear-gradient(0deg, #000000, #3D3B38);
border-radius: 98rpx;
font-weight: 400;
font-size: 34rpx;
text-align: center;
color: #FFFFFF;
margin: 0 auto;
}
}
.title{
color: #222222;
font-weight: 500;
font-size: 30rpx;
text-align: center;
margin-top: 30rpx;
}
.tips{
font-weight: 500;
font-size: 24rpx;
color: #999999;
text-align: center;
margin-top: 20rpx;
line-height: 50rpx;
}
&-bd{
padding-top: 140rpx;
text-align: center;
image{
width: 353rpx;
height: 252rpx;
}
}
}
</style>