b4d86fc7 by zrj

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

1 parent c4285d0f
...@@ -192,6 +192,7 @@ ...@@ -192,6 +192,7 @@
192 <el-col :span="24"> 192 <el-col :span="24">
193 <el-tabs v-model="activeName" class="match-tabs"> 193 <el-tabs v-model="activeName" class="match-tabs">
194 <el-tab-pane v-for="tab in tabList" :label="tab.customTitle" :name="tab.id"> 194 <el-tab-pane v-for="tab in tabList" :label="tab.customTitle" :name="tab.id">
195 <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>
195 <div class="richContent" v-html="tab.customText"></div> 196 <div class="richContent" v-html="tab.customText"></div>
196 </el-tab-pane> 197 </el-tab-pane>
197 </el-tabs> 198 </el-tabs>
...@@ -240,6 +241,7 @@ import SubstationList from "@/viewsPc/match/components/substation-list"; ...@@ -240,6 +241,7 @@ import SubstationList from "@/viewsPc/match/components/substation-list";
240 import MatchInfoProjectList from "@/viewsPc/match/components/matchInfo-projectList"; 241 import MatchInfoProjectList from "@/viewsPc/match/components/matchInfo-projectList";
241 import QuickRow from "@/viewsPc/match/components/quick-row"; 242 import QuickRow from "@/viewsPc/match/components/quick-row";
242 import Pickup from '@/viewsPc/components/pickup' 243 import Pickup from '@/viewsPc/components/pickup'
244 import {fillImgUrl} from "/@/utils/ruoyi";
243 import {getCurrentInstance, ref} from 'vue' 245 import {getCurrentInstance, ref} from 'vue'
244 import {reactive, onMounted} from '@vue/runtime-core' 246 import {reactive, onMounted} from '@vue/runtime-core'
245 import {useRoute, useRouter} from 'vue-router' 247 import {useRoute, useRouter} from 'vue-router'
...@@ -321,6 +323,12 @@ onMounted(() => { ...@@ -321,6 +323,12 @@ onMounted(() => {
321 function getTab() { 323 function getTab() {
322 match.getLabelList().then(res=>{ 324 match.getLabelList().then(res=>{
323 tabList.value = res.data 325 tabList.value = res.data
326 tabList.value.forEach(item => {
327 if (item.fileUrl) {
328 item.fileUrl = JSON.parse(item.fileUrl)
329 }
330 })
331
324 if(route.query.tabId){ 332 if(route.query.tabId){
325 activeName.value = route.query.tabId 333 activeName.value = route.query.tabId
326 } else { 334 } else {
...@@ -670,6 +678,33 @@ const openPickup = () => { ...@@ -670,6 +678,33 @@ const openPickup = () => {
670 } 678 }
671 proxy.$refs['pickupRef'].open(obj) 679 proxy.$refs['pickupRef'].open(obj)
672 } 680 }
681
682 const downloadUrl = function (data) {
683 if(data && data.length > 0) {
684 console.log(data[0])
685 let filePath = fillImgUrl(data[0].url)
686 console.log(filePath)
687 let x = new XMLHttpRequest();
688 x.open("GET", filePath, true);
689 x.responseType = 'blob';
690 x.onload=function() {
691 let url = window.URL.createObjectURL(x.response)
692 let link=document.createElement('a') // 创建a标签
693 link.style.display = 'none'
694 link.target = '_target'
695 link.href = url // 设置下载地址
696 link.download = data[0].name || '' // 添加downLoad属性
697 document.body.appendChild(link)
698 link.click()
699 }
700 x.send()
701 } else {
702 ElMessage.warning({
703 message: '没有可以下载的文件',
704 })
705 }
706 }
707
673 </script> 708 </script>
674 709
675 <style lang="scss" scoped> 710 <style lang="scss" scoped>
...@@ -1077,6 +1112,7 @@ const openPickup = () => { ...@@ -1077,6 +1112,7 @@ const openPickup = () => {
1077 overflow: hidden; 1112 overflow: hidden;
1078 display: flex; 1113 display: flex;
1079 justify-content: center; 1114 justify-content: center;
1115 width: 100%;
1080 } 1116 }
1081 1117
1082 .richContent img { 1118 .richContent img {
......
...@@ -89,9 +89,8 @@ export default defineConfig(({ mode, command }) => { ...@@ -89,9 +89,8 @@ export default defineConfig(({ mode, command }) => {
89 rewrite: (p) => p.replace(/^\/dev-api\/ztx-webSite/, '') 89 rewrite: (p) => p.replace(/^\/dev-api\/ztx-webSite/, '')
90 }, 90 },
91 '/dev-api': { 91 '/dev-api': {
92 target: 'http://192.168.1.118:8082',
93 // target: 'http://192.168.1.22:8082', 92 // target: 'http://192.168.1.22:8082',
94 // target: 'https://tk005.wxjylt.com/stage-api', 93 target: 'https://tk005.wxjylt.com/stage-api',
95 // target: 'http://124.70.181.90:1880/stage-api', 94 // target: 'http://124.70.181.90:1880/stage-api',
96 // target: 'https://sys.2025wtcwuxi.com/stage-api/', 95 // target: 'https://sys.2025wtcwuxi.com/stage-api/',
97 changeOrigin: true, 96 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!