Commit 7d4bc06d by xinla

Merge branch 'front_end_dev_1.5'

2 parents 5c347198 b6090946
...@@ -54,36 +54,17 @@ export default { ...@@ -54,36 +54,17 @@ export default {
const player = this.$refs.videoPlayer.player const player = this.$refs.videoPlayer.player
this.playerOptions['sources'][0]['src'] = e.attachment this.playerOptions['sources'][0]['src'] = e.attachment
player.play() player.play()
},
down(type) {
let contact = JSON.parse(this.message.contact)
const url = window.URL.createObjectURL(
new Blob([contact[type]], {
type:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
})
)
const link = document.createElement('a')
link.href = url
link.setAttribute('download', this.content) // 下载文件的名称及文件类型后缀
document.body.appendChild(link)
link.click()
document.body.removeChild(link) // 下载完成移除元素
window.URL.revokeObjectURL(url) // 释放掉blob对象
} }
} }
} }
</script> </script>
<template> <template>
<div> <div class="message">
<div v-if="message.msgType === 'text'" class="msgtypetext"> <template v-if="message.msgType === 'text'">
{{ content }} {{ content }}
</div> </template>
<div <template v-else-if="'image,emotion'.includes(message.msgType)">
v-else-if="'image,emotion'.includes(message.msgType)"
class="msgtypeimg"
>
<el-image <el-image
style="width: 100px; height: 100px" style="width: 100px; height: 100px"
:src="content" :src="content"
...@@ -91,7 +72,7 @@ export default { ...@@ -91,7 +72,7 @@ export default {
:preview-src-list="[content]" :preview-src-list="[content]"
> >
</el-image> </el-image>
</div> </template>
<a <a
v-else-if="'file'.includes(message.msgType)" v-else-if="'file'.includes(message.msgType)"
class="msgtypefile" class="msgtypefile"
...@@ -108,7 +89,7 @@ export default { ...@@ -108,7 +89,7 @@ export default {
> >
{{ content }} {{ content }}
</a> </a>
<div v-else-if="message.msgType === 'voice'" class="msgtypevoice"> <div v-else-if="message.msgType === 'voice'">
<i <i
class="el-icon-microphone" class="el-icon-microphone"
style=" font-size: 40px; color: #199ed8;" style=" font-size: 40px; color: #199ed8;"
...@@ -186,6 +167,7 @@ export default { ...@@ -186,6 +167,7 @@ export default {
<div class="card_name">{{ content }}</div> <div class="card_name">{{ content }}</div>
<div class="card_foot">个人名片</div> <div class="card_foot">个人名片</div>
</div> </div>
<div v-else>不支持的消息类型:{{ message.msgType }}</div>
<el-dialog <el-dialog
v-if="audioSrc[0]" v-if="audioSrc[0]"
...@@ -194,14 +176,14 @@ export default { ...@@ -194,14 +176,14 @@ export default {
@close="close" @close="close"
> >
<div class="shabowboxvidoe shabowboxaudio"> <div class="shabowboxvidoe shabowboxaudio">
<AudioPlayer <!-- <AudioPlayer
:audio-list="audioSrc" :audio-list="audioSrc"
ref="AudioPlayer" ref="AudioPlayer"
:before-play="onBeforePlay" :before-play="onBeforePlay"
/> /> -->
<!-- <audio controls> <audio controls>
<source :src="audioSrc[0]" type="audio/mpeg" /> <source :src="audioSrc[0]" type="audio/mpeg" />
</audio> --> </audio>
</div> </div>
<span slot="footer" class="dialog-footer"> </span> <span slot="footer" class="dialog-footer"> </span>
</el-dialog> </el-dialog>
...@@ -209,6 +191,25 @@ export default { ...@@ -209,6 +191,25 @@ export default {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.message {
position: relative;
padding: 10px;
line-height: 14px;
border-radius: 5px;
background: $blue;
color: #fff;
display: inline-block;
&::before {
content: '';
display: inline-block;
position: absolute;
left: -13px;
width: 0;
height: 0;
border: 7px solid transparent;
border-right-color: $blue;
}
}
.msgtypefile { .msgtypefile {
margin: 5px; margin: 5px;
width: 200px; width: 200px;
...@@ -229,6 +230,8 @@ export default { ...@@ -229,6 +230,8 @@ export default {
0 6px 8px 0 rgba(0, 0, 0, 0.19); 0 6px 8px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 8px 0 rgba(0, 0, 0, 0.19); box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 8px 0 rgba(0, 0, 0, 0.19);
position: relative; position: relative;
background: #f8f8f8;
overflow: hidden;
.card_name { .card_name {
width: 320px; width: 320px;
......
...@@ -54,19 +54,6 @@ export function resetForm(refName) { ...@@ -54,19 +54,6 @@ export function resetForm(refName) {
} }
} }
//年月日格式
export function yearMouthDay(data) {
var time = new Date(data)
var year = time.getFullYear()
var month = time.getMonth() + 1
var date = time.getDate()
console.log(year + '-' + add0(month) + '-' + add0(date))
return year + '-' + add0(month) + '-' + add0(date)
}
function add0(m) {
return m < 10 ? '0' + m : m
}
// 添加日期范围 // 添加日期范围
export function addDateRange(params, dateRange) { export function addDateRange(params, dateRange) {
var search = params var search = params
......
<template> <template>
<div class="takecontent"> <div class="takecontent">
<ul> <ul>
<li v-for="(item, index) in allChat" :key="index"> <li v-for="(item, index) in data" :key="index">
<!-- <span v-if="item.fromInfo.name">{{item.fromInfo.name}}</span> --> <!-- <span v-if="item.fromInfo.name">{{item.fromInfo.name}}</span> -->
<div class="mb15"> <div class="mb15">
<span class="mr20">{{ item.fromId }}</span> <span class="mr20">{{ item.name }}</span>
<span <span
:style="{ color: item.action == 'send' ? '#199ed8' : '#999' }" :style="{ color: item.action == 'send' ? '#199ed8' : '#999' }"
>{{ item.msgTime }}</span >{{ item.msgTime }}</span
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
ChatContent ChatContent
}, },
props: { props: {
allChat: { data: {
type: Array, type: Array,
defluat: () => [] defluat: () => []
} }
...@@ -86,7 +86,6 @@ export default { ...@@ -86,7 +86,6 @@ export default {
.takecontent { .takecontent {
text-align: left; text-align: left;
width: 100%; width: 100%;
height: 600px;
overflow-y: scroll; overflow-y: scroll;
::-webkit-scrollbar { ::-webkit-scrollbar {
...@@ -96,73 +95,5 @@ export default { ...@@ -96,73 +95,5 @@ export default {
ul li { ul li {
padding: 10px; padding: 10px;
} }
.msgtypetext {
padding: 10px 0;
}
.msgtypevoice {
margin: 10px;
}
.msgtypefile {
margin: 10px;
width: 200px;
height: 40px;
line-height: 40px;
cursor: pointer;
color: #199ed8;
text-indent: 10px;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2), 0 1px 4px 0 rgba(0, 0, 0, 0.19);
}
.card_name {
width: 320px;
height: 105px;
line-height: 80px;
text-indent: 10px;
}
.msgtypevideo {
margin: 10px;
cursor: pointer;
border-radius: 8px;
}
.msgtypeimg {
width: 100px;
height: 80px;
margin: 10px;
img {
width: 100px;
height: 80px;
}
}
.msgtypecard {
width: 320px;
height: 140px;
margin: 10px;
border-radius: 8px;
-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2),
0 6px 8px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 8px 0 rgba(0, 0, 0, 0.19);
position: relative;
.card_foot {
position: absolute;
height: 20px;
border-top: 1px solid #efefef;
text-align: left;
bottom: 15px;
padding: 10px;
color: #333;
font-weight: bold;
width: 100%;
}
}
} }
</style> </style>
<template>
<div>
<div class="top">
<div class="name">
<span v-if="queryChat"> 与{{ queryChat.receiveName }}的聊天</span>
<span class="fr download" @click="exportList()">下载会话</span>
</div>
</div>
<el-tabs v-model="activeTab">
<el-tab-pane
v-for="(item, index) of list"
:key="index"
:label="item.label"
:name="item.type"
>
<chatListClassTab
:queryChat="queryChat"
:type="item.type"
></chatListClassTab>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import chatListClassTab from './chatListClassTab.vue'
import api from '@/api/conversation/content.js'
export default {
components: { chatListClassTab },
props: {
queryChat: {
type: Object,
default: () => ({})
}
},
data() {
return {
activeTab: 'all',
list: [
{
label: '全部',
type: 'all'
},
{
label: '图片及视频',
type: 'image'
},
{
label: '文件',
type: 'file'
},
{
label: '链接',
type: 'link'
},
{
label: '语音通话',
type: 'voice'
}
]
}
},
watch: {},
mounted() {},
methods: {
exportList() {
this.$confirm('是否确认导出所有数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
return api.exportList(this.queryChat)
})
.then((response) => {
this.download(response.msg)
})
.catch(function() {})
}
}
}
</script>
<style lang="scss" scoped>
/deep/ .el-tabs__header {
margin: 0;
}
.top {
padding: 15px;
}
.name {
font-size: 18px;
min-height: 20px;
}
.download {
color: #199ed8;
text-align: right;
font-size: 16px;
cursor: pointer;
}
</style>
<template>
<div class="chatListClassTab" v-loading="loading">
<el-date-picker
v-model="dateRange"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right"
@change="getList(1)"
>
</el-date-picker>
<div class="list">
<template v-if="list.length">
<chatList
v-if="'all,image,link'.includes(type)"
:data="list"
></chatList>
<el-table
v-else-if="type == 'file'"
:data="list"
stripe
style="width: 100%"
:header-cell-style="{ background: '#fff' }"
>
<el-table-column prop="msgtype" label="类型"> </el-table-column>
<el-table-column label="名称">
<template slot-scope="{ row }">
{{ JSON.parse(row.contact).filename }}
</template>
</el-table-column>
<el-table-column label="大小">
<template slot-scope="{ row }">
{{ filterSize(JSON.parse(row.contact).filesize) }}
</template>
</el-table-column>
<el-table-column label="来源">
<template slot-scope="{ row }">
{{ row.name }}
</template>
</el-table-column>
<el-table-column prop="action" label="操作">
<template slot-scope="{ row }">
<el-button type="text" size="small" @click="downloadFile(row)"
>下载</el-button
>
</template>
</el-table-column>
</el-table>
<el-table
v-else-if="type == 'voice'"
:data="list"
stripe
:header-cell-style="{ background: '#fff' }"
>
<el-table-column prop="date" label="发起人">
<template slot-scope="{ row }">
{{ row.name }}
</template>
</el-table-column>
<el-table-column prop="name" label="通话时间">
<template slot-scope="{ row }">
{{ row.msgTime }}
</template>
</el-table-column>
<el-table-column prop="address" label="时长" min-width="50">
<template slot-scope="{ row }">
{{ JSON.parse(row.contact).play_length }}s
</template>
</el-table-column>
<el-table-column prop="address" min-width="150" label="操作">
<template slot-scope="{ row }">
<!-- <el-button
type="text"
size="small"
@click="voiceLook(JSON.parse(row.contact))"
>查看</el-button
> -->
<!-- <AudioPlayer
:audio-list="[JSON.parse(row.contact).attachment]"
ref="AudioPlayer"
/> -->
<audio controls>
<source
:src="JSON.parse(row.contact).attachment"
type="audio/mpeg"
/>
</audio>
</template>
</el-table-column>
</el-table>
</template>
<el-empty v-else :image-size="100"></el-empty>
</div>
<el-pagination
v-if="total"
layout="prev, pager, next"
:current-page.sync="currentPage"
@current-change="getList"
:total="total"
/>
</div>
</template>
<script>
import chatList from './chatList.vue'
import api from '@/api/conversation/content.js'
export default {
name: '',
components: { chatList },
props: {
// 消息收发者
queryChat: {
type: Object,
default: () => ({})
},
// 消息类型
type: {
type: String | Number,
default: 0
}
},
data() {
return {
loading: false,
currentPage: 1,
dateRange: [],
list: [],
total: 0
}
},
computed: {},
watch: {
queryChat() {
this.getList(1)
}
},
created() {},
mounted() {},
methods: {
getList(page) {
if (!this.queryChat.fromId) {
return //没有选择人
}
this.loading = true
let query = {
msgType: this.type == 'all' ? '' : this.type,
pageSize: '10'
// orderByColumn: 'msg_time',
// isAsc: 'asc'
}
if (this.dateRange) {
query.beginTime = this.dateRange[0]
query.endTime = this.dateRange[1]
} else {
query.beginTime = ''
query.endTime = ''
}
page && (query.pageNum = this.currentPage = page)
Object.assign(query, this.queryChat)
api
.getChatList(query)
.then((res) => {
this.total = ~~res.total
this.list = res.rows
this.loading = false
})
.catch((err) => {
this.loading = false
})
},
filterSize(size) {
if (!size) return ''
if (size < pow1024(1)) return size + ' B'
if (size < pow1024(2)) return (size / pow1024(1)).toFixed(2) + ' KB'
if (size < pow1024(3)) return (size / pow1024(2)).toFixed(2) + ' MB'
if (size < pow1024(4)) return (size / pow1024(3)).toFixed(2) + ' GB'
return (size / pow1024(4)).toFixed(2) + ' TB'
function pow1024(num) {
return Math.pow(1024, num)
}
},
downloadFile(row) {
this.$confirm('是否确认下载该文件?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then((response) => {
this.download(JSON.parse(row.contact).attachment)
})
.catch(function() {})
}
}
}
</script>
<style lang="scss" scoped>
.list {
height: calc(100vh - 370px);
margin-top: 10px;
background: white;
overflow-y: scroll;
border-bottom: 1px solid #efefef;
color: #999;
text-align: center;
::-webkit-scrollbar {
display: none;
}
}
.chatListClassTab {
padding: 10px 10px 0;
background: #fff;
}
</style>
<template>
<div class="list" v-loading="loading">
<div v-if="personList.length >= 1">
<ul>
<li
v-for="(item, index) in personList"
:key="index"
@click="liClick(item)"
>
<el-row style="padding:10px">
<span class="fl">
<img :src="item.finalChatContext.fromInfo.avatar"
/></span>
<span class="fl" style="margin-left:8px;">
<p>
{{ item.roomInfo.groupName }}
<span class="fr gray">{{
parseTime(item.finalChatContext.msgtime)
}}</span>
</p>
<p class="gray " v-if="item.finalChatContext.text">
{{ item.finalChatContext.text.content }}
</p>
</span>
</el-row>
</li>
</ul>
</div>
<div v-else></div>
</div>
</template>
<script>
import { parseTime } from '@/utils/common.js'
export default {
props: {
personList: {
type: Array,
defluat: () => []
},
loading: {
type: Boolean,
defluat: false
}
},
data() {
return {
loadings: true
}
},
methods: {
liClick(e) {
this.$emit('chatFn', e)
}
}
}
</script>
<style lang="scss" scoped>
.list {
overflow-y: scroll;
height: 652px;
::-webkit-scrollbar {
display: none;
}
/deep/ .el-loading-spinner {
margin-top: 20px;
}
.gray {
color: #999;
}
.padt10 {
padding-top: 10px;
}
ul li {
overflow: hidden;
border-bottom: 1px solid #efefef;
cursor: pointer;
p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
:hover {
background: #efefef;
}
img {
width: 40px;
height: 40px;
float: left;
}
}
}
</style>
<template>
<div class="takecontent">
<ul>
<li v-for="(item, index) in allChat" :key="index">
<div :style="{ color: item.action == 'send' ? '#199ed8' : '#999' }">
{{ item.from }}
<span
:style="{ color: item.action == 'send' ? '#199ed8' : '#999' }"
>{{ parseTime(item.msgtime) }}</span
>
</div>
<div v-if="item.msgtype == 'text'" class="msgtypetext">
{{ item.text.content }}
</div>
<div v-else-if="item.msgtype == 'image'" class="msgtypeimg">
<img :src="item.image.attachment" />
</div>
<div
v-else-if="item.msgtype == 'file'"
class="msgtypefile"
@click="down(item.file)"
>
{{ item.file.filename }}
</div>
<div v-else-if="item.msgtype == 'voice'" class="msgtypevoice">
<i class="el-icon-video-play" @click="play(item, 'voice')"></i>
</div>
<div v-else-if="item.msgtype == 'video'" class="msgtypevideo">
<i class="el-icon-video-play" @click="play(item, 'video')"></i>
</div>
<div v-else-if="item.msgtype == 'location'" class="msgtypecard ">
<div class="card_name"></div>
<div class="card_foot">{{ item.location.address }}</div>
</div>
<div v-else-if="item.msgtype == 'weapp'" class="msgtypecard ">
<div class="card_name"></div>
<div class="card_foot">小程序</div>
</div>
<div v-else-if="item.msgtype == 'card'" class="msgtypecard ">
<div class="card_name">{{ item.card.corpname }}</div>
<div class="card_foot">个人名片</div>
</div>
</li>
</ul>
<el-dialog :visible.sync="dia" :show-close="false">
<p>播放</p>
</el-dialog>
</div>
</template>
<script>
import { parseTime, yearMouthDay } from '@/utils/common.js'
export default {
props: {
allChat: {
type: Array,
defluat: () => []
}
},
data() {
return {
dia: false
}
},
methods: {
play() {
this.dia = true
},
down(e) {
//下载文件
}
}
}
</script>
<style lang="scss" scoped>
.takecontent {
text-align: left;
width: 100%;
height: 600px;
overflow-y: scroll;
::-webkit-scrollbar {
display: none;
}
ul li {
padding: 8px;
}
.msgtypetext {
padding: 10px 0;
}
.msgtypevoice {
margin: 10px;
}
.msgtypefile {
margin: 10px;
width: 200px;
height: 40px;
line-height: 40px;
cursor: pointer;
color: #199ed8;
text-indent: 10px;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2), 0 1px 4px 0 rgba(0, 0, 0, 0.19);
}
.card_name {
line-height: 80px;
text-indent: 10px;
}
.msgtypevideo {
margin: 10px;
font-size: 40px;
cursor: pointer;
color: #199ed8;
border-radius: 8px;
}
.msgtypeimg {
width: 100px;
height: 80px;
margin: 10px;
}
.msgtypecard {
width: 300px;
height: 140px;
margin: 10px;
border-radius: 8px;
-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2),
0 6px 8px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 8px 0 rgba(0, 0, 0, 0.19);
position: relative;
.card_foot {
position: absolute;
height: 20px;
border-top: 1px solid #efefef;
text-align: left;
bottom: 15px;
padding: 10px;
color: #333;
font-weight: bold;
width: 100%;
}
}
}
</style>
<template> <template>
<div class="list" v-loading="loading"> <div class="groupList" v-loading="loading">
<div v-if="personList.length"> <ul v-if="personList.length">
<ul>
<li <li
v-for="(item, index) in personList" v-for="(item, index) in personList"
:key="index" :key="index"
@click="liClick(item)" :class="{ active: index == active }"
@click="liClick(item, index)"
> >
<el-row type="flex" v-if="item.msgType == 'text'"> <el-row type="flex" align="middle">
<div class="ninebox"> <div class="ninebox">
<ul v-if="item.avatar"> <ul v-if="item.avatar">
<li v-for="(a, i) in item.avatar.split(',')" :key="i"> <li v-for="(a, i) in item.avatar.split(',')" :key="i">
...@@ -15,11 +15,15 @@ ...@@ -15,11 +15,15 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="fl" style="margin-left:8px;line-height:60px"> <div
<p> style="margin-left:8px;line-height:60px"
class="toe"
:title="item.name"
>
{{ item.name }} {{ item.name }}
<!-- <span class="fr gray">{{ item.msgTime }}</span> --> <!-- <p>
</p> <span class="fr gray">{{ item.msgTime }}</span>
</p> -->
<!-- <p class="gray" v-if="item"> <!-- <p class="gray" v-if="item">
{{ item.name }}: {{ item.name }}:
{{ item.content }} {{ item.content }}
...@@ -37,10 +41,7 @@ ...@@ -37,10 +41,7 @@
</el-row> --> </el-row> -->
</li> </li>
</ul> </ul>
</div> <el-empty v-else :image-size="100"></el-empty>
<div class="ac" v-else>
暂无数据
</div>
</div> </div>
</template> </template>
<script> <script>
...@@ -59,12 +60,14 @@ export default { ...@@ -59,12 +60,14 @@ export default {
data() { data() {
return { return {
loadings: true loadings: true,
active: undefined
} }
}, },
methods: { methods: {
liClick(e) { liClick(data, index) {
this.$emit('groupFn', e) this.active = index
this.$emit('groupFn', data)
} }
} }
} }
...@@ -75,6 +78,7 @@ export default { ...@@ -75,6 +78,7 @@ export default {
width: 54px; width: 54px;
height: 52px; height: 52px;
border: 1px solid #199ed8; border: 1px solid #199ed8;
overflow: hidden;
ul li { ul li {
float: left; float: left;
width: 15px; width: 15px;
...@@ -83,8 +87,8 @@ export default { ...@@ -83,8 +87,8 @@ export default {
margin: 1px 1px 1px 1px; margin: 1px 1px 1px 1px;
} }
} }
.list { .groupList {
overflow-y: scroll; overflow-y: auto;
height: calc(100vh - 328px); height: calc(100vh - 328px);
::-webkit-scrollbar { ::-webkit-scrollbar {
...@@ -111,9 +115,12 @@ export default { ...@@ -111,9 +115,12 @@ export default {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
:hover { &:hover {
background: #efefef; background: #efefef;
} }
&.active {
background: #ebf4fc;
}
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
<template>
<div class="list" v-loading="loading">
<div v-if="personList.length">
<ul>
<li
v-for="(item, index) in personList"
:key="index"
@click="liClick(item)"
>
<el-row style="padding:10px">
<span class="fl"> <img :src="item.avatar"/></span>
<span class="fl" style="margin-left:8px">
<p>{{ item.name }}</p>
</span>
</el-row>
</li>
</ul>
</div>
<div class="ac" v-else>
暂无数据
</div>
</div>
</template>
<script>
import { parseTime } from '@/utils/common.js'
export default {
props: {
personList: {
type: Array,
defluat: () => []
},
loading: {
type: Boolean,
defluat: false
}
},
data() {
return {
loadings: true
}
},
methods: {
liClick(e) {
console.log(e)
this.$emit('chatFn', e)
}
}
}
</script>
<style lang="scss" scoped>
.list {
overflow-y: scroll;
height: calc(100vh - 328px);
::-webkit-scrollbar {
display: none;
}
/deep/ .el-loading-spinner {
margin-top: 20px;
}
.gray {
color: #999;
}
.padt10 {
padding-top: 10px;
}
ul li {
overflow: hidden;
border-bottom: 1px solid #efefef;
cursor: pointer;
p {
white-space: nowrap;
overflow: hidden;
line-height: 40px;
text-overflow: ellipsis;
}
:hover {
background: #efefef;
}
img {
width: 40px;
height: 40px;
float: left;
}
}
}
</style>
<template>
<div class="list" v-loading="loading">
<div v-if="personList.length">
<ul>
<li
v-for="(item, index) in personList"
:key="index"
@click="liClick(item)"
>
<el-row>
<span class="fl"> <img :src="item.avatar"/></span>
<span class="fl" style="margin-left:8px">
<p>{{ item.name }}</p>
</span>
<!-- <span class="fl">
<p>{{ item.contact }}</p>
</span> -->
</el-row>
</li>
</ul>
</div>
<div class="ac" v-else>
暂无数据
</div>
</div>
</template>
<script>
import { parseTime } from '@/utils/common.js'
export default {
props: {
personList: {
type: Array,
defluat: () => []
},
loading: {
type: Boolean,
defluat: false
}
},
data() {
return {
loadings: true
}
},
methods: {
liClick(e) {
console.log(e, 'liClick')
this.$emit('chatFn', e)
},
msgContentType(type, msg) {
console.log(type, msg, 'msgContentType')
//消息获取
/*case msg = JSON.parse(msg);
switch (type){
case "text":
}*/
}
}
}
</script>
<style lang="scss" scoped>
.list {
overflow-y: scroll;
height: calc(100vh - 328px);
::-webkit-scrollbar {
display: none;
}
/deep/ .el-loading-spinner {
margin-top: 20px;
}
.gray {
color: #999;
}
.padt10 {
padding-top: 10px;
}
ul li {
padding: 10px;
overflow: hidden;
border-bottom: 1px solid #efefef;
cursor: pointer;
p {
white-space: nowrap;
overflow: hidden;
line-height: 40px;
text-overflow: ellipsis;
}
:hover {
background: #efefef;
}
img {
width: 40px;
height: 40px;
float: left;
}
}
}
</style>
<template> <template>
<div class="list" v-loading="loading"> <div class="userList" v-loading="loading">
<div v-if="personList.length >= 1"> <ul v-if="personList.length">
<ul>
<li <li
v-for="(item, index) in personList" v-for="(item, index) in personList"
class="list"
:class="{ active: index == active }"
:key="index" :key="index"
@click="liClick(item)" @click="liClick(item, index)"
> >
<el-row style="padding:10px"> <img class="fl mr10" :src="item.avatar" />
<el-col :span="3"><img :src="item.avatar"/></el-col> <div class="name" :title="item.name">
<el-col :span="21">
<p>
{{ item.name }} {{ item.name }}
<span class="fr gray">{{ item.msgTime }}</span> </div>
</p>
<p class="gray padt10" v-if="item.contact">
{{ JSON.parse(item.contact).content }}
</p>
</el-col>
</el-row>
</li> </li>
</ul> </ul>
</div> <el-empty v-else :image-size="100"></el-empty>
<div v-else></div>
</div> </div>
</template> </template>
<script> <script>
import { parseTime } from '@/utils/common.js'
export default { export default {
props: { props: {
personList: { personList: {
...@@ -41,20 +32,23 @@ export default { ...@@ -41,20 +32,23 @@ export default {
data() { data() {
return { return {
loadings: true loadings: true,
active: undefined
} }
}, },
methods: { methods: {
liClick(e) { liClick(data, index) {
this.$emit('chatFn', e) this.active = index
this.$emit('chatFn', data)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.list { .userList {
overflow-y: scroll; overflow-y: auto;
height: calc(100vh - 328px); height: calc(100vh - 288px);
::-webkit-scrollbar { ::-webkit-scrollbar {
display: none; display: none;
} }
...@@ -62,25 +56,28 @@ export default { ...@@ -62,25 +56,28 @@ export default {
/deep/ .el-loading-spinner { /deep/ .el-loading-spinner {
margin-top: 20px; margin-top: 20px;
} }
.gray { .gray {
color: #999; color: #999;
} }
.padt10 { .list {
padding-top: 10px;
}
ul li {
padding: 10px; padding: 10px;
overflow: hidden; overflow: hidden;
border-bottom: 1px solid #efefef; border-bottom: 1px solid #efefef;
cursor: pointer; cursor: pointer;
p { text-align: left;
.name {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
line-height: 40px;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
:hover { &:hover {
background: #efefef; background: #efefef;
} }
&.active {
background: #ebf4fc;
}
img { img {
width: 40px; width: 40px;
height: 40px; height: 40px;
......
<template>
<div class="customer">
<el-row type="flex">
<el-col :span="6" class="borderRight">
<div class="name pd15">客户列表({{ customerTotal }})</div>
<el-input
class="mb5"
placeholder="搜索客户"
prefix-icon="el-icon-search"
v-model="customerQuery.name"
@keyup.enter.native="getCustomerList(1)"
>
</el-input>
<div v-loading="customerLoading">
<ul v-infinite-scroll="getCustomerList" class="customer-wrap">
<template v-if="customerList.length">
<el-row
v-for="(item, index) in customerList"
:key="index"
tag="li"
@click.native="choiceCustomer(item, index)"
class="customer-li"
:class="{ active: index == personIndex }"
:gutter="20"
type="flex"
align="middle"
>
<el-col :span="4">
<img v-if="item.avatar" :src="item.avatar" alt="头像" />
</el-col>
<el-col :span="10" v-if="item" class="toe">
<span style="line-height:40px">{{ item.name }}</span>
</el-col>
<el-col :span="10" class="ar">
<span
:style="{ color: item.type === 1 ? '#4bde03' : '#f9a90b' }"
>{{ { 1: '@微信', 2: '@企业微信' }[item.type] }}
</span>
<i
:class="[
'el-icon-s-custom',
{ 1: 'man', 2: 'woman' }[item.gender]
]"
></i>
</el-col>
</el-row>
</template>
<el-empty v-else :image-size="100"></el-empty>
</ul>
</div>
</el-col>
<el-col :span="6" class="borderRight">
<template v-if="talkName">
<div class="name pd15">{{ talkName }}</div>
<el-input
class="mb5"
placeholder="搜索联系人"
prefix-icon="el-icon-search"
v-model="chatContent"
@keyup.enter.native="getChatList()"
>
</el-input>
<el-tabs v-model="activeName" @tab-click="getChatList()">
<el-tab-pane label="单聊" name="0">
<userList
v-if="activeName == 0"
:personList="personList"
:loading="loading"
@chatFn="chatFn"
>
</userList>
</el-tab-pane>
<el-tab-pane label="群聊" name="2">
<grouplist
v-if="activeName == 2"
:personList="personList"
:loading="loading"
@groupFn="groupFn"
>
</grouplist>
</el-tab-pane>
</el-tabs>
</template>
<el-empty v-else :image-size="100" description="请选择客户"></el-empty>
</el-col>
<el-col :span="12">
<chatListClass
v-show="queryChat.receiveName"
:queryChat="queryChat"
></chatListClass>
<el-empty
v-if="!queryChat.receiveName"
:image-size="100"
description="请选择联系人"
></el-empty>
</el-col>
</el-row>
</div>
</template>
<script>
import chatListClass from './component/chatListClass.vue'
import userList from './component/userList.vue'
import grouplist from './component/groupList.vue'
import api from '@/api/conversation/content.js'
import * as apiCustomer from '@/api/customer/index'
export default {
components: {
userList,
grouplist,
chatListClass
},
data() {
return {
customerLoading: false,
customerQuery: {
pageNum: 1,
pageSize: 10,
name: ''
},
customerList: [],
customerTotal: 0,
talkName: '',
chatContent: '',
personIndex: undefined,
activeName: '0',
personList: [],
loading: false,
fromId: '',
queryChat: {}
}
},
created() {
// this.customerList()
},
methods: {
chatFn(data) {
this.queryChat = {
fromId: this.fromId,
receiveName: data.name,
toList: data.receiver
}
},
groupFn(data) {
this.queryChat = {
fromId: this.fromId,
receiveName: data.name,
roomId: data.receiver
}
},
choiceCustomer(data, index) {
this.personIndex = index
this.talkName = data.name
this.fromId = data.externalUserid
this.getChatList()
},
getChatList(flag) {
if (!this.fromId) {
return
}
if (flag) {
this.loading = true
}
this.personList = []
if (this.activeName == '0') {
api
.selectAloneChatList({
fromId: this.fromId,
contact: this.chatContent
})
.then(({ data }) => {
this.loading = false
this.personList = data
})
.catch((err) => {
this.loading = false
})
} else {
api
.getGroupChatList(this.fromId)
.then(({ data }) => {
this.loading = false
this.personList = data
})
.catch((err) => {
this.loading = false
})
}
},
getCustomerList(page) {
this.customerLoading = true
if (page) {
this.customerQuery.pageNum = page
this.customerList = []
}
page && (this.customerQuery.pageNum = page)
apiCustomer.getList(this.customerQuery).then((res) => {
this.customerList.push(...res.rows)
this.customerTotal = ~~res.total
this.customerQuery.pageNum++
this.customerLoading = false
})
}
}
}
</script>
<style lang="scss" scoped>
/deep/.el-tabs__nav-scroll {
padding-left: 15px;
}
.borderRight {
border-right: 2px solid #ccc;
}
.customer {
background: #f6f6f9;
.el-tabs {
background: #fff;
}
/deep/ .el-tabs__header {
margin: 0;
}
.name {
font-size: 18px;
min-height: 20px;
}
.customer-wrap {
position: relative;
height: calc(100vh - 288px);
background: white;
border-bottom: 1px solid #efefef;
overflow-y: auto;
overflow-x: hidden;
color: #999;
text-align: center;
.customer-li {
padding: 10px;
text-align: left;
cursor: pointer;
border-bottom: 1px solid #efefef;
&:hover {
background: #efefef;
}
img {
width: 40px;
}
&.active {
background: #ebf4fc;
}
}
}
}
.el-icon-s-custom {
font-size: 16px;
margin-left: 4px;
color: #999;
&.man {
color: #13a2e8;
}
&.woman {
color: #f753b2;
}
}
.userList {
height: calc(100vh - 328px);
}
</style>
<template>
<div class="employ">
<el-row type="flex">
<el-col :span="6" class="borderR">
<!-- <div class="hd_box">
<div class="name">成员({{employAmount}})</div>
<div class="paddingT10">
<el-input placeholder="请输入内容" prefix-icon="el-icon-search" v-model="employName">
</el-input>
</div>
</div> -->
<div class="ct_box ct_boxFirst" style="height: calc(100vh - 197px)">
<el-tree
ref="tree"
class="filter-tree"
:data="treeData"
:props="defaultProps"
:filter-node-method="filterNode"
highlight-current
@node-click="handleNodeClick"
:default-expand-all="true"
>
</el-tree>
</div>
</el-col>
<el-col :span="6" class="borderR">
<template v-if="talkName">
<div class="name pd15">{{ talkName }}</div>
<el-tabs v-model="activeName" @tab-click="tabClick(true)">
<el-tab-pane label="内部联系人" name="0">
<userList
v-if="activeName == 0"
:personList="personList"
:loading="loading"
@chatFn="chatFn"
>
</userList>
</el-tab-pane>
<el-tab-pane label="外部联系人" name="1">
<userList
v-if="activeName == 1"
:personList="personList"
:loading="loading"
@chatFn="chatFn"
>
</userList>
</el-tab-pane>
<el-tab-pane label="群聊" name="2">
<grouplist
class="ct_box"
v-if="activeName == 2"
:personList="personList"
:loading="loading"
@groupFn="groupFn"
>
</grouplist>
</el-tab-pane>
</el-tabs>
</template>
<el-empty v-else :image-size="100" description="请选择员工"></el-empty>
</el-col>
<el-col :span="12">
<chatListClass
v-show="queryChat.receiveName"
:queryChat="queryChat"
></chatListClass>
<el-empty
v-if="!queryChat.receiveName"
description="请选择联系人"
:image-size="100"
></el-empty>
</el-col>
</el-row>
</div>
</template>
<script>
import chatListClass from './component/chatListClass.vue'
import userList from './component/userList.vue'
import grouplist from './component/groupList.vue'
import * as apiOrg from '@/api/organization'
import api from '@/api/conversation/content.js'
export default {
components: {
grouplist,
userList,
chatListClass
},
data() {
return {
employAmount: 1,
fromId: '',
// employName: '',
talkName: '',
treeData: [],
defaultProps: {
label: 'name',
children: 'children'
},
activeName: '0',
chat: {},
personList: [],
loading: false,
queryChat: {}
}
},
watch: {
// employName(val) {
// this.$refs.tree.filter(val)
// }
},
mounted() {
this.getTree()
//this.getAmount()
},
methods: {
chatFn(data) {
this.queryChat = {
fromId: this.fromId,
receiveName: data.name,
toList: data.receiver
}
},
groupFn(data) {
this.queryChat = {
fromId: this.fromId,
receiveName: data.name,
roomId: data.receiver
}
},
getTree() {
apiOrg.getTree().then(({ data }) => {
this.treeData = this.handleTree(data)
this.handleNodeClick(this.treeData[0], true)
})
},
tabClick(flag) {
this.personList = []
if (!this.fromId) {
return
}
if (flag) {
this.loading = true
}
if (this.activeName == 0) {
api
.getInternalChatList(this.fromId)
.then(({ data }) => {
this.loading = false
this.personList = data
})
.catch((err) => {
this.loading = false
})
} else if (this.activeName == 1) {
api
.getExternalChatList(this.fromId)
.then(({ data }) => {
this.loading = false
this.personList = data
})
.catch((err) => {
this.loading = false
})
} else {
api
.getGroupChatList(this.fromId)
.then(({ data }) => {
this.loading = false
this.personList = data
})
.catch((err) => {
this.loading = false
})
}
},
filterNode(value, data) {
console.log(value, data)
if (!value) return true
return data.name.indexOf(value) !== -1
},
handleNodeClick(data, add) {
if (!data.userId) {
let querys = {
pageNum: '1',
pageSize: '999',
department: data.id
}
apiOrg.getList(querys).then(({ rows }) => {
this.$set(data, 'children', [])
data.children = rows
})
} else {
this.talkName = data.name
this.fromId = data.userId
this.tabClick()
this.queryChat = {
fromId: data.userId
}
}
}
}
}
</script>
<style lang="scss" scoped>
/deep/.el-tabs__nav-scroll {
padding-left: 15px;
}
.borderR {
border-right: 2px solid #ccc;
}
/deep/ .el-tabs__header {
margin: 0;
}
.employ {
background: #f6f6f9;
.el-tabs {
background: #fff;
}
.name {
font-size: 18px;
min-height: 20px;
}
.ct_box {
background: white;
height: calc(100vh - 286px);
padding: 0 10px;
overflow-y: auto;
border-bottom: 1px solid #efefef;
color: #999;
text-align: center;
::-webkit-scrollbar {
display: none;
}
}
}
</style>
...@@ -8,17 +8,17 @@ ...@@ -8,17 +8,17 @@
<user v-if="activeName == 2"></user> <user v-if="activeName == 2"></user>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="全局检索" name="3"> <el-tab-pane label="全局检索" name="3">
<role v-if="activeName == 3"></role> <global v-if="activeName == 3"></global>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</template> </template>
<script> <script>
import employee from './employeeTest.vue' import employee from './employee.vue'
import user from './userTest.vue' import user from './customer.vue'
import role from './roleTest.vue' import global from './global.vue'
export default { export default {
components: { employee, user, role }, components: { employee, user, global },
data() { data() {
return { return {
activeName: '1' activeName: '1'
...@@ -31,6 +31,8 @@ export default { ...@@ -31,6 +31,8 @@ export default {
} }
} }
</script> </script>
<style scoped> <style lang="scss" scoped>
/* *{margin: 0;padding: 0;} */ /deep/.pd15 {
padding: 15px;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!