| | |
| | | <div class="title">{{state.content.title}}</div> |
| | | <el-divider border-style="dashed"/> |
| | | <div class="time">更新时间:{{state.content.updateTime?state.content.updateTime:state.content.createTime}}</div> |
| | | <div v-html="state.content.content"></div> |
| | | <div v-html="state.content.content" @click="showFile($event)"></div> |
| | | </div> |
| | | <div class="main" v-if="state.firstClass == '法律法规'"> |
| | | <div class="title">{{state.content.title}}</div> |
| | |
| | | import {ElMessage} from "element-plus"; |
| | | import {getLawsDetails, getNoticeDetails, getPublishDetails} from "../../api/home/homePage"; |
| | | import { getDict } from "@/api/login" |
| | | import axios from "axios"; |
| | | import {getToken} from "@/utils/auth"; |
| | | |
| | | const route = useRoute() |
| | | const router = useRouter() |
| | |
| | | } |
| | | } |
| | | |
| | | const showFile = (e) => { |
| | | if(e.target.nodeName === 'A'){ |
| | | console.log("e",e) |
| | | e.preventDefault(); |
| | | const file = { |
| | | fileUrl: e.target.href, |
| | | fileName: e.target.download |
| | | } |
| | | axios.get( file.fileUrl,{ |
| | | headers: |
| | | { |
| | | 'Content-Type': 'application/json', |
| | | 'Authorization':getToken(), |
| | | }, |
| | | responseType: 'blob' |
| | | } |
| | | ).then(res=>{ |
| | | if (res) { |
| | | const link = document.createElement('a') |
| | | let blob = new Blob([res.data],{type: res.data.type}) |
| | | link.style.display = "none"; |
| | | link.href = URL.createObjectURL(blob); // 创建URL |
| | | link.setAttribute("download", file.fileName); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | } else { |
| | | this.$message.error('获取文件失败') |
| | | } |
| | | this.handleClose(); |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const back = ()=>{ |
| | | if(state.firstClass == '通知公告'){ |