Commit 95dca5d9 by qiyeqing

语音播放

1 parent 4265eaca
<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 allChat" :key="index">
<!-- <span v-if="item.fromInfo.name">{{item.fromInfo.name}}</span> --> <!-- <span v-if="item.fromInfo.name">{{item.fromInfo.name}}</span> -->
<div :style="{'color':item.action=='send'?'#199ed8':'#999'}"><span v-if="item.fromInfo">{{item.fromInfo.name}}</span> <span <div :style="{'color':item.action=='send'?'#199ed8':'#999'}"><span
v-if="item.fromInfo">{{item.fromInfo.name}}</span> <span
:style="{'color':item.action=='send'?'#199ed8':'#999'}">{{parseTime(item.msgtime)}}</span></div> :style="{'color':item.action=='send'?'#199ed8':'#999'}">{{parseTime(item.msgtime)}}</span></div>
<div v-if="item.msgtype=='text'" class="msgtypetext" > <div v-if="item.msgtype=='text'" class="msgtypetext">
{{item.text.content}} {{item.text.content}}
</div> </div>
<div v-else-if="item.msgtype=='image'" class="msgtypeimg"> <div v-else-if="item.msgtype=='image'" class="msgtypeimg">
<img :src="item.image.attachment" @click="showImg(item)"> <img :src="item.image.attachment" @click="showImg(item)">
</div> </div>
<div v-else-if="item.msgtype=='file'" class="msgtypefile" @click="down(item.file)"> <div v-else-if="item.msgtype=='file'" class="msgtypefile" @click="down(item.file)">
{{item.file.filename}} {{item.file.filename}}
</div> </div>
<div v-else-if="item.msgtype=='voice'" class="msgtypevoice"> <div v-else-if="item.msgtype=='voice'" class="msgtypevoice">
<i class="el-icon-microphone" style=" font-size: 40px; color: #199ed8;" @click="playVideo(item)"></i> <i class="el-icon-microphone" style=" font-size: 40px; color: #199ed8;" @click="playVideo(item)"></i>
</div> </div>
<div v-else-if="item.msgtype=='emotion'" class="msgtypeimg"> <div v-else-if="item.msgtype=='emotion'" class="msgtypeimg">
<img :src="item.emotion.attachment" @click="showImg(item)"> <img :src="item.emotion.attachment" @click="showImg(item)">
</div> </div>
<div v-else-if="item.msgtype=='video'" class="msgtypevideo"> <div v-else-if="item.msgtype=='video'" class="msgtypevideo">
<i class="el-icon-video-play" style=" font-size: 40px; color: #199ed8;" @click="play(item,'video')"></i> <i class="el-icon-video-play" style=" font-size: 40px; color: #199ed8;" @click="play(item,'video')"></i>
</div> </div>
<div v-else-if="item.msgtype=='location'" class="msgtypecard" > <div v-else-if="item.msgtype=='location'" class="msgtypecard">
<div class="card_name"> <div class="card_name">
<el-amap ref="map" vid="amapDemo" :center="[item.location.longitude, item.location.latitude]" :zoom="zoom" class="amap-demo" style="pointer-events: none;"> <el-amap ref="map" vid="amapDemo" :center="[item.location.longitude, item.location.latitude]" :zoom="zoom"
<el-amap-marker :position="[item.location.longitude, item.location.latitude]"></el-amap-marker> class="amap-demo" style="pointer-events: none;">
</el-amap> <el-amap-marker :position="[item.location.longitude, item.location.latitude]"></el-amap-marker>
</el-amap>
</div> </div>
<div class="card_foot" >{{item.location.address}}</div> <div class="card_foot">{{item.location.address}}</div>
</div> </div>
<div v-else-if="item.msgtype=='weapp'" class="msgtypecard"> <div v-else-if="item.msgtype=='weapp'" class="msgtypecard">
<div class="card_name"></div> <div class="card_name"></div>
...@@ -45,61 +45,58 @@ ...@@ -45,61 +45,58 @@
</li> </li>
</ul> </ul>
<div class="shabowbox" v-show="dia" > <div class="shabowbox" v-show="dia">
<div class="close" @click="dia=false"><i class="el-icon-circle-close"></i></div> <div class="close" @click="dia=false"><i class="el-icon-circle-close"></i></div>
<div class="shabowboxvidoe"> <div class="shabowboxvidoe">
<video-player class="video-player vjs-custom-skin" <video-player class="video-player vjs-custom-skin" ref="videoPlayer" id="videoPlayer" :playsinline="true"
ref="videoPlayer" :options="playerOptions"></video-player>
id="videoPlayer" </div>
:playsinline="true" :options="playerOptions"></video-player>
</div> </div>
<div class="shabowbox" v-show="diavioce">
<div class="close" @click="vioceClose"><i class="el-icon-circle-close"></i></div>
<div class="shabowboxvidoe shabowboxaudio">
<AudioPlayer :audio-list="vioceSrc" ref="AudioPlayer" :before-play="onBeforePlay" />
</div>
</div> </div>
<div class="shabowbox" v-show="diavioce" > <el-dialog :visible.sync="dialogVisible" width="30%">
<div class="close" @click="diavioce=false"><i class="el-icon-circle-close"></i></div> <img :src="imgSrc" style="width:100%;max-height:600px">
<div class="shabowboxvidoe shabowboxaudio"> <span slot="footer" class="dialog-footer">
<AudioPlayer :audio-list="vioceSrc" </span>
:before-play="onBeforePlay" /> </el-dialog>
</div>
</div>
<el-dialog
:visible.sync="dialogVisible"
width="30%"
>
<img :src="imgSrc" style="width:100%;max-height:600px">
<span slot="footer" class="dialog-footer">
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {
import { AMapManager } from 'vue-amap'; AMapManager
} from 'vue-amap';
import 'video.js/dist/video-js.css' import 'video.js/dist/video-js.css'
import 'vue-video-player/src/custom-theme.css' import 'vue-video-player/src/custom-theme.css'
import { import {
parseTime, parseTime,
yearMouthDay yearMouthDay
} from '@/utils/common.js' } from '@/utils/common.js'
export default { export default {
components:{AMapManager}, components: {
AMapManager
},
props: { props: {
allChat: { allChat: {
type: Array, type: Array,
defluat: () => [] defluat: () => []
} }
}, },
mounted(){ mounted() {
}, },
data() { data() {
return { return {
dia: false, dia: false,
diavioce:false, diavioce: false,
dialogVisible:false, dialogVisible: false,
imgSrc:'', imgSrc: '',
vioceSrc:[], vioceSrc: [],
playerOptions: { playerOptions: {
playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度 playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
autoplay: false, //如果true,浏览器准备好时开始回放。 autoplay: false, //如果true,浏览器准备好时开始回放。
...@@ -116,50 +113,55 @@ ...@@ -116,50 +113,55 @@
}], }],
poster: "", //你的封面地址(覆盖在视频上面的图片) poster: "", //你的封面地址(覆盖在视频上面的图片)
width: document.documentElement.clientWidth, width: document.documentElement.clientWidth,
height:'475', height: '475',
notSupportedMessage: '此视频暂无法播放,请稍后再试' //允许覆盖Video.js无法播放媒体源时显示的默认信息。 notSupportedMessage: '此视频暂无法播放,请稍后再试' //允许覆盖Video.js无法播放媒体源时显示的默认信息。
}, },
zoom: 15, zoom: 15,
center: [117.148118, 36.660223], center: [117.148118, 36.660223],
markers: [ markers: [{
{ position: [117.148118, 36.660223],
position: [117.148118, 36.660223], visible: false,
visible: false, draggable: false,
draggable: false,
}]
}
]
} }
}, },
methods: { methods: {
  vioceClose() {
    this.diavioce = false
playVideo(e){ const mp3 = this.$refs.AudioPlayer;
this.vioceSrc=[e.voice.attachment] mp3.pause()
this.diavioce=true; },
playVideo(e) {
this.vioceSrc = [ e.voice.attachment]
this.diavioce = true;
}, },
onBeforePlay(next){ onBeforePlay(next) {
next() // 开始播放 next() // 开始播放
}, },
showImg(e){ showImg(e) {
this.imgSrc=e.image.attachment; this.imgSrc = e.image.attachment;
this.dialogVisible=true this.dialogVisible = true
}, },
play(e) { play(e) {
this.dia=true this.dia = true
const player = this.$refs.videoPlayer.player const player = this.$refs.videoPlayer.player
this.playerOptions['sources'][0]['src']=e.video.attachment; this.playerOptions['sources'][0]['src'] = e.video.attachment;
player.play() player.play()
}, },
down(e) { down(e) {
//下载文件 const url = window.URL.createObjectURL(new Blob([e.attachment], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
}))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', e.filename) // 下载文件的名称及文件类型后缀
document.body.appendChild(link)
link.click()
document.body.removeChild(link); // 下载完成移除元素
window.URL.revokeObjectURL(url); // 释放掉blob对象
} }
} }
} }
...@@ -170,11 +172,54 @@ ...@@ -170,11 +172,54 @@
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
#videoPlayer /deep/ .vjs-tech{ height: 450px;}
.shabowbox{ position: fixed;width:100%;height: 100%; background: rgba(0, 0, 0,0.4);left: 0;top: 0;z-index: 2000;} #videoPlayer /deep/ .vjs-tech {
.shabowboxvidoe{ position: fixed;width: 800px; height: 475px;left: 50%;margin-left: -400px;top:50%;margin-top: -235px;;z-index: 2001;background: #fff;} height: 450px;
.shabowboxaudio{ height: 125px;padding: 12px;} }
.close{ position: fixed;width: 50px; height:50px;right: 10px;z-index: 2012;top: 10px;text-align: center;line-height: 50px;font-size: 20px;color: #FFF;cursor: pointer;font-size: 43px;}
.shabowbox {
position: fixed;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
left: 0;
top: 0;
z-index: 2000;
}
.shabowboxvidoe {
position: fixed;
width: 800px;
height: 475px;
left: 50%;
margin-left: -400px;
top: 50%;
margin-top: -235px;
;
z-index: 2001;
background: #fff;
}
.shabowboxaudio {
height: 125px;
padding: 12px;
}
.close {
position: fixed;
width: 50px;
height: 50px;
right: 10px;
z-index: 2012;
top: 10px;
text-align: center;
line-height: 50px;
font-size: 20px;
color: #FFF;
cursor: pointer;
font-size: 43px;
}
.takecontent { .takecontent {
text-align: left; text-align: left;
width: 100%; width: 100%;
...@@ -217,9 +262,9 @@ ...@@ -217,9 +262,9 @@
.msgtypevideo { .msgtypevideo {
margin: 10px; margin: 10px;
cursor: pointer; cursor: pointer;
border-radius: 8px; border-radius: 8px;
} }
...@@ -257,4 +302,5 @@ ...@@ -257,4 +302,5 @@
} }
} }
</style> </style>
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<div class="employ"> <div class="employ">
<el-row> <el-row>
<el-col :span="6" class="borderR"> <el-col :span="6" class="borderR">
<div class="hd_box"> <!-- <div class="hd_box">
<div class="hd_name">成员({{employAmount}})</div> <div class="hd_name">成员({{employAmount}})</div>
<div class="paddingT10"> <div class="paddingT10">
<el-input placeholder="请输入内容" prefix-icon="el-icon-search" v-model="employName"> <el-input placeholder="请输入内容" prefix-icon="el-icon-search" v-model="employName">
</el-input> </el-input>
</div> </div>
</div> </div> -->
<div class="ct_box ct_boxFirst"> <div class="ct_box ct_boxFirst">
<el-tree class="filter-tree" :data="treeData" :props="defaultProps" :filter-node-method="filterNode" <el-tree class="filter-tree" :data="treeData" :props="defaultProps" :filter-node-method="filterNode"
ref="tree" @node-click="handleNodeClick" :default-expand-all="true"> ref="tree" @node-click="handleNodeClick" :default-expand-all="true">
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<el-table-column prop="action" label="操作"> <el-table-column prop="action" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="downloadFile(scope.row)">下载</el-button> <el-button type="text" size="small" @click="downloadFile(scope.row)">下载</el-button>
<el-button type="text" size="small">查看</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -122,14 +122,26 @@ ...@@ -122,14 +122,26 @@
start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick"> start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="activeNameThreeClick">
</el-date-picker> </el-date-picker>
</div> </div>
<el-table :data="fileData" stripe style="width: 100%" :header-cell-style="{background:'#fff'}"> <el-table :data="allVoice" stripe style="width: 100%" :header-cell-style="{background:'#fff'}">
<el-table-column prop="date" label="发起人"> <el-table-column prop="date" label="发起人">
<template slot-scope="scope">
{{scope.row.fromInfo.name}}
</template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="通话时间"> <el-table-column prop="name" label="通话时间">
<template slot-scope="scope">
{{parseTime(scope.row.msgtime)}}
</template>
</el-table-column> </el-table-column>
<el-table-column prop="address" label="时长"> <el-table-column prop="address" label="时长">
<template slot-scope="scope">
{{(scope.row.voice.play_length)}}s
</template>
</el-table-column> </el-table-column>
<el-table-column prop="address" label="操作"> <el-table-column prop="address" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="voiceLook(scope.row.voice)">查看</el-button>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
...@@ -150,8 +162,9 @@ ...@@ -150,8 +162,9 @@
content content
} from '@/api/content.js' } from '@/api/content.js'
import { import {
yearMouthDay,download yearMouthDay,parseTime
} from '@/utils/common.js' } from '@/utils/common.js'
export default { export default {
components: { components: {
list, list,
...@@ -195,8 +208,19 @@ ...@@ -195,8 +208,19 @@
}, },
mounted() { mounted() {
this.getTree() this.getTree()
this.getAmount()
}, },
methods: { methods: {
voiceLook(e){
const url = window.URL.createObjectURL(new Blob([e.attachment]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download','yuyin') // 下载文件的名称及文件类型后缀
document.body.appendChild(link)
link.click()
document.body.removeChild(link); // 下载完成移除元素
window.URL.revokeObjectURL(url); // 释放掉blob对象
},
downloadFile(e){ downloadFile(e){
const url = window.URL.createObjectURL(new Blob([e.file.attachment],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'})) const url = window.URL.createObjectURL(new Blob([e.file.attachment],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'}))
const link = document.createElement('a') const link = document.createElement('a')
...@@ -331,6 +355,18 @@ ...@@ -331,6 +355,18 @@
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.indexOf(value) !== -1;
}, },
getAmount(){
let querys = {
pageNum: '1',
pageSize: '999',
department: ''
}
api.getList(querys).then(({
total
}) => {
this.employAmount= total
})
},
handleNodeClick(data, add) { handleNodeClick(data, add) {
if (!data.userId) { if (!data.userId) {
let querys = { let querys = {
...@@ -341,10 +377,11 @@ ...@@ -341,10 +377,11 @@
api.getList(querys).then(({ api.getList(querys).then(({
rows rows
}) => { }) => {
const newChild = rows;
this.$set(data, 'children', []); this.$set(data, 'children', []);
data.children = rows data.children = rows
}) })
} else { } else {
this.talkName = data.name; this.talkName = data.name;
this.employId = data.userId; this.employId = data.userId;
...@@ -413,7 +450,7 @@ ...@@ -413,7 +450,7 @@
} }
.ct_boxFirst { .ct_boxFirst {
height: 707px !important; height: 800px !important;
} }
.ct_box { .ct_box {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!