Commit daac14c2 authored by 赵茹林's avatar 赵茹林

聊天记录组件 更新 支持时间分段

团队概况 修复 平均业绩小数点不正确的问题
parent de675b9e
...@@ -7,147 +7,152 @@ ...@@ -7,147 +7,152 @@
<el-dialog title="聊天记录" append-to-body :visible.sync="show"> <el-dialog title="聊天记录" append-to-body :visible.sync="show">
<div v-loading="loading" style="height: 500px; overflow: auto;" class="liaotian-content"> <div v-loading="loading" style="height: 500px; overflow: auto;" class="liaotian-content">
<div class="real-time">{{ startAt }}</div> <div v-if="list.length">
<div class="chat-record" v-for="item in list" :key="item.id"> <div class="real-time">{{ startAt || chatStartAt }}</div>
<div class="le"> <div class="chat-record" v-for="item in list" :key="item.id">
<div class="le-content" v-if="item.author == 'left'"> <div class="le">
<div class="le-content-image"> <div class="le-content" v-if="item.author == 'left'">
<img :src="item.headimg" alt=""> <div class="le-content-image">
</div> <img :src="item.headimg" alt="">
<div class="le-content-box">
<div class="le-content-box-title">{{ item.nick }} {{ item.gmt_create }}</div>
<!-- 聊天内容 -->
<div class="chat-record-content" v-if="item.image_type == 1000" v-html="item.sentence"></div>
<!-- 聊天图片 -->
<div class="chat-record-content-image" v-if="item.image_type == 3">
<img :src="'https://hjapi.aihujing.com/ims/file/down?file_path='+item.image_osskey" alt="">
</div>
<!-- 聊天语音 -->
<div class="chat-record-content-audio" v-if="item.image_type == 34">
<audio controls="controls" width="260px" height="40px" class="le-content-audio" @play="audioClick('sourceFile'+item.id)" :id="'sourceFile'+item.id" :data-id="'sourceFile'+item.id">
<source :src="'https://hjapi.aihujing.com/ims/file/down?file_path='+item.image_osskey" type="audio/mp3">
</audio>
</div> </div>
<!-- 分享名片 --> <div class="le-content-box">
<div class="share-business-card" v-if="item.image_type == 42"> <div class="le-content-box-title">{{ item.nick }} {{ item.gmt_create }}</div>
<div class="share-business-card-image"> <!-- 聊天内容 -->
<div class="share-business-card-image-avtive"> <div class="chat-record-content" v-if="item.image_type == 1000" v-html="item.sentence"></div>
<img :src="item.sentence.small_headimg" alt=""> <!-- 聊天图片 -->
<div class="chat-record-content-image" v-if="item.image_type == 3">
<img :src="'https://hjapi.aihujing.com/ims/file/down?file_path='+item.image_osskey" alt="">
</div>
<!-- 聊天语音 -->
<div class="chat-record-content-audio" v-if="item.image_type == 34">
<audio controls="controls" width="260px" height="40px" class="le-content-audio" @play="audioClick('sourceFile'+item.id)" :id="'sourceFile'+item.id" :data-id="'sourceFile'+item.id">
<source :src="'https://hjapi.aihujing.com/ims/file/down?file_path='+item.image_osskey" type="audio/mp3">
</audio>
</div>
<!-- 分享名片 -->
<div class="share-business-card" v-if="item.image_type == 42">
<div class="share-business-card-image">
<div class="share-business-card-image-avtive">
<img :src="item.sentence.small_headimg" alt="">
</div>
<div class="share-business-card-name">{{ item.sentence.nickname }}</div>
</div>
<div class="card">
个人名片
</div> </div>
<div class="share-business-card-name">{{ item.sentence.nickname }}</div>
</div> </div>
<div class="card"> <!-- 发送视频 -->
个人名片 <div class="video-news" style="width: 65%;" v-if="item.image_type == 42"> <!-- v-if="item.image_type == 42" -->
<video class="my-video" @play="videoClick('sourceFile'+item.id)" :data-id="'sourceFile'+item.id" :src="item.sentence.video_url" :poster="item.sentence.img_url" style="width: 100%;outline: none" controls="controls"></video>
</div> </div>
</div> <!-- 聊天动态图 -->
<!-- 发送视频 --> <div class="chat-record-content" style="width: 20%" v-if="item.image_type == 47">
<div class="video-news" style="width: 65%;" v-if="item.image_type == 42"> <!-- v-if="item.image_type == 42" --> <img width="100%" :src="item.sentence" alt="">
<video class="my-video" @play="videoClick('sourceFile'+item.id)" :data-id="'sourceFile'+item.id" :src="item.sentence.video_url" :poster="item.sentence.img_url" style="width: 100%;outline: none" controls="controls"></video>
</div>
<!-- 聊天动态图 -->
<div class="chat-record-content" style="width: 20%" v-if="item.image_type == 47">
<img width="100%" :src="item.sentence" alt="">
</div>
<!-- 分享内容 -->
<div class="share-kuang" v-if="item.image_type === 49">
<div class="title">
{{ item.sentence.des }}
</div> </div>
<div class="share-kuang-content"> <!-- 分享内容 -->
<div class="kuang-content"> <div class="share-kuang" v-if="item.image_type === 49">
{{ item.sentence.title }} <div class="title">
{{ item.sentence.des }}
</div> </div>
<div class="kuang-image"> <div class="share-kuang-content">
<img :src="item.sentence.img_url" width="100%" height="100%" alt=""> <div class="kuang-content">
{{ item.sentence.title }}
</div>
<div class="kuang-image">
<img :src="item.sentence.img_url" width="100%" height="100%" alt="">
</div>
</div> </div>
</div> </div>
</div> <!-- 红包 -->
<!-- 红包 --> <div class="red-envelopes" v-if="item.image_type == 436207665 || item.image_type == 419430449">
<div class="red-envelopes" v-if="item.image_type == 436207665 || item.image_type == 419430449"> <div class="red-envelopes-content">
<div class="red-envelopes-content"> <div class="red-envelopes-content-image">
<div class="red-envelopes-content-image"> <img v-if="item.image_type == 436207665" src="https://wx.gtimg.com/hongbao/1800/hb.png" alt="">
<img v-if="item.image_type == 436207665" src="https://wx.gtimg.com/hongbao/1800/hb.png" alt=""> <img v-if="item.image_type == 419430449" src="../../assets/gou.png" alt="">
<img v-if="item.image_type == 419430449" src="../../assets/gou.png" alt=""> </div>
</div> <div class="red-envelopes-content-gongxi">
<div class="red-envelopes-content-gongxi"> {{ item.sentence.des }}
{{ item.sentence.des }} </div>
</div> </div>
<div class="title">{{ item.sentence.title }}</div>
</div> </div>
<div class="title">{{ item.sentence.title }}</div>
</div> </div>
</div> </div>
</div> </div>
</div> <div class="ri" v-show="item.author == 'right'">
<div class="ri" v-show="item.author == 'right'"> <div class="ri-content">
<div class="ri-content"> <div class="le-content-image">
<div class="le-content-image"> <img :src="item.headimg" alt="">
<img :src="item.headimg" alt="">
</div>
<div class="le-content-box">
<div class="le-content-box-title">{{ item.gmt_create }} {{ item.nick }}</div>
<!-- 聊天内容 -->
<div class="chat-record-content" v-if="item.image_type == 1000">{{ item.sentence }}</div>
<!-- 聊天图片 -->
<div class="chat-record-content-image" v-if="item.image_type == 3">
<img :src="'https://hjapi.aihujing.com/ims/file/down?file_path='+item.image_osskey" alt="">
</div>
<!-- 聊天语音 -->
<div class="chat-record-content-audio" v-if="item.image_type == 34">
<audio controls="controls" width="260px" height="40px" class="le-content-audio" @play="audioClick('sourceFile'+item.id)" :id="'sourceFile'+item.id" :data-id="'sourceFile'+item.id">
<source :src="'https://hjapi.aihujing.com/ims/file/down?file_path='+item.image_osskey" type="audio/mp3">
</audio>
</div> </div>
<!-- 分享名片 --> <div class="le-content-box">
<div class="share-business-card" v-if="item.image_type == 42"> <div class="le-content-box-title">{{ item.gmt_create }} {{ item.nick }}</div>
<div class="share-business-card-image"> <!-- 聊天内容 -->
<div class="share-business-card-image-avtive"> <div class="chat-record-content" v-if="item.image_type == 1000">{{ item.sentence }}</div>
<img :src="item.sentence.small_headimg" alt=""> <!-- 聊天图片 -->
<div class="chat-record-content-image" v-if="item.image_type == 3">
<img :src="'https://hjapi.aihujing.com/ims/file/down?file_path='+item.image_osskey" alt="">
</div>
<!-- 聊天语音 -->
<div class="chat-record-content-audio" v-if="item.image_type == 34">
<audio controls="controls" width="260px" height="40px" class="le-content-audio" @play="audioClick('sourceFile'+item.id)" :id="'sourceFile'+item.id" :data-id="'sourceFile'+item.id">
<source :src="'https://hjapi.aihujing.com/ims/file/down?file_path='+item.image_osskey" type="audio/mp3">
</audio>
</div>
<!-- 分享名片 -->
<div class="share-business-card" v-if="item.image_type == 42">
<div class="share-business-card-image">
<div class="share-business-card-image-avtive">
<img :src="item.sentence.small_headimg" alt="">
</div>
<div class="share-business-card-name">{{ item.sentence.nickname }}</div>
</div>
<div class="card">
个人名片
</div> </div>
<div class="share-business-card-name">{{ item.sentence.nickname }}</div>
</div> </div>
<div class="card"> <!-- 发送视频 -->
个人名片 <div class="video-news" style="width: 65%; float:right;" v-if="item.image_type == 43">
<video class="my-video" @play="videoClick('sourceFile'+item.id)" :data-id="'sourceFile'+item.id" :src="item.sentence.video_url" :poster="item.sentence.img_url" style="width: 100%;outline: none" controls="controls"></video>
</div> </div>
</div> <!-- 聊天动态图 -->
<!-- 发送视频 --> <div class="chat-record-content" style="width: 20%" v-if="item.image_type == 47">
<div class="video-news" style="width: 65%; float:right;" v-if="item.image_type == 43"> <img width="100%" :src="item.sentence" alt="">
<video class="my-video" @play="videoClick('sourceFile'+item.id)" :data-id="'sourceFile'+item.id" :src="item.sentence.video_url" :poster="item.sentence.img_url" style="width: 100%;outline: none" controls="controls"></video>
</div>
<!-- 聊天动态图 -->
<div class="chat-record-content" style="width: 20%" v-if="item.image_type == 47">
<img width="100%" :src="item.sentence" alt="">
</div>
<!-- 分享内容 -->
<div class="share-kuang" v-if="item.image_type === 49">
<div class="title">
{{ item.sentence.des }}
</div> </div>
<div class="share-kuang-content"> <!-- 分享内容 -->
<div class="kuang-content"> <div class="share-kuang" v-if="item.image_type === 49">
{{ item.sentence.title }} <div class="title">
{{ item.sentence.des }}
</div> </div>
<div class="kuang-image"> <div class="share-kuang-content">
<img :src="item.sentence.img_url" width="100%" height="100%" alt=""> <div class="kuang-content">
{{ item.sentence.title }}
</div>
<div class="kuang-image">
<img :src="item.sentence.img_url" width="100%" height="100%" alt="">
</div>
</div> </div>
</div> </div>
</div> <!-- 红包 -->
<!-- 红包 --> <div class="red-envelopes" v-if="item.image_type == 436207665 || item.image_type == 419430449">
<div class="red-envelopes" v-if="item.image_type == 436207665 || item.image_type == 419430449"> <div class="red-envelopes-content">
<div class="red-envelopes-content"> <div class="red-envelopes-content-image">
<div class="red-envelopes-content-image"> <img v-if="item.image_type == 436207665" src="https://wx.gtimg.com/hongbao/1800/hb.png" alt="">
<img v-if="item.image_type == 436207665" src="https://wx.gtimg.com/hongbao/1800/hb.png" alt=""> <img v-if="item.image_type == 419430449" src="../../assets/gou.png" alt="">
<img v-if="item.image_type == 419430449" src="../../assets/gou.png" alt=""> </div>
</div> <div class="red-envelopes-content-gongxi">
<div class="red-envelopes-content-gongxi"> {{ item.sentence.des }}
{{ item.sentence.des }} </div>
</div> </div>
<div class="title">{{ item.sentence.title }}</div>
</div> </div>
<div class="title">{{ item.sentence.title }}</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-else style="display: flex;align-items: center;justify-content: center;color: #999999;height: 100%;">
暂无数据
</div>
</div> </div>
</el-dialog> </el-dialog>
...@@ -169,8 +174,18 @@ ...@@ -169,8 +174,18 @@
startAt: { startAt: {
type: String, type: String,
default: '', default: '',
required: true required: false // 与 chatStartAt chatEndAt 两个字段互斥
} },
chatStartAt: {
type: String,
default: '',
required: false
},
chatEndAt: {
type: String,
default: '',
required: false
},
}, },
data() { data() {
return { return {
...@@ -192,7 +207,16 @@ ...@@ -192,7 +207,16 @@
}, },
getData() { getData() {
this.loading = true; this.loading = true;
getChatrecordApi(this.friendId, {start_at: this.startAt}).then(res => { var json = {};
if (this.startAt) {
json = {start_at: this.startAt}
} else if (this.chatStartAt && this.chatEndAt) {
json = {
chat_start_at: this.chatStartAt,
chat_end_at: this.chatEndAt,
}
}
getChatrecordApi(this.friendId, json).then(res => {
if (res.length > 0) { if (res.length > 0) {
res.map(item => { res.map(item => {
if (!Util.isJSON(item.sentence) && String(item.image_type).toUpperCase() === 'NULL') { if (!Util.isJSON(item.sentence) && String(item.image_type).toUpperCase() === 'NULL') {
...@@ -201,7 +225,7 @@ ...@@ -201,7 +225,7 @@
}) })
this.list = res this.list = res
} else { } else {
this.$message.error('没有聊天记录'); // this.$message.error('没有聊天记录');
this.list = [] this.list = []
} }
this.loading = false; this.loading = false;
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<!--<el-button size="small" v-if="scope.row.chat_count > 0">聊天记录</el-button>--> <!--<el-button size="small" v-if="scope.row.chat_count > 0">聊天记录</el-button>-->
<chat-record <chat-record
v-if="scope.row.chat_count > 0" v-if="scope.row.chat_count > 0"
:friend-id="scope.row.friend_id" :start-at="dialogObj.start_at"></chat-record> :friend-id="scope.row.friend_id" :chat-start-at="scope.row.chat_start_at" :chat-end-at="scope.row.chat_end_at"></chat-record>
<phone-record <phone-record
v-if="scope.row.phone_source_file" v-if="scope.row.phone_source_file"
:src="scope.row.phone_source_file"></phone-record> :src="scope.row.phone_source_file"></phone-record>
...@@ -143,8 +143,8 @@ ...@@ -143,8 +143,8 @@
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<chat-record <chat-record
v-if="dialog.search.type == '0'" v-if="scope.row.chat_count > 0"
:friend-id="scope.row.friend_id" :start-at="dialogObj.start_at"></chat-record> :friend-id="scope.row.friend_id" :chat-start-at="scope.row.chat_start_at" :chat-end-at="scope.row.chat_end_at"></chat-record>
<phone-record <phone-record
v-if="dialog.search.type == '1' && scope.row.source_file" v-if="dialog.search.type == '1' && scope.row.source_file"
:src="scope.row.source_file"></phone-record> :src="scope.row.source_file"></phone-record>
......
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
}, },
transRate(child, mother) { transRate(child, mother) {
if (mother) { if (mother) {
return `${Math.floor(child * 100) / mother}%` return `${Math.floor(child * 1000 / mother)/10}%`
} else { } else {
return '-' return '-'
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment