Browse Source

Merge branch 'chengyang' of http://120.46.222.128:10021/elink-star/epmet-work-pc-chengyang into chengyang

chengyang
是小王呀\24601 8 months ago
parent
commit
1b822ed4e7
  1. 5
      src/views/modules/base/smartExport/exset.vue
  2. 52
      src/views/modules/shequzhili/eventOld/cpts/event-detail.vue

5
src/views/modules/base/smartExport/exset.vue

@ -1255,9 +1255,7 @@ specialCategoryList: [
fileReader.readAsText(res.data)
},
downloadFile(res) {
if (res.headers["content-disposition"]) {
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
console.log('filename', fileName)
let fileName = this.search.name
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
var url = window.URL.createObjectURL(blob)
var aLink = document.createElement('a')
@ -1270,7 +1268,6 @@ specialCategoryList: [
window.URL.revokeObjectURL(url) //blob
this.$message.success('导出成功')
this.$emit('close')
} else this.$message.error('下载失败')
}
},
watch: {

52
src/views/modules/shequzhili/eventOld/cpts/event-detail.vue

@ -42,14 +42,23 @@
<img :src="src" :key="src" style="width: 150px; height: 150px; padding-right: 10px"
v-for="src in info.imageList" @click="watchImg(src)" />
</div>
<div v-if="info.voiceList && info.voiceList.length > 0" :class="[
<!-- v-if="info.voiceList && info.voiceList.length > 0" -->
<div :class="[
'm-info-prop',
{ 'm-info-prop-vis': source === 'visiual' },
]">
]" v-show="fasle" >
<span class="u-info-title-2">语音</span>
<audio controls>
<source :src="item.url" type="" :key="item.url" v-for="item in info.voiceList" />
<!-- v-for="item in info.voiceList" -->
<audio controls controlsList="download">
<source src="https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/prod/20241204/fee163b9aa7d48efad55860c774f122f.mp3" type=""/>
</audio>
<el-button type="text" icon="el-icon-download"
@click="downloadFile('https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/prod/20241204/fee163b9aa7d48efad55860c774f122f.mp3')"
>
下载语音
</el-button>
</div>
<div :class="[
'm-info-prop',
@ -209,6 +218,7 @@
import { requestPost } from "@/js/dai/request";
import foldText from "@/views/components/foldText";
import projectInfo from "../../xiangmu/cpts/project-info";
function iniData() {
return {
user: {},
@ -312,6 +322,40 @@ export default {
this.loadGrid();
},
methods: {
//
downloadFile(url) {
const fileName = '录音.mp3'
this.getOSSBlobResource(url).then(res => {
this.saveFile(res, fileName)
})
},
getOSSBlobResource(url) {
return new Promise((resolve) => {
const xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.setRequestHeader('Cache-Control', 'no-cache')
xhr.onload = () => {
if (xhr.status === 200) {
resolve(xhr.response)
}
}
xhr.send()
})
},
//
saveFile(data, fileName) {
const exportBlob = new Blob([data])
const saveLink = document.createElement('a')
document.body.appendChild(saveLink)
saveLink.style.display = 'none'
var urlObject = window.URL.createObjectURL(exportBlob)
saveLink.href = urlObject
saveLink.download = fileName
saveLink.click()
document.body.removeChild(saveLink)
},
watchImg(src) {
window.open(src);
},

Loading…
Cancel
Save