Files
dvcp_v2_wxcp_app/src/project/pidu/AppConversation/conversationDetail.vue

559 lines
15 KiB
Vue
Raw Normal View History

2023-03-09 16:24:36 +08:00
<template>
<div class="conversationDetail">
2023-03-10 10:10:17 +08:00
<AiTopFixed>
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#ffffff"
inactive-color="#666666" :bar-style="barStyle" :active-item-style="activeStyle" active-color="#3975C6 " @change="change">
</u-tabs>
<div class="top-search">
2023-06-07 15:03:50 +08:00
<div class="left" @click="isShowDate=true">
<div class="color-999" v-if="!dateList.length">开始时间-结束时间</div>
<div v-else>{{dateList[0]}}{{dateList[1]}}</div>
<img src="./img/del-icon.png" alt="" v-if="dateList.length" @click.stop="clearDate()">
2023-03-10 10:10:17 +08:00
</div>
<div class="right">
2023-03-10 10:15:56 +08:00
<u-search v-model="keyword" :clearabled="true" placeholder="请输入关键词" :show-action="false" bg-color="#F5F5F5"
2023-03-10 10:10:17 +08:00
search-icon-color="#999" color="#999" height="58" @search="getListInit" @clear="getListInit">
</u-search>
</div>
</div>
</AiTopFixed>
2023-06-07 15:03:50 +08:00
<div class="conversation-list" v-if="list.length">
2023-03-10 10:10:17 +08:00
<div v-for="(item, index) in list" :key="index">
2023-06-08 13:44:24 +08:00
<div class="item" :class="item.userId == user.wxUserId ? 'item-right' : 'item-left'">
2023-06-09 14:14:51 +08:00
2023-06-08 13:44:24 +08:00
<!-- <img src="./img/fail-icon.png" alt="" class="fail-img" v-if="item.userId == user.wxUserId"> -->
2023-06-09 14:14:51 +08:00
2023-06-08 17:18:08 +08:00
<img :src="item.userAvatar" alt="" class="user-img" v-if="item.userId != user.wxUserId && item.userAvatar">
<img src="./img/user-img.png" alt="" class="user-img" v-if="item.userId != user.wxUserId && !item.userAvatar">
2023-06-09 11:52:50 +08:00
<p class="user-name">{{item.userName}}<span>{{item.msgSendTime}}</span></p>
2023-03-10 10:10:17 +08:00
<div class="content">
2023-06-08 13:44:24 +08:00
<span class="cir" v-if="item.msgType == 'text'"></span>
2023-06-09 11:52:50 +08:00
<p class="content-text" v-if="item.msgType == 'text'">{{item.content}}</p>
2023-06-08 13:44:24 +08:00
2023-06-07 15:03:50 +08:00
<div class="img-list" v-if="item.msgType == 'image'">
<img :src="item.sdkFileUrl" alt="" @click="previewImage(item.sdkFileUrl)">
</div>
2023-06-08 17:18:08 +08:00
2023-06-08 16:48:32 +08:00
<audio :src="item.sdkFileUrl" controls style="display: block;" v-if="item.msgType == 'voice'"></audio>
2023-06-08 13:44:24 +08:00
<video :src="item.sdkFileUrl" v-if="item.msgType == 'video'" />
<div class="file" @click="prevFile(item)" v-if="item.msgType == 'file'">
<u-row justify="between">
<label class="left">
<img :src="$cdn + 'common/appendix.png'" alt="">
2023-06-08 16:48:32 +08:00
<span>{{ item.sdkFileName }}</span>
2023-06-08 13:44:24 +08:00
</label>
2023-06-08 16:48:32 +08:00
<span>{{ item.fileSizeStr }}</span>
2023-06-08 13:44:24 +08:00
</u-row>
</div>
2023-06-08 16:48:32 +08:00
<div class="revoke-text" v-if="item.msgType == 'revoke'">{{item.userName}}{{item.msgSendTime.substring(0, 16)}}撤回了一条消息</div>
2023-06-09 11:52:50 +08:00
<div class="revoke-text" v-if="item.msgType == 'disagree'">对方不同意会话存档内容你将无法继续提供服务</div>
<div class="revoke-text" v-if="item.msgType == 'agree'">对方同意会话存档内容你可以继续提供服务</div>
<div class="card-info" v-if="item.msgType == 'card'">
<div class="top">
<div class="card-left">
<h3>{{item.cardCorpName}}</h3>
<p>{{item.cardUserName}}</p>
<div>{{item.cardUserId}}</div>
</div>
<div class="card-right">
<img :src="item.cardUserAvatar" alt="" v-if="item.cardUserAvatar">
<img src="./img/user-img.png" alt="" v-else>
</div>
</div>
2023-06-09 17:30:11 +08:00
<div class="bottom">个人名片</div>
2023-06-09 11:52:50 +08:00
</div>
<img :src="item.sdkFileUrl" alt="" v-if="item.msgType == 'emotion'" :style="[{width: item.width/2+'px'}, {height: item.height/2+'px'}]">
2023-06-09 14:14:51 +08:00
<div class="map-info" v-if="item.msgType == 'location'">
<map style="width: 100%; height: 100%;" :latitude="item.lat" :longitude="item.lng" :scale="item.zoom"></map>
<div class="address-text">
<p>{{item.title}}</p>
<p>{{item.address}}</p>
</div>
</div>
2023-06-09 11:52:50 +08:00
2023-06-09 16:53:52 +08:00
<div class="card-info" v-if="item.msgType == 'weapp'" @click="openApp(item)">
<div class="top">
<div class="card-left">
<h3>{{item.description}}</h3>
<p>{{item.title}}</p>
<div>{{item.username}}{{item.displayname}}</div>
</div>
</div>
<div class="bottom">小程序</div>
</div>
<div class="card-info" v-if="item.msgType == 'link'" @click="openLink(item)">
<div class="top">
<div class="card-left">
<p>{{item.title}}</p>
<div>{{item.username}}</div>
</div>
<div class="card-right" v-if="item.imageUrl">
<img :src="item.imageUrl" alt="" >
</div>
</div>
<div class="bottom">分享链接</div>
</div>
2023-05-05 10:40:05 +08:00
</div>
2023-06-08 13:44:24 +08:00
<img :src="item.userAvatar" alt="" class="user-img" v-if="item.userId == user.wxUserId">
2023-06-09 14:14:51 +08:00
2023-06-08 13:44:24 +08:00
<!-- <img src="./img/fail-icon.png" alt="" class="fail-img" v-if="item.userId != user.wxUserId"> -->
2023-03-10 10:10:17 +08:00
</div>
</div>
</div>
2023-06-07 15:03:50 +08:00
<AiEmpty v-else/>
<u-calendar v-model="isShowDate" @change="onDateChange" mode="range"></u-calendar>
2023-06-08 16:48:32 +08:00
<!-- <div class="footer" @click="toGroup">{{type == 1 ? '群详情' : '个人信息'}}</div> -->
2023-03-09 16:24:36 +08:00
</div>
</template>
<script>
2023-06-08 16:48:32 +08:00
import {mapState, mapActions} from "vuex";
2023-03-09 16:24:36 +08:00
export default {
name: "conversationDetail",
2023-06-09 09:47:12 +08:00
enablePullDownRefresh: true,
2023-03-09 16:24:36 +08:00
data() {
return {
2023-03-10 10:10:17 +08:00
tabList: [
2023-06-07 16:45:37 +08:00
{name: '全部', value: ''},
2023-06-08 13:44:24 +08:00
{name: '图片/视频', value: 'imagevideo'},
2023-06-07 16:45:37 +08:00
{name: '语音', value: 'voice'},
2023-06-08 13:44:24 +08:00
{name: '文件', value: 'file'},
2023-03-10 10:10:17 +08:00
],
currentTabs: 0,
barStyle: {
'width': '24px',
'height': '2px',
'border-radius': '0',
'bottom': '5px'
},
activeStyle: {
'font-weight' : '400',
'color': '#000000'
},
keyword: '',
2023-06-07 15:03:50 +08:00
toUserId: '',
roomId: '',
current: 1,
pages: 2,
list: [],
type: '',
isShowDate: false,
dateList: [],
amrPlay: '',
amrPlayStatus: false,
2023-03-09 16:24:36 +08:00
};
},
2023-06-07 15:03:50 +08:00
computed: {
...mapState(['user']),
},
onLoad(option) {
if(option.toUserId) {
this.toUserId = option.toUserId
}else {
this.roomId = option.roomId
}
this.type = option.type
this.getList()
},
2023-03-09 16:24:36 +08:00
onShow() {
document.title = '会话详情'
},
2023-06-09 09:47:12 +08:00
onPullDownRefresh() {
if(this.current > this.pages) {
uni.stopPullDownRefresh()
return this.$u.toast('已加载完成,没有更多数据')
}else {
this.current ++
this.getList()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1000)
}
},
2023-03-09 16:24:36 +08:00
methods: {
2023-06-07 15:03:50 +08:00
toGroup() {
if(this.type == 1) {
uni.navigateTo({url: `./groupDetail`})
}else {
uni.navigateTo({url: `./userInfo`})
}
},
2023-03-10 10:10:17 +08:00
change(index) {
this.keyword = ''
this.currentTabs = index
this.getListInit()
},
2023-06-07 15:03:50 +08:00
onDateChange (e) {
console.log(e)
this.dateList = [e.startDate, e.endDate]
this.getListInit()
},
clearDate() {
this.dateList = []
this.getListInit()
},
2023-03-10 10:10:17 +08:00
getListInit() {
2023-06-07 15:03:50 +08:00
this.current = 1
this.pages = 2
this.list = []
this.getList()
},
getList() {
this.$http.post(`/app/appsessionarchiveinfo/listByUser`, null, {
params: {
current: this.current,
2023-06-09 11:52:50 +08:00
size: 10,
2023-06-08 09:54:53 +08:00
msgType: this.tabList[this.currentTabs].value,
2023-06-08 13:44:24 +08:00
// msgType: 'file',
2023-06-07 15:03:50 +08:00
toUserId: this.toUserId,
roomId: this.roomId,
type: this.type,
2023-06-07 16:45:37 +08:00
content: this.keyword,
startTime: this.dateList.length ? this.dateList[0] : '',
2023-06-08 09:54:53 +08:00
endTime: this.dateList.length ? this.dateList[1] : ''
2023-06-07 15:03:50 +08:00
}
}).then(res=> {
if(res?.data) {
2023-06-09 14:14:51 +08:00
res.data.records.map((item) => {
if(item.msgType == 'location') {
item.covers = [{
latitude: item.lat,
longitude: item.lng,
label: {
content: item.address
},
callout: {
content: item.title
}
}]
}
})
2023-06-09 09:47:12 +08:00
this.list = this.current > 1 ? [ ...res.data.records, ...this.list]: res.data.records
2023-06-07 15:03:50 +08:00
this.pages = res.data.pages
}
})
},
previewImage(img) {
uni.previewImage({
urls: [img],
current: img
})
},
2023-06-08 16:48:32 +08:00
...mapActions(['previewFile']),
2023-06-08 13:44:24 +08:00
prevFile(file) {
this.$loading()
this.previewFile({ ...file }).then(()=>{
this.$hideLoading()
})
},
2023-06-09 16:53:52 +08:00
openLink(row) {
window.open(row.linkUrl);
},
openApp(row) {
uni.navigateToMiniProgram({
// appId: row.goodsJdAppid,
// path: row.goodsJdUrl
})
}
2023-03-09 16:24:36 +08:00
},
2023-06-07 15:03:50 +08:00
onReachBottom() {
2023-06-09 09:47:12 +08:00
// this.current ++
// this.getList()
2023-06-07 15:03:50 +08:00
}
2023-03-09 16:24:36 +08:00
};
</script>
<style lang="scss" scoped>
.conversationDetail {
2023-03-10 10:10:17 +08:00
height: 100%;
::v-deep .AiTopFixed {
.placeholder {
.content {
padding: 0 !important;
}
}
.fixed {
margin: 0 !important;
.content {
padding: 0 !important;
}
}
}
.top-search {
padding: 20px 32px;
display: flex;
.left {
2023-06-07 15:03:50 +08:00
width: 400px;
2023-03-10 10:10:17 +08:00
div {
2023-06-07 15:03:50 +08:00
display: inline-block;
2023-03-10 10:10:17 +08:00
line-height: 64px;
}
2023-06-07 15:03:50 +08:00
img {
display: inline-block;
width: 32px;
height: 32px;
margin-left: 8px;
vertical-align: middle;
}
2023-03-10 10:10:17 +08:00
}
.right {
2023-06-07 15:03:50 +08:00
width: calc(100% - 400px);
2023-03-10 10:10:17 +08:00
}
}
.conversation-list {
2023-06-07 15:03:50 +08:00
padding: 48px 32px 160px;
2023-03-10 10:10:17 +08:00
// background-color: #EBECF0;
.item {
margin-bottom: 48px;
display: flex;
2023-06-09 11:52:50 +08:00
position: relative;
.user-name {
position: absolute;
top: 0;
left: 24px;
font-family: PingFangSC-Regular;
font-size: 22px;
color: #666;
padding:0 0 0 64px;
span {
display: inline-block;
margin: 0 12px;
font-family: PingFangSC-Regular;
font-size: 20px;
color: #999;
}
}
2023-03-10 10:10:17 +08:00
.user-img {
width: 72px;
height: 72px;
margin-right: 20px;
2023-06-07 15:03:50 +08:00
border-radius: 50%;
2023-03-10 10:10:17 +08:00
}
.content {
max-width: calc(100% - 144px);
position: relative;
2023-06-09 11:52:50 +08:00
margin-top: 44px;
2023-06-08 13:44:24 +08:00
.cir {
2023-03-10 10:10:17 +08:00
width: 0px;
height: 0px;
border: 10px solid transparent;
position: absolute;
top: 20px;
}
2023-06-09 11:52:50 +08:00
.content-text {
2023-03-10 10:10:17 +08:00
display: inline-block;
padding: 14px 54px 14px 32px;
2023-06-08 17:56:21 +08:00
width: 100%;
2023-03-10 10:10:17 +08:00
background-color: #fff;
font-family: PingFangSC-Regular;
font-size: 32px;
color: #333;
word-break: break-all;
2023-06-08 17:56:21 +08:00
box-sizing: border-box;
2023-03-10 10:10:17 +08:00
}
}
.fail-img {
width: 32px;
height: 32px;
margin: auto 0 auto 24px;
}
2023-06-07 15:03:50 +08:00
.img-list {
img {
2023-06-09 16:53:52 +08:00
max-width: 400px;
2023-06-07 15:03:50 +08:00
margin: 0 16px 16px 0;
}
}
2023-06-08 13:44:24 +08:00
::v-deep .uni-audio-default {
height: 72px;
2023-06-09 16:53:52 +08:00
width: 280px!important;
min-width: 0!important;
2023-06-08 13:44:24 +08:00
}
::v-deep .uni-audio-left {
height: 72px;
width: 72px;
.uni-audio-button {
margin: 14px;
}
}
::v-deep .uni-audio-right {
height: 72px;
margin-left: 72px;
padding: 10px 32px 10px 0;
}
.revoke-text {
line-height: 54px;
padding: 0 24px;
border-radius: 8px;
2023-06-08 16:48:32 +08:00
background-color: #EEE;
color: #999;
2023-06-08 13:44:24 +08:00
margin-top: 16px;
}
.file {
height: 128px;
background: #FFFFFF;
border-radius: 8px;
border: 1px solid #CCCCCC;
box-sizing: border-box;
padding: 0 16px;
margin-bottom: 32px;
& > .u-row {
height: 100%;
.left {
width: 522px;
display: flex;
align-items: center;
& > img {
width: 96px;
height: 96px;
}
& > span {
font-size: 32px;
color: #333333;
display: inline-block;
line-height: 44px;
text-overflow: ellipsis;
overflow-x: hidden;
white-space: nowrap;
}
}
& > span {
font-size: 28px;
color: #999;
margin: -8px 0 0 16px;
}
}
}
2023-06-09 11:52:50 +08:00
.card-info {
width: 450px;
background: #FFF;
.top {
padding: 16px 32px;
display: flex;
.card-left {
width: calc(100% - 120px);
h3 {
font-family: PingFangSC-Regular;
font-size: 32px;
color: #333;
line-height: 44px;
height: 74px;
}
p {
font-family: PingFangSC-SNaNpxibold;
font-size: 32px;
color: #333;
line-height: 44px;
}
div {
font-family: PingFangSC-Regular;
font-size: 24px;
color: #999;
line-height: 34px;
}
}
.card-right {
img {
width: 84px;
height: 84px;
}
}
}
.bottom {
padding-left: 32px;
line-height: 48px;
font-family: PingFangSC-Regular;
font-size: 22px;
color: #999;
border-top: 1px solid #eee;
}
}
2023-06-09 14:14:51 +08:00
.map-info {
width: 560px;
height: 400px;
.address-text {
position: absolute;
bottom: 0;
left: 0;
width: 560px;
background-color: rgba(0, 0, 0, .7);
p {
color: #fff;
line-height: 44px;
font-size: 24px;
padding-left: 32px;
word-break: break-all;
}
}
}
2023-03-10 10:10:17 +08:00
}
.item-left {
.content {
2023-06-08 13:44:24 +08:00
.cir {
2023-03-10 10:10:17 +08:00
left: -18px;
border-right-color: #fff;
}
}
}
.item-right {
width: 100%;
justify-content: right;
2023-06-09 11:52:50 +08:00
.user-name {
left: 0;
right: 82px;
text-align: right;
}
2023-03-10 10:10:17 +08:00
.user-img {
margin: 0 0 0 20px;
}
.content {
2023-06-08 13:44:24 +08:00
.cir {
2023-03-10 10:10:17 +08:00
border-left-color: #C7E7FE;
right: -18px;
}
2023-06-09 11:52:50 +08:00
.content-text {
2023-03-10 10:10:17 +08:00
background-color: #C7E7FE;
padding: 14px 32px 14px 54px;
}
}
2023-06-08 13:44:24 +08:00
.fail-img {
margin: auto 24px auto 0;
}
2023-03-10 10:10:17 +08:00
}
}
2023-06-07 15:03:50 +08:00
.footer{
width: 100%;
height: 112px;
line-height: 112px;
background: #1365DD;
box-shadow: inset 0px 1px 0px 0px #EEEEEE;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFF;
text-align: center;
position: fixed;
bottom: 0;
left: 0;
2023-06-08 16:48:32 +08:00
z-index: 99;
2023-06-07 15:03:50 +08:00
}
2023-03-09 16:24:36 +08:00
}
</style>