fileList.vue 2.61 KB
<template>
  <div>
    <div class="box">
      <el-breadcrumb class="mt20" :separator-icon="ArrowRight">
        <el-breadcrumb-item :to="{ path: '/' }">
          <el-icon>
            <HomeFilled/>
          </el-icon>
          首页
        </el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/business/index' }">商务专区</el-breadcrumb-item>
        <el-breadcrumb-item>文件下载</el-breadcrumb-item>
      </el-breadcrumb>
      <el-card class=" mt20 mb20">
        <div v-for="n in newsList" class="item" @click="goDetail(n)">
          <a class="file-item" target="_blank" :href="fillImgUrl_webSite(n.attacthJsonObj[0]?.url)">
            <h3 class="esp">
              <i class="icon pdf" v-if="n.attacthJsonObj[0]?.url.indexOf('pdf')>-1"></i>
              <i class="icon doc" v-else-if="n.attacthJsonObj[0]?.url.indexOf('doc')>-1"></i>
              <i class="icon xls" v-else-if="n.attacthJsonObj[0]?.url.indexOf('xls')>-1"></i>
              <i class="icon txt" v-else-if="n.attacthJsonObj[0]?.url.indexOf('txt')>-1"></i>
              <i class="icon ppt" v-else-if="n.attacthJsonObj[0]?.url.indexOf('ppt')>-1"></i>
              <i class="icon zip" v-else-if="n.attacthJsonObj[0]?.url.indexOf('zip')>-1"></i>
              <i class="icon zip" v-else-if="n.attacthJsonObj[0]?.url.indexOf('rar')>-1"></i>
              <i class="icon othe" v-else></i>
              {{ n.name }}
            </h3>
          </a>
        </div>

        <div class="pc-page-box" v-if="total>8">
          <PaginationPc v-model:page="query.pageNum" v-model:limit="query.pageSize" :total="total" @pagination="getList"/>
        </div>

        <el-empty v-if="newsList.length == 0" description="暂无数据"/>

      </el-card>
    </div>
  </div>
</template>

<script setup>
import { ArrowRight } from '@element-plus/icons-vue'

const route = useRoute()
const router = useRouter()
import { onMounted, ref } from 'vue'
import { getNewsListById } from '@/apiPc/webSite'
import { useRoute, useRouter } from 'vue-router'

const query = ref({
  pageSize: 10,
  pageNum: 1
})
const total = ref(0)
const newsList = ref([])
onMounted(() => {
  query.value.sortId = route.query.sortId
  query.value.code = route.query.code
  getList()
})
const getList = () => {
  getNewsListById(query.value).then(res => {
    newsList.value = res.rows
    for(var f of newsList.value){
      f.attacthJsonObj = JSON.parse(f.attacthJson)
    }
    total.value = res.total
  })
}
const goDetail = (n) => {
  if (n.isOut == '1') {
    window.open(n.jumpUrl)
  } else {
    router.push({
      path: `/news/detail/${n.noteId}`
    })
  }
}
</script>

<style scoped lang="scss">

</style>