Compare commits
3 Commits
main
...
wyfMain-de
Author | SHA1 | Date | |
---|---|---|---|
64f76df2ef | |||
98aa8e8fdb | |||
7f50f09bbe |
47
src/api/addressBook/index.js
Normal file
47
src/api/addressBook/index.js
Normal file
@ -0,0 +1,47 @@
|
||||
import request from '@/service/index.js'
|
||||
|
||||
// 查询用户是否需要添加好友
|
||||
export const ServeCheckFriend = (data) => {
|
||||
return request({
|
||||
url: '/api/v1/contact/friend/check',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 主动添加好友(单向好友)
|
||||
export const ServeAddFriend = (data) => {
|
||||
return request({
|
||||
url: '/api/v1/contact/friend/add',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 查询我的好友列表
|
||||
export const ServeQueryFriendsList = (data) => {
|
||||
return request({
|
||||
url: '/api/v1/contact/friend/list',
|
||||
method: 'POST',
|
||||
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,
|
||||
})
|
||||
}
|
@ -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,
|
||||
})
|
||||
@ -240,3 +240,12 @@ export const ServeConvertText = (data) => {
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 获取用户所在群聊列表(我的群聊)
|
||||
export const ServeUserGroupChatList = (data) => {
|
||||
return request({
|
||||
url: '/api/v1/group/user/list',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
@ -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,
|
||||
})
|
||||
|
@ -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
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
@ -92,8 +92,14 @@ export function createApp() {
|
||||
}
|
||||
// 通讯录跳转
|
||||
window.handleContacts = () => {
|
||||
// 旧版本-按组织架构树的通讯录
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/chooseByDeps/index?chooseMode=3&type=true'
|
||||
// });
|
||||
|
||||
// 新版本-按公司别、好友、群组的通讯录
|
||||
uni.navigateTo({
|
||||
url: '/pages/chooseByDeps/index?chooseMode=3&type=true'
|
||||
url: '/pages/addressBook/index?type=true',
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -193,6 +193,22 @@
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/addressBook/index",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/addressBook/addFriend/index",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
396
src/pages/addressBook/addFriend/index.vue
Normal file
396
src/pages/addressBook/addFriend/index.vue
Normal 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>
|
943
src/pages/addressBook/index.vue
Normal file
943
src/pages/addressBook/index.vue
Normal file
@ -0,0 +1,943 @@
|
||||
<template>
|
||||
<div class="address-book-page">
|
||||
<zPaging ref="zPaging" :show-scrollbar="false" @scrolltolower="doLoadMore">
|
||||
<template #top>
|
||||
<div :class="'top_bg'">
|
||||
<customNavbar
|
||||
:class="'index_top_navbar'"
|
||||
:title="$t('index.mine.addressBook')"
|
||||
:hideHome="navshow"
|
||||
:hideBack="navshow"
|
||||
>
|
||||
<template #left>
|
||||
<tm-icon
|
||||
@click="goWebHome"
|
||||
v-if="navshow"
|
||||
name="tmicon-angle-left"
|
||||
style="padding-left: 30rpx;"
|
||||
></tm-icon>
|
||||
</template>
|
||||
</customNavbar>
|
||||
<div class="pl-[32rpx] pr-[32rpx] pt-[32rpx] pb-[32rpx]">
|
||||
<customInput
|
||||
:searchText="searchVal"
|
||||
@inputSearchText="inputSearchText"
|
||||
></customInput>
|
||||
</div>
|
||||
</div>
|
||||
<tm-tabs
|
||||
:list="state.addressBookTabs"
|
||||
align="center"
|
||||
:width="750"
|
||||
:height="300"
|
||||
:itemWidth="250"
|
||||
default-name="company"
|
||||
activeColor="#46299d"
|
||||
activeFontColor="#46299d"
|
||||
tabs-line-ani-color="#46299d"
|
||||
:showTabsLineAni="true"
|
||||
:showTabsLine="false"
|
||||
:activeFontSize="32"
|
||||
:itemFontSize="30"
|
||||
@update:activeName="updateAddressBookTab"
|
||||
></tm-tabs>
|
||||
</template>
|
||||
<div class="address-book">
|
||||
<div class="address-book-tabs-panes-list">
|
||||
<div
|
||||
class="tabs-panes-each address-book-company"
|
||||
v-if="
|
||||
state.addressBookActiveTab === 'company' &&
|
||||
state.myContractList.length > 0
|
||||
"
|
||||
>
|
||||
<div class="address-book-company-name">
|
||||
<span>{{ state.myCompany }}</span>
|
||||
</div>
|
||||
<div
|
||||
class="members-list-each"
|
||||
v-for="(item, index) in state.myContractList"
|
||||
: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: 0 0 24rpx;">
|
||||
<span class="members-name">
|
||||
{{ item.nickname }}
|
||||
</span>
|
||||
<span class="members-jobNum">
|
||||
{{ item.job_num }}
|
||||
</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>
|
||||
</div>
|
||||
<div
|
||||
class="tabs-panes-each address-book-friends"
|
||||
v-if="
|
||||
state.addressBookActiveTab === 'friends' &&
|
||||
state.myFriendsList.length > 0
|
||||
"
|
||||
>
|
||||
<div
|
||||
class="members-list-each"
|
||||
v-for="(item, index) in state.myFriendsList"
|
||||
:key="index"
|
||||
@click="toUserDetail(item)"
|
||||
>
|
||||
<wd-swipe-action
|
||||
class="swipe-action"
|
||||
@click="showDeleteModal(item, index)"
|
||||
>
|
||||
<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>
|
||||
<template #right>
|
||||
<div
|
||||
v-for="(swipeActionItem,
|
||||
swipeActionIndex) in state.swipeAction"
|
||||
:key="swipeActionIndex"
|
||||
>
|
||||
<span>{{ swipeActionItem.text }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</wd-swipe-action>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="tabs-panes-each address-book-groups"
|
||||
v-if="
|
||||
state.addressBookActiveTab === 'groups' &&
|
||||
state.myGroupsList.length > 0
|
||||
"
|
||||
>
|
||||
<div
|
||||
class="groups-list-each"
|
||||
v-for="(item, index) in state.myGroupsList"
|
||||
:key="index"
|
||||
>
|
||||
<div class="groups-info">
|
||||
<avatarModule
|
||||
:mode="2"
|
||||
:avatar="item?.avatar"
|
||||
:groupType="Number(item?.group_type)"
|
||||
:customStyle="{ width: '72rpx', height: '72rpx' }"
|
||||
></avatarModule>
|
||||
<span class="groups-name">
|
||||
{{ item?.group_name }}
|
||||
</span>
|
||||
<span
|
||||
class="groups-type"
|
||||
:style="{
|
||||
color:
|
||||
groupTypeMapping[item?.group_type]?.result_type_color,
|
||||
border:
|
||||
'1px solid' +
|
||||
groupTypeMapping[item?.group_type]?.result_type_color,
|
||||
}"
|
||||
>
|
||||
{{ groupTypeMapping[item?.group_type]?.result_type }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="groups-btns">
|
||||
<div class="groups-btns-each" @click="toGroupChat(item)">
|
||||
<span>{{ $t('addressBook.btns.enterGroup') }}</span>
|
||||
</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>
|
||||
<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>
|
||||
</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 { ref, onMounted, reactive, watch } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { handleSetWebviewStyle } from '@/utils/common'
|
||||
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,
|
||||
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页
|
||||
addressBookActiveTab: 'company', //当前选中的通讯录tab
|
||||
myContractListPage: 1, //当前查询的我的组织架构通讯录列表分页
|
||||
myContractListPageSize: 10, //我的组织架构通讯录列表单页数量
|
||||
myContractList: [], //我的组织架构通讯录列表
|
||||
hasMoreContracts: true, //是否还有更多我的组织架构通讯录数据
|
||||
myFriendsListPage: 1, //当前查询的我的好友列表分页
|
||||
myFriendsListPageSize: 10, //我的好友列表单页数量
|
||||
myFriendsList: [], //我的好友列表
|
||||
hasMoreFriends: true, //是否还有更多我的好友数据
|
||||
myGroupsListPage: 1, //当前查询的群组列表分页
|
||||
myGroupsListPageSize: 10, //群组列表单页数量
|
||||
myGroupsList: [], //我的群组列表
|
||||
hasMoreGroups: true, //是否还有更多我的群组数据
|
||||
myCompany: '', //当前登录人公司别
|
||||
swipeAction: [], //左滑操作栏按钮组
|
||||
isLoadingData: true, //是否正在加载数据
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.type) {
|
||||
navshow.value = true
|
||||
}
|
||||
})
|
||||
|
||||
const goWebHome = () => {
|
||||
uni.navigateBack()
|
||||
let OAWebView = plus.webview.all()
|
||||
OAWebView.forEach((webview) => {
|
||||
if (webview.id === 'webviewId1') {
|
||||
webview.evalJS(`handleBackHost()`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
state.swipeAction = [
|
||||
{
|
||||
text: t('addressBook.btns.delete'), //操作按钮的文本,
|
||||
},
|
||||
]
|
||||
state.addressBookTabs = [
|
||||
{
|
||||
key: 'company',
|
||||
title: t('addressBook.tabs.company'),
|
||||
},
|
||||
{
|
||||
key: 'friends',
|
||||
title: t('addressBook.tabs.friends'),
|
||||
},
|
||||
{
|
||||
key: 'groups',
|
||||
title: t('addressBook.tabs.groups'),
|
||||
},
|
||||
]
|
||||
handleSetWebviewStyle()
|
||||
getMyContractList()
|
||||
})
|
||||
|
||||
//输入搜索内容
|
||||
const inputSearchText = (e) => {
|
||||
searchVal.value = e
|
||||
}
|
||||
|
||||
//切换通讯录tab
|
||||
const updateAddressBookTab = (e) => {
|
||||
state.addressBookActiveTab = e
|
||||
}
|
||||
|
||||
//获取“组织架构”通讯录列表
|
||||
const getMyContractList = () => {
|
||||
let params = {
|
||||
type: 'addressBook', //查我的通讯录的时候写死addressBook
|
||||
page: state.myContractListPage,
|
||||
page_size: state.myContractListPageSize,
|
||||
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) {
|
||||
state.myContractList = res.data?.user_list || []
|
||||
} else {
|
||||
state.myContractList = state.myContractList.concat(
|
||||
res.data?.user_list || [],
|
||||
)
|
||||
}
|
||||
if (state.myContractList.length < res.data?.count) {
|
||||
state.hasMoreContracts = true
|
||||
} else {
|
||||
state.hasMoreContracts = false
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
state.isLoadingData = false
|
||||
})
|
||||
}
|
||||
|
||||
//获取“我的好友”列表
|
||||
const getMyFriendsList = () => {
|
||||
let params = {
|
||||
type: 'myFriends', //查我得好友的时候写死myFriends
|
||||
page: state.myFriendsListPage,
|
||||
page_size: state.myFriendsListPageSize,
|
||||
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 || []
|
||||
} else {
|
||||
state.myFriendsList = state.myFriendsList.concat(
|
||||
res.data?.user_list || [],
|
||||
)
|
||||
}
|
||||
if (state.myFriendsList.length < res.data?.count) {
|
||||
state.hasMoreFriends = true
|
||||
} else {
|
||||
state.hasMoreFriends = false
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
state.isLoadingData = false
|
||||
})
|
||||
}
|
||||
|
||||
//点击进入用户详情页面
|
||||
const toUserDetail = (userInfo) => {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/dialog/dialogDetail/userDetail??erpUserId=' +
|
||||
userInfo.erp_user_id,
|
||||
})
|
||||
}
|
||||
|
||||
//获取“我的群组”列表
|
||||
const getMyGroupsList = () => {
|
||||
let params = {
|
||||
page: state.myGroupsListPage,
|
||||
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 || []
|
||||
} else {
|
||||
state.myGroupsList = state.myGroupsList.concat(res.data?.items || [])
|
||||
}
|
||||
if (state.myGroupsList.length < res.data?.total) {
|
||||
state.hasMoreGroups = true
|
||||
} else {
|
||||
state.hasMoreGroups = false
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
state.isLoadingData = false
|
||||
})
|
||||
}
|
||||
|
||||
//加载更多数据
|
||||
const doLoadMore = (e) => {
|
||||
if (state.addressBookActiveTab === 'company' && state.hasMoreContracts) {
|
||||
state.myContractListPage += 1
|
||||
getMyContractList()
|
||||
} else if (state.addressBookActiveTab === 'friends' && state.hasMoreFriends) {
|
||||
state.myFriendsListPage += 1
|
||||
getMyFriendsList()
|
||||
} else if (state.addressBookActiveTab === 'groups' && state.hasMoreGroups) {
|
||||
state.myGroupsListPage += 1
|
||||
getMyGroupsList()
|
||||
}
|
||||
}
|
||||
|
||||
//获取会话Id
|
||||
const getSessionId = (talk_type, receiver_id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let params = {
|
||||
talkType: talk_type,
|
||||
receiverId: receiver_id,
|
||||
}
|
||||
const resp = ServeGetSessionId(params)
|
||||
console.log(resp)
|
||||
resp.then(({ code, data }) => {
|
||||
console.log(data)
|
||||
if (code == 200) {
|
||||
resolve(data?.sessionId)
|
||||
} else {
|
||||
}
|
||||
})
|
||||
resp.catch(() => {})
|
||||
})
|
||||
}
|
||||
|
||||
//点击跳转进入我的指定群聊
|
||||
const toGroupChat = async (groupInfo) => {
|
||||
let talk_type = 2
|
||||
let receiver_id = groupInfo.id
|
||||
const sessionId = await getSessionId(talk_type, receiver_id)
|
||||
if (useTalkStore().findTalkIndex(`${talk_type}_${receiver_id}`) === -1) {
|
||||
ServeCreateTalkList({
|
||||
talk_type,
|
||||
receiver_id,
|
||||
}).then(async ({ code, data }) => {
|
||||
if (code == 200) {
|
||||
let item = formatTalkItem(data)
|
||||
useTalkStore().addItem(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
useDialogueStore().setDialogue({
|
||||
name: groupInfo.group_name,
|
||||
talk_type: 2,
|
||||
receiver_id: receiver_id,
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: '/pages/dialog/index?sessionId=' + sessionId,
|
||||
})
|
||||
}
|
||||
|
||||
//显示删除好友确认框
|
||||
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: {},
|
||||
1: {},
|
||||
2: {
|
||||
result_type: t('index.mine.department'),
|
||||
result_type_color: '#377EC6',
|
||||
},
|
||||
3: {
|
||||
result_type: t('index.mine.project'),
|
||||
result_type_color: '#C1681C',
|
||||
},
|
||||
4: {
|
||||
result_type: t('index.type.company'),
|
||||
result_type_color: '#7A58DE',
|
||||
},
|
||||
}
|
||||
|
||||
watch(
|
||||
() => state.addressBookActiveTab,
|
||||
(newVal) => {
|
||||
if (newVal === 'company') {
|
||||
state.myContractListPage = 1
|
||||
getMyContractList()
|
||||
} else if (newVal === 'friends') {
|
||||
state.myFriendsListPage = 1
|
||||
getMyFriendsList()
|
||||
} else if (newVal === 'groups') {
|
||||
state.myGroupsListPage = 1
|
||||
getMyGroupsList()
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
watch(
|
||||
() => searchVal.value,
|
||||
(newVal) => {
|
||||
if (newVal === 'company') {
|
||||
state.myContractListPage = 1
|
||||
getMyContractList()
|
||||
} else if (state.addressBookActiveTab === 'friends') {
|
||||
state.myFriendsListPage = 1
|
||||
getMyFriendsList()
|
||||
} else if (state.addressBookActiveTab === 'groups') {
|
||||
state.myGroupsListPage = 1
|
||||
getMyGroupsList()
|
||||
}
|
||||
},
|
||||
)
|
||||
</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;
|
||||
}
|
||||
|
||||
.address-book-page {
|
||||
.address-book {
|
||||
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%;
|
||||
|
||||
.address-book-tabs-panes-list {
|
||||
margin: 30rpx 24rpx;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.tabs-panes-each {
|
||||
gap: 30rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
}
|
||||
.address-book-company,
|
||||
.address-book-friends {
|
||||
.address-book-company-name {
|
||||
margin: 0 0 -16rpx;
|
||||
span {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.address-book-groups {
|
||||
.groups-list-each {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
padding: 24rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.groups-info {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 16rpx;
|
||||
.groups-name {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
.groups-type {
|
||||
font-size: 24rpx;
|
||||
border-radius: 6rpx;
|
||||
font-weight: bold;
|
||||
padding: 6rpx 12rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
.groups-btns {
|
||||
flex-shrink: 0;
|
||||
margin: 0 0 0 16rpx;
|
||||
.groups-btns-each {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #46299d;
|
||||
padding: 16rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
span {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -61,13 +61,17 @@
|
||||
<template #bottom>
|
||||
<customBtn
|
||||
:isBottom="true"
|
||||
:btnText="$t('user.detail.sendMsg')"
|
||||
:btnText="
|
||||
state.canSendMsg
|
||||
? $t('user.detail.sendMsg')
|
||||
: $t('addressBook.btns.addFriend')
|
||||
"
|
||||
:subBtnText="
|
||||
state.userInfo.sys_id === state.uid
|
||||
!state.canSendMsg || state.userInfo.sys_id === state.uid
|
||||
? ''
|
||||
: $t('user.detail.ringBell')
|
||||
"
|
||||
@clickBtn="toTalkUser"
|
||||
@clickBtn="checkSendPermission"
|
||||
@clickSubBtn="handleCall"
|
||||
></customBtn>
|
||||
</template>
|
||||
@ -112,6 +116,7 @@ const talkStore = useTalkStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
import { getUserInfoByClickAvatar } from '@/api/user/index'
|
||||
import { ServeCheckFriend, ServeAddFriend } from '@/api/addressBook/index'
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
const { t } = useI18n()
|
||||
@ -123,6 +128,7 @@ const state = reactive({
|
||||
isShowPhoneCall: false, //是否显示电话拨号弹框
|
||||
phoneNumber: '', //手机号
|
||||
uid: computed(() => userStore.uid), //当前用户id
|
||||
canSendMsg: false, //是否可以发送消息(是好友或同公司别),如果不可以就需要先加好友
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
@ -145,6 +151,7 @@ const getUserInfo = () => {
|
||||
console.log(data)
|
||||
if (code == 200) {
|
||||
state.userInfo = data
|
||||
checkNeedAddFriend()
|
||||
let department = ''
|
||||
let post = ''
|
||||
if (data?.erp_dept_position?.length > 0) {
|
||||
@ -237,6 +244,44 @@ const doPhoneCall = () => {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
//检查是否可以发送消息,如果不可以要先添加好友
|
||||
const checkSendPermission = () => {
|
||||
if (state.canSendMsg) {
|
||||
toTalkUser()
|
||||
} else {
|
||||
doAddFriend()
|
||||
}
|
||||
}
|
||||
|
||||
//校验是否需要加好友
|
||||
const checkNeedAddFriend = () => {
|
||||
let params = {
|
||||
receiver_id: state.userInfo.sys_id, //聊天的用户id
|
||||
talk_type: 1,
|
||||
}
|
||||
ServeCheckFriend(params).then((res) => {
|
||||
console.log(res)
|
||||
if (res?.code === 200) {
|
||||
state.canSendMsg = res.data?.is_friend || false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//主动加好友(单向好友)
|
||||
const doAddFriend = () => {
|
||||
let params = {
|
||||
receiver_id: state.userInfo.sys_id, //聊天的用户id
|
||||
talk_type: 1,
|
||||
}
|
||||
ServeAddFriend(params).then((res) => {
|
||||
console.log(res)
|
||||
if (res?.code === 200) {
|
||||
message.success(t('addressBook.message.addSuccess') + ' !')
|
||||
state.canSendMsg = true
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.outer-layer {
|
||||
@ -279,6 +324,7 @@ const doPhoneCall = () => {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
@ -682,6 +682,21 @@
|
||||
</tm-sheet>
|
||||
</div>
|
||||
</tm-drawer>
|
||||
<tm-alert
|
||||
:content="state.notFriendOrSameCompanyHint"
|
||||
color="#fff"
|
||||
:shadow="2"
|
||||
:height="96"
|
||||
:closable="false"
|
||||
class="notFriendOrSameCompanyHint"
|
||||
v-if="talkParams.type === 1 && !state.isFriendOrSameCompany"
|
||||
>
|
||||
<template #right>
|
||||
<div class="addFriendBtn" @click="doAddFriend">
|
||||
<span>{{ $t('addressBook.btns.add') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</tm-alert>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
@ -751,6 +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, ServeAddFriend } from '@/api/addressBook/index'
|
||||
import {
|
||||
onLoad as uniOnload,
|
||||
onUnload as uniOnUnload,
|
||||
@ -758,6 +774,8 @@ import {
|
||||
onHide,
|
||||
} from '@dcloudio/uni-app'
|
||||
import ws from '@/connect'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
const { t } = useI18n()
|
||||
|
||||
Quill.register('formats/emoji', EmojiBlot)
|
||||
import 'quill-mention'
|
||||
@ -861,6 +879,12 @@ const state = ref({
|
||||
readDetailHeight: 400, //已读未读详情高度
|
||||
isFirstEnter: true, //是否是第一次进入
|
||||
isFromHide: false, //是否从hide后恢复
|
||||
isFriendOrSameCompany: false, //当前单聊对象是否为自己的好友(不同公司别)/ 同公司别
|
||||
notFriendOrSameCompanyHint: [
|
||||
{
|
||||
content: t('addressBook.message.notFriendsOrSameCompany'),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// 创建一个响应式的 Map 来维护已读数量
|
||||
@ -2146,6 +2170,7 @@ const handleAvatarTouchEnd = () => {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
checkNeedAddFriend()
|
||||
if (uni.getSystemInfoSync().osName === 'ios') {
|
||||
let versions = uni.getSystemInfoSync().osVersion.split('.')
|
||||
if (Number(versions[0]) < 16) {
|
||||
@ -2721,6 +2746,35 @@ const chatInputHeight = computed(() => {
|
||||
console.error(rpxToPx(72) + 'px', 'chatInputHeight')
|
||||
return rpxToPx(72) + 'px'
|
||||
})
|
||||
|
||||
//校验是否需要加好友
|
||||
const checkNeedAddFriend = () => {
|
||||
let params = {
|
||||
receiver_id: talkParams.receiver_id, //聊天的用户id
|
||||
talk_type: 1,
|
||||
}
|
||||
ServeCheckFriend(params).then((res) => {
|
||||
console.log(res)
|
||||
if (res?.code === 200) {
|
||||
state.value.isFriendOrSameCompany = res.data?.is_friend || false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//主动加好友(单向好友)
|
||||
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>
|
||||
<style scoped lang="less">
|
||||
.dialog-page {
|
||||
@ -2740,6 +2794,32 @@ const chatInputHeight = computed(() => {
|
||||
line-height: unset !important;
|
||||
}
|
||||
}
|
||||
|
||||
.notFriendOrSameCompanyHint {
|
||||
margin: 120rpx 24rpx;
|
||||
:deep(.round-2) {
|
||||
margin: 10rpx !important;
|
||||
box-shadow: 0 2px 6px 1px rgba(0, 0, 0, 0.2) !important;
|
||||
}
|
||||
:deep(.bdcld) {
|
||||
align-items: center !important;
|
||||
}
|
||||
.addFriendBtn {
|
||||
background-color: #46299d;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 10rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
span {
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.edit-revoked-message {
|
||||
|
@ -6,10 +6,12 @@ import { MessageComponents } from '@/constant/message'
|
||||
import { ITalkRecord } from '@/types/chat'
|
||||
import WdLoading from "@/uni_modules/wot-design-uni/components/wd-loading/wd-loading.vue";
|
||||
import { useInject } from '@/hooks'
|
||||
import { parseTime } from '@/utils/datetime'
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
const msgId = ref(null)
|
||||
const createdAt = ref(null)
|
||||
const { showUserInfoModal } = useInject()
|
||||
const isShow = ref(true)
|
||||
const items = ref<ITalkRecord[]>([])
|
||||
@ -21,7 +23,8 @@ const onMaskClick = () => {
|
||||
|
||||
const onLoadData = () => {
|
||||
ServeGetForwardRecords({
|
||||
msg_id: msgId.value
|
||||
msg_id: msgId.value,
|
||||
biz_date: createdAt.value
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
items.value = res.data.items || []
|
||||
@ -41,6 +44,7 @@ onMounted(() => {
|
||||
const page = pages[pages.length - 1]
|
||||
const options = page.$page.options
|
||||
msgId.value = options.msgId
|
||||
createdAt.value = parseTime(new Date((options.created_at as any)), '{y}{m}')
|
||||
console.log(msgId.value,'msgId.value');
|
||||
|
||||
onLoadData()
|
||||
|
@ -66,11 +66,11 @@
|
||||
/>
|
||||
<template v-slot:label>
|
||||
<div
|
||||
class="w-full h-[208rpx] pt-[22rpx] pb-[32rpx] pl-[14rpx] pr-[12rpx]"
|
||||
class="w-full px-[14rpx]"
|
||||
>
|
||||
<div
|
||||
@click="creatGroupChat"
|
||||
class="flex items-center pl-[22rpx] mb-[32rpx]"
|
||||
class="flex items-center pl-[22rpx] py-[32rpx]"
|
||||
>
|
||||
<div class="mr-[26rpx] flex items-center">
|
||||
<tm-image
|
||||
@ -86,9 +86,27 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
<div
|
||||
@click="toAddFriendPage"
|
||||
class="flex items-center pl-[22rpx] py-[32rpx]"
|
||||
>
|
||||
<div class="mr-[26rpx] flex items-center">
|
||||
<tm-image
|
||||
:width="40"
|
||||
:height="44"
|
||||
:src="addFriend"
|
||||
></tm-image>
|
||||
</div>
|
||||
<div
|
||||
class="leading-[54rpx] text-[32rpx] text-[#FFFFFF] font-bold"
|
||||
>
|
||||
添加好友
|
||||
</div>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
<div
|
||||
@click="toAddressBookPage"
|
||||
class="flex items-center pl-[22rpx] mt-[32rpx]"
|
||||
class="flex items-center pl-[22rpx] py-[32rpx]"
|
||||
>
|
||||
<div class="mr-[26rpx] flex items-center">
|
||||
<tm-image
|
||||
@ -144,6 +162,7 @@ import chatItem from './components/chatItem.vue'
|
||||
import addCircle from '@/static/image/chatList/addCircle.png'
|
||||
import cahtPopover from '@/static/image/chatList/cahtPopover.png'
|
||||
import zu3289 from '@/static/image/chatList/zu3289@2x.png'
|
||||
import addFriend from '@/static/image/chatList/addFriend.png'
|
||||
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
|
||||
import { handleSetWebviewStyle } from '@/utils/common'
|
||||
const paging = ref()
|
||||
@ -216,10 +235,23 @@ const toSearchPage = () => {
|
||||
})
|
||||
}
|
||||
|
||||
//点击跳转到添加好友页面
|
||||
const toAddFriendPage = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/addressBook/addFriend/index',
|
||||
})
|
||||
}
|
||||
|
||||
//点击跳转到通讯录页面
|
||||
const toAddressBookPage = () => {
|
||||
// 旧版本-按组织架构树的通讯录
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/chooseByDeps/index?chooseMode=3',
|
||||
// })
|
||||
|
||||
// 新版本-按公司别、好友、群组的通讯录
|
||||
uni.navigateTo({
|
||||
url: '/pages/chooseByDeps/index?chooseMode=3',
|
||||
url: '/pages/addressBook/index',
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,9 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
|
||||
zPaging.value?.complete([])
|
||||
} else {
|
||||
// 加载更多且为空,保持原列表不变
|
||||
zPaging.value?.complete(state.searchResult ? [state.searchResult] : [])
|
||||
zPaging.value?.complete(
|
||||
state.searchResult ? [state.searchResult] : [],
|
||||
)
|
||||
}
|
||||
} else {
|
||||
if (props.isPagination) {
|
||||
@ -303,7 +305,8 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
|
||||
if (
|
||||
paginationKey &&
|
||||
Array.isArray(
|
||||
(state?.searchResult && state?.searchResult[paginationKey]) || [],
|
||||
(state?.searchResult && state?.searchResult[paginationKey]) ||
|
||||
[],
|
||||
)
|
||||
) {
|
||||
data[paginationKey] = state.searchResult[paginationKey].concat(
|
||||
@ -328,8 +331,58 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
|
||||
} else if (state?.first_talk_record_infos?.talk_type === 2) {
|
||||
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 {
|
||||
state.searchResult = data
|
||||
zPaging.value?.complete([data])
|
||||
@ -368,7 +421,7 @@ const cancelSearch = () => {
|
||||
})
|
||||
} else {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
BIN
src/static/image/chatList/addFriend.png
Normal file
BIN
src/static/image/chatList/addFriend.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 654 B |
@ -193,5 +193,30 @@
|
||||
"release_hand_to_send": "松开发送",
|
||||
"release_hand_to_cancel": "松开取消",
|
||||
"hold_to": "按住",
|
||||
"speak": "说话"
|
||||
"speak": "说话",
|
||||
"addressBook": {
|
||||
"tabs": {
|
||||
"company": "组织架构",
|
||||
"friends": "我的好友",
|
||||
"groups": "我的群组"
|
||||
},
|
||||
"btns": {
|
||||
"enterGroup": "进入群聊",
|
||||
"addFriend": "添加好友",
|
||||
"add": "添加",
|
||||
"delete": "删除"
|
||||
},
|
||||
"message": {
|
||||
"addSuccess": "添加成功",
|
||||
"notFriendsOrSameCompany": "对方还不是您的好友,请添加到通讯录中吧!",
|
||||
"deleteSuccess": "删除成功",
|
||||
"doOrNotDeleteFriend": "是否删除该好友"
|
||||
}
|
||||
},
|
||||
"addFriend": {
|
||||
"pageTitle": "添加好友",
|
||||
"message": {
|
||||
"notFindData": "没有找到哦~"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user