feat:修复点赞和喜欢数;注册完善资料步骤;女生人脸认证步骤修复

This commit is contained in:
ctw committed 2025-12-09 11:50:38 +08:00
1 parent 0be6d590e4
commit 05f921349a
5 files changed
+261 -174

No files matched your search

+1 -1
View File
@@ -507,7 +507,7 @@
RecentApi.updateUserLocation(params);
},
fail: (err) => {
uni.showToast({ title: '位置信息获取失败,请打开系统定位', icon: 'none' });
// uni.showToast({ title: '位置信息获取失败,请打开系统定位', icon: 'none' });
},
});
+25 -13
View File
@@ -54,7 +54,7 @@
<capsule-cell title="职业" :value="userinfo.occ" />
</wd-picker>
<textarea
class="h-280rpx w-84% mx-auto my-4 rounded-10rpx bg-color-light p-10rpx text-32rpx text-color-theme"
class="h-280rpx w-78% mx-auto my-4 rounded-10rpx bg-color-light p-10rpx text-32rpx text-color-theme"
v-model="userinfo.description"
:maxlength="100"
placeholder="个人简介(100字以内)"
@@ -162,17 +162,17 @@
<view class="flex-row-center mt-6 gap-8">
<view
v-if="stepActive > 0"
class="size-100rpx rounded-full bg-color-light text-center line-height-100rpx active:bg-color"
class="size-160rpx rounded-full bg-color-light text-center line-height-160rpx active:bg-color"
@click="stepActive--"
>
<uni-icons type="arrow-left" color="#D29E52" size="36" />
<uni-icons type="arrow-left" color="#D29E52" size="44" />
</view>
<view
v-if="stepActive < 3"
class="size-100rpx rounded-full bg-color-light text-center line-height-100rpx active:bg-color"
class="size-160rpx rounded-full bg-color-light text-center line-height-160rpx active:bg-color"
@click="nextStep"
>
<uni-icons type="arrow-right" color="#D29E52" size="36" />
<uni-icons type="arrow-right" color="#D29E52" size="44" />
</view>
</view>
@@ -269,7 +269,7 @@
console.log('查询用户人脸认证状态', code, data);
if (code !== 0) return uni.showToast({ title: '查询用户人脸认证失败', icon: 'none' });
switch (data.authStatus) {
switch (data?.authStatus) {
case '1':
// 待认证
break;
@@ -287,7 +287,17 @@
onLoad(async () => {
await getFaceVerify();
const { data } = await UserApi.getUserInfo();
Object.assign(userinfo, data);
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,
});
});
// 下一步
@@ -367,7 +377,7 @@
useMsgBox: true,
extParams: null,
},
async function (response: any) {
function (response: any) {
console.log('认证结果', response);
switch (response.code) {
@@ -379,15 +389,17 @@
});
break;
case 1000:
uni.showToast({ title: '您已认证成功', icon: 'none' });
await UserApi.updateUser(userinfo);
sheep.$store('user').getInfo();
UserApi.updateUser(userinfo).then(() => {
sheep.$store('user').getInfo();
uni.showToast({ title: '您已认证成功', icon: 'none' });
});
break;
case 1001:
await RecentApi.cancelFaceVerify({ authId });
// uni.showToast({ title: '系统错误', icon: 'none' });
RecentApi.cancelFaceVerify({ authId });
uni.showToast({ title: '系统错误', icon: 'none' });
break;
case 1003:
RecentApi.cancelFaceVerify({ authId });
uni.showToast({ title: '验证中断', icon: 'none' });
break;
case 2002:
+118 -41
View File
@@ -1,42 +1,111 @@
<template>
<wd-config-provider theme="dark">
<wd-navbar title="选择性别" fixed safeAreaInsetTop :bordered="false"></wd-navbar>
</wd-config-provider>
<wd-config-provider theme="dark" :theme-vars="{ darkBackground2: '#1b1b1b' }">
<wd-navbar
:title="curStep === 0 ? '选择性别' : '完善资料'"
fixed
safeAreaInsetTop
:bordered="false"
></wd-navbar>
<view class="flex-col-center px-6 pt-40">
<view class="text-center mb-12 text-base">请选择您的性别</view>
<view class="flex justify-center gap-6">
<view class="flex-col-center">
<view
class="flex-col-center w-240rpx h-250rpx rounded-full bg-#444 transition-all duration-300 border-2 border-solid"
:style="{ border: userInfo.sex === 1 ? '8rpx solid #D29E52' : '8rpx solid transparent' }"
@click="userInfo.sex = 1"
>
<image class="size-120rpx" src="@/static/gender-man.png" mode="aspectFill" />
</view>
<text class="text-lg mt-1">男</text>
</view>
<view class="flex-col-center">
<view
class="flex-col-center w-240rpx h-250rpx rounded-full bg-#444 transition-all duration-100 border-2 border-solid"
:style="{ border: userInfo.sex === 2 ? '8rpx solid #D29E52' : '8rpx solid transparent' }"
@click="userInfo.sex = 2"
>
<image class="size-120rpx" src="@/static/gender-woman.png" mode="aspectFill" />
</view>
<text class="text-lg mt-1">女</text>
</view>
</view>
<view
class="bg-color-theme-dark px-10 py-2 mt-10 text-lg rounded-full c-black active:bg-color-theme"
@click="handleSave"
<swiper
:current="curStep"
style="height: calc(100vh - 44rpx)"
@change="(e) => (curStep = e.detail.current)"
:duration="200"
disable-touch
>
保 存
</view>
</view>
<swiper-item>
<view class="flex-col-center px-6 pt-40">
<view class="text-center mb-12 text-base">请选择您的性别</view>
<view class="flex justify-center gap-6">
<view class="flex-col-center">
<view
class="flex-col-center w-240rpx h-250rpx rounded-full bg-#444 transition-all duration-300 border-2 border-solid"
:style="{
border: userInfo.sex === 1 ? '8rpx solid #D29E52' : '8rpx solid transparent',
}"
@click="userInfo.sex = 1"
>
<image class="size-120rpx" src="@/static/gender-man.png" mode="aspectFill" />
</view>
<text class="text-lg mt-1">男</text>
</view>
<view class="flex-col-center">
<view
class="flex-col-center w-240rpx h-250rpx rounded-full bg-#444 transition-all duration-100 border-2 border-solid"
:style="{
border: userInfo.sex === 2 ? '8rpx solid #D29E52' : '8rpx solid transparent',
}"
@click="userInfo.sex = 2"
>
<image class="size-120rpx" src="@/static/gender-woman.png" mode="aspectFill" />
</view>
<text class="text-lg mt-1">女</text>
</view>
</view>
<view
class="bg-color-theme-dark px-20 py-2 mt-10 text-lg rounded-full c-black active:bg-color-theme"
@click="nextStep"
>
下一步
</view>
</view>
</swiper-item>
<swiper-item>
<view class="flex-row-center mt-200rpx mb-100rpx">
<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' },
}"
/>
</view>
<view class="px-2">
<wd-cell-group>
<wd-cell title="昵称" value="输入">
<template #default>
<input type="text" v-model="userInfo.nickname" :maxlength="12" />
</template>
</wd-cell>
<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-cell-group>
<wd-cell title="邀请码" value="请输入邀请码">
<template #default>
<input type="text" v-model="userInfo.invitationCode" :maxlength="12" />
</template>
</wd-cell>
</view>
<view class="flex-col-center px-6 pt-10">
<view
v-if="curStep === 1"
class="bg-color-theme-dark px-16 py-2 mt-10 text-lg rounded-full c-black active:bg-color-theme"
@click="handleSave"
>
保 存
</view>
</view>
</swiper-item>
</swiper>
</wd-config-provider>
</template>
<script setup lang="ts">
@@ -49,23 +118,31 @@
// sex选中的性别:0-未知,1-男,2-女
const userInfo = ref<any>({});
const curStep = ref(0);
onLoad(async () => {
const { data = null } = await UserApi.getUserInfo();
userInfo.value = data ?? [];
});
// 下一步
const nextStep = () => {
if (!userInfo.value.sex) return uni.showToast({ title: '请选择性别', icon: 'none' });
curStep.value++;
};
const handleSave = async () => {
if (userInfo.value.sex != 1 && userInfo.value.sex != 2) {
sheep.$helper.toast('请选择性别');
return;
}
if (userInfo.value.sex != 1 && userInfo.value.sex != 2)
return sheep.$helper.toast('请选择性别');
if (!userInfo.value.avatar) return sheep.$helper.toast('请完善头像');
if (!userInfo.value.nickname) return sheep.$helper.toast('请完善昵称');
if (!userInfo.value.birthday) return sheep.$helper.toast('请完善生日');
await UserApi.updateUser(userInfo.value);
await sheep.$store('user').getInfo();
sheep.$helper.toast('保存成功');
setTimeout(() => {
uni.reLaunch({ url: '/pages/home/home' });
}, 500);
}, 300);
};
</script>
+2 -2
View File
@@ -190,7 +190,7 @@
// @ts-ignore
import sheep from '@/sheep';
import RecentApi from '@/sheep/api/member/recent';
import { onLoad } from '@dcloudio/uni-app';
import { onShow } from '@dcloudio/uni-app';
// @ts-ignore
import { fen2yuan } from '@/sheep/hooks/useGoods';
@@ -232,7 +232,7 @@
return '';
});
onLoad(async () => {
onShow(async () => {
const { data: totalData } = await RecentApi.recentTotal();
recentTotal.value = totalData ?? {};
});
+115 -117
View File
@@ -1,7 +1,11 @@
<template>
<view class="border-1 border-b-solid border-#444444 px-4 py-4">
<view class="mb-1 flex items-center" @click="detail">
<image :src="member.memberAvatar" class="mr-3 size-120rpx rounded-full bg-#333333" mode="aspectFill" />
<image
:src="member.memberAvatar"
class="mr-3 size-120rpx rounded-full bg-#333333"
mode="aspectFill"
/>
<view class="flex-1 overflow-hidden">
<view class="flex justify-between items-center">
<text class="text-base truncate">{{ member?.memberNickname }}</text>
@@ -10,8 +14,11 @@
</text>
</view>
<view class="flex my-1">
<view v-for="(item, index) in data.memberTagList" :key="index"
class="mr-2 flex items-center px-1 text-18rpx text-black rounded-4rpx bg-color-theme-dark">
<view
v-for="(item, index) in data.memberTagList"
:key="index"
class="mr-2 flex items-center px-1 text-18rpx text-black rounded-4rpx bg-color-theme-dark"
>
<wd-icon name="discount-filled" size="10px" color="#000" />
<text class="whitespace-nowrap">{{ item.tagTitle }}</text>
</view>
@@ -26,8 +33,14 @@
<view class="mb-30rpx pl-140rpx">
<text class="leading-[1.5] text-white">{{ data.description }}</text>
<view class="mt-20rpx flex flex-wrap gap-20rpx">
<image v-for="(pic, index) in data.coverPic?.split(',')" :key="index" :src="pic"
class="size-260rpx rounded-10rpx bg-#333333" mode="aspectFill" @click="previewImage(pic)" />
<image
v-for="(pic, index) in data.coverPic?.split(',')"
:key="index"
:src="pic"
class="size-260rpx rounded-10rpx bg-#333333"
mode="aspectFill"
@click="previewImage(pic)"
/>
<template v-if="false" v-for="video in data.coverVideo?.split(',')">
<!-- #ifdef APP-PLUS -->
<su-video class="size-260rpx rounded-10rpx bg-#333333" :src="video" />
@@ -43,11 +56,10 @@
<text> {{ data.issueCity }} · {{ data.distance?.toFixed(2) || 0 }}km </text>
</view>
<view class="flex gap-60rpx pl-130rpx text-white">
<view v-if="props.showLike" class="flex items-center gap-10rpx text-sm">
<uni-icons v-if="isLike || data.recentOperationStatus?.isLike" type="heart-filled" size="22" color="#D29E52"
@click="handleunLike" />
<uni-icons v-else type="heart" size="22" color="#B5B4BC" @click="handleLike" />
<text>{{ operationTotal?.likeTotal || 0 }} 喜欢</text>
<view v-if="props.showLike" class="flex items-center gap-10rpx text-sm" @click="handleLike">
<uni-icons v-if="isLike" type="heart-filled" size="22" color="#D29E52" />
<uni-icons v-else type="heart" size="22" color="#B5B4BC" />
<text>{{ operationTotal }} 喜欢</text>
</view>
<view v-if="props.showChat" class="flex items-center gap-10rpx text-sm" @click="goChat">
<uni-icons type="chat" size="22" color="#B5B4BC" />
@@ -58,126 +70,112 @@
</template>
<script setup lang="ts">
// @ts-nocheck
import RecentApi from '@/sheep/api/member/recent';
import { computed, onMounted, reactive, ref } from 'vue';
import { formatDate } from '@/sheep/util/index';
import { getGender } from '@/sheep/util/index';
import useConfigStore from '@/chat-store/configStore.js';
import useChatStore from '@/chat-store/chatStore.js';
import useFriendStore from '@/chat-store/friendStore.js';
import request from '@/common/request';
// @ts-nocheck
import RecentApi from '@/sheep/api/member/recent';
import { computed, onMounted, reactive, ref } from 'vue';
import { formatDate } from '@/sheep/util/index';
import { getGender } from '@/sheep/util/index';
import useConfigStore from '@/chat-store/configStore.js';
import useChatStore from '@/chat-store/chatStore.js';
import useFriendStore from '@/chat-store/friendStore.js';
import request from '@/common/request';
const props = withDefaults(
defineProps<{
data: any;
showLike?: boolean;
showChat?: boolean;
}>(),
{
showLike: true,
showChat: true,
},
);
const emit = defineEmits<(e: 'detail') => void>();
const props = withDefaults(
defineProps<{
data: any;
showLike?: boolean;
showChat?: boolean;
}>(),
{
showLike: true,
showChat: true,
},
);
const emit = defineEmits<(e: 'detail') => void>();
const member = computed(() => props.data.member || {});
const member = computed(() => props.data.member || {});
const isLike = ref(false);
const params = reactive({
memberId: member.value.memberId, // 被操作的用户id
memberRecentId: props.data.id, // 当前朋友圈的编号,不能为空
// 朋友圈操作类型,不能为空
action: '',
// RECENT_LIKE-朋友圈-点赞
// RECENT_SHIELD-朋友圈-屏蔽
// RECENT_REPORT-朋友圈-举报
});
const operationTotal = ref({});
onMounted(() => {
operationTotal.value = props.data.operationTotal;
});
// 图片预览
const previewImage = (img: string) => {
uni.previewImage({
urls: [img],
const isLike = ref(props.data.recentOperationStatus?.isLike);
const operationTotal = ref(props.data.operationTotal?.likeTotal || 0);
const params = reactive({
memberId: member.value.memberId, // 被操作的用户id
memberRecentId: props.data.id, // 当前朋友圈的编号,不能为空
// 朋友圈操作类型,不能为空
action: '',
// RECENT_LIKE-朋友圈-点赞
// RECENT_SHIELD-朋友圈-屏蔽
// RECENT_REPORT-朋友圈-举报
});
};
// 喜欢
const handleLike = async () => {
params.action = 'RECENT_LIKE';
const { code } = await RecentApi.recentOperate(params);
if (code !== 0) return;
// 图片预览
const previewImage = (img: string) => {
uni.previewImage({
urls: [img],
});
};
isLike.value = true;
if (
operationTotal.value.recentLikeTotal === undefined ||
operationTotal.value.recentLikeTotal === null
) {
operationTotal.value.recentLikeTotal = 1;
} else {
operationTotal.value.recentLikeTotal++;
}
};
// 喜欢
const handleLike = async () => {
params.action = 'RECENT_LIKE';
const { code } = await RecentApi.recentOperate(params);
if (code !== 0) return;
// 取消喜欢
const handleunLike = async () => { };
isLike.value = !isLike.value;
isLike.value ? operationTotal.value++ : operationTotal.value--;
};
// 打招呼 私聊
const goChat = async () => {
if (!member.value.memberId) return uni.showToast({ title: '用户不存在' });
const { code } = await RecentApi.chatAddFriend({
friendUserId: member.value.memberId,
});
if (code !== 0) return uni.showToast({ title: '好友添加失败', icon: 'error' });
// 打招呼 私聊
const goChat = async () => {
if (!member.value.memberId) return uni.showToast({ title: '用户不存在' });
const { code } = await RecentApi.chatAddFriend({
friendUserId: member.value.memberId,
});
if (code !== 0) return uni.showToast({ title: '好友添加失败', icon: 'error' });
const friendStore = useFriendStore();
const configStore = useConfigStore();
const chatStore = useChatStore();
const friendStore = useFriendStore();
const configStore = useConfigStore();
const chatStore = useChatStore();
request({
url: '/user/find/' + member.value.memberId,
method: 'GET',
}).then((user: any) => {
let friendInfo = user;
request({
url: '/user/find/' + member.value.memberId,
method: 'GET',
}).then((user: any) => {
let friendInfo = user;
const friend = {
id: friendInfo.id,
nickName: friendInfo.nickName,
headImage: friendInfo.headImageThumb,
online: friendInfo.online,
deleted: false,
};
friendStore.addFriend(friend);
const friend = {
id: friendInfo.id,
nickName: friendInfo.nickName,
headImage: friendInfo.headImageThumb,
online: friendInfo.online,
deleted: false,
};
friendStore.addFriend(friend);
const chat: any = {
type: 'PRIVATE',
targetId: friendInfo.id,
showName: friendInfo.nickName,
headImage: friendInfo.headImageThumb,
isDnd: friendInfo.isDnd,
};
chatStore.openChat(chat);
const chatIdx = chatStore.findChatIdx(chat);
const chat: any = {
type: 'PRIVATE',
targetId: friendInfo.id,
showName: friendInfo.nickName,
headImage: friendInfo.headImageThumb,
isDnd: friendInfo.isDnd,
};
chatStore.openChat(chat);
const chatIdx = chatStore.findChatIdx(chat);
// 防止初始化期间进入会话导致的消息不刷新
if (!configStore.appInit || chatStore.loading) {
uni.showToast({
title: '正在初始化页面,请稍后...',
icon: 'none',
});
return;
}
// 防止初始化期间进入会话导致的消息不刷新
if (!configStore.appInit || chatStore.loading) {
uni.showToast({
title: '正在初始化页面,请稍后...',
icon: 'none',
});
return;
}
uni.navigateTo({ url: '/pages/message/chat-box?chatIdx=' + chatIdx });
});
};
uni.navigateTo({ url: '/pages/message/chat-box?chatIdx=' + chatIdx });
});
};
// 详情
const detail = () => {
emit('detail');
};
// 详情
const detail = () => {
emit('detail');
};
</script>