This commit is contained in:
dzc committed 2025-12-05 10:17:14 +08:00
1 parent 50bca31432
commit b77471d4ce
2 files changed
+146 -169

No files matched your search

+28 -33
View File
@@ -14,13 +14,8 @@
</template>
</wd-navbar>
<swiper
:current="current"
style="height: calc(100vh - 44rpx - 100rpx)"
@change="(e) => (current = e.detail.current)"
:duration="200"
disable-touch
>
<swiper :current="current" style="height: calc(100vh - 44rpx - 100rpx)"
@change="(e) => (current = e.detail.current)" :duration="200" disable-touch>
<swiper-item v-for="(item, index) in segmentedItems" :key="index">
<scroll-user :scene="item['search-action']" />
</swiper-item>
@@ -31,34 +26,34 @@
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';
import segmented from '@/sheep/components/segmented/segmented.vue';
import RecentApi from '@/sheep/api/member/recent';
import ScrollUser from './components/scroll-user.vue';
// @ts-ignore
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, ref } from 'vue';
import segmented from '@/sheep/components/segmented/segmented.vue';
import RecentApi from '@/sheep/api/member/recent';
import ScrollUser from './components/scroll-user.vue';
// @ts-ignore
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
const current = ref(0);
const segmentedItems = ref([]);
const userCity = computed(() => sheep.$store('user').userCity);
const current = ref(0);
const segmentedItems = ref([]);
const userCity = computed(() => sheep.$store('user').userCity);
onLoad(async () => {
// 获取顶部导航栏tab菜单
const { data } = await RecentApi.getSquareTabMenu();
if (data && data.length > 0) {
segmentedItems.value = data;
}
});
onLoad(async () => {
// 获取顶部导航栏tab菜单
const { data } = await RecentApi.getSquareTabMenu();
if (data && data.length > 0) {
segmentedItems.value = data;
}
});
const goSelectAddress = () => {
uni.navigateTo({
url: '/pages/home/city',
events: {
changeCity: async () => {
// await refreshList();
},
const goSelectAddress = () => {
uni.navigateTo({
url: '/pages/home/city',
events: {
changeCity: async () => {
// await refreshList();
},
});
};
},
});
};
</script>
+118 -136
View File
@@ -1,11 +1,7 @@
<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>
@@ -14,11 +10,8 @@
</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>
@@ -33,14 +26,8 @@
<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" />
@@ -57,15 +44,10 @@
</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-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?.recentLikeTotal || 0 }} 喜欢</text>
<text>{{ operationTotal?.likeTotal || 0 }} 喜欢</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" />
@@ -76,126 +58,126 @@
</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 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 operationTotal = ref({});
};
onMounted(() => {
operationTotal.value = props.data.operationTotal;
// 喜欢
const handleLike = async () => {
params.action = 'RECENT_LIKE';
const { code } = await RecentApi.recentOperate(params);
if (code !== 0) return;
isLike.value = true;
if (
operationTotal.value.recentLikeTotal === undefined ||
operationTotal.value.recentLikeTotal === null
) {
operationTotal.value.recentLikeTotal = 1;
} else {
operationTotal.value.recentLikeTotal++;
}
};
// 取消喜欢
const handleunLike = async () => { };
// 打招呼 私聊
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 previewImage = (img: string) => {
uni.previewImage({
urls: [img],
});
};
const friendStore = useFriendStore();
const configStore = useConfigStore();
const chatStore = useChatStore();
// 喜欢
const handleLike = async () => {
params.action = 'RECENT_LIKE';
const { code } = await RecentApi.recentOperate(params);
if (code !== 0) return;
request({
url: '/user/find/' + member.value.memberId,
method: 'GET',
}).then((user: any) => {
let friendInfo = user;
isLike.value = true;
if (
operationTotal.value.recentLikeTotal === undefined ||
operationTotal.value.recentLikeTotal === null
) {
operationTotal.value.recentLikeTotal = 1;
} else {
operationTotal.value.recentLikeTotal++;
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);
// 防止初始化期间进入会话导致的消息不刷新
if (!configStore.appInit || chatStore.loading) {
uni.showToast({
title: '正在初始化页面,请稍后...',
icon: 'none',
});
return;
}
};
// 取消喜欢
const handleunLike = async () => {};
uni.navigateTo({ url: '/pages/message/chat-box?chatIdx=' + chatIdx });
});
};
// 打招呼 私聊
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();
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 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;
}
uni.navigateTo({ url: '/pages/message/chat-box?chatIdx=' + chatIdx });
});
};
// 详情
const detail = () => {
emit('detail');
};
// 详情
const detail = () => {
emit('detail');
};
</script>