From 64f76df2ef8b380274b72a3615691a80485b75a2 Mon Sep 17 00:00:00 2001 From: wangyifeng <812766448@qq.com> Date: Fri, 6 Jun 2025 18:28:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=A2=A8=E5=86=8CSAAS?= =?UTF-8?q?=E5=8A=A0=E5=A5=BD=E5=8F=8B=E6=96=B0=E9=9C=80=E6=B1=82=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/addressBook/index.js | 19 + src/api/chat/index.js | 2 +- src/api/search/index.js | 4 +- .../talk/message/ForwardMessage.vue | 2 +- src/pages.json | 8 + src/pages/addressBook/addFriend/index.vue | 396 ++++++++++++++++++ src/pages/addressBook/index.vue | 321 ++++++++++---- src/pages/dialog/index.vue | 19 +- src/pages/forwardRecord/index.vue | 6 +- src/pages/index/index.vue | 9 +- src/pages/search/components/searchList.vue | 65 ++- src/uni_modules/tmui/locale/zh-Hans.json | 13 +- 12 files changed, 770 insertions(+), 94 deletions(-) create mode 100644 src/pages/addressBook/addFriend/index.vue diff --git a/src/api/addressBook/index.js b/src/api/addressBook/index.js index 53bd0a0..dbc25d5 100644 --- a/src/api/addressBook/index.js +++ b/src/api/addressBook/index.js @@ -26,3 +26,22 @@ export const ServeQueryFriendsList = (data) => { data, }) } + +// 删除好友(单向好友) +export const ServeDeleteFriend = (data) => { + return request({ + url: '/api/v1/contact/friend/delete', + method: 'POST', + data, + }) +} + + +//添加我的好友时候的搜索接口 +export const ServeFriendSearch = (data) => { + return request({ + url: '/api/v1/contact/friend/search', + method: 'POST', + data, + }) +} \ No newline at end of file diff --git a/src/api/chat/index.js b/src/api/chat/index.js index 5096308..640ab1b 100644 --- a/src/api/chat/index.js +++ b/src/api/chat/index.js @@ -83,7 +83,7 @@ export const ServeTalkRecords = (data) => { // 获取转发会话记录详情列表服务接口 export const ServeGetForwardRecords = (data) => { return request({ - url: '/api/v1/talk/records/forward', + url: '/api/v1/talk/records/forward/v2', method: 'GET', data, }) diff --git a/src/api/search/index.js b/src/api/search/index.js index 504cb39..96cede9 100644 --- a/src/api/search/index.js +++ b/src/api/search/index.js @@ -4,7 +4,7 @@ import qs from 'qs' // ES搜索聊天记录-主页搜索什么都有 export const ServeSeachQueryAll = (data) => { return request({ - url: '/api/v1/elasticsearch/query-all', + url: '/api/v1/elasticsearch/query-all/v2', method: 'POST', data, }) @@ -13,7 +13,7 @@ export const ServeSeachQueryAll = (data) => { // ES搜索用户数据 export const ServeQueryUser = (data) => { return request({ - url: '/api/v1/elasticsearch/query-user', + url: '/api/v1/elasticsearch/query-user/v2', method: 'POST', data, }) diff --git a/src/components/talk/message/ForwardMessage.vue b/src/components/talk/message/ForwardMessage.vue index 9a32e56..e7acc03 100644 --- a/src/components/talk/message/ForwardMessage.vue +++ b/src/components/talk/message/ForwardMessage.vue @@ -24,7 +24,7 @@ console.log(props.extra.records) const onClick = () => { // isShowRecord.value = true uni.navigateTo({ - url: '/pages/forwardRecord/index?msgId=' + props.data.msg_id + url: '/pages/forwardRecord/index?msgId=' + props.data.msg_id + '&created_at=' + props.data?.created_at }) } diff --git a/src/pages.json b/src/pages.json index 85195dd..5960f7a 100644 --- a/src/pages.json +++ b/src/pages.json @@ -201,6 +201,14 @@ "navigationStyle": "custom", "enablePullDownRefresh": false } + }, + { + "path": "pages/addressBook/addFriend/index", + "type": "page", + "style": { + "navigationStyle": "custom", + "enablePullDownRefresh": false + } } ], "globalStyle": { diff --git a/src/pages/addressBook/addFriend/index.vue b/src/pages/addressBook/addFriend/index.vue new file mode 100644 index 0000000..2064c40 --- /dev/null +++ b/src/pages/addressBook/addFriend/index.vue @@ -0,0 +1,396 @@ + + + diff --git a/src/pages/addressBook/index.vue b/src/pages/addressBook/index.vue index 2d9e243..0f1174b 100644 --- a/src/pages/addressBook/index.vue +++ b/src/pages/addressBook/index.vue @@ -46,7 +46,10 @@
{{ state.myCompany }} @@ -72,7 +75,7 @@ }" >
-
+
{{ item.nickname }} @@ -129,7 +132,10 @@
-
- -
-
- - {{ item.nickname }} - - - {{ item.job_num }} - - -
-
- - -
-
- {{ postionItem.position_name }} -
-
-
- -
+ + +
-
-
-
- {{ item.company_name }} +
+
+ {{ item.company_name }} +
-
+ +
+
+ + + {{ + searchVal + ? $t('addFriend.message.notFindData') + : $t('search.hint') + }} + +
+ +
+ {{ $t('addressBook.message.doOrNotDeleteFriend') }} +
+
@@ -269,13 +334,17 @@ import { ServeUserGroupChatList, ServeCreateTalkList } from '@/api/chat/index' import { ServeGetSessionId } from '@/api/search/index' import { formatTalkItem } from '@/utils/talk' import { useDialogueStore, useTalkStore } from '@/store' -import { ServeQueryFriendsList } from '@/api/addressBook/index' +import { + ServeQueryFriendsList, + ServeDeleteFriend, +} from '@/api/addressBook/index' import { useI18n } from 'vue-i18n' const { t } = useI18n() const navshow = ref(false) const searchVal = ref('') +const friendDeleteModalRef = ref(null) const state = reactive({ addressBookTabs: [], //tab页 @@ -293,6 +362,8 @@ const state = reactive({ myGroupsList: [], //我的群组列表 hasMoreGroups: true, //是否还有更多我的群组数据 myCompany: '', //当前登录人公司别 + swipeAction: [], //左滑操作栏按钮组 + isLoadingData: true, //是否正在加载数据 }) onLoad((options) => { @@ -312,6 +383,11 @@ const goWebHome = () => { } onMounted(() => { + state.swipeAction = [ + { + text: t('addressBook.btns.delete'), //操作按钮的文本, + }, + ] state.addressBookTabs = [ { key: 'company', @@ -349,9 +425,11 @@ const getMyContractList = () => { name: searchVal.value, } console.error(params) + state.isLoadingData = true ServeQueryFriendsList(params) .then((res) => { console.log(res) + state.isLoadingData = false if (res?.code === 200) { state.myCompany = res.data?.company_name if (state.myContractListPage === 1) { @@ -368,7 +446,9 @@ const getMyContractList = () => { } } }) - .catch((err) => {}) + .catch((err) => { + state.isLoadingData = false + }) } //获取“我的好友”列表 @@ -380,9 +460,11 @@ const getMyFriendsList = () => { name: searchVal.value, } console.error(params) + state.isLoadingData = true ServeQueryFriendsList(params) .then((res) => { console.log(res) + state.isLoadingData = false if (res?.code === 200) { if (state.myFriendsListPage === 1) { state.myFriendsList = res.data?.user_list || [] @@ -398,7 +480,9 @@ const getMyFriendsList = () => { } } }) - .catch((err) => {}) + .catch((err) => { + state.isLoadingData = false + }) } //点击进入用户详情页面 @@ -417,9 +501,11 @@ const getMyGroupsList = () => { page_size: state.myGroupsListPageSize, group_name: searchVal.value, } + state.isLoadingData = true ServeUserGroupChatList(params) .then((res) => { console.log(res) + state.isLoadingData = false if (res?.code === 200) { if (state.myGroupsListPage === 1) { state.myGroupsList = res.data?.items || [] @@ -433,7 +519,9 @@ const getMyGroupsList = () => { } } }) - .catch((err) => {}) + .catch((err) => { + state.isLoadingData = false + }) } //加载更多数据 @@ -496,6 +584,35 @@ const toGroupChat = async (groupInfo) => { }) } +//显示删除好友确认框 +const showDeleteModal = (userInfo, friendIndex) => { + friendDeleteModalRef.value.open({ + userInfo, + friendIndex, + }) +} + +//关闭删除好友确认框 +const hideDeleteModal = () => { + friendDeleteModalRef.value.close() +} + +//删除好友 +const doDeleteFriend = (args) => { + console.log(args.userInfo, args.friendIndex) + let params = { + receiver_id: args.userInfo.id, //聊天的用户id + talk_type: 1, + } + ServeDeleteFriend(params).then((res) => { + console.log(res) + if (res?.code === 200) { + message.success(t('addressBook.message.deleteSuccess') + ' !') + state.myFriendsList.splice(args.friendIndex, 1) + } + }) +} + // 映射表-根据groupType设置对应值 const groupTypeMapping = { 0: {}, @@ -519,15 +636,12 @@ watch( (newVal) => { if (newVal === 'company') { state.myContractListPage = 1 - state.myContractList = [] getMyContractList() } else if (newVal === 'friends') { state.myFriendsListPage = 1 - state.myFriendsList = [] getMyFriendsList() } else if (newVal === 'groups') { state.myGroupsListPage = 1 - state.myGroupsList = [] getMyGroupsList() } }, @@ -538,15 +652,12 @@ watch( (newVal) => { if (newVal === 'company') { state.myContractListPage = 1 - state.myContractList = [] getMyContractList() } else if (state.addressBookActiveTab === 'friends') { state.myFriendsListPage = 1 - state.myFriendsList = [] getMyFriendsList() } else if (state.addressBookActiveTab === 'groups') { state.myGroupsListPage = 1 - state.myGroupsList = [] getMyGroupsList() } }, @@ -594,7 +705,11 @@ watch( width: 100%; .address-book-tabs-panes-list { - padding: 30rpx 24rpx; + margin: 30rpx 24rpx; + overflow: hidden; + flex: 1; + display: flex; + flex-direction: column; .tabs-panes-each { gap: 30rpx 0; @@ -621,15 +736,36 @@ watch( justify-content: center; background-color: #fff; width: 100%; - padding: 24rpx; border-radius: 8rpx; + .swipe-action { + width: 100%; + overflow: visible !important; + + :deep(.wd-swipe-action__right) { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + background-color: #cf3050; + padding: 0 48rpx; + border-radius: 0 8rpx 8rpx 0; + span { + color: #fff; + line-height: 1; + font-size: 30rpx; + font-weight: 400; + } + } + } + .members-info { display: flex; flex-direction: row; align-items: flex-start; justify-content: flex-start; gap: 16rpx; + padding: 24rpx 24rpx 0; .members-info-area { display: flex; @@ -710,6 +846,7 @@ watch( } .company-infos { margin: 0 0 0 88rpx; + padding: 0 0 24rpx 24rpx; .company-each { span { font-size: 24rpx; @@ -772,6 +909,34 @@ watch( } } } + .addressBook-noData { + margin: 30rpx 24rpx; + overflow: hidden; + flex: 1; + gap: 30rpx 0; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + img { + width: 500rpx; + } + span { + font-size: 30rpx; + font-weight: 400; + line-height: 1; + color: #999; + } + } + } + } + + .friendDeleteModal { + .friendDeleteModal-content { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; } } } diff --git a/src/pages/dialog/index.vue b/src/pages/dialog/index.vue index 9898550..07fd3f3 100644 --- a/src/pages/dialog/index.vue +++ b/src/pages/dialog/index.vue @@ -692,7 +692,7 @@ v-if="talkParams.type === 1 && !state.isFriendOrSameCompany" > @@ -766,7 +766,7 @@ import zu6053 from '@/static/image/chatList/zu6053@2x.png' import deepBubble from '@/components/deep-bubble/deep-bubble.vue' import { isRevoke } from './menu' import useConfirm from '@/components/x-confirm/useConfirm.js' -import { ServeCheckFriend } from '@/api/addressBook/index' +import { ServeCheckFriend, ServeAddFriend } from '@/api/addressBook/index' import { onLoad as uniOnload, onUnload as uniOnUnload, @@ -2760,6 +2760,21 @@ const checkNeedAddFriend = () => { } }) } + +//主动加好友(单向好友) +const doAddFriend = () => { + let params = { + receiver_id: talkParams.receiver_id, //聊天的用户id + talk_type: 1, + } + ServeAddFriend(params).then((res) => { + console.log(res) + if (res?.code === 200) { + message.success(t('addressBook.message.addSuccess') + ' !') + state.value.isFriendOrSameCompany = true + } + }) +}