Files
dvcp_v2_webapp/project/pidu/app/AppSessionArchive/components/Detail.vue

526 lines
15 KiB
Vue
Raw Normal View History

2023-04-26 14:23:45 +08:00
<template>
2023-04-26 16:16:46 +08:00
<ai-list v-loading="isLoading" class="detail">
2023-04-26 14:23:45 +08:00
<template slot="title">
2023-04-26 16:16:46 +08:00
<ai-title title="会话存档详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
<template #left>
<div class="addressBook-left">
<div class="addressBook-left__title">
2023-06-07 17:53:53 +08:00
<h2 :class="[tabIndex == 1 ? 'tab-active' : '']" @click="typeClick(1)">群聊会话</h2>
<h2 :class="[tabIndex == 0 ? 'tab-active' : '']" @click="typeClick(0)">私聊会话</h2>
2023-04-26 16:16:46 +08:00
</div>
<div class="addressBook-left__list--title">
<el-input
2023-06-08 09:37:11 +08:00
size="mini"
placeholder="请输入联系人姓名"
v-model="searchName"
clearable
suffix-icon="iconfont iconSearch">
2023-04-26 16:16:46 +08:00
</el-input>
</div>
<div class="addressBook-left__list--wrapper">
2023-06-07 17:53:53 +08:00
<div class="addressBook-left__list--item" v-for="(item, index) in list" :key="index" :class="leftActiveIndex == index ? 'active' : ''" @click="leftClick(index)">
<div v-if="tabIndex == 1">
<img src="./img/group-img.png" alt="">{{item.roomName}}
</div>
<div v-else>
<img :src="item.toUserAvatar" alt="">{{item.toUserName}}
</div>
2023-04-26 16:16:46 +08:00
</div>
2023-06-07 17:53:53 +08:00
<AiEmpty v-if="!list.length"></AiEmpty>
2023-04-26 16:16:46 +08:00
</div>
2023-06-08 09:37:11 +08:00
<el-pagination class="pagination"
layout="prev, pager, next"
:total="total" @current-change="currentChange" :current-page="current" :page-size="20">
</el-pagination>
2023-04-26 16:16:46 +08:00
</div>
2023-04-26 14:23:45 +08:00
</template>
<template slot="content">
2023-04-26 16:16:46 +08:00
<div class="content-right-title">
<div class="tab-content">
2023-06-07 17:53:53 +08:00
<h2 v-for="(item, index) in msgTypeList" :key="index" :class="msgType == index ? 'tab-active' : ''" @click="msgTypeClick(index)">{{item.name}}</h2>
2023-04-26 16:16:46 +08:00
</div>
<div class="search-content">
2023-06-08 09:37:11 +08:00
<el-date-picker v-model="time" size="small" type="daterange" value-format="yyyy-MM-dd"
2023-04-26 16:16:46 +08:00
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="onChange">
</el-date-picker>
2023-06-07 17:53:53 +08:00
<el-input size="small" placeholder="输入搜索内容" v-model="searchMsg" clearable
@clear="msgCurrent = 1, searchMsg = '', getMsgListInit()" suffix-icon="iconfont iconSearch"
v-throttle="() => {(msgCurrent = 1), getMsgListInit();}"/>
2023-04-26 16:16:46 +08:00
<ai-download :instance="instance" url="/app/appconvenientaddressbook/export" :params="search" fileName="会话存档"
2023-06-07 17:53:53 +08:00
:disabled="msgList.length == 0">
<el-button icon="iconfont iconExported" :disabled="msgList.length == 0">导出</el-button>
2023-04-26 16:16:46 +08:00
</ai-download>
</div>
</div>
2023-04-26 16:33:55 +08:00
<div class="content-right-info">
2023-06-07 17:53:53 +08:00
<div v-for="(item, index) in msgList" :key="index">
<div class="item item-right" v-if="item.userId == user.wxUserId">
2023-06-07 17:57:27 +08:00
<p class="time" v-if="index == 0">{{item.createTime}}</p>
2023-04-26 16:33:55 +08:00
<div class="item-content-flex">
2023-06-07 17:53:53 +08:00
<!-- <i class="el-icon-warning"></i> -->
<div class="content" v-if="item.msgType == 'text'">
2023-04-26 16:33:55 +08:00
<span></span>
<p>{{item.content}}</p>
</div>
2023-06-07 17:53:53 +08:00
<div class="img-list" v-if="item.msgType == 'image'">
<img :src="item.sdkFileUrl" alt="" v-viewer>
</div>
<img :src="item.userAvatar" alt="" class="user-img">
2023-04-26 16:33:55 +08:00
</div>
</div>
2023-06-07 17:53:53 +08:00
<div class="item item-left" v-else>
2023-06-07 17:57:27 +08:00
<p class="time" v-if="index == 0">{{item.createTime}}</p>
2023-04-26 16:33:55 +08:00
<div class="item-content-flex">
2023-06-07 17:53:53 +08:00
<img :src="item.userAvatar" alt="" class="user-img">
<div class="content" v-if="item.msgType == 'text'">
2023-04-26 16:33:55 +08:00
<span></span>
<p>{{item.content}}</p>
</div>
2023-06-07 17:53:53 +08:00
<div class="img-list" v-if="item.msgType == 'image'">
<img :src="item.sdkFileUrl" alt="" v-viewer>
</div>
<!-- <i class="el-icon-warning"></i> -->
2023-04-26 16:33:55 +08:00
</div>
</div>
</div>
2023-06-07 17:53:53 +08:00
<AiEmpty v-if="!msgList.length"></AiEmpty>
2023-04-26 16:33:55 +08:00
</div>
2023-06-08 09:37:11 +08:00
<el-pagination class="msg-list-pagination"
layout="prev, pager, next"
:total="msgTotal" @current-change="msgCurrentChange" :current-page="msgCurrent" :page-size="20">
</el-pagination>
2023-04-26 14:23:45 +08:00
</template>
2023-04-26 16:16:46 +08:00
</ai-list>
2023-04-26 14:23:45 +08:00
</template>
<script>
2023-06-07 17:53:53 +08:00
import { mapState } from 'vuex'
import Viewer from 'v-viewer'
import Vue from 'vue'
Vue.use(Viewer);
2023-04-26 14:23:45 +08:00
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
isLoading: false,
2023-06-07 17:53:53 +08:00
tabIndex: 1,
2023-04-26 16:16:46 +08:00
searchName: '',
time: [],
search: {
name: ''
},
2023-04-26 16:33:55 +08:00
current: 1,
2023-06-08 09:37:11 +08:00
total: 0,
2023-06-07 17:53:53 +08:00
list: [],
leftActiveIndex: 0,
msgCurrent: 1,
2023-06-08 09:37:11 +08:00
msgTotal: 0,
2023-06-07 17:53:53 +08:00
msgList: [],
msgType: 0,
msgTypeList: [
{name: '全部', value: ''},
{name: '文本', value: 'text'},
{name: '图片', value: 'image'},
{name: '语音', value: 'voice'},
],
searchMsg: '',
id: 'LiuYe'
2023-04-26 14:23:45 +08:00
}
},
2023-06-07 17:53:53 +08:00
computed: {
...mapState(['user']),
},
2023-04-26 14:23:45 +08:00
created () {
2023-06-07 17:53:53 +08:00
this.isLoading = true
2023-04-26 14:23:45 +08:00
if (this.params && this.params.id) {
this.id = this.params.id
2023-06-07 17:53:53 +08:00
this.getList()
2023-04-26 14:23:45 +08:00
}
2023-06-08 09:37:11 +08:00
this.getList()
2023-04-26 14:23:45 +08:00
},
methods: {
2023-06-07 17:53:53 +08:00
getListInit() {
this.isLoading = true
this.current = 1
this.leftActiveIndex = 0
this.getList()
},
getList () {
this.instance.post(`/app/appsessionarchiveindex/list`, null, {
params: {
userId: this.id,
type: this.tabIndex,
size: 20,
current: this.current,
toUserName: this.tabIndex == 1 ? '' : this.searchName,
roomName: this.tabIndex == 1 ? this.searchName : '',
}
}).then(res => {
2023-04-26 14:23:45 +08:00
if (res.code === 0) {
2023-06-07 17:53:53 +08:00
this.list = res.data.records
2023-06-08 09:37:11 +08:00
this.total = res.data.total || 0
2023-06-07 17:53:53 +08:00
this.getMsgListInit()
2023-04-26 14:23:45 +08:00
}
this.isLoading = false
}).catch(() => {
this.isLoading = false
})
},
2023-06-07 17:53:53 +08:00
getMsgListInit() {
this.isLoading = true
this.msgCurrent = 1
this.getMsgList()
},
getMsgList() {
this.instance.post(`/app/appsessionarchiveinfo/listByUser`, null, {
params: {
userId: this.id,
type: this.tabIndex,
size: 20,
current: this.msgCurrent,
msgType: this.msgTypeList[this.msgType].value,
toUserId: this.list[this.leftActiveIndex].type == 1 ? '' : this.list[this.leftActiveIndex].toUserId,
roomId: this.list[this.leftActiveIndex].type == 1 ? this.list[this.leftActiveIndex].roomId : '',
type: this.list[this.leftActiveIndex].type,
content: this.searchMsg,
2023-06-08 09:37:11 +08:00
startTime: this.time ? this.time[0] : '',
endTime: this.time ? this.time[1] : ''
2023-06-07 17:53:53 +08:00
}
}).then(res => {
if (res.code === 0) {
this.msgList = res.data.records
2023-06-08 09:37:11 +08:00
this.msgTotal = res.data.total || 0
2023-06-07 17:53:53 +08:00
}
this.isLoading = false
}).catch(() => {
this.isLoading = false
})
},
typeClick(index) {
this.tabIndex = index
this.getListInit()
},
onChange() {
2023-06-08 09:37:11 +08:00
this.getMsgListInit()
2023-06-07 17:53:53 +08:00
},
currentChange(e) {
console.log(e)
this.current = e
this.getList()
},
msgCurrentChange(e) {
this.msgCurrent = e
this.getMsgList()
},
leftClick(index) {
this.leftActiveIndex = index
this.getMsgListInit()
},
msgTypeClick(index) {
this.msgType = index
this.getMsgListInit()
},
2023-04-26 14:23:45 +08:00
onConfirm() {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appintegralmerchandiseorder/writeOffOrder`, null, {
params: {
code: this.form.code,
2023-06-07 17:53:53 +08:00
id: this.params.id,
2023-04-26 14:23:45 +08:00
}
}).then(res => {
if (res.code == 0) {
this.isShow = false
this.getInfo(this.params.id)
this.$message.success('核销成功')
}
})
}
})
},
cancel () {
this.$emit('change', {
type: 'List',
isRefresh: true
})
}
}
}
</script>
<style scoped lang="scss">
2023-04-26 16:16:46 +08:00
.detail {
.addressBook-left {
width: 100%;
height: auto;
background: #FAFAFB;
2023-06-08 09:37:11 +08:00
position: relative;
2023-04-26 16:16:46 +08:00
.addressBook-left__title {
display: flex;
align-items: center;
width: 100%;
height: 40px;
background: #ffffff;
h2 {
flex: 1;
height: 100%;
line-height: 40px;
color: #222;
font-size: 14px;
text-align: center;
cursor: pointer;
border-bottom: 2px solid transparent;
&.tab-active {
color: #2266FF;
border-bottom: 2px solid #2266FF;
}
}
}
.addressBook-left__list--wrapper {
2023-06-08 09:37:11 +08:00
height: calc(100% - 110px);
2023-04-26 16:16:46 +08:00
padding: 8px;
2023-06-08 09:37:11 +08:00
overflow-y: scroll;
2023-04-26 16:16:46 +08:00
.addressBook-left__list--item {
line-height: 44px;
font-size: 16px;
color: #333;
margin-bottom: 8px;
padding: 8px;
cursor: pointer;
img {
width: 44px;
height: 44px;
border-radius: 50%;
margin-right: 8px;
vertical-align: middle;
}
}
.addressBook-left__list--item:hover {
background-color: #E8EFFF;
}
.active {
background-color: #E8EFFF;
color: #26f;
}
}
.addressBook-left__list--title {
display: flex;
align-items: center;
margin: 8px 8px 0;
.addressBook-left__list--search {
flex: 1;
:deep( input ){
width: 100%;
}
}
.el-button {
width: 84px;
flex-shrink: 1;
margin-right: 8px;
}
}
2023-06-08 09:37:11 +08:00
.pagination {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
background-color: #fff;
}
2023-04-26 14:23:45 +08:00
}
2023-04-26 16:16:46 +08:00
:deep( .ai-list__content--right ){
2023-04-26 14:23:45 +08:00
flex: 1;
2023-04-26 16:16:46 +08:00
min-width: 0;
margin-left: 1px;
box-shadow: none;
.ai-list__content--right-wrapper {
width: 100%;
2023-06-08 09:37:11 +08:00
position: relative;
padding: 0!important;
height: 100%;
2023-04-26 16:16:46 +08:00
}
}
.content-right-title {
height: 40px;
border-bottom: 1px solid #ddd;
display: flex;
justify-content: space-between;
box-sizing: content-box;
.tab-content {
display: flex;
align-items: center;
width: 300px;
height: 40px;
background: #ffffff;
h2 {
flex: 1;
height: 100%;
line-height: 40px;
color: #222;
font-size: 14px;
text-align: center;
cursor: pointer;
border-bottom: 2px solid transparent;
&.tab-active {
color: #2266FF;
border-bottom: 2px solid #2266FF;
}
}
}
.search-content {
display: flex;
padding: 4px 8px 4px 0;
.ai-download,
.el-input {
margin-left: 8px;
}
.el-input {
width: 240px;
}
.el-date-editor--daterange {
width: 240px;
}
:deep .el-date-editor .el-range-separator {
width: 30px;
}
}
2023-04-26 14:23:45 +08:00
}
2023-04-26 16:33:55 +08:00
.content-right-info {
padding: 24px 16px;
2023-06-08 09:37:11 +08:00
height: calc(100% - 80px);
overflow-y: scroll;
2023-04-26 16:33:55 +08:00
.item {
margin-bottom: 48px;
.time {
color: #999;
font-size: 14px;
line-height: 44px;
2023-04-26 16:57:26 +08:00
text-align: center;
2023-04-26 16:33:55 +08:00
}
.item-content-flex {
display: flex;
.user-img {
width: 44px;
height: 44px;
2023-04-26 16:57:26 +08:00
border-radius: 50%;
2023-04-26 16:33:55 +08:00
margin-right: 8px;
}
.content {
max-width: calc(100% - 144px);
position: relative;
2023-04-26 16:57:26 +08:00
background-color: #f3f6f9;
2023-04-26 16:33:55 +08:00
span {
width: 0px;
height: 0px;
border: 10px solid transparent;
position: absolute;
2023-04-26 16:57:26 +08:00
top: 50%;
margin-top: -10px;
2023-04-26 16:33:55 +08:00
}
p {
display: inline-block;
2023-04-26 16:57:26 +08:00
padding: 8px;
line-height: 28px;
2023-04-26 16:33:55 +08:00
font-family: PingFangSC-Regular;
2023-04-26 16:57:26 +08:00
font-size: 16px;
2023-04-26 16:33:55 +08:00
color: #333;
word-break: break-all;
}
}
2023-06-07 17:53:53 +08:00
.img-list {
img {
width: 200px;
height: 200px;
}
}
2023-04-26 16:57:26 +08:00
.el-icon-warning {
font-size: 32px;
color: #f46;
margin-top: 8px;
2023-04-26 16:33:55 +08:00
}
}
}
.item-left {
2023-04-26 16:57:26 +08:00
.item-content-flex {
.user-img {
margin: 0 20px 0 0;
}
.content {
span {
left: -18px;
border-right-color: #f3f6f9;
}
}
.el-icon-warning {
margin-left: 16px;
2023-04-26 16:33:55 +08:00
}
}
2023-04-26 16:57:26 +08:00
2023-04-26 16:33:55 +08:00
}
.item-right {
width: 100%;
justify-content: right;
2023-04-26 16:57:26 +08:00
.item-content-flex {
justify-content: end;
.user-img {
margin: 0 0 0 20px;
}
.content {
background-color: #90e287;
span {
border-left-color:#90e287;
right: -18px;
}
2023-04-26 16:33:55 +08:00
}
2023-04-26 16:57:26 +08:00
.el-icon-warning {
margin-right: 16px;
2023-04-26 16:33:55 +08:00
}
}
2023-04-26 16:57:26 +08:00
2023-04-26 16:33:55 +08:00
}
2023-06-08 09:37:11 +08:00
}
.addressBook-left__list--wrapper::-webkit-scrollbar,
.content-right-info::-webkit-scrollbar {
width: 4px;
}
.addressBook-left__list--wrapper::-webkit-scrollbar-thumb,
.content-right-info::-webkit-scrollbar-thumb {
border-radius: 10px;
background: rgba(0,0,0,0.2);
}
.addressBook-left__list--wrapper::-webkit-scrollbar-track
.content-right-info::-webkit-scrollbar-track {
border-radius: 0;
background: rgba(0,0,0,0.1);
}
.msg-list-pagination {
position: absolute;
bottom: 0;
width: calc(100% - 32px);
text-align: center;
2023-04-26 16:33:55 +08:00
}
2023-04-26 14:23:45 +08:00
}
</style>