-
-
-
-
-
- {{ item.nickname }}
-
-
- {{ item.job_num }}
-
-
-
-
-
-
-
-
- {{ postionItem.position_name }}
-
-
-
-
-
-
+
+
+
+
+
+
+ {{ item.nickname }}
+
+
+ {{ item.job_num }}
+
+
+
+
+
+
+
-
-
+
+
+
+
+ {{ postionItem.position_name }}
+
+
+
+
+
+
-
-
-
-
{{ item.company_name }}
+
+
+ {{ item.company_name }}
+
-
+
+
+ {{ swipeActionItem.text }}
+
+
+
+
+

+
+ {{
+ 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"
>
-
+
{{ $t('addressBook.btns.add') }}
@@ -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
+ }
+ })
+}