2024-11-19 05:57:36 +00:00
|
|
|
<template>
|
|
|
|
<div class="outer-layer">
|
|
|
|
<div>
|
2024-12-24 08:28:44 +00:00
|
|
|
<tm-navbar :hideBack="false" hideHome title="" :leftWidth="420">
|
2024-11-22 01:06:37 +00:00
|
|
|
<template v-slot:left>
|
2024-12-24 08:28:44 +00:00
|
|
|
<div class="flex items-center ml-[48rpx]">
|
|
|
|
<tm-image
|
|
|
|
:width="72"
|
|
|
|
:height="72"
|
|
|
|
:round="12"
|
|
|
|
:src="userStore.avatar"
|
|
|
|
></tm-image>
|
|
|
|
<div class="ml-[24rpx] text-[36rpx] font-bold">
|
|
|
|
{{ userStore.nickname }}
|
|
|
|
</div>
|
2024-11-22 01:06:37 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-slot:right>
|
2024-12-30 06:47:02 +00:00
|
|
|
<div class="mr-[48rpx] popoverBox">
|
2024-12-24 08:28:44 +00:00
|
|
|
<tm-popover position="br" color="#333333" :width="260">
|
|
|
|
<tm-image
|
|
|
|
:width="41"
|
|
|
|
:height="41"
|
|
|
|
:round="12"
|
|
|
|
:src="addCircle"
|
|
|
|
></tm-image>
|
|
|
|
<template v-slot:label>
|
2025-02-05 08:22:32 +00:00
|
|
|
<div
|
|
|
|
class="w-full h-[208rpx] pt-[22rpx] pb-[22rpx] pl-[34rpx] pr-[32rpx]"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
@click="creatGroupChat"
|
|
|
|
class="flex items-center mb-[30rpx]"
|
|
|
|
>
|
2024-12-24 08:28:44 +00:00
|
|
|
<div class="mr-[26rpx] flex items-center">
|
|
|
|
<tm-image
|
|
|
|
:width="40"
|
|
|
|
:height="40"
|
|
|
|
:src="cahtPopover"
|
|
|
|
></tm-image>
|
|
|
|
</div>
|
2025-02-05 08:22:32 +00:00
|
|
|
<div
|
|
|
|
class="leading-[54rpx] text-[32rpx] text-[#FFFFFF] font-bold"
|
|
|
|
>
|
|
|
|
发起群聊
|
|
|
|
</div>
|
2024-12-24 08:28:44 +00:00
|
|
|
</div>
|
2025-02-05 08:22:32 +00:00
|
|
|
<div class="divider"></div>
|
|
|
|
<div
|
|
|
|
@click="toAddressBookPage"
|
|
|
|
class="flex items-center mt-[28rpx]"
|
|
|
|
>
|
2024-12-24 08:28:44 +00:00
|
|
|
<div class="mr-[26rpx] flex items-center">
|
|
|
|
<tm-image
|
|
|
|
:width="40"
|
|
|
|
:height="40"
|
|
|
|
:src="zu3289"
|
|
|
|
></tm-image>
|
|
|
|
</div>
|
2025-02-05 08:22:32 +00:00
|
|
|
<div
|
|
|
|
class="leading-[54rpx] text-[32rpx] text-[#FFFFFF] font-bold"
|
|
|
|
>
|
2024-12-24 08:28:44 +00:00
|
|
|
通讯录
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</tm-popover>
|
2024-11-22 01:06:37 +00:00
|
|
|
</div>
|
2024-12-24 08:28:44 +00:00
|
|
|
</template>
|
2024-11-22 01:06:37 +00:00
|
|
|
</tm-navbar>
|
2024-11-19 05:57:36 +00:00
|
|
|
</div>
|
|
|
|
<div class="root">
|
2024-12-26 09:02:48 +00:00
|
|
|
<div class="searchRoot" @click="toSearchPage">
|
2024-12-24 08:28:44 +00:00
|
|
|
<tm-input
|
|
|
|
placeholder="请输入…"
|
|
|
|
color="#F9F9FD"
|
|
|
|
:round="1"
|
|
|
|
prefix="tmicon-search"
|
|
|
|
prefixColor="#46299D"
|
2025-03-04 01:14:53 +00:00
|
|
|
placeholderStyle="color:#BABABA"
|
2024-12-24 08:28:44 +00:00
|
|
|
></tm-input>
|
2024-11-19 05:57:36 +00:00
|
|
|
</div>
|
|
|
|
<div class="contentRoot">
|
2024-11-22 01:06:37 +00:00
|
|
|
<chatItem
|
2024-12-24 08:28:44 +00:00
|
|
|
v-for="(item, index) in items"
|
2024-11-22 01:06:37 +00:00
|
|
|
:key="item.index_name"
|
|
|
|
:index="index"
|
|
|
|
:data="item"
|
|
|
|
/>
|
2024-11-19 05:57:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2024-11-11 06:46:14 +00:00
|
|
|
<script setup>
|
2025-02-05 08:22:32 +00:00
|
|
|
import { ref, watch, computed } from 'vue'
|
|
|
|
import { onShow, onLoad } from '@dcloudio/uni-app'
|
|
|
|
import { useChatList } from '@/store/chatList/index.js'
|
|
|
|
import { useAuth } from '@/store/auth'
|
|
|
|
import { useTalkStore, useUserStore, useDialogueStore } from '@/store'
|
|
|
|
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'
|
2024-11-11 06:46:14 +00:00
|
|
|
|
2025-02-05 08:22:32 +00:00
|
|
|
const talkStore = useTalkStore()
|
|
|
|
const userStore = useUserStore()
|
|
|
|
const dialogueStore = useDialogueStore()
|
|
|
|
const { userInfo } = useAuth()
|
2024-11-11 06:46:14 +00:00
|
|
|
|
2025-02-05 08:22:32 +00:00
|
|
|
const topItems = computed(() => talkStore.topItems)
|
2024-11-22 01:06:37 +00:00
|
|
|
const items = computed(() => {
|
|
|
|
// if (searchKeyword.value.length === 0) {
|
2025-02-05 08:22:32 +00:00
|
|
|
return talkStore.talkItems
|
2024-11-22 01:06:37 +00:00
|
|
|
// }
|
|
|
|
|
|
|
|
// return talkStore.talkItems.filter((item) => {
|
|
|
|
// let keyword = item.remark || item.name
|
|
|
|
|
|
|
|
// return keyword.toLowerCase().indexOf(searchKeyword.value.toLowerCase()) != -1
|
|
|
|
// })
|
2025-02-05 08:22:32 +00:00
|
|
|
})
|
2024-11-22 01:06:37 +00:00
|
|
|
|
2024-12-24 08:28:44 +00:00
|
|
|
const creatGroupChat = () => {
|
|
|
|
uni.navigateTo({
|
2025-02-05 08:22:32 +00:00
|
|
|
url: '/pages/creatGroupChat/index',
|
|
|
|
})
|
|
|
|
}
|
2024-11-22 01:06:37 +00:00
|
|
|
|
2024-12-26 09:02:48 +00:00
|
|
|
const toSearchPage = () => {
|
|
|
|
uni.navigateTo({
|
2025-02-05 08:22:32 +00:00
|
|
|
url: '/pages/search/index',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
//点击跳转到通讯录页面
|
|
|
|
const toAddressBookPage = () => {
|
|
|
|
uni.navigateTo({
|
2025-02-06 09:01:28 +00:00
|
|
|
url: '/pages/chooseByDeps/index?chooseMode=3',
|
2025-02-05 08:22:32 +00:00
|
|
|
})
|
|
|
|
}
|
2024-12-26 09:02:48 +00:00
|
|
|
|
2024-12-24 08:28:44 +00:00
|
|
|
watch(
|
|
|
|
() => talkStore,
|
|
|
|
(newValue, oldValue) => {
|
2025-02-05 08:22:32 +00:00
|
|
|
// console.log(talkStore)
|
2024-12-24 08:28:44 +00:00
|
|
|
},
|
2025-02-05 08:22:32 +00:00
|
|
|
{ deep: true, immediate: true },
|
|
|
|
)
|
2024-11-22 01:06:37 +00:00
|
|
|
|
2024-12-24 08:28:44 +00:00
|
|
|
onShow(() => {
|
2025-02-05 08:22:32 +00:00
|
|
|
talkStore.loadTalkList()
|
|
|
|
})
|
|
|
|
|
|
|
|
onLoad((options) => {
|
2025-02-06 09:01:28 +00:00
|
|
|
if (options?.openSessionIndexName) {
|
2025-02-05 08:22:32 +00:00
|
|
|
if (items?.value?.length > 0) {
|
2025-02-06 09:01:28 +00:00
|
|
|
items.value.forEach((openSession) => {
|
|
|
|
if (openSession.index_name === options?.openSessionIndexName) {
|
2025-02-05 08:22:32 +00:00
|
|
|
dialogueStore.setDialogue(openSession)
|
|
|
|
if (openSession.unread_num > 0) {
|
|
|
|
ServeClearTalkUnreadNum({
|
|
|
|
talk_type: openSession.talk_type,
|
|
|
|
receiver_id: openSession.receiver_id,
|
|
|
|
}).then(() => {
|
|
|
|
talkStore.updateItem({
|
|
|
|
index_name: openSession.index_name,
|
|
|
|
unread_num: 0,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
uni.navigateTo({
|
|
|
|
url: '/pages/dialog/index?sessionId=' + openSession.id,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2024-11-11 06:46:14 +00:00
|
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
2024-12-24 08:28:44 +00:00
|
|
|
uni-page-body,
|
|
|
|
page {
|
|
|
|
height: 100%;
|
2024-11-26 08:51:36 +00:00
|
|
|
}
|
2024-11-19 05:57:36 +00:00
|
|
|
.outer-layer {
|
|
|
|
overflow-y: auto;
|
|
|
|
flex: 1;
|
2025-02-05 08:22:32 +00:00
|
|
|
background-image: url('@/static/image/clockIn/z3280@3x.png');
|
2024-11-19 05:57:36 +00:00
|
|
|
background-size: cover;
|
|
|
|
padding: 0 32rpx 20rpx 32rpx;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
.root {
|
|
|
|
flex: 1;
|
|
|
|
padding: 20rpx 0;
|
|
|
|
}
|
|
|
|
.searchRoot {
|
|
|
|
background-color: #fff;
|
|
|
|
padding: 22rpx 18rpx;
|
|
|
|
}
|
|
|
|
.contentRoot {
|
|
|
|
margin-top: 20rpx;
|
|
|
|
background-color: #fff;
|
|
|
|
}
|
2025-02-05 08:22:32 +00:00
|
|
|
.divider {
|
2024-12-24 08:28:44 +00:00
|
|
|
height: 1rpx;
|
2025-02-05 08:22:32 +00:00
|
|
|
background-color: #7c7c7c;
|
2024-12-24 08:28:44 +00:00
|
|
|
opacity: 0.6;
|
|
|
|
}
|
2024-12-30 06:47:02 +00:00
|
|
|
.popoverBox {
|
2025-02-05 08:22:32 +00:00
|
|
|
:deep(.popover-bcc) {
|
|
|
|
transform: translateX(20rpx) translateY(40rpx);
|
2024-12-30 06:47:02 +00:00
|
|
|
}
|
|
|
|
}
|
2024-11-11 06:46:14 +00:00
|
|
|
</style>
|