| | |
| | | <!-- 列表内容 --> |
| | | <div class="w-full px-6 flex-1 h-full" style="box-sizing: border-box;"> |
| | | <div v-for="(item, index) in policyList" :key="index" class="policy-item"> |
| | | <div @click="toDetail" |
| | | <div @click="toDetail(item)" |
| | | class="flex flex-col justify-between items-start py-4 border-b border-gray-200 hover:bg-gray-50" style="border-bottom: 1px solid #f1f1f1;"> |
| | | <div class="flex-1"> |
| | | <a |
| | |
| | | 标准动态 |
| | | </h3> |
| | | <ul class="space-y-4 my-[0px]"> |
| | | <li v-for="(news, index) in standardNews" :key="index" class="text-sm" |
| | | <li v-for="(news, index) in standardNews" @click="toDetail(news)" :key="index" class="text-sm" |
| | | style="border-bottom: 1px dashed; border-color: #d1d1d1; padding: 10px 0;"> |
| | | <a href="#" class="text-[18px] text-[#646465] hover:text-blue-600">{{ news.title }}</a> |
| | | <div class="text-gray-400 mt-1 text-[14px] text-[#646465]">发布时间:{{ news.date }}</div> |
| | |
| | | |
| | | <script setup lang="ts"> |
| | | import { ref, onMounted } from 'vue' |
| | | import mammoth from 'mammoth'; |
| | | import { useRouter } from 'vue-router'; |
| | | import axios from 'axios'; |
| | | const activeTab = ref('laws') |
| | | const currentPage = ref(1) |
| | | const pageSize = ref(20) |
| | | const total = ref(100) |
| | | const router = useRouter(); |
| | | // 模拟数据 |
| | | const policyList = ref([ |
| | | { |
| | | title: '《上海市经济信息化委关于开展2025年度上海市工业通信业用能设备更新专项扶持资金项目申报工作的通知》', |
| | | description: '有关单位:为贯彻落实《上海市节能减排(应对气候变化)专项资金管理办法(沪发改规范〔2021〕5号)》和《上海市工业通信业用能设备更新专项扶持实施细则》(沪经信规范〔2025〕1号),进一步推进本市工业通信业用能设备更新工作,现组织开展2025年度上海市工业通信业用能设备更新专项扶持资金项目申报工作。', |
| | | publishTime: '2024-04-23' |
| | | }, |
| | | // 添加更多数据项... |
| | | ]) |
| | | const policyList = ref([ ]) |
| | | |
| | | const standardNews = ref([ |
| | | { |
| | | id: '7', |
| | | title: '上海市人民政府关于印发《上海市推动大规模设备更新和消费品以旧换新行动计划(2024-2027年)》的通知', |
| | | date: '2024-04-23', |
| | | link: 'test', |
| | | }, |
| | | { |
| | | id: '1', |
| | | title: '上海市经济信息化委关于征集用能设备更新供应链平台的通知', |
| | | date: '2025-02-07', |
| | | link: 'https://sheitc.sh.gov.cn/jjyx/20250207/7e424cc336b84066890ba2366c4543a1.html', |
| | | }, |
| | | { |
| | | id: '2', |
| | | title: '浙江大规模以旧换新方案公布', |
| | | date: '2025-02-08', |
| | | link: 'https://news.qq.com/rain/a/20250208A05YH100', |
| | | }, |
| | | { |
| | | id: '3', |
| | | title: '2024年设备更新与消费品以旧换新成效显著', |
| | | date: '2025-02-10', |
| | | link: 'https://www.sohu.com/a/857615850_122006510', |
| | | }, |
| | | { |
| | | id: '4', |
| | | title: '印发推动工业领域设备更新工作实施方案的通知', |
| | | date: '2024-10-22', |
| | | link: 'https://gxj.quanzhou.gov.cn/zwgk/zfxxgk/fdzdgknr/gzdt/202410/t20241022_3093021.htm', |
| | | }, |
| | | { |
| | | id: '5', |
| | | title: '关于《上海市工业通信业用能设备更新专项政策实施细则(征求意见稿)》公开征求意见的公告', |
| | | date: '2024-12-18', |
| | | link: 'https://sheitc.sh.gov.cn/gg/20241218/517c960cef5d40f0bb04b1099c64d9eb.html', |
| | | }, |
| | | ]) |
| | | const standardNews = ref([]) |
| | | |
| | | onMounted(()=>{ |
| | | initNewsList() |
| | | }) |
| | | // 初始化新闻列表数据 |
| | | const initNewsList=()=>{ |
| | | axios({ |
| | | url:"/static/Data/newsData/list.json", |
| | | method:"get" |
| | | }).then(res=>{ |
| | | const result = res.data |
| | | const {LegalRelatedList,StandardDynamicsList} = result |
| | | |
| | | policyList.value = LegalRelatedList.map(item=>{ |
| | | return { |
| | | id:item.id, |
| | | title:item.title, |
| | | description:item.description, |
| | | publishTime:item.pubdate |
| | | } |
| | | }) |
| | | standardNews.value = StandardDynamicsList.map(item=>{ |
| | | return { |
| | | id:item.id, |
| | | title:item.title, |
| | | date:item.pubdate, |
| | | } |
| | | }) |
| | | }).catch(err=>{ |
| | | |
| | | }) |
| | | } |
| | | |
| | | const handleSizeChange = (val: number) => { |
| | | pageSize.value = val |
| | |
| | | // TODO: 重新加载数据 |
| | | } |
| | | |
| | | const toDetail = ()=>{ |
| | | const toDetail = (node)=>{ |
| | | router.push({ |
| | | path:"/news-detail/99" |
| | | path:`news-detail/${node.id}` |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | // TODO: 初始化加载数据 |
| | | readDocFile() |
| | | }) |
| | | |
| | | const readDocFile = () => { |
| | | let filePath = "http://198.18.0.1:5680/static/Data/test.docx" |
| | | // 将文件转为blob对象 |
| | | // let docFileBlob = new Blob([filePath]) |
| | | // let reader = new FileReader() |
| | | // reader.readAsArrayBuffer(docFileBlob) |
| | | |
| | | // reader.onload = (evt)=> { |
| | | // let arrayBuffer = evt.target.result |
| | | // mammoth.convertToHtml({ arrayBuffer: arrayBuffer }).then((res)=>{ |
| | | // console.log(res,158) |
| | | // }).catch(err=>{ |
| | | // console.log(err) |
| | | // }) |
| | | // } |
| | | |
| | | // 读取文件内容 |
| | | fetch(filePath) |
| | | .then(res => res.arrayBuffer()) |
| | | .then(buffer => { |
| | | mammoth.convertToHtml({ arrayBuffer: buffer }) |
| | | .then((result) => { |
| | | console.log(result,'文件读取'); |
| | | }) |
| | | .catch((err) => { |
| | | console.error("转换错误:", err); |
| | | }); |
| | | }) |
| | | .catch(error => console.error('Error reading file:', error)); |
| | | // 将文件转换成blob对象 |
| | | |
| | | // mammoth.convertToHtml({ |
| | | // path: filePath, |
| | | // // options: { |
| | | // // styleMap: ` |
| | | // // p[style-name='Title'] => h1 |
| | | // // p[style-name='Subtitle'] => h2 |
| | | // // strong => b |
| | | // // ` |
| | | // // } |
| | | // }).then(res => { |
| | | // console.log(res) |
| | | // }).catch(err => { |
| | | // console.log(err) |
| | | // }) |
| | | } |
| | | </script> |
| | | |