fix:女生认证

This commit is contained in:
dzc committed 2026-01-07 16:06:22 +08:00
1 parent 55bc87855b
commit e52882238c
7 files changed
+366 -458

No files matched your search

+2 -2
View File
@@ -5,9 +5,9 @@ const CHAT_ENV = {};
// 开发
if (ENV == 'DEV') {
CHAT_ENV.BASE_URL = 'http://chatsever.zianxin.com';
// CHAT_ENV.WS_URL = 'ws://chatapp.zianxin.com/im';
CHAT_ENV.WS_URL = 'ws://chatapp.zianxin.com/im';
// CHAT_ENV.BASE_URL = 'http://127.0.0.1:8888';
CHAT_ENV.WS_URL = 'ws://127.0.0.1:8876/im'
// CHAT_ENV.WS_URL = 'ws://127.0.0.1:8876/im'
// H5 走本地代理解决跨域问题
// #ifdef H5
+65 -80
View File
@@ -1,13 +1,6 @@
<template>
<wd-config-provider theme="dark">
<wd-navbar
title="精英男士认证"
safeAreaInsetTop
fixed
placeholder
:bordered="false"
style="z-index: 999"
>
<wd-navbar title="精英男士认证" safeAreaInsetTop fixed placeholder :bordered="false" style="z-index: 999">
<template #left>
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52" />
@@ -20,24 +13,16 @@
<view class="text-sm my-2 mx-8 c-#949494">上传本人头像,女生更放心与你见面~</view>
<view class="h-60rpx"></view>
<view class="flex-col-center">
<s-uploader
v-model:url="userinfo.avatar"
fileMediatype="image"
limit="1"
mode="grid"
:imageStyles="{
width: '268rpx',
height: '268rpx',
border: { width: '6rpx', color: '#D29E52', radius: '50rpx' },
}"
/>
<s-uploader v-model:url="userinfo.avatar" fileMediatype="image" limit="1" mode="grid" :imageStyles="{
width: '268rpx',
height: '268rpx',
border: { width: '6rpx', color: '#D29E52', radius: '50rpx' },
}" />
<image class="w-260rpx" src="@/static/face-auth-prompt.png" mode="aspectFit" />
</view>
<view
class="mx-auto w-200rpx rounded-full p-3 text-center bg-color-theme-dark active:bg-color-theme"
@click="createFaceVerify"
>
<view class="mx-auto w-200rpx rounded-full p-3 text-center bg-color-theme-dark active:bg-color-theme"
@click="createFaceVerify">
开始认证
</view>
@@ -49,68 +34,68 @@
</template>
<script setup lang="ts">
import RecentApi from '@/sheep/api/member/recent';
import { onLoad } from '@dcloudio/uni-app';
// @ts-ignore
import UserApi from '@/sheep/api/member/user';
import { reactive } from 'vue';
import verify from './ali-face-verify';
import RecentApi from '@/sheep/api/member/recent';
import { onLoad } from '@dcloudio/uni-app';
// @ts-ignore
import UserApi from '@/sheep/api/member/user';
import { reactive } from 'vue';
import verify from './ali-face-verify';
// 用户信息
const userinfo = reactive<any>({
avatar: '',
nickname: '',
birthday: '',
height: '',
weight: '',
occ: '',
description: '',
photo: [],
// 用户信息
const userinfo = reactive<any>({
avatar: '',
nickname: '',
birthday: '',
height: '',
weight: '',
occ: '',
description: '',
photo: [],
});
onLoad(async () => {
uni.showLoading({ title: '加载中...' });
const { data } = await UserApi.getUserInfo();
Object.assign(userinfo, {
avatar: data.avatar,
birthday: data.birthday ?? '',
description: data.description,
height: data.height ?? '',
weight: data.weight ?? '',
mobile: data.mobile,
nickname: data.nickname,
occ: data.occ ?? '',
sex: data.sex,
});
uni.hideLoading();
});
onLoad(async () => {
uni.showLoading({ title: '加载中...' });
const { data } = await UserApi.getUserInfo();
Object.assign(userinfo, {
avatar: data.avatar,
birthday: data.birthday ?? '',
description: data.description,
height: data.height ?? '',
weight: data.weight ?? '',
mobile: data.mobile,
nickname: data.nickname,
occ: data.occ ?? '',
sex: data.sex,
});
uni.hideLoading();
// 创建人脸认证
const createFaceVerify = async () => {
// #ifndef APP-PLUS
uni.showToast({ title: '当前设备不支持', icon: 'error' });
// #endif
// #ifdef APP-PLUS
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.createBoyFaceVerify({
authPic: userinfo.avatar,
metaInfoJson: metaInfo,
});
console.log('男 创建人脸认证接口responseData:', code, data);
// 创建人脸认证
const createFaceVerify = async () => {
// #ifndef APP-PLUS
uni.showToast({ title: '当前设备不支持', icon: 'error' });
// #endif
if (code !== 0)
return uni.showToast({ title: '请上传包含人脸的头像', icon: 'none', duration: 6000 });
// #ifdef APP-PLUS
if (!userinfo.avatar) return uni.showToast({ title: '请先上传人脸照片', icon: 'error' });
const { code: userResCode } = await UserApi.updateUser(userinfo);
if (userResCode !== 0) return;
const aliyunVerify = uni.requireNativePlugin('AP-FaceDetectModule');
const metaInfo = JSON.stringify(aliyunVerify.getMetaInfo());
// 创建男生人脸认证
const { code, data } = await RecentApi.createBoyFaceVerify({
authPic: userinfo.avatar,
metaInfoJson: metaInfo,
});
console.log('男 创建人脸认证接口responseData:', code, data);
if (code !== 0)
return uni.showToast({ title: '请上传包含人脸的头像', icon: 'none', duration: 6000 });
const { code: userResCode } = await UserApi.updateUser(userinfo);
if (userResCode !== 0) return;
verify(data.bizId, data.id);
// #endif
};
verify(data.bizId, data.id);
// #endif
};
</script>
+82 -113
View File
@@ -1,13 +1,6 @@
<template>
<wd-config-provider theme="dark">
<wd-navbar
title="魅力女生认证"
safeAreaInsetTop
fixed
placeholder
:bordered="false"
style="z-index: 999"
>
<wd-navbar title="魅力女生认证" safeAreaInsetTop placeholder :bordered="false" style="z-index: 999">
<template #left>
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52" />
@@ -15,7 +8,7 @@
</template>
</wd-navbar>
<view class="pt-20" style="height: calc(100vh - 44rpx - 200rpx)">
<view class="mt-30rpx">
<wd-steps :active="0" align-center>
<wd-step v-for="index in 4" :key="index" />
</wd-steps>
@@ -24,47 +17,23 @@
<view class="text-xl my-2 mx-8 c-#FCFBFE">完善详细资料(必填)</view>
<view class="text-sm my-2 mx-8 c-#949494">认真填写,展现你的魅力~</view>
<view class="h-60rpx"></view>
<wd-picker
v-model="userinfo.height"
:columns="columnsHeight"
label="身高"
title="身高"
align-right
:default-value="180"
>
<wd-picker v-model="userinfo.height" :columns="columnsHeight" label="身高" title="身高" align-right
:default-value="180">
<capsule-cell title="身高" :value="userinfo.height ? userinfo.height + 'cm' : ''" />
</wd-picker>
<wd-picker
v-model="userinfo.weight"
:columns="columnsWeight"
label="体重"
title="体重"
align-right
:default-value="60"
>
<wd-picker v-model="userinfo.weight" :columns="columnsWeight" label="体重" title="体重" align-right
:default-value="60">
<capsule-cell title="体重" :value="userinfo.weight ? userinfo.weight + 'kg' : ''" />
</wd-picker>
<wd-picker
v-model="userinfo.occ"
:columns="columnsOcc"
label="从事职业"
title="从事职业"
align-right
>
<wd-picker v-model="userinfo.occ" :columns="columnsOcc" label="从事职业" title="从事职业" align-right>
<capsule-cell title="职业" :value="userinfo.occ" />
</wd-picker>
<textarea
class="h-200rpx w-78% mx-auto my-4 rounded-10rpx bg-color-light p-24rpx text-32rpx text-color-theme"
v-model="userinfo.description"
:maxlength="100"
placeholder="个人简介(100字以内)"
placeholder-style="color: rgba(255, 255, 255, 0.6)"
/>
<textarea class="h-200rpx w-78% mx-auto my-4 rounded-10rpx bg-color-light p-24rpx text-32rpx text-color-theme"
v-model="userinfo.description" :maxlength="100" placeholder="个人简介(100字以内)"
placeholder-style="color: rgba(255, 255, 255, 0.6)" />
<view
class="size-160rpx rounded-full bg-color-light text-center mx-auto line-height-160rpx active:bg-color"
@click="nextStep"
>
<view class="size-160rpx rounded-full bg-color-light text-center mx-auto line-height-160rpx active:bg-color"
@click="nextStep">
<uni-icons type="arrow-right" color="#D29E52" size="44" />
</view>
</view>
@@ -72,80 +41,80 @@
</template>
<script setup lang="ts">
import { onShow } from '@dcloudio/uni-app';
import { reactive } from 'vue';
// @ts-ignore
import UserApi from '@/sheep/api/member/user';
import CapsuleCell from '../components/capsule-cell.vue';
import { onShow } from '@dcloudio/uni-app';
import { reactive } from 'vue';
// @ts-ignore
import UserApi from '@/sheep/api/member/user';
import CapsuleCell from '../components/capsule-cell.vue';
// 用户信息
const userinfo = reactive<any>({
avatar: '',
nickname: '',
birthday: '',
height: '',
weight: '',
occ: '',
description: '',
photo: [],
// 用户信息
const userinfo = reactive<any>({
avatar: '',
nickname: '',
birthday: '',
height: '',
weight: '',
occ: '',
description: '',
photo: [],
});
onShow(async () => {
uni.showLoading({ title: '加载中...' });
const { data } = await UserApi.getUserInfo();
Object.assign(userinfo, {
avatar: data.avatar,
birthday: data.birthday ?? '',
description: data.description,
height: data.height ?? '',
weight: data.weight ?? '',
mobile: data.mobile,
nickname: data.nickname,
occ: data.occ ?? '',
sex: data.sex,
});
uni.hideLoading();
});
onShow(async () => {
uni.showLoading({ title: '加载中...' });
const { data } = await UserApi.getUserInfo();
Object.assign(userinfo, {
avatar: data.avatar,
birthday: data.birthday ?? '',
description: data.description,
height: data.height ?? '',
weight: data.weight ?? '',
mobile: data.mobile,
nickname: data.nickname,
occ: data.occ ?? '',
sex: data.sex,
});
uni.hideLoading();
});
const nextStep = async () => {
if (userinfo.height && userinfo.weight && userinfo.occ && userinfo.description) {
const { code } = await UserApi.updateUser(userinfo);
if (code !== 0) return;
return uni.redirectTo({ url: '/pages/profile/face-verify/girl-verify-2' });
}
uni.showToast({ title: '请填写完整信息', icon: 'none' });
};
const nextStep = async () => {
if (userinfo.height && userinfo.weight && userinfo.occ && userinfo.description) {
const { code } = await UserApi.updateUser(userinfo);
if (code !== 0) return;
return uni.redirectTo({ url: '/pages/profile/face-verify/girl-verify-2' });
}
uni.showToast({ title: '请填写完整信息', icon: 'none' });
};
</script>
<script lang="ts">
// 身高选择器选项
const columnsHeight = Array.from({ length: 100 }, (_, i) => ({
label: i + 100 + 'cm',
value: i + 100,
})).reverse();
// 体重选择器选项
const columnsWeight = Array.from({ length: 80 }, (_, i) => ({
label: i + 20 + 'kg',
value: i + 20,
}));
// 职业选择器选项
const columnsOcc = [
{ text: '互联网', value: '互联网' },
{ text: '金融', value: '金融' },
{ text: '娱乐', value: '娱乐' },
{ text: 'CEO', value: 'CEO' },
{ text: '高管', value: '高管' },
{ text: '投资人', value: '投资人' },
{ text: '学生', value: '学生' },
{ text: '其他', value: '其他' },
{ text: '老师', value: '老师' },
{ text: '白领', value: '白领' },
{ text: '模特', value: '模特' },
{ text: '主播', value: '主播' },
{ text: '幼师', value: '幼师' },
{ text: 'coser', value: 'coser' },
{ text: '空乘', value: '空乘' },
{ text: '公关', value: '公关' },
{ text: '护士', value: '护士' },
];
// 身高选择器选项
const columnsHeight = Array.from({ length: 100 }, (_, i) => ({
label: i + 100 + 'cm',
value: i + 100,
})).reverse();
// 体重选择器选项
const columnsWeight = Array.from({ length: 80 }, (_, i) => ({
label: i + 20 + 'kg',
value: i + 20,
}));
// 职业选择器选项
const columnsOcc = [
{ text: '互联网', value: '互联网' },
{ text: '金融', value: '金融' },
{ text: '娱乐', value: '娱乐' },
{ text: 'CEO', value: 'CEO' },
{ text: '高管', value: '高管' },
{ text: '投资人', value: '投资人' },
{ text: '学生', value: '学生' },
{ text: '其他', value: '其他' },
{ text: '老师', value: '老师' },
{ text: '白领', value: '白领' },
{ text: '模特', value: '模特' },
{ text: '主播', value: '主播' },
{ text: '幼师', value: '幼师' },
{ text: 'coser', value: 'coser' },
{ text: '空乘', value: '空乘' },
{ text: '公关', value: '公关' },
{ text: '护士', value: '护士' },
];
</script>
+58 -76
View File
@@ -1,13 +1,6 @@
<template>
<wd-config-provider theme="dark">
<wd-navbar
title="魅力女生认证"
safeAreaInsetTop
fixed
placeholder
:bordered="false"
style="z-index: 999"
>
<wd-navbar title="魅力女生认证" safeAreaInsetTop placeholder :bordered="false" style="z-index: 999">
<template #left>
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52" />
@@ -15,7 +8,7 @@
</template>
</wd-navbar>
<view class="pt-20" style="height: calc(100vh - 44rpx - 200rpx)">
<view class="mt-30rpx">
<wd-steps :active="1" align-center>
<wd-step v-for="index in 4" :key="index" />
</wd-steps>
@@ -25,24 +18,13 @@
<view class="text-sm my-2 mx-8 c-#949494">请上传本人真实照片,更容易受到男士青睐</view>
<view class="h-60rpx"></view>
<view class="mx-8 mb-8">
<wd-upload
v-model:file-list="imageFileList"
:action="baseUrl + apiPath + '/infra/file/upload'"
:header="header"
image-mode="aspectFill"
accept="image"
multiple
:limit="9"
:max-size="3000000"
@success="uploadSuccess"
:before-remove="beforeRemove"
/>
<wd-upload v-model:file-list="imageFileList" :action="baseUrl + apiPath + '/infra/file/upload'" :header="header"
image-mode="aspectFill" accept="image" multiple :limit="9" :max-size="3000000" @success="uploadSuccess"
:before-remove="beforeRemove" />
</view>
<view
class="size-160rpx rounded-full bg-color-light text-center mx-auto line-height-160rpx active:bg-color"
@click="nextStep"
>
<view class="size-160rpx rounded-full bg-color-light text-center mx-auto line-height-160rpx active:bg-color"
@click="nextStep">
<uni-icons type="arrow-right" color="#D29E52" size="44" />
</view>
</view>
@@ -50,63 +32,63 @@
</template>
<script setup lang="ts">
// @ts-ignore
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
// @ts-ignore
import { getAccessToken } from '@/sheep/request';
import RecentApi from '@/sheep/api/member/recent';
import { useMessage } from '@/uni_modules/wot-design-uni';
// @ts-ignore
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
// @ts-ignore
import { getAccessToken } from '@/sheep/request';
import RecentApi from '@/sheep/api/member/recent';
import { useMessage } from '@/uni_modules/wot-design-uni';
import useAblum from '../use-ablum';
import { ref, watch } from 'vue';
import useAblum from '../use-ablum';
import { ref, watch } from 'vue';
const messageBox = useMessage();
const { ablumList, getUserAlbum } = useAblum();
const messageBox = useMessage();
const { ablumList, getUserAlbum } = useAblum();
const imageFileList = ref([]);
const imageFileList = ref([]);
watch(
() => ablumList.value,
(val) => {
imageFileList.value = val.map((item: any) => ({ url: item.address, id: item.id }));
},
{ immediate: true },
);
watch(
() => ablumList.value,
(val) => {
imageFileList.value = val.map((item: any) => ({ url: item.address, id: item.id }));
},
{ immediate: true },
);
const header = {
Accept: '*/*',
'tenant-id': tenantId,
Authorization: 'Bearer ' + getAccessToken(),
};
const header = {
Accept: '*/*',
'tenant-id': tenantId,
Authorization: 'Bearer ' + getAccessToken(),
};
const uploadSuccess = async ({ file }: any) => {
await RecentApi.saveUserAlbum({
address: JSON.parse(file.response).data,
resourceType: 'IMAGE',
const uploadSuccess = async ({ file }: any) => {
await RecentApi.saveUserAlbum({
address: JSON.parse(file.response).data,
resourceType: 'IMAGE',
});
await getUserAlbum();
};
// 相册移除确认
const beforeRemove = ({ file, fileList, resolve }: any) => {
messageBox
.confirm({
msg: '是否移除',
title: '提示',
})
.then(async () => {
const { code } = await RecentApi.deleteUserAlbum(file.id);
if (code === 0) {
await getUserAlbum();
resolve(true);
}
});
await getUserAlbum();
};
};
// 相册移除确认
const beforeRemove = ({ file, fileList, resolve }: any) => {
messageBox
.confirm({
msg: '是否移除',
title: '提示',
})
.then(async () => {
const { code } = await RecentApi.deleteUserAlbum(file.id);
if (code === 0) {
await getUserAlbum();
resolve(true);
}
});
};
const nextStep = () => {
if (imageFileList.value.length > 2 && imageFileList.value.length < 10) {
return uni.redirectTo({ url: '/pages/profile/face-verify/girl-verify-3' });
}
uni.showToast({ title: '请上传照片', icon: 'none' });
};
const nextStep = () => {
if (imageFileList.value.length > 2 && imageFileList.value.length < 10) {
return uni.redirectTo({ url: '/pages/profile/face-verify/girl-verify-3' });
}
uni.showToast({ title: '请上传照片', icon: 'none' });
};
</script>
+46 -47
View File
@@ -1,13 +1,6 @@
<template>
<wd-config-provider theme="dark">
<wd-navbar
title="魅力女生认证"
safeAreaInsetTop
fixed
placeholder
:bordered="false"
style="z-index: 999"
>
<wd-navbar title="魅力女生认证" safeAreaInsetTop placeholder :bordered="false" style="z-index: 999">
<template #left>
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52" />
@@ -15,7 +8,7 @@
</template>
</wd-navbar>
<view class="pt-20" style="height: calc(100vh - 44rpx - 200rpx)">
<view class="mt-30rpx">
<wd-steps :active="2" align-center>
<wd-step v-for="index in 4" :key="index" />
</wd-steps>
@@ -26,36 +19,23 @@
我们会保护你的隐私,联系方式只展示给审核人员和付费后的VIP男生
</view>
<view class="h-60rpx"></view>
<input
class="h-100rpx mx-8 my-4 rounded-50rpx bg-color-light px-40rpx text-32rpx text-color-theme"
v-model="wxInfo.wechatNumber"
type="text"
placeholder="请输入您的微信号"
placeholder-style="color: rgba(255, 255, 255, 0.6)"
:maxlength="20"
/>
<input class="h-100rpx mx-8 my-4 rounded-50rpx bg-color-light px-40rpx text-32rpx text-color-theme"
v-model="wxInfo.wechatNumber" type="text" placeholder="请输入您的微信号"
placeholder-style="color: rgba(255, 255, 255, 0.6)" :maxlength="20" />
<view class="flex-row-center my-6">
<s-uploader
v-model:url="wxInfo.wechatQrcode"
fileMediatype="image"
limit="1"
mode="grid"
:imageStyles="{
width: '268rpx',
height: '268rpx',
border: { width: '6rpx', color: '#D29E52', radius: '50rpx' },
}"
/>
<s-uploader v-model:url="wxInfo.wechatQrcode" fileMediatype="image" limit="1" mode="grid" :imageStyles="{
width: '268rpx',
height: '268rpx',
border: { width: '6rpx', color: '#D29E52', radius: '50rpx' },
}" />
</view>
<view class="text-sm mx-8 text-color-theme">
请上传与上方微信匹配的微信二维码以便客服核实
</view>
<view class="text-sm mx-8 text-color-theme">匹配不通过将不会认证通过哦~</view>
<view
class="size-160rpx rounded-full bg-color-light text-center mx-auto my-8 line-height-160rpx active:bg-color"
@click="nextStep"
>
<view class="size-160rpx rounded-full bg-color-light text-center mx-auto my-8 line-height-160rpx active:bg-color"
@click="nextStep">
<uni-icons type="arrow-right" color="#D29E52" size="44" />
</view>
</view>
@@ -63,23 +43,42 @@
</template>
<script setup lang="ts">
import RecentApi from '@/sheep/api/member/recent';
import { reactive } from 'vue';
import { computed, reactive } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
// 微信信息
const wxInfo = reactive({
wechatNumber: '',
wechatQrcode: '',
});
// @ts-ignore
import sheep from '@/sheep';
const nextStep = async () => {
if (wxInfo.wechatNumber && wxInfo.wechatQrcode) {
const { code, data } = await RecentApi.createWecahtAuth(wxInfo); // 创建微信认证
console.log('创建微信认证response:', code, data);
import RecentApi from '@/sheep/api/member/recent';
if (code !== 0) return;
return uni.redirectTo({ url: '/pages/profile/face-verify/girl-verify-4' });
// 微信信息
const wxInfo = reactive({
wechatNumber: '',
wechatQrcode: '',
});
const userInfo = computed(() => sheep.$store('user').userInfo);
onShow(() => {
sheep.$store('user').updateUserData();
if (userInfo.value) {
if (userInfo.value.wechatNum) {
wxInfo.wechatNumber = userInfo.value.wechatNum
}
uni.showToast({ title: '请完善微信信息', icon: 'none' });
};
if (userInfo.value.wechatQrCode) {
wxInfo.wechatQrcode = userInfo.value.wechatQrCode
}
}
})
const nextStep = async () => {
if (wxInfo.wechatNumber && wxInfo.wechatQrcode) {
const { code, data } = await RecentApi.createWecahtAuth(wxInfo); // 创建微信认证
console.log('创建微信认证response:', code, data);
if (code !== 0) return;
return uni.redirectTo({ url: '/pages/profile/face-verify/girl-verify-4' });
}
uni.showToast({ title: '请完善微信信息', icon: 'none' });
};
</script>
+111 -138
View File
@@ -1,13 +1,6 @@
<template>
<wd-config-provider theme="dark">
<wd-navbar
title="魅力女生认证"
safeAreaInsetTop
fixed
placeholder
:bordered="false"
style="z-index: 999"
>
<wd-navbar title="魅力女生认证" safeAreaInsetTop placeholder :bordered="false" style="z-index: 999">
<template #left>
<navigator open-type="navigateBack" hover-class="navigator-hover">
<uni-icons type="back" size="30" color="#D29E52" />
@@ -15,7 +8,7 @@
</template>
</wd-navbar>
<view class="pt-20" style="height: calc(100vh - 44rpx - 200rpx)">
<view class="mt-30rpx">
<wd-steps :active="3" align-center>
<wd-step v-for="index in 4" :key="index" />
</wd-steps>
@@ -25,54 +18,29 @@
<view class="text-sm my-2 mx-8 c-#949494">上传清晰的五官头像,让更多用户发现你~</view>
<view class="h-60rpx"></view>
<view class="mx-8 flex items-center">
<s-uploader
class="flex-1"
v-model:url="userinfo.avatar"
fileMediatype="image"
limit="1"
mode="grid"
<s-uploader class="flex-1" v-model:url="userinfo.avatar" fileMediatype="image" limit="1" mode="grid"
:imageStyles="{
width: '268rpx',
height: '268rpx',
border: { width: '6rpx', color: '#D29E52', radius: '50rpx' },
}"
/>
}" />
<view class="flex-1 flex-col-center">
<image class="w-160rpx h-180rpx" src="@/static/face-auth-prompt.png" mode="aspectFit" />
<view class="text-xs text-color-theme">确保本人头像</view>
<view class="text-xs text-color-theme">才能通过审核哦</view>
</view>
</view>
<wd-datetime-picker
v-model="userinfo.birthday"
label="生日"
title="生日"
type="date"
align-right
:default-value="Date.now()"
:min-date="new Date(1980, 1, 1).getTime()"
:max-date="Date.now()"
>
<wd-datetime-picker v-model="userinfo.birthday" label="生日" title="生日" type="date" align-right
:default-value="Date.now()" :min-date="new Date(1980, 1, 1).getTime()" :max-date="Date.now()">
<capsule-cell title="生日" :value="formatDate(userinfo.birthday, 'YYYY-MM-DD')" />
</wd-datetime-picker>
<input
class="h-100rpx mx-8 my-4 rounded-50rpx bg-color-light px-40rpx text-32rpx text-color-theme"
v-model="userinfo.nickname"
type="text"
placeholder="请输入昵称"
placeholder-style="color: rgba(255, 255, 255, 0.6)"
:maxlength="10"
/>
<capsule-cell
title="位置权限"
:value="locationAuth ? '已允许' : '未允许'"
@click="openLocationAuth"
/>
<input class="h-100rpx mx-8 my-4 rounded-50rpx bg-color-light px-40rpx text-32rpx text-color-theme"
v-model="userinfo.nickname" type="text" placeholder="请输入昵称" placeholder-style="color: rgba(255, 255, 255, 0.6)"
:maxlength="10" />
<capsule-cell title="位置权限" :value="locationAuth ? '已允许' : '未允许'" @click="openLocationAuth" />
<view
class="mx-auto mt-6 w-200rpx rounded-full p-3 text-center bg-color-theme-dark active:bg-color-theme"
@click="createFaceVerify"
>
<view class="mx-auto mt-6 w-200rpx rounded-full p-3 text-center bg-color-theme-dark active:bg-color-theme"
@click="createFaceVerify">
开始认证
</view>
</view>
@@ -80,107 +48,112 @@
</template>
<script setup lang="ts">
import { onLoad, onShow } from '@dcloudio/uni-app';
import CapsuleCell from '../components/capsule-cell.vue';
// @ts-ignore
import { formatDate } from '@/sheep/helper/utils';
import { reactive, ref } from 'vue';
// @ts-ignore
import UserApi from '@/sheep/api/member/user';
import RecentApi from '@/sheep/api/member/recent';
import verify from './ali-face-verify';
// @ts-ignore
import checkOpenGPSService from './openSettings.js';
import { onLoad, onShow } from '@dcloudio/uni-app';
import CapsuleCell from '../components/capsule-cell.vue';
// @ts-ignore
import { formatDate } from '@/sheep/helper/utils';
import { reactive, ref } from 'vue';
// @ts-ignore
import UserApi from '@/sheep/api/member/user';
import RecentApi from '@/sheep/api/member/recent';
import verify from './ali-face-verify';
// @ts-ignore
import checkOpenGPSService from './openSettings.js';
// 用户信息
const userinfo = reactive<any>({
avatar: '',
nickname: '',
birthday: '',
height: '',
weight: '',
occ: '',
description: '',
photo: [],
// 用户信息
const userinfo = reactive<any>({
avatar: '',
nickname: '',
birthday: '',
height: '',
weight: '',
occ: '',
description: '',
photo: [],
});
const locationAuth = ref(false);
onLoad(async () => {
uni.showLoading({ title: '加载中...' });
const { data } = await UserApi.getUserInfo();
Object.assign(userinfo, {
avatar: data.avatar,
birthday: data.birthday ?? '',
description: data.description,
height: data.height ?? '',
weight: data.weight ?? '',
mobile: data.mobile,
nickname: data.nickname,
wechatNum: data.wechatNum ?? '',
occ: data.occ ?? '',
sex: data.sex,
});
const locationAuth = ref(false);
uni.hideLoading();
onLoad(async () => {
uni.showLoading({ title: '加载中...' });
const { data } = await UserApi.getUserInfo();
Object.assign(userinfo, {
avatar: data.avatar,
birthday: data.birthday ?? '',
description: data.description,
height: data.height ?? '',
weight: data.weight ?? '',
mobile: data.mobile,
nickname: data.nickname,
occ: data.occ ?? '',
sex: data.sex,
});
uni.hideLoading();
checkOpenGPSService();
});
checkOpenGPSService();
onShow(() => {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
locationAuth.value = true;
const params = {
lat: String(res.latitude),
lon: String(res.longitude),
province: res.address?.province ?? '',
city: res.address?.city ?? '',
district: res.address?.district ?? '',
address: res.address?.street ?? '',
};
await RecentApi.updateUserLocation(params);
},
fail: () => {
locationAuth.value = false;
},
});
});
onShow(() => {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
locationAuth.value = true;
const params = {
lat: String(res.latitude),
lon: String(res.longitude),
province: res.address?.province ?? '',
city: res.address?.city ?? '',
district: res.address?.district ?? '',
address: res.address?.street ?? '',
};
await RecentApi.updateUserLocation(params);
},
fail: () => {
locationAuth.value = false;
},
});
const openLocationAuth = () => {
if (locationAuth.value) return;
checkOpenGPSService();
};
const createFaceVerify = async () => {
// #ifndef APP-PLUS
uni.showToast({ title: '当前设备不支持', icon: 'error' });
// #endif
if (!userinfo.birthday || !userinfo.nickname)
return uni.showToast({ title: '请完善信息', icon: 'none' });
if (!locationAuth.value) return uni.showToast({ title: '请先授权位置权限', icon: 'none' });
// #ifdef APP-PLUS
if (!userinfo.avatar) return uni.showToast({ title: '请先上传人脸照片', icon: 'error' });
console.log("userinfo:", userinfo.wechatNum);
const aliyunVerify = uni.requireNativePlugin('AP-FaceDetectModule');
const metaInfo = JSON.stringify(aliyunVerify.getMetaInfo());
// 创建女生人脸认证
const { code, data, msg } = await RecentApi.createGirlFaceVerify({
memberHeight: userinfo.height,
memberWeight: userinfo.weight,
memberWechatNumber: userinfo.wechatNum,
memberOcc: userinfo.occ,
memberDesc: userinfo.description,
authPic: userinfo.avatar,
metaInfoJson: metaInfo,
});
console.log('女 创建人脸认证接口responseData:', code, JSON.stringify(data));
const openLocationAuth = () => {
if (locationAuth.value) return;
checkOpenGPSService();
};
if (code !== 0) {
return uni.showToast({ title: msg ?? '请上传包含人脸的头像', icon: 'none', duration: 6000 });
}
const createFaceVerify = async () => {
// #ifndef APP-PLUS
uni.showToast({ title: '当前设备不支持', icon: 'error' });
// #endif
if (!userinfo.birthday || !userinfo.nickname)
return uni.showToast({ title: '请完善信息', icon: 'none' });
if (!locationAuth.value) return uni.showToast({ title: '请先授权位置权限', icon: 'none' });
// #ifdef APP-PLUS
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.wechatNumber,
memberOcc: userinfo.occ,
memberDesc: userinfo.description,
authPic: userinfo.avatar,
metaInfoJson: metaInfo,
});
console.log('女 创建人脸认证接口responseData:', code, data);
if (code !== 0)
return uni.showToast({ title: '请上传包含人脸的头像', icon: 'none', duration: 6000 });
verify(data.bizId, data.id);
// #endif
};
verify(data.bizId, data.id);
// #endif
};
</script>
+2 -2
View File
@@ -37,8 +37,8 @@ export default async (command: 'build' | 'serve', mode: string) => {
},
// 聊天相关api
'/api': {
// target: 'http://chatsever.zianxin.com',
target: 'http://127.0.0.1:8888',
target: 'http://chatsever.zianxin.com',
// target: 'http://127.0.0.1:8888',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},