listIndex.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <el-row class="main animate__animated animate__backInLeft">
  3. <el-col :span="24" class="info">
  4. <el-col :span="24" class="tabs">
  5. <el-col
  6. :span="6"
  7. :class="['tabList', item.id == tabActive ? 'tabActiveList' : '']"
  8. v-for="(item, index) in tabList"
  9. :key="index"
  10. @click="tabChange(item)"
  11. >
  12. {{ item.title }}
  13. </el-col>
  14. </el-col>
  15. <el-col :span="24" class="infoList">
  16. <el-col
  17. :span="24"
  18. class="list"
  19. v-for="(item, index) in list"
  20. :key="index"
  21. @click="toDetail(item)"
  22. >
  23. <el-col :span="3" class="date">
  24. <el-col :span="24" class="dateInfo">
  25. <el-col :span="24" class="years"> --{{ dayjs(item.date).format('YYYY') }}-- </el-col>
  26. <el-col :span="24" class="days">
  27. {{ dayjs(item.date).format('MM-DD') }}
  28. </el-col>
  29. </el-col>
  30. </el-col>
  31. <el-col :span="14" class="mess">
  32. <el-col :span="24" class="title">
  33. {{ item.title }}
  34. </el-col>
  35. <!-- <el-col :span="24" class="brief" v-html="item.brief"> </el-col> -->
  36. <el-col :span="24" class="brief"> {{ getContent(item.brief) }}</el-col>
  37. </el-col>
  38. <el-col :span="6" class="imgs">
  39. <el-image class="images" :src="item.url || defUrl"></el-image>
  40. </el-col>
  41. </el-col>
  42. </el-col>
  43. <el-col :span="24" class="pages">
  44. <pages-index :total="total" @search="toSearch" ref="pages"/>
  45. </el-col>
  46. </el-col>
  47. </el-row>
  48. </template>
  49. <script setup lang="ts">
  50. import { ref, onMounted } from 'vue'
  51. import dayjs from 'dayjs'
  52. import getContent from '@/utils/getContent'
  53. /* 分页 */
  54. import pagesIndex from '../../../components/windows/pagesIndex.vue'
  55. import { get } from 'lodash-es'
  56. const defUrl = 'zxzx.jpg'
  57. const pages = ref()
  58. const tabList = ref([
  59. {
  60. id: '1',
  61. title: '党建天地',
  62. type: 'djtd',
  63. },
  64. {
  65. id: '2',
  66. title: '政策法规',
  67. type: 'zcfg',
  68. },
  69. {
  70. id: '3',
  71. title: '招标采购',
  72. type: 'zbcg',
  73. },
  74. {
  75. id: '4',
  76. title: '集团要闻',
  77. type: 'jtyw',
  78. },
  79. ])
  80. const tabActive = ref('1')
  81. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  82. const list = ref<any[]>([
  83. {
  84. id: '1',
  85. title: '集团召开2021年度安全生产委员会第一次全体(扩大)视频会议',
  86. brief:
  87. '1月29日,集团召开2021年度安全生产委员会第一次全体(扩大)视频会议,会议由集团总经理王爽主持。会上,集团副总经理于懿通报了2020年度安全生产工作情况,安排部署下阶段重点工作。集团安保部副部长张凯传达国家、省、市...',
  88. date: '2024-12-24',
  89. url: 'news2.png',
  90. },
  91. {
  92. id: '2',
  93. title: '集团召开2021年度安全生产委员会第一次全体(扩大)视频会议',
  94. brief:
  95. '1月29日,集团召开2021年度安全生产委员会第一次全体(扩大)视频会议,会议由集团总经理王爽主持。会上,集团副总经理于懿通报了2020年度安全生产工作情况,安排部署下阶段重点工作。集团安保部副部长张凯传达国家、省、市...',
  96. date: '2024-12-24',
  97. url: 'news3.png',
  98. },
  99. {
  100. id: '3',
  101. title: '集团召开2021年度安全生产委员会第一次全体(扩大)视频会议',
  102. brief:
  103. '1月29日,集团召开2021年度安全生产委员会第一次全体(扩大)视频会议,会议由集团总经理王爽主持。会上,集团副总经理于懿通报了2020年度安全生产工作情况,安排部署下阶段重点工作。集团安保部副部长张凯传达国家、省、市...',
  104. date: '2024-12-24',
  105. url: 'news4.png',
  106. },
  107. {
  108. id: '4',
  109. title: '集团召开2021年度安全生产委员会第一次全体(扩大)视频会议',
  110. brief:
  111. '1月29日,集团召开2021年度安全生产委员会第一次全体(扩大)视频会议,会议由集团总经理王爽主持。会上,集团副总经理于懿通报了2020年度安全生产工作情况,安排部署下阶段重点工作。集团安保部副部长张凯传达国家、省、市...',
  112. date: '2024-12-24',
  113. url: 'news2.png',
  114. },
  115. ])
  116. const total = ref(40)
  117. const tabType = ref('djtd')
  118. /* 选择 */
  119. const tabChange = (event: { id: string }) => {
  120. tabActive.value = event.id
  121. const tab = tabList.value.find((f) => f.id == event.id)
  122. if (!tab) return
  123. const type = get(tab, 'type')
  124. if (!type) return
  125. tabType.value = type
  126. toSearch()
  127. console.log(pages)
  128. pages.value.reset()
  129. }
  130. import { jtxw } from '@/api/api'
  131. /* 查询 */
  132. const toSearch = async ({ skip = 0, limit = 10, ...info } = {}) => {
  133. const result = await jtxw.query(tabType.value, { skip, limit, ...info })
  134. if (result.errcode == 0) {
  135. const resList = get(result, 'data.data', [])
  136. const resTotal = get(result, 'data.total', 0)
  137. if (resList.length > 0) {
  138. list.value = resList
  139. total.value = resTotal
  140. }
  141. }
  142. }
  143. const toDetail = (data: object) => {
  144. const content_id = get(data, 'content_id')
  145. window.open(`/newsDetail?content_id=${content_id}`)
  146. }
  147. import { useRoute } from 'vue-router'
  148. const route = useRoute()
  149. /* 初始化 */
  150. onMounted(() => {
  151. const tag = get(route, 'query.tag')
  152. if (tag) {
  153. let e: any = { id: tag }
  154. tabChange(e)
  155. } else toSearch()
  156. })
  157. </script>
  158. <style scoped lang="scss">
  159. .main {
  160. padding: 0 17%;
  161. .info {
  162. .tabs {
  163. display: flex;
  164. padding: 0 30%;
  165. margin: 0 0 50px 0;
  166. .tabList {
  167. text-align: center;
  168. color: rgb(102, 102, 102);
  169. // font-family: '黑体';
  170. font-size: 18px;
  171. font-weight: 500;
  172. line-height: 26px;
  173. letter-spacing: 0px;
  174. border-bottom: 4px solid transparent;
  175. }
  176. .tabList:hover {
  177. cursor: pointer;
  178. color: rgb(25, 25, 26);
  179. border-bottom: 4px solid rgb(21, 134, 255);
  180. }
  181. .tabActiveList {
  182. color: rgb(25, 25, 26);
  183. border-bottom: 4px solid rgb(21, 134, 255);
  184. padding: 0 0 10px 0;
  185. }
  186. }
  187. .infoList {
  188. .list {
  189. display: flex;
  190. border-bottom: 1px solid rgb(217, 217, 217);
  191. margin: 0 0 30px 0;
  192. padding: 0 0 30px 0;
  193. cursor: pointer;
  194. .date {
  195. display: flex;
  196. align-items: center;
  197. justify-content: center;
  198. text-align: center;
  199. .days {
  200. color: rgb(28, 136, 254);
  201. font-family: '钉钉进步体';
  202. font-size: 36px;
  203. font-weight: 400;
  204. line-height: 40px;
  205. letter-spacing: 0px;
  206. }
  207. .years {
  208. color: rgb(28, 136, 254);
  209. font-family: '钉钉进步体';
  210. font-size: 20px;
  211. font-weight: 400;
  212. line-height: 40px;
  213. letter-spacing: 0px;
  214. }
  215. }
  216. .mess {
  217. padding: 0 10px 0 0;
  218. .title {
  219. color: rgb(25, 25, 26);
  220. // font-family: '黑体';
  221. font-size: 24px;
  222. font-weight: 500;
  223. line-height: 35px;
  224. letter-spacing: 0px;
  225. margin: 0 0 30px 0;
  226. overflow: hidden;
  227. text-overflow: ellipsis;
  228. -webkit-line-clamp: 1;
  229. word-break: break-all;
  230. display: -webkit-box;
  231. -webkit-box-orient: vertical;
  232. }
  233. .brief {
  234. color: rgb(102, 102, 102);
  235. // font-family: '黑体';
  236. font-size: 16px;
  237. font-weight: 400;
  238. line-height: 32px;
  239. letter-spacing: 0px;
  240. overflow: hidden;
  241. text-overflow: ellipsis;
  242. -webkit-line-clamp: 3;
  243. word-break: break-all;
  244. display: -webkit-box;
  245. -webkit-box-orient: vertical;
  246. }
  247. }
  248. .imgs {
  249. .images {
  250. width: 100%;
  251. height: 160px;
  252. }
  253. }
  254. }
  255. .list:last-child {
  256. border-bottom: none;
  257. }
  258. }
  259. }
  260. }
  261. </style>