8.25 sjs
Showing
2 changed files
with
40 additions
and
12 deletions
| ... | @@ -42,20 +42,22 @@ | ... | @@ -42,20 +42,22 @@ |
| 42 | </template> | 42 | </template> |
| 43 | </el-tab-pane> | 43 | </el-tab-pane> |
| 44 | </el-tabs> | 44 | </el-tabs> |
| 45 | <div v-loading="loading" class="infoPart"> | 45 | <div v-loading="loading" class="infoPart" style="position: relative"> |
| 46 | <h3 class="leftboderTT">{{ nowTab.name }}</h3> | 46 | <h3 class="leftboderTT">{{ nowTab.name }}</h3> |
| 47 | <div class="content"> | 47 | <div class="content"> |
| 48 | <div style="padding-left: 30px"> | 48 | <div style="padding-left: 30px"> |
| 49 | <el-link v-for="v in fileList" :href="fillImgUrl(v.url)" :underline="false" class="link" target="_blank" | 49 | <el-button style="position: absolute; top: 20px; right: 50px" type="primary" @click="downloadUrl(fileList)">{{language===0?'下载文档':'Download Document'}}</el-button> |
| 50 | type="primary"> | 50 | |
| 51 | <span style="border-bottom: 1px solid var(--el-color-primary)"> | 51 | <!-- <el-link v-for="v in fileList" :href="fillImgUrl(v.url)" :underline="false" class="link" target="_blank"--> |
| 52 | {{ v.name }} | 52 | <!-- type="primary">--> |
| 53 | <el-icon style="margin-left: 10px;position: relative;bottom: -2px"> | 53 | <!-- <span style="border-bottom: 1px solid var(--el-color-primary)">--> |
| 54 | <Download/> | 54 | <!-- {{ v.name }}--> |
| 55 | </el-icon> | 55 | <!-- <el-icon style="margin-left: 10px;position: relative;bottom: -2px">--> |
| 56 | </span> | 56 | <!-- <Download/>--> |
| 57 | 57 | <!-- </el-icon>--> | |
| 58 | </el-link> | 58 | <!-- </span>--> |
| 59 | |||
| 60 | <!-- </el-link>--> | ||
| 59 | </div> | 61 | </div> |
| 60 | <div v-if="content" v-html="content" /> | 62 | <div v-if="content" v-html="content" /> |
| 61 | <div v-else> | 63 | <div v-else> |
| ... | @@ -95,6 +97,7 @@ import {onMounted, ref} from "vue"; | ... | @@ -95,6 +97,7 @@ import {onMounted, ref} from "vue"; |
| 95 | import {getppInfo} from "@/apiPc/match"; | 97 | import {getppInfo} from "@/apiPc/match"; |
| 96 | import {useRoute} from "vue-router"; | 98 | import {useRoute} from "vue-router"; |
| 97 | import {fillImgUrl} from "/@/utils/ruoyi"; | 99 | import {fillImgUrl} from "/@/utils/ruoyi"; |
| 100 | import {ElMessage} from "element-plus"; | ||
| 98 | 101 | ||
| 99 | const route = useRoute() | 102 | const route = useRoute() |
| 100 | const language = useStorage('language', 0) | 103 | const language = useStorage('language', 0) |
| ... | @@ -181,6 +184,31 @@ const changeTab = (n) => { | ... | @@ -181,6 +184,31 @@ const changeTab = (n) => { |
| 181 | 184 | ||
| 182 | }) | 185 | }) |
| 183 | } | 186 | } |
| 187 | |||
| 188 | const downloadUrl = function (data) { | ||
| 189 | if(data && data.length > 0) { | ||
| 190 | let filePath = fillImgUrl(data[0].url) | ||
| 191 | let x = new XMLHttpRequest(); | ||
| 192 | x.open("GET", filePath, true); | ||
| 193 | x.responseType = 'blob'; | ||
| 194 | x.onload=function() { | ||
| 195 | let url = window.URL.createObjectURL(x.response) | ||
| 196 | let link=document.createElement('a') // 创建a标签 | ||
| 197 | link.style.display = 'none' | ||
| 198 | link.target = '_target' | ||
| 199 | link.href = url // 设置下载地址 | ||
| 200 | link.download = data[0].name || '' // 添加downLoad属性 | ||
| 201 | document.body.appendChild(link) | ||
| 202 | link.click() | ||
| 203 | } | ||
| 204 | x.send() | ||
| 205 | } else { | ||
| 206 | ElMessage.warning({ | ||
| 207 | message: '没有可以下载的文件', | ||
| 208 | }) | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 184 | </script> | 212 | </script> |
| 185 | 213 | ||
| 186 | <!--<style lang="scss" scoped>--> | 214 | <!--<style lang="scss" scoped>--> | ... | ... |
| ... | @@ -43,7 +43,7 @@ const title = ref('') | ... | @@ -43,7 +43,7 @@ const title = ref('') |
| 43 | const cptName = ref('') | 43 | const cptName = ref('') |
| 44 | const show = ref(false) | 44 | const show = ref(false) |
| 45 | const form = ref({}) | 45 | const form = ref({}) |
| 46 | const hotelType = ref('1') | 46 | const hotelType = ref('') |
| 47 | 47 | ||
| 48 | let matchId = '' | 48 | let matchId = '' |
| 49 | let type = '' | 49 | let type = '' | ... | ... |
-
Please register or sign in to post a comment