feat:人脸认证状态

This commit is contained in:
ctw committed 2025-12-03 18:27:11 +08:00
1 parent 77e7b6fd49
commit cf810bc44a
4 files changed
+191 -141

No files matched your search

@@ -10,7 +10,7 @@
<script setup lang="ts">
defineProps<{
title: '';
value: '';
title: string;
value: string;
}>();
</script>
+45 -33
View File
@@ -120,7 +120,7 @@
<view class="mx-8 flex items-center">
<s-uploader
class="flex-1"
v-model:url="girlAuthPic"
v-model:url="userinfo.avatar"
fileMediatype="image"
limit="1"
mode="grid"
@@ -154,7 +154,7 @@
type="text"
placeholder="请输入昵称"
placeholder-style="color: rgba(255, 255, 255, 0.6)"
maxlength="10"
:maxlength="10"
/>
<capsule-cell title="位置权限" :value="'未允许'" />
</view>
@@ -191,7 +191,7 @@
<view class="h-60rpx"></view>
<view class="flex-col-center">
<s-uploader
v-model:url="boyAuthPic"
v-model:url="userinfo.avatar"
fileMediatype="image"
limit="1"
mode="grid"
@@ -219,15 +219,21 @@
</template>
<script setup lang="ts">
// @ts-nocheck
import RecentApi from '@/sheep/api/member/recent';
import SUploader from '@/sheep/components/s-uploader/s-uploader.vue';
import { computed, reactive, ref } from 'vue';
// @ts-ignore
import sheep from '@/sheep/index';
// @ts-ignore
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
// @ts-ignore
import { getAccessToken } from '@/sheep/request';
// @ts-ignore
import { formatDate } from '@/sheep/helper/utils';
import CapsuleCell from './components/capsule-cell.vue';
import { onLoad } from '@dcloudio/uni-app';
// @ts-ignore
import UserApi from '@/sheep/api/member/user';
const userInfoStore = computed(() => sheep.$store('user').userInfo);
@@ -249,8 +255,6 @@
wechatNum: '',
wechatQrCode: '',
});
const girlAuthPic = ref(''); // 认证图片 女
const boyAuthPic = ref(''); // 认证图片 男
const header = {
Accept: '*/*',
@@ -258,6 +262,34 @@
Authorization: 'Bearer ' + getAccessToken(),
};
// 查询用户人脸认证状态
const getFaceVerify = async () => {
const { code, data } = await RecentApi.getFaceVerify();
if (code !== 0) return uni.showToast({ title: '查询用户人脸认证失败', icon: 'error' });
console.log('查询用户人脸认证状态', code, data);
switch (data.authStatus) {
case '1':
// 待认证
break;
case '2':
return uni.showToast({ title: '你的人脸审核中', icon: 'error' });
case '3':
// 审核通过
break;
case '4':
// 审核失败
break;
}
};
onLoad(async () => {
await getFaceVerify();
const { data } = await UserApi.getUserInfo();
Object.assign(userinfo, data);
});
// 人脸认证 女
const girlFaceVerify = async () => {
// #ifndef APP-PLUS
@@ -265,25 +297,25 @@
// #endif
// #ifdef APP-PLUS
if (!girlAuthPic.value) return uni.showToast({ title: '请先上传人脸照片', icon: 'error' });
if (!userinfo.avatar) return uni.showToast({ title: '请先上传人脸照片', icon: 'error' });
const aliyunVerify = uni.requireNativePlugin('AP-FaceDetectModule');
const metaInfo = JSON.stringify(aliyunVerify.getMetaInfo());
// 创建人脸认证
// 创建女生人脸认证
const { code, data } = await RecentApi.createGirlFaceVerify({
memberHeight: userinfo.height,
memberWeight: userinfo.weight,
memberWechatNumber: wxInfo.wechatNum,
memberOcc: userinfo.occ,
memberDesc: userinfo.description,
authPic: girlAuthPic.value,
authPic: userinfo.avatar,
metaInfoJson: metaInfo,
});
console.log('创建人脸认证接口responseData:', code, data);
if (code !== 0)
return uni.showToast({ title: '请上传包含人脸的头像', icon: 'none', duration: 6000 });
verify(data.bizId);
verify(data.bizId, data.id);
// #endif
};
@@ -294,34 +326,14 @@
// #endif
// #ifdef APP-PLUS
if (!boyAuthPic.value) return uni.showToast({ title: '请先上传人脸照片', icon: 'error' });
if (!userinfo.avatar) return uni.showToast({ title: '请先上传人脸照片', icon: 'error' });
const aliyunVerify = uni.requireNativePlugin('AP-FaceDetectModule');
const metaInfo = JSON.stringify(aliyunVerify.getMetaInfo());
// 查询用户人脸认证
// const { code, data } = await RecentApi.getFaceVerify();
// if (code !== 0) return uni.showToast({ title: '查询用户人脸认证失败', icon: 'error' });
// console.log('查询用户人脸认证', code, data);
// switch (data.authStatus) {
// case '1':
// // 待认证
// break;
// case '2':
// return uni.showToast({ title: '你的人脸审核中', icon: 'error' });
// case '3':
// // 审核通过
// break;
// case '4':
// // 审核失败
// break;
// }
// 创建人脸认证
// 创建男生人脸认证
const { code, data } = await RecentApi.createBoyFaceVerify({
authPic: boyAuthPic.value,
authPic: userinfo.avatar,
metaInfoJson: metaInfo,
});
console.log('创建人脸认证接口responseData:', code, data);
+139 -105
View File
@@ -4,8 +4,10 @@
<wd-navbar title="我的" safeAreaInsetTop :bordered="false">
<template #right>
<navigator hover-class="navigator-hover">
<view class="flex items-center rounded-full h-44rpx bg-color-theme py-1 px-2 text-black"
@click="editUserInfo">
<view
class="flex items-center rounded-full h-44rpx bg-color-theme py-1 px-2 text-black"
@click="editUserInfo"
>
<uni-icons type="auth" size="20" color="#333"></uni-icons>
<text class="text-sm">编辑资料</text>
</view>
@@ -16,15 +18,21 @@
<scroll-view class="h-[calc(100vh-144rpx)]" scroll-y>
<!-- 个人信息 -->
<view class="flex items-center p-6">
<image :src="userInfo.avatar" class="mr-4 size-100px rounded-full bg-#333 border border-amber border-solid"
mode="aspectFill" />
<image
:src="userInfo.avatar"
class="mr-4 size-100px rounded-full bg-#333 border border-amber border-solid"
mode="aspectFill"
/>
<view class="flex-1">
<view class="mb-1 text-base">{{ userInfo.nickname }}</view>
<view class="mb-2 text-xs text-#ffffff80 flex items-center">
<text>ID: {{ userInfo.id }}</text>
<image class="size-24rpx ml-4" :src="userGenderImageSrc" mode="scaleToFill" />
</view>
<text v-if="userCity?.t" class="bg-#333 text-color-theme-dark text-xs px-2 py-1 rounded-1 truncate">
<text
v-if="userCity?.t"
class="bg-#333 text-color-theme-dark text-xs px-2 py-1 rounded-1 truncate"
>
{{ userCity?.t || '' }}
</text>
</view>
@@ -52,11 +60,16 @@
<!-- 开通vip -->
<view
class="text-color-theme-dark mx-4 p-4 rounded-2 bg-gradient-to-b from-#111 to-#222 b-4 b-solid b-t-#D29E52/60 b-l-#D29E52/40 b-r-#D29E52/40 b-b-#D29E52/20 flex justify-between">
class="text-color-theme-dark mx-4 p-4 rounded-2 bg-gradient-to-b from-#111 to-#222 b-4 b-solid b-t-#D29E52/60 b-l-#D29E52/40 b-r-#D29E52/40 b-b-#D29E52/20 flex justify-between"
>
<view class="font-900 font-italic text-xl">VIP</view>
<view class="flex items-center">
<text class="text-xs">尊享vip免费特权</text>
<navigator url="/pages/profile/apply-vip" open-type="navigate" hover-class="navigator-hover">
<navigator
url="/pages/profile/apply-vip"
open-type="navigate"
hover-class="navigator-hover"
>
<text class="ml-4 px-4 py-1 rounded-full text-24rpx bg-color-theme text-black">
立即开通
</text>
@@ -69,14 +82,29 @@
<!-- 菜单 -->
<view class="mt-4 mx-1">
<wd-cell-group>
<wd-cell v-for="(item, index) in MenuCellList" :key="index" :title="item.title" :value="item.value"
icon-size="24" :icon="item.icon" is-link ellipsis :to="item.to" @click="item.click" />
<wd-cell
v-for="(item, index) in MenuCellList"
:key="index"
:title="item.title"
:value="item.value"
icon-size="24"
:icon="item.icon"
is-link
ellipsis
:to="item.to"
@click="item.click"
/>
</wd-cell-group>
</view>
<view class="h-100rpx"></view>
</scroll-view>
<wd-popup v-model="myEvaluationShow" custom-style="border-radius:32rpx;" closable :safe-area-inset-bottom="true">
<wd-popup
v-model="myEvaluationShow"
custom-style="border-radius:32rpx;"
closable
:safe-area-inset-bottom="true"
>
<view class="w-90vw h-400rpx flex-col-center gap-4 flex-wrap">
<view class="text-color-theme text-lg">我的评价{{ myEvaluation.evaluateCount }}</view>
<view class="w-90% flex justify-around">
@@ -102,112 +130,118 @@
<view class="text-color-theme text-lg">综合评分 {{ myEvaluation.avgScore }}</view>
</view>
</wd-popup>
<wd-curtain v-model="curtainShow"
<wd-curtain
v-model="curtainShow"
src="https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png"
close-position="top-right" :width="300" close-on-click-modal show-menu-by-longpress />
close-position="top-right"
:width="300"
close-on-click-modal
show-menu-by-longpress
/>
</wd-config-provider>
</template>
<script setup lang="ts">
import { computed, reactive, ref } from 'vue';
import UserAblum from './components/user-ablum.vue';
import useAblum from './use-ablum';
// @ts-ignore
import sheep from '@/sheep';
import RecentApi from '@/sheep/api/member/recent';
import { onLoad } from '@dcloudio/uni-app';
// @ts-ignore
import { fen2yuan } from '@/sheep/hooks/useGoods';
import { computed, reactive, ref } from 'vue';
import UserAblum from './components/user-ablum.vue';
import useAblum from './use-ablum';
// @ts-ignore
import sheep from '@/sheep';
import RecentApi from '@/sheep/api/member/recent';
import { onLoad } from '@dcloudio/uni-app';
// @ts-ignore
import { fen2yuan } from '@/sheep/hooks/useGoods';
const { ablumList } = useAblum();
const { ablumList } = useAblum();
// 统计信息
const recentTotal = ref({
memberRecentId: null,
bizType: null,
likeTotal: 0,
likeItTotal: 0,
likeMeTotal: 0,
reportTotal: 0,
shieldTotal: 0,
collectTotal: 0,
userLikeItTotal: 0,
userLikeMeTotal: 0,
});
// 我的评价数据
const myEvaluation = reactive({
scoreSc: 0,
scoreNx: 0,
scoreSk: 0,
scoreYq: 0,
avgScore: 0,
evaluateCount: 0,
});
const myEvaluationShow = ref(false); // 我的评价弹窗
const curtainShow = ref(false); // 关注公众号弹窗
const userInfo = computed(() => sheep.$store('user').userInfo);
const userCity = computed(() => sheep.$store('user').userCity);
const userWallet = computed(() => sheep.$store('user').userWallet);
const userGenderImageSrc = computed(() => {
const sex = userInfo.value.sex;
if (sex === 1) return '/static/gender-man.png';
if (sex === 2) return '/static/gender-woman.png';
return '';
});
onLoad(async () => {
const { data: totalData } = await RecentApi.recentTotal();
recentTotal.value = totalData ?? {};
});
// 修改用户信息
const editUserInfo = () => {
uni.navigateTo({
url: '/pages/profile/userinfo',
// 统计信息
const recentTotal = ref({
memberRecentId: null,
bizType: null,
likeTotal: 0,
likeItTotal: 0,
likeMeTotal: 0,
reportTotal: 0,
shieldTotal: 0,
collectTotal: 0,
userLikeItTotal: 0,
userLikeMeTotal: 0,
});
};
// type: 0-我喜欢 1-喜欢我
const goLike = (type: 0 | 1) => {
uni.navigateTo({
url: `/pages/profile/like?type=${type}`,
// 我的评价数据
const myEvaluation = reactive({
scoreSc: 0,
scoreNx: 0,
scoreSk: 0,
scoreYq: 0,
avgScore: 0,
evaluateCount: 0,
});
};
const myEvaluationShow = ref(false); // 我的评价弹窗
const curtainShow = ref(false); // 关注公众号弹窗
// 查看我的评价
const lookMyEvaluation = async () => {
const { data = null } = await RecentApi.myEvaluate();
if (data) {
Object.assign(myEvaluation, data);
myEvaluationShow.value = true;
return;
}
uni.showToast({ title: '查看失败', icon: 'none' });
};
// 关注公众号
const subOfficial = () => {
curtainShow.value = true;
};
// 问题反馈
const goFeedback = () => {
uni.navigateTo({
url: '/pages/profile/feedback',
const userInfo = computed(() => sheep.$store('user').userInfo);
const userCity = computed(() => sheep.$store('user').userCity);
const userWallet = computed(() => sheep.$store('user').userWallet);
const userGenderImageSrc = computed(() => {
const sex = userInfo.value.sex;
if (sex === 1) return '/static/gender-man.png';
if (sex === 2) return '/static/gender-woman.png';
return '';
});
};
// cell菜单
const MenuCellList = [
{ title: '我的收益', value: '', icon: 'wallet', to: '/pages/wechat/index' },
{ title: '访客记录', value: '', icon: 'dong', to: '/pages/profile/view-record' },
{ title: '认证中心', value: '', icon: 'user', to: '/pages/profile/face-verify' },
{ title: '我的动态√', value: '', icon: 'star', to: '/pages/profile/my-moment' },
{ title: '我的评价√', value: '', icon: 'view-module', to: '', click: lookMyEvaluation },
{ title: '问题反馈√', value: '', icon: 'backtop-rectangle', to: '', click: goFeedback },
// { title: '客服助手', value: '', icon: 'service', to: '' },
{ title: '关注公众号√', value: '获取最新消息', icon: 'qrcode', to: '', click: subOfficial },
{ title: '设置√', value: '', icon: 'setting1', to: '/pages/profile/setting' },
];
onLoad(async () => {
const { data: totalData } = await RecentApi.recentTotal();
recentTotal.value = totalData ?? {};
});
// 修改用户信息
const editUserInfo = () => {
uni.navigateTo({
url: '/pages/profile/userinfo',
});
};
// type: 0-我喜欢 1-喜欢我
const goLike = (type: 0 | 1) => {
uni.navigateTo({
url: `/pages/profile/like?type=${type}`,
});
};
// 查看我的评价
const lookMyEvaluation = async () => {
const { data = null } = await RecentApi.myEvaluate();
if (data) {
Object.assign(myEvaluation, data);
myEvaluationShow.value = true;
return;
}
uni.showToast({ title: '查看失败', icon: 'none' });
};
// 关注公众号
const subOfficial = () => {
curtainShow.value = true;
};
// 问题反馈
const goFeedback = () => {
uni.navigateTo({
url: '/pages/profile/feedback',
});
};
// cell菜单
const MenuCellList = [
{ title: '我的收益', value: '', icon: 'wallet', to: '/pages/wechat/index' },
{ title: '访客记录', value: '', icon: 'dong', to: '/pages/profile/view-record' },
{ title: '认证中心', value: '', icon: 'user', to: '/pages/profile/face-verify' },
{ title: '我的动态√', value: '', icon: 'star', to: '/pages/profile/my-moment' },
{ title: '我的评价√', value: '', icon: 'view-module', to: '', click: lookMyEvaluation },
{ title: '问题反馈√', value: '', icon: 'backtop-rectangle', to: '', click: goFeedback },
// { title: '客服助手', value: '', icon: 'service', to: '' },
{ title: '关注公众号√', value: '获取最新消息', icon: 'qrcode', to: '', click: subOfficial },
{ title: '设置√', value: '', icon: 'setting1', to: '/pages/profile/setting' },
];
</script>
+5 -1
View File
@@ -29,7 +29,11 @@
fileMediatype="image"
limit="1"
mode="grid"
:imageStyles="{ width: '268rpx', height: '268rpx' }"
:imageStyles="{
width: '268rpx',
height: '268rpx',
border: { width: '6rpx', color: '#D29E52', radius: '50rpx' },
}"
/>
</view>