feat:修复朋友圈详情页刷新;修复私聊;朋友圈操作
This commit is contained in:
1 parent
4fc92459a0
commit
18d42d3e05
8 files changed
+217
-130
No files matched your search
@@ -9,7 +9,7 @@ SHOPRO_API_PATH=/app-api
|
||||
SHOPRO_DEV_BASE_URL = http://chatapi.zianxin.com
|
||||
|
||||
# 后端接口 - 正式环境(通过 process.env.NODE_ENV != development)
|
||||
SHOPRO_BASE_URL=http://api-dashboard.yudao.iocoder.cn
|
||||
SHOPRO_BASE_URL=http://chatapi.zianxin.com
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
|
||||
SHOPRO_UPLOAD_TYPE=server
|
||||
|
||||
+1
-1
@@ -388,7 +388,7 @@
|
||||
return group;
|
||||
},
|
||||
exit() {
|
||||
console.log('1exit');
|
||||
console.log('exit');
|
||||
this.isExit = true;
|
||||
wsApi.close(3099);
|
||||
uni.removeStorageSync('loginInfo');
|
||||
|
||||
+5
-5
@@ -1,12 +1,11 @@
|
||||
const ENV = 'DEV'; //设置环境(打包前修改此变量)
|
||||
const ENV = process.env.NODE_ENV === 'development' ? 'DEV' : 'PROD';
|
||||
|
||||
const CHAT_ENV = {};
|
||||
|
||||
// 开发
|
||||
if (ENV == 'DEV') {
|
||||
CHAT_ENV.BASE_URL = 'http://chatsever.zianxin.com';
|
||||
// CHAT_ENV.BASE_URL = "https://www.boxim.online/api";
|
||||
CHAT_ENV.WS_URL = 'ws://chatapp.zianxin.com/im';
|
||||
// CHAT_ENV.WS_URL = "wss://www.boxim.online/im";
|
||||
|
||||
// H5 走本地代理解决跨域问题
|
||||
// #ifdef H5
|
||||
@@ -14,9 +13,10 @@ if (ENV == 'DEV') {
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 生产
|
||||
if (ENV == 'PROD') {
|
||||
CHAT_ENV.BASE_URL = 'https://www.boxim.online/api';
|
||||
CHAT_ENV.WS_URL = 'wss://www.boxim.online/im';
|
||||
CHAT_ENV.BASE_URL = 'http://chatsever.zianxin.com';
|
||||
CHAT_ENV.WS_URL = 'ws://chatapp.zianxin.com/im';
|
||||
}
|
||||
|
||||
export default CHAT_ENV;
|
||||
@@ -113,7 +113,7 @@
|
||||
align-items: center;
|
||||
background-color: $im-bg;
|
||||
white-space: nowrap;
|
||||
border-bottom: 1px solid $im-border;
|
||||
border-top: 1px solid $im-border;
|
||||
|
||||
&:hover {
|
||||
background-color: $im-bg-active;
|
||||
|
||||
+76
-48
@@ -18,7 +18,12 @@
|
||||
{{ userDetail.member?.memberCity ? userDetail.member?.memberCity + ' · ' : '' }}
|
||||
{{ userDetail.distance?.toFixed(2) }}km
|
||||
</view>
|
||||
<uni-icons type="more-filled" size="28" color="#ffcd32"></uni-icons>
|
||||
<uni-icons
|
||||
type="more-filled"
|
||||
size="28"
|
||||
color="#ffcd32"
|
||||
@click="actionShow = true"
|
||||
></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
@@ -117,38 +122,46 @@
|
||||
/>
|
||||
</view>
|
||||
</scroll-list>
|
||||
</wd-config-provider>
|
||||
|
||||
<view class="fixed bottom-100 left-0 right-0 flex justify-around bg-transparent">
|
||||
<view class="text-base py-2 px-10 rounded-full bg-color-theme-dark flex gap-2" @click="goChat">
|
||||
<uni-icons type="chat" size="24" color="#B5B4BC"></uni-icons>
|
||||
<text>私聊</text>
|
||||
<view class="fixed bottom-100 left-0 right-0 flex justify-around bg-transparent">
|
||||
<view
|
||||
class="text-base py-2 px-10 rounded-full bg-color-theme-dark flex gap-2"
|
||||
@click="goChat"
|
||||
>
|
||||
<uni-icons type="chat" size="24" color="#B5B4BC"></uni-icons>
|
||||
<text>私聊</text>
|
||||
</view>
|
||||
<view
|
||||
class="text-base py-2 px-10 rounded-full bg-white c-black flex gap-2"
|
||||
@click="handleLike"
|
||||
>
|
||||
<uni-icons type="heart" size="24" color="#B5B4BC"></uni-icons>
|
||||
<text>喜欢</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-base py-2 px-10 rounded-full bg-white c-black flex gap-2" @click="handleLike">
|
||||
<uni-icons type="heart" size="24" color="#B5B4BC"></uni-icons>
|
||||
<text>喜欢</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<wd-action-sheet
|
||||
v-model="actionShow"
|
||||
:actions="actionList"
|
||||
@select="actionSelect"
|
||||
cancel-text="取消"
|
||||
/>
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, getCurrentInstance, reactive } from 'vue';
|
||||
// @ts-nocheck
|
||||
import { ref, computed, getCurrentInstance, reactive, onMounted } from 'vue';
|
||||
import MomentCard from '@/sheep/components/moment-card/moment-card.vue';
|
||||
import ScrollList from '@/sheep/components/scroll-list/scroll-list.vue';
|
||||
import useScroll from '@/sheep/hooks/use-scroll';
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
// @ts-ignore
|
||||
import { getGender } from '@/sheep/util/index';
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
// @ts-ignore
|
||||
import useConfigStore from '@/chat-store/configStore.js';
|
||||
// @ts-ignore
|
||||
import useChatStore from '@/chat-store/chatStore.js';
|
||||
// @ts-ignore
|
||||
import useFriendStore from '@/chat-store/friendStore.js';
|
||||
// @ts-ignore
|
||||
import request from '@/common/request';
|
||||
|
||||
const userCity = computed(() => sheep.$store('user').userCity);
|
||||
@@ -160,6 +173,16 @@
|
||||
});
|
||||
const scrollTop = ref(0);
|
||||
const userDetail = ref<any>({});
|
||||
const actionShow = ref(false);
|
||||
const actionList = ref([
|
||||
{
|
||||
name: '选项1',
|
||||
},
|
||||
{
|
||||
name: '选项2',
|
||||
color: '#0083ff',
|
||||
},
|
||||
]);
|
||||
|
||||
onLoad((options: any) => {
|
||||
const { memberId } = options;
|
||||
@@ -174,6 +197,10 @@
|
||||
});
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
refreshList();
|
||||
});
|
||||
|
||||
const { listData, loadMoreStatus, refreshList, listLoadMore } = useScroll(
|
||||
RecentApi.quickPage,
|
||||
params,
|
||||
@@ -227,50 +254,51 @@
|
||||
const friendStore = useFriendStore();
|
||||
const configStore = useConfigStore();
|
||||
const chatStore = useChatStore();
|
||||
let friendInfo: any = {};
|
||||
|
||||
request({
|
||||
url: '/user/find/' + userDetail.value.memberId,
|
||||
method: 'GET',
|
||||
}).then((user: any) => {
|
||||
console.log(user);
|
||||
friendInfo = user;
|
||||
let friendInfo = user;
|
||||
|
||||
const friend = {
|
||||
id: user.id,
|
||||
nickName: user.nickName,
|
||||
headImage: user.headImageThumb,
|
||||
online: user.online,
|
||||
id: friendInfo.id,
|
||||
nickName: friendInfo.nickName,
|
||||
headImage: friendInfo.headImageThumb,
|
||||
online: friendInfo.online,
|
||||
deleted: false,
|
||||
};
|
||||
friendStore.addFriend(friend);
|
||||
});
|
||||
|
||||
let chat: any = {
|
||||
type: 'PRIVATE',
|
||||
targetId: friendInfo.id,
|
||||
showName: friendInfo.nickName,
|
||||
headImage: friendInfo.headImageThumb,
|
||||
};
|
||||
// if (this.isFriend) {
|
||||
// chat.isDnd = this.friendInfo.isDnd;
|
||||
// }
|
||||
chatStore.openChat(chat);
|
||||
let chatIdx = chatStore.findChatIdx(chat);
|
||||
uni.navigateTo({
|
||||
url: '/pages/message/chat-box?chatIdx=' + chatIdx,
|
||||
});
|
||||
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 });
|
||||
});
|
||||
};
|
||||
|
||||
function actionSelect({ item, index }) {
|
||||
console.log(item, index);
|
||||
|
||||
// toast.show(`当前选中项: ${item.title}, 下标: ${index}`);
|
||||
}
|
||||
|
||||
// 喜欢
|
||||
const handleLike = () => {
|
||||
uni.showToast({ title: '功能开发中...' });
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
placeholder="请输入手机号"
|
||||
placeholder-style="color: rgba(255, 255, 255, 0.6)"
|
||||
v-model="phone"
|
||||
maxlength="11"
|
||||
/>
|
||||
</view>
|
||||
<view class="relative flex w-full items-center">
|
||||
@@ -24,6 +25,7 @@
|
||||
placeholder="验证码"
|
||||
placeholder-style="color: rgba(255, 255, 255, 0.6)"
|
||||
v-model="smsCode"
|
||||
maxlength="6"
|
||||
/>
|
||||
<view
|
||||
class="absolute right-20rpx rounded-16rpx bg-color-theme-dark px-20rpx py-16rpx text-12px"
|
||||
|
||||
@@ -60,15 +60,15 @@
|
||||
<uni-icons
|
||||
v-if="isLike"
|
||||
type="heart-filled"
|
||||
size="24"
|
||||
size="22"
|
||||
color="#ffcd32"
|
||||
@click="handleunLike"
|
||||
/>
|
||||
<uni-icons v-else type="heart" size="24" color="#B5B4BC" @click="handleLike" />
|
||||
<uni-icons v-else type="heart" size="22" color="#B5B4BC" @click="handleLike" />
|
||||
<text>{{ data.operationTotal || 0 }} 喜欢</text>
|
||||
</view>
|
||||
<view class="flex items-center gap-10rpx text-sm" @click="goChat">
|
||||
<uni-icons type="chat" size="24" color="#B5B4BC" />
|
||||
<view v-if="!pageId" class="flex items-center gap-10rpx text-sm" @click="goChat">
|
||||
<uni-icons type="chat" size="22" color="#B5B4BC" />
|
||||
<text>打招呼</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -76,12 +76,16 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// @ts-nocheck
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
// @ts-ignore
|
||||
import { formatDate } from '@/sheep/util/index';
|
||||
// @ts-ignore
|
||||
import { getGender } from '@/sheep/util/index';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
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 = defineProps<{
|
||||
data: any;
|
||||
@@ -89,24 +93,33 @@
|
||||
const emit = defineEmits<(e: 'detail') => void>();
|
||||
|
||||
const member = computed(() => props.data.member || {});
|
||||
const pageId = ref();
|
||||
|
||||
onLoad((options: any) => {
|
||||
const { memberId = null } = options;
|
||||
pageId.value = memberId;
|
||||
});
|
||||
|
||||
const isLike = ref(false);
|
||||
const params = reactive({
|
||||
memberId: 7, // 被操作的用户id
|
||||
memberRecentId: 8, // 用户朋友圈编号-不能为空
|
||||
// 朋友圈操作类型 不能为空
|
||||
memberId: member.value.memberId, // 被操作的用户id
|
||||
memberRecentId: props.data.id, // 当前朋友圈的编号,不能为空
|
||||
// 朋友圈操作类型,不能为空
|
||||
// RECENT_LIKE-朋友圈-点赞
|
||||
|
||||
// RECENT_REPORT-朋友圈-举报
|
||||
// RECENT_SHIELD-朋友圈-屏蔽
|
||||
|
||||
// MEMBER_COLLECT-用户-收藏
|
||||
// MEMBER_SHIELD-用户-屏蔽
|
||||
// MEMBER_REPORT-用户-举报
|
||||
// MEMBER_RATING-用户-评价
|
||||
action: '',
|
||||
reportType: '1', // 举报类型
|
||||
scoreSc: 5, // 身材评分
|
||||
scoreNx: 4, // 耐心评分
|
||||
scoreSk: 3, // 爽快评分
|
||||
scoreYq: 2, // 有趣评分
|
||||
scoreSc: 0, // 身材评分
|
||||
scoreNx: 0, // 耐心评分
|
||||
scoreSk: 0, // 爽快评分
|
||||
scoreYq: 0, // 有趣评分
|
||||
});
|
||||
|
||||
// 图片预览
|
||||
@@ -120,20 +133,62 @@
|
||||
const handleLike = async () => {
|
||||
params.action = 'RECENT_LIKE';
|
||||
const { code } = await RecentApi.recentOperate(params);
|
||||
if (code == 200) {
|
||||
if (code === 0) {
|
||||
isLike.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
// 取消喜欢
|
||||
const handleunLike = async () => {
|
||||
await RecentApi.recentOperate(params);
|
||||
isLike.value = false;
|
||||
};
|
||||
const handleunLike = async () => {};
|
||||
|
||||
// 去聊天
|
||||
const goChat = () => {
|
||||
uni.showToast({ title: '功能开发中...' });
|
||||
// 打招呼 私聊
|
||||
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 });
|
||||
});
|
||||
};
|
||||
|
||||
// 详情
|
||||
|
||||
@@ -1,61 +1,63 @@
|
||||
<template>
|
||||
<view class="flex px-4 py-2">
|
||||
<image
|
||||
class="w-200rpx h-300rpx mr-3 rounded-2 bg-#777"
|
||||
:src="data.coverPic?.split(',')[0]"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view class="flex-1 overflow-hidden">
|
||||
<view class="flex justify-between items-center mt-2">
|
||||
<text class="text-sm truncate">{{ member.memberNickname }}</text>
|
||||
<text class="py-4rpx px-2 rounded-full text-22rpx bg-color-theme-dark whitespace-nowrap">
|
||||
{{
|
||||
member.appRefreshDate
|
||||
? formatDate(member.appRefreshDate, 'MM-DD HH:mm前') + ' 在线'
|
||||
: '离线'
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
<view
|
||||
v-for="(item, index) in data.memberTagList"
|
||||
:key="index"
|
||||
class="mt-2 inline-flex px-1 py-6rpx text-18rpx c-black rounded-4rpx bg-color-theme-dark mr-2"
|
||||
>
|
||||
<wd-icon name="discount-filled" size="10px" color="#000" />
|
||||
<text>{{ item.tagTitle }}</text>
|
||||
</view>
|
||||
<view class="mt-2 flex flex-wrap gap-3">
|
||||
<text class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1">
|
||||
{{ getGender(member.memberSex) }} · {{ member.memberAge || 0 }}岁
|
||||
</text>
|
||||
<text
|
||||
v-if="member.memberHeight"
|
||||
class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1"
|
||||
<view>
|
||||
<view class="flex px-4 py-2">
|
||||
<image
|
||||
class="w-200rpx h-300rpx mr-3 rounded-2 bg-#777"
|
||||
:src="data.coverPic?.split(',')[0]"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view class="flex-1 overflow-hidden">
|
||||
<view class="flex justify-between items-center mt-2">
|
||||
<text class="text-sm truncate">{{ member.memberNickname }}</text>
|
||||
<text class="py-4rpx px-2 rounded-full text-22rpx bg-color-theme-dark whitespace-nowrap">
|
||||
{{
|
||||
member.appRefreshDate
|
||||
? formatDate(member.appRefreshDate, 'MM-DD HH:mm前') + ' 在线'
|
||||
: '离线'
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
<view
|
||||
v-for="(item, index) in data.memberTagList"
|
||||
:key="index"
|
||||
class="mt-2 inline-flex px-1 py-6rpx text-18rpx c-black rounded-4rpx bg-color-theme-dark mr-2"
|
||||
>
|
||||
{{ member.memberHeight }}cm
|
||||
</text>
|
||||
<text
|
||||
v-if="member.memberWeight"
|
||||
class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1"
|
||||
>
|
||||
{{ member.memberWeight }}kg
|
||||
</text>
|
||||
<text
|
||||
v-if="member.memberOcc"
|
||||
class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1"
|
||||
>
|
||||
{{ member.memberOcc }}
|
||||
</text>
|
||||
<text
|
||||
v-if="data.distance"
|
||||
class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1"
|
||||
>
|
||||
{{ data.distance.toFixed(2) }}km
|
||||
</text>
|
||||
<wd-icon name="discount-filled" size="10px" color="#000" />
|
||||
<text>{{ item.tagTitle }}</text>
|
||||
</view>
|
||||
<view class="mt-2 flex flex-wrap gap-3">
|
||||
<text class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1">
|
||||
{{ getGender(member.memberSex) }} · {{ member.memberAge || 0 }}岁
|
||||
</text>
|
||||
<text
|
||||
v-if="member.memberHeight"
|
||||
class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1"
|
||||
>
|
||||
{{ member.memberHeight }}cm
|
||||
</text>
|
||||
<text
|
||||
v-if="member.memberWeight"
|
||||
class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1"
|
||||
>
|
||||
{{ member.memberWeight }}kg
|
||||
</text>
|
||||
<text
|
||||
v-if="member.memberOcc"
|
||||
class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1"
|
||||
>
|
||||
{{ member.memberOcc }}
|
||||
</text>
|
||||
<text
|
||||
v-if="data.distance"
|
||||
class="bg-#333 text-color-theme-dark text-22rpx px-1 py-4rpx rounded-1"
|
||||
>
|
||||
{{ data.distance.toFixed(2) }}km
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-1rpx bg-#333 ml-30 mr-4"></view>
|
||||
</view>
|
||||
<view class="h-1rpx bg-#333 ml-30 mr-4"></view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
Reference in new issue
Block a user