完成墨册SAAS加好友新需求移动端

This commit is contained in:
wangyifeng 2025-06-06 18:28:36 +08:00
parent 98aa8e8fdb
commit 64f76df2ef
12 changed files with 770 additions and 94 deletions

View File

@ -26,3 +26,22 @@ export const ServeQueryFriendsList = (data) => {
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,
})
}

View File

@ -83,7 +83,7 @@ export const ServeTalkRecords = (data) => {
// 获取转发会话记录详情列表服务接口 // 获取转发会话记录详情列表服务接口
export const ServeGetForwardRecords = (data) => { export const ServeGetForwardRecords = (data) => {
return request({ return request({
url: '/api/v1/talk/records/forward', url: '/api/v1/talk/records/forward/v2',
method: 'GET', method: 'GET',
data, data,
}) })

View File

@ -4,7 +4,7 @@ import qs from 'qs'
// ES搜索聊天记录-主页搜索什么都有 // ES搜索聊天记录-主页搜索什么都有
export const ServeSeachQueryAll = (data) => { export const ServeSeachQueryAll = (data) => {
return request({ return request({
url: '/api/v1/elasticsearch/query-all', url: '/api/v1/elasticsearch/query-all/v2',
method: 'POST', method: 'POST',
data, data,
}) })
@ -13,7 +13,7 @@ export const ServeSeachQueryAll = (data) => {
// ES搜索用户数据 // ES搜索用户数据
export const ServeQueryUser = (data) => { export const ServeQueryUser = (data) => {
return request({ return request({
url: '/api/v1/elasticsearch/query-user', url: '/api/v1/elasticsearch/query-user/v2',
method: 'POST', method: 'POST',
data, data,
}) })

View File

@ -24,7 +24,7 @@ console.log(props.extra.records)
const onClick = () => { const onClick = () => {
// isShowRecord.value = true // isShowRecord.value = true
uni.navigateTo({ 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
}) })
} }
</script> </script>

View File

@ -201,6 +201,14 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path": "pages/addressBook/addFriend/index",
"type": "page",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@ -0,0 +1,396 @@
<template>
<div class="add-friend-page">
<zPaging ref="zPaging" :show-scrollbar="false" @scrolltolower="doLoadMore">
<template #top>
<div :class="'top_bg'">
<customNavbar
:class="'index_top_navbar'"
:title="$t('addFriend.pageTitle')"
></customNavbar>
<div class="pl-[32rpx] pr-[32rpx] pt-[32rpx] pb-[32rpx]">
<customInput
:searchText="searchVal"
@inputSearchText="inputSearchText"
></customInput>
</div>
</div>
</template>
<div class="add-friend">
<div class="add-friend-list" v-if="state.friendsList.length > 0">
<div
class="members-list-each"
v-for="(item, index) in state.friendsList"
:key="index"
@click="toUserDetail(item)"
>
<div class="members-info">
<avatarModule
:mode="1"
:avatar="item.avatar"
:groupType="0"
:userName="item.nickname"
:customStyle="{ width: '72rpx', height: '72rpx' }"
:customTextStyle="{
fontSize: '32rpx',
fontWeight: 'bold',
color: '#fff',
lineHeight: '44rpx',
}"
></avatarModule>
<div class="members-info-area">
<div
class="members-info-basic"
:style="{ padding: item.company_name ? 0 : '0 0 24rpx' }"
>
<span class="members-name">
{{ item.nickname }}
</span>
<span class="members-jobNum">
{{ item.job_num }}
</span>
<!-- <span class="members-company">{{ item.company_name }}</span> -->
</div>
<div class="members-positions-area">
<tm-popover position="bc">
<tm-scrolly :refresher="false" :height="84">
<div class="members-positions">
<div
class="members-positions-each"
v-for="(postionItem,
positionIndex) in item.user_position"
:key="positionIndex"
>
{{ postionItem.position_name }}
</div>
</div>
</tm-scrolly>
<template v-slot:label>
<tm-scrolly
:refresher="false"
:height="
item.user_position.length >= 4
? 180
: item.user_position.length === 3
? 140
: item.user_position.length === 2
? 100
: item.user_position.length === 1
? 60
: 0
"
>
<div class="members-positions-popover-box">
<div
class="members-positions-popover"
v-for="(postionItem,
positionIndex) in item.user_position"
:key="positionIndex"
>
{{ postionItem.position_name }}
</div>
</div>
</tm-scrolly>
</template>
</tm-popover>
</div>
</div>
</div>
<div class="company-infos" v-if="item.company_name">
<div class="company-each">
<span>{{ item.company_name }}</span>
</div>
</div>
</div>
</div>
<div class="addressBook-noData" v-if="state.friendsList.length === 0">
<img src="@/static/image/search/search-no-data.png" />
<span>
{{
searchVal
? $t('addFriend.message.notFindData')
: $t('search.hint')
}}
</span>
</div>
</div>
</zPaging>
</div>
</template>
<script setup>
import customInput from '@/components/custom-input/custom-input.vue'
import zPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import avatarModule from '@/components/avatar-module/index.vue'
import { ServeFriendSearch } from '@/api/addressBook/index'
import { ref, onMounted, reactive } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const searchVal = ref('')
const state = reactive({
friendsListPage: 1, //
friendsListPageSize: 10, //
friendsList: [], //
hasMoreFriends: true, //
})
onMounted(() => {
getFriendsList()
})
//
const inputSearchText = (e) => {
searchVal.value = e
}
//
const getFriendsList = () => {
let params = {
name: searchVal.value,
}
ServeFriendSearch(params)
.then((res) => {
console.error(res)
if (res?.code === 200) {
if (state.friendsListPage === 1) {
state.friendsList = res.data?.user_list || []
} else {
state.friendsList = state.friendsList.concat(
res.data?.user_list || [],
)
}
if (state.friendsList.length < res.data?.count) {
state.hasMoreFriends = true
} else {
state.hasMoreFriends = false
}
}
})
.catch((err) => {
console.log(err)
})
}
//
const toUserDetail = (userInfo) => {
uni.navigateTo({
url:
'/pages/dialog/dialogDetail/userDetail??erpUserId=' +
userInfo.erp_user_id,
})
}
//
const doLoadMore = (e) => {
state.friendsListPage += 1
getFriendsList()
}
watch(
() => searchVal.value,
(newVal) => {
state.friendsListPage = 1
getFriendsList()
},
)
</script>
<style scoped lang="scss">
::v-deep .zp-paging-container-content {
height: 100%;
display: flex;
}
::v-deep .index_top_navbar .tmicon-angle-left {
color: #fff !important;
}
::v-deep .index_top_navbar .text-weight-b {
color: #fff !important;
}
::v-deep .index_top_navbar .statusHeightTop > .noNvueBorder:first-child {
background: transparent !important;
border: none !important;
}
.top_bg {
background: url('@/static/image/mine/page_top.png') no-repeat;
background-size: cover;
background-position: bottom center;
}
:deep(.animateAll_tabs_tmui) {
width: 120rpx !important;
height: 10rpx !important;
}
.add-friend-page {
.add-friend {
flex: 1;
display: flex;
flex-direction: column;
background-image: url('@/static/image/clockIn/z3280@3x.png');
background-size: cover;
background-position: bottom center;
background-attachment: fixed;
width: 100%;
.add-friend-list {
margin: 30rpx 24rpx;
overflow: hidden;
flex: 1;
gap: 30rpx 0;
.members-list-each {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
background-color: #fff;
width: 100%;
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;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
gap: 16rpx;
.members-info-basic {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
.members-name {
font-size: 30rpx;
font-weight: 500;
width: 150rpx;
word-break: break-all;
}
.members-jobNum {
font-size: 26rpx;
font-weight: 400;
color: #999;
word-break: break-all;
margin: 10rpx 0 0;
}
.members-company {
font-size: 24rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
.members-positions-area {
.members-positions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
gap: 10rpx;
padding: 4rpx 0 0;
max-height: 84rpx;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
.members-positions-each {
background-color: #eee9f8;
line-height: 1;
font-size: 24rpx;
padding: 4rpx 16rpx;
color: #46299d;
}
}
.members-positions-popover-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10rpx 0;
.members-positions-popover {
background-color: #eee9f8;
line-height: 1;
font-size: 24rpx;
padding: 8rpx 16rpx;
color: #46299d;
width: 100%;
}
}
}
}
}
.company-infos {
margin: 0 0 0 88rpx;
padding: 0 0 24rpx 24rpx;
.company-each {
span {
font-size: 24rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
}
}
}
.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;
}
}
}
}
</style>

View File

@ -46,7 +46,10 @@
<div class="address-book-tabs-panes-list"> <div class="address-book-tabs-panes-list">
<div <div
class="tabs-panes-each address-book-company" class="tabs-panes-each address-book-company"
v-if="state.addressBookActiveTab === 'company'" v-if="
state.addressBookActiveTab === 'company' &&
state.myContractList.length > 0
"
> >
<div class="address-book-company-name"> <div class="address-book-company-name">
<span>{{ state.myCompany }}</span> <span>{{ state.myCompany }}</span>
@ -72,7 +75,7 @@
}" }"
></avatarModule> ></avatarModule>
<div class="members-info-area"> <div class="members-info-area">
<div class="members-info-basic"> <div class="members-info-basic" style="padding: 0 0 24rpx;">
<span class="members-name"> <span class="members-name">
{{ item.nickname }} {{ item.nickname }}
</span> </span>
@ -129,13 +132,20 @@
</div> </div>
<div <div
class="tabs-panes-each address-book-friends" class="tabs-panes-each address-book-friends"
v-if="state.addressBookActiveTab === 'friends'" v-if="
state.addressBookActiveTab === 'friends' &&
state.myFriendsList.length > 0
"
> >
<div <div
class="members-list-each" class="members-list-each"
v-for="(item, index) in state.myFriendsList" v-for="(item, index) in state.myFriendsList"
:key="index" :key="index"
@click="toUserDetail(item)" @click="toUserDetail(item)"
>
<wd-swipe-action
class="swipe-action"
@click="showDeleteModal(item, index)"
> >
<div class="members-info"> <div class="members-info">
<avatarModule <avatarModule
@ -152,7 +162,10 @@
}" }"
></avatarModule> ></avatarModule>
<div class="members-info-area"> <div class="members-info-area">
<div class="members-info-basic"> <div
class="members-info-basic"
:style="{ padding: item.company_name ? 0 : '0 0 24rpx' }"
>
<span class="members-name"> <span class="members-name">
{{ item.nickname }} {{ item.nickname }}
</span> </span>
@ -211,11 +224,24 @@
<span>{{ item.company_name }}</span> <span>{{ item.company_name }}</span>
</div> </div>
</div> </div>
<template #right>
<div
v-for="(swipeActionItem,
swipeActionIndex) in state.swipeAction"
:key="swipeActionIndex"
>
<span>{{ swipeActionItem.text }}</span>
</div>
</template>
</wd-swipe-action>
</div> </div>
</div> </div>
<div <div
class="tabs-panes-each address-book-groups" class="tabs-panes-each address-book-groups"
v-if="state.addressBookActiveTab === 'groups'" v-if="
state.addressBookActiveTab === 'groups' &&
state.myGroupsList.length > 0
"
> >
<div <div
class="groups-list-each" class="groups-list-each"
@ -252,8 +278,47 @@
</div> </div>
</div> </div>
</div> </div>
<div
class="addressBook-noData"
v-if="
!state.isLoadingData &&
((state.addressBookActiveTab === 'company' &&
state.myContractList.length === 0) ||
(state.addressBookActiveTab === 'friends' &&
state.myFriendsList.length === 0) ||
(state.addressBookActiveTab === 'groups' &&
state.myGroupsList.length === 0))
"
>
<img src="@/static/image/search/search-no-data.png" />
<span>
{{
searchVal
? $t('addFriend.message.notFindData')
: $t('search.hint')
}}
</span>
</div> </div>
</div> </div>
</div>
<tm-modal
class="friendDeleteModal"
ref="friendDeleteModalRef"
:mask="true"
:okText="$t('ok')"
okColor="#46299d"
cancelColor="#999"
@ok="doDeleteFriend"
@cancel="hideDeleteModal"
:teleport="false"
titleStyle="font-size: 40rpx;font-weight: 600;line-height: 1;"
:height="300"
:round="4"
>
<div class="friendDeleteModal-content">
<span>{{ $t('addressBook.message.doOrNotDeleteFriend') }}</span>
</div>
</tm-modal>
</zPaging> </zPaging>
</div> </div>
</template> </template>
@ -269,13 +334,17 @@ import { ServeUserGroupChatList, ServeCreateTalkList } from '@/api/chat/index'
import { ServeGetSessionId } from '@/api/search/index' import { ServeGetSessionId } from '@/api/search/index'
import { formatTalkItem } from '@/utils/talk' import { formatTalkItem } from '@/utils/talk'
import { useDialogueStore, useTalkStore } from '@/store' import { useDialogueStore, useTalkStore } from '@/store'
import { ServeQueryFriendsList } from '@/api/addressBook/index' import {
ServeQueryFriendsList,
ServeDeleteFriend,
} from '@/api/addressBook/index'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const { t } = useI18n() const { t } = useI18n()
const navshow = ref(false) const navshow = ref(false)
const searchVal = ref('') const searchVal = ref('')
const friendDeleteModalRef = ref(null)
const state = reactive({ const state = reactive({
addressBookTabs: [], //tab addressBookTabs: [], //tab
@ -293,6 +362,8 @@ const state = reactive({
myGroupsList: [], // myGroupsList: [], //
hasMoreGroups: true, // hasMoreGroups: true, //
myCompany: '', // myCompany: '', //
swipeAction: [], //
isLoadingData: true, //
}) })
onLoad((options) => { onLoad((options) => {
@ -312,6 +383,11 @@ const goWebHome = () => {
} }
onMounted(() => { onMounted(() => {
state.swipeAction = [
{
text: t('addressBook.btns.delete'), //,
},
]
state.addressBookTabs = [ state.addressBookTabs = [
{ {
key: 'company', key: 'company',
@ -349,9 +425,11 @@ const getMyContractList = () => {
name: searchVal.value, name: searchVal.value,
} }
console.error(params) console.error(params)
state.isLoadingData = true
ServeQueryFriendsList(params) ServeQueryFriendsList(params)
.then((res) => { .then((res) => {
console.log(res) console.log(res)
state.isLoadingData = false
if (res?.code === 200) { if (res?.code === 200) {
state.myCompany = res.data?.company_name state.myCompany = res.data?.company_name
if (state.myContractListPage === 1) { 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, name: searchVal.value,
} }
console.error(params) console.error(params)
state.isLoadingData = true
ServeQueryFriendsList(params) ServeQueryFriendsList(params)
.then((res) => { .then((res) => {
console.log(res) console.log(res)
state.isLoadingData = false
if (res?.code === 200) { if (res?.code === 200) {
if (state.myFriendsListPage === 1) { if (state.myFriendsListPage === 1) {
state.myFriendsList = res.data?.user_list || [] 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, page_size: state.myGroupsListPageSize,
group_name: searchVal.value, group_name: searchVal.value,
} }
state.isLoadingData = true
ServeUserGroupChatList(params) ServeUserGroupChatList(params)
.then((res) => { .then((res) => {
console.log(res) console.log(res)
state.isLoadingData = false
if (res?.code === 200) { if (res?.code === 200) {
if (state.myGroupsListPage === 1) { if (state.myGroupsListPage === 1) {
state.myGroupsList = res.data?.items || [] 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 // -groupType
const groupTypeMapping = { const groupTypeMapping = {
0: {}, 0: {},
@ -519,15 +636,12 @@ watch(
(newVal) => { (newVal) => {
if (newVal === 'company') { if (newVal === 'company') {
state.myContractListPage = 1 state.myContractListPage = 1
state.myContractList = []
getMyContractList() getMyContractList()
} else if (newVal === 'friends') { } else if (newVal === 'friends') {
state.myFriendsListPage = 1 state.myFriendsListPage = 1
state.myFriendsList = []
getMyFriendsList() getMyFriendsList()
} else if (newVal === 'groups') { } else if (newVal === 'groups') {
state.myGroupsListPage = 1 state.myGroupsListPage = 1
state.myGroupsList = []
getMyGroupsList() getMyGroupsList()
} }
}, },
@ -538,15 +652,12 @@ watch(
(newVal) => { (newVal) => {
if (newVal === 'company') { if (newVal === 'company') {
state.myContractListPage = 1 state.myContractListPage = 1
state.myContractList = []
getMyContractList() getMyContractList()
} else if (state.addressBookActiveTab === 'friends') { } else if (state.addressBookActiveTab === 'friends') {
state.myFriendsListPage = 1 state.myFriendsListPage = 1
state.myFriendsList = []
getMyFriendsList() getMyFriendsList()
} else if (state.addressBookActiveTab === 'groups') { } else if (state.addressBookActiveTab === 'groups') {
state.myGroupsListPage = 1 state.myGroupsListPage = 1
state.myGroupsList = []
getMyGroupsList() getMyGroupsList()
} }
}, },
@ -594,7 +705,11 @@ watch(
width: 100%; width: 100%;
.address-book-tabs-panes-list { .address-book-tabs-panes-list {
padding: 30rpx 24rpx; margin: 30rpx 24rpx;
overflow: hidden;
flex: 1;
display: flex;
flex-direction: column;
.tabs-panes-each { .tabs-panes-each {
gap: 30rpx 0; gap: 30rpx 0;
@ -621,15 +736,36 @@ watch(
justify-content: center; justify-content: center;
background-color: #fff; background-color: #fff;
width: 100%; width: 100%;
padding: 24rpx;
border-radius: 8rpx; 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 { .members-info {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: flex-start; align-items: flex-start;
justify-content: flex-start; justify-content: flex-start;
gap: 16rpx; gap: 16rpx;
padding: 24rpx 24rpx 0;
.members-info-area { .members-info-area {
display: flex; display: flex;
@ -710,6 +846,7 @@ watch(
} }
.company-infos { .company-infos {
margin: 0 0 0 88rpx; margin: 0 0 0 88rpx;
padding: 0 0 24rpx 24rpx;
.company-each { .company-each {
span { span {
font-size: 24rpx; 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;
} }
} }
} }

View File

@ -692,7 +692,7 @@
v-if="talkParams.type === 1 && !state.isFriendOrSameCompany" v-if="talkParams.type === 1 && !state.isFriendOrSameCompany"
> >
<template #right> <template #right>
<div class="addFriendBtn"> <div class="addFriendBtn" @click="doAddFriend">
<span>{{ $t('addressBook.btns.add') }}</span> <span>{{ $t('addressBook.btns.add') }}</span>
</div> </div>
</template> </template>
@ -766,7 +766,7 @@ import zu6053 from '@/static/image/chatList/zu6053@2x.png'
import deepBubble from '@/components/deep-bubble/deep-bubble.vue' import deepBubble from '@/components/deep-bubble/deep-bubble.vue'
import { isRevoke } from './menu' import { isRevoke } from './menu'
import useConfirm from '@/components/x-confirm/useConfirm.js' import useConfirm from '@/components/x-confirm/useConfirm.js'
import { ServeCheckFriend } from '@/api/addressBook/index' import { ServeCheckFriend, ServeAddFriend } from '@/api/addressBook/index'
import { import {
onLoad as uniOnload, onLoad as uniOnload,
onUnload as uniOnUnload, 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
}
})
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.dialog-page { .dialog-page {

View File

@ -6,10 +6,12 @@ import { MessageComponents } from '@/constant/message'
import { ITalkRecord } from '@/types/chat' import { ITalkRecord } from '@/types/chat'
import WdLoading from "@/uni_modules/wot-design-uni/components/wd-loading/wd-loading.vue"; import WdLoading from "@/uni_modules/wot-design-uni/components/wd-loading/wd-loading.vue";
import { useInject } from '@/hooks' import { useInject } from '@/hooks'
import { parseTime } from '@/utils/datetime'
const emit = defineEmits(['close']) const emit = defineEmits(['close'])
const msgId = ref(null) const msgId = ref(null)
const createdAt = ref(null)
const { showUserInfoModal } = useInject() const { showUserInfoModal } = useInject()
const isShow = ref(true) const isShow = ref(true)
const items = ref<ITalkRecord[]>([]) const items = ref<ITalkRecord[]>([])
@ -21,7 +23,8 @@ const onMaskClick = () => {
const onLoadData = () => { const onLoadData = () => {
ServeGetForwardRecords({ ServeGetForwardRecords({
msg_id: msgId.value msg_id: msgId.value,
biz_date: createdAt.value
}).then((res) => { }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
items.value = res.data.items || [] items.value = res.data.items || []
@ -41,6 +44,7 @@ onMounted(() => {
const page = pages[pages.length - 1] const page = pages[pages.length - 1]
const options = page.$page.options const options = page.$page.options
msgId.value = options.msgId msgId.value = options.msgId
createdAt.value = parseTime(new Date((options.created_at as any)), '{y}{m}')
console.log(msgId.value,'msgId.value'); console.log(msgId.value,'msgId.value');
onLoadData() onLoadData()

View File

@ -87,7 +87,7 @@
</div> </div>
<div class="divider"></div> <div class="divider"></div>
<div <div
@click="toAddressBookPage" @click="toAddFriendPage"
class="flex items-center pl-[22rpx] py-[32rpx]" class="flex items-center pl-[22rpx] py-[32rpx]"
> >
<div class="mr-[26rpx] flex items-center"> <div class="mr-[26rpx] flex items-center">
@ -235,6 +235,13 @@ const toSearchPage = () => {
}) })
} }
//
const toAddFriendPage = () => {
uni.navigateTo({
url: '/pages/addressBook/addFriend/index',
})
}
// //
const toAddressBookPage = () => { const toAddressBookPage = () => {
// - // -

View File

@ -291,7 +291,9 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
zPaging.value?.complete([]) zPaging.value?.complete([])
} else { } else {
// //
zPaging.value?.complete(state.searchResult ? [state.searchResult] : []) zPaging.value?.complete(
state.searchResult ? [state.searchResult] : [],
)
} }
} else { } else {
if (props.isPagination) { if (props.isPagination) {
@ -303,7 +305,8 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
if ( if (
paginationKey && paginationKey &&
Array.isArray( Array.isArray(
(state?.searchResult && state?.searchResult[paginationKey]) || [], (state?.searchResult && state?.searchResult[paginationKey]) ||
[],
) )
) { ) {
data[paginationKey] = state.searchResult[paginationKey].concat( data[paginationKey] = state.searchResult[paginationKey].concat(
@ -328,8 +331,58 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
} else if (state?.first_talk_record_infos?.talk_type === 2) { } else if (state?.first_talk_record_infos?.talk_type === 2) {
total = data.group_record_count total = data.group_record_count
} }
let noMoreSearchResultRecord = true
if (
Object.keys(data).includes('talk_record_infos') &&
state.searchResult['talk_record_infos']?.length > 0
) {
//
if (state.searchResult['talk_record_infos']?.length < total) {
noMoreSearchResultRecord = false
}
}
zPaging.value?.completeByNoMore([data], noMoreSearchResultRecord)
} else {
let noMoreSearchResultUser = true
let noMoreSearchResultGroup = true
let noMoreSearchResultGeneral = true
if (
Object.keys(data).includes('user_infos') &&
state.searchResult['user_infos']?.length > 0
) {
//
if (state.searchResult['user_infos']?.length < total) {
noMoreSearchResultUser = false
}
}
if (
Object.keys(data).includes(
'group_member_infos' || 'group_infos',
) &&
state.searchResult['combinedGroup']?.length > 0
) {
//
if (state.searchResult['combinedGroup']?.length < total) {
noMoreSearchResultGroup = false
}
}
if (
Object.keys(data).includes('general_infos') &&
state.searchResult['general_infos']?.length > 0
) {
//
if (state.searchResult['general_infos']?.length < total) {
noMoreSearchResultGeneral = false
}
}
// zPaging.value?.completeByTotal([data], total)
zPaging.value?.completeByNoMore(
[data],
noMoreSearchResultUser &&
noMoreSearchResultGroup &&
noMoreSearchResultGeneral,
)
} }
zPaging.value?.completeByTotal([data], total)
} else { } else {
state.searchResult = data state.searchResult = data
zPaging.value?.complete([data]) zPaging.value?.complete([data])
@ -368,7 +421,7 @@ const cancelSearch = () => {
}) })
} else { } else {
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/index' url: '/pages/index/index',
}) })
} }
} }

View File

@ -203,11 +203,20 @@
"btns": { "btns": {
"enterGroup": "进入群聊", "enterGroup": "进入群聊",
"addFriend": "添加好友", "addFriend": "添加好友",
"add": "添加" "add": "添加",
"delete": "删除"
}, },
"message": { "message": {
"addSuccess": "添加成功", "addSuccess": "添加成功",
"notFriendsOrSameCompany": "对方还不是您的好友,请添加到通讯录中吧!" "notFriendsOrSameCompany": "对方还不是您的好友,请添加到通讯录中吧!",
"deleteSuccess": "删除成功",
"doOrNotDeleteFriend": "是否删除该好友"
}
},
"addFriend": {
"pageTitle": "添加好友",
"message": {
"notFindData": "没有找到哦~"
} }
} }
} }