b4d86fc7 by zrj

10.9 世锦赛详情增加 下载文件功能

1 parent c4285d0f
......@@ -192,6 +192,7 @@
<el-col :span="24">
<el-tabs v-model="activeName" class="match-tabs">
<el-tab-pane v-for="tab in tabList" :label="tab.customTitle" :name="tab.id">
<el-button v-if="tab.fileUrl&&tab.fileUrl.length>0" style="float: right" type="primary" @click="downloadUrl(tab.fileUrl)">{{language===0?'下载文档':'Download Document'}}</el-button>
<div class="richContent" v-html="tab.customText"></div>
</el-tab-pane>
</el-tabs>
......@@ -240,6 +241,7 @@ import SubstationList from "@/viewsPc/match/components/substation-list";
import MatchInfoProjectList from "@/viewsPc/match/components/matchInfo-projectList";
import QuickRow from "@/viewsPc/match/components/quick-row";
import Pickup from '@/viewsPc/components/pickup'
import {fillImgUrl} from "/@/utils/ruoyi";
import {getCurrentInstance, ref} from 'vue'
import {reactive, onMounted} from '@vue/runtime-core'
import {useRoute, useRouter} from 'vue-router'
......@@ -321,6 +323,12 @@ onMounted(() => {
function getTab() {
match.getLabelList().then(res=>{
tabList.value = res.data
tabList.value.forEach(item => {
if (item.fileUrl) {
item.fileUrl = JSON.parse(item.fileUrl)
}
})
if(route.query.tabId){
activeName.value = route.query.tabId
} else {
......@@ -670,6 +678,33 @@ const openPickup = () => {
}
proxy.$refs['pickupRef'].open(obj)
}
const downloadUrl = function (data) {
if(data && data.length > 0) {
console.log(data[0])
let filePath = fillImgUrl(data[0].url)
console.log(filePath)
let x = new XMLHttpRequest();
x.open("GET", filePath, true);
x.responseType = 'blob';
x.onload=function() {
let url = window.URL.createObjectURL(x.response)
let link=document.createElement('a') // 创建a标签
link.style.display = 'none'
link.target = '_target'
link.href = url // 设置下载地址
link.download = data[0].name || '' // 添加downLoad属性
document.body.appendChild(link)
link.click()
}
x.send()
} else {
ElMessage.warning({
message: '没有可以下载的文件',
})
}
}
</script>
<style lang="scss" scoped>
......@@ -1077,6 +1112,7 @@ const openPickup = () => {
overflow: hidden;
display: flex;
justify-content: center;
width: 100%;
}
.richContent img {
......
......@@ -89,9 +89,8 @@ export default defineConfig(({ mode, command }) => {
rewrite: (p) => p.replace(/^\/dev-api\/ztx-webSite/, '')
},
'/dev-api': {
target: 'http://192.168.1.118:8082',
// target: 'http://192.168.1.22:8082',
// target: 'https://tk005.wxjylt.com/stage-api',
target: 'https://tk005.wxjylt.com/stage-api',
// target: 'http://124.70.181.90:1880/stage-api',
// target: 'https://sys.2025wtcwuxi.com/stage-api/',
changeOrigin: true,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!