list.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view>
  3. <block v-if="datainfo.length>0">
  4. <!-- 通知 -->
  5. <block v-if="type=='notice'">
  6. <view class="tzlist flex" v-for="(ite,idx) in datainfo" :key="idx" @click="getDetail(ite)">
  7. <image :src="notica" v-if="ite.noticeType==3" class="titimg"></image>
  8. <image :src="noticb" v-else-if="ite.noticeType==1" class="titimg"></image>
  9. <image :src="noticc" v-else-if="ite.noticeType==2" class="titimg"></image>
  10. <view class="titbox flex1">
  11. <view class="tit">{{ite.noticeTitle}}</view>
  12. <view class="teplist flext ">
  13. <view class="imgs flexcc">
  14. <image :src="time" class="imga"></image>
  15. </view>
  16. <view class="txt">{{ite.updateTime||ite.createTime}}</view>
  17. </view>
  18. <view class="teplist flext" v-if="ite.address">
  19. <view class="imgs flexcc">
  20. <image :src="adr" class="imgb"></image>
  21. </view>
  22. <view class="txt">{{ite.address}}</view>
  23. </view>
  24. <view class="teptxt overtwo" v-if="ite.noticeContent">
  25. <rich-text :nodes="filterImages(ite.noticeContent)"></rich-text>
  26. </view>
  27. </view>
  28. </view>
  29. </block>
  30. <!-- 新闻 -->
  31. <block v-if="type=='article'">
  32. <view class="artlist" v-for="(ite,idx) in datainfo" :key="idx" @click="getDetail(ite.newsId)">
  33. <view class="over tit">{{ite.newsTitle}}</view>
  34. <view class="txt overtwo mb10" v-if="ite.newsContent"><rich-text :nodes="filterImages(ite.newsContent)"></rich-text></view>
  35. <view class="nfoot flexc">
  36. <image :src="look"></image>
  37. <text>{{ite.viewsNum}}</text>
  38. <view class="flex1"></view>
  39. <text>{{ite.releaseTime||KaTime(ite.createTime)}}</text>
  40. </view>
  41. </view>
  42. </block>
  43. <!-- 视频 -->
  44. <block v-if="type=='avideo'">
  45. <view class="avideo" v-for="(ite,idx) in datainfo" :key="idx">
  46. <video v-if="ite.newUrl[0]" id="myVideo" :src="baseUrl+ite.newUrl[0]" controls></video>
  47. <view class="tit">{{ite.newsTitle}}</view>
  48. <view class="nfoot flexc">
  49. <image :src="look"></image>
  50. <text>{{ite.viewsNum}}</text>
  51. <view class="flex1"></view>
  52. <text>{{ite.releaseTime||KaTime(ite.createTime)}}</text>
  53. </view>
  54. </view>
  55. </block>
  56. <view class="shax" v-if="wtdt">{{wtdt}}</view>
  57. </block>
  58. <!-- 无数据 -->
  59. <view class="nodata" v-else>
  60. <image :src="nodata"></image>
  61. <view>当前暂无信息喔</view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  67. import config from '@/config'
  68. export default{
  69. props:{
  70. datainfo: {
  71. type: Array,
  72. default () {
  73. return []
  74. }
  75. },
  76. wtdt:{
  77. type:String,
  78. default () {
  79. return ''
  80. }
  81. },
  82. type:{
  83. type:String,
  84. default () {
  85. return 0
  86. }
  87. },
  88. },
  89. data(){
  90. return{
  91. noiconpimg:require("@/static/images/nodata.png"),
  92. nodata:require("@/work/images/nodata.png"),
  93. notica:require("@/news/images/notice/notica.png"),
  94. noticb:require("@/news/images/notice/noticb.png"),
  95. noticc:require("@/news/images/notice/noticc.png"),
  96. time:require("@/news/images/notice/time.png"),
  97. adr:require("@/news/images/notice/adr.png"),
  98. look:require("@/static/images/home/look.png"),
  99. baseUrl:config.baseUrl,
  100. }
  101. },
  102. mounted() {
  103. },
  104. methods:{
  105. checkPermi, checkRole,
  106. getDetail(e){
  107. this.$emit('getDetail',e)
  108. },
  109. // 过滤掉图片
  110. filterImages(html) {
  111. if (!html) return '';
  112. return html.replace(/<img[^>]*>/gi, '');
  113. },
  114. KaTime(val){
  115. if(val){
  116. return val.substring(0,10)
  117. }
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss" scoped>
  123. .tzlist{display: flex;padding-top: 30rpx;position: relative;
  124. &::before{content: '';top: 54rpx;left: 24rpx;position: absolute;width: 2rpx;background-color: #E6E6E6;bottom: -30rpx;}
  125. .titimg{width: 48rpx;height: 48rpx;margin-right: 18rpx;flex: 0 0 auto;}
  126. .titbox{border-bottom: 2rpx solid #E6E6E6;padding-bottom: 4rpx;
  127. .tit{font-weight: bold;font-size: 30rpx;color: #000000;line-height: 48rpx;margin-bottom: 12rpx;}
  128. .teplist{margin-bottom: 12rpx;
  129. .imgs{width: 26rpx;height: 28rpx;margin-right: 18rpx;
  130. .imga{width: 26rpx;height: 26rpx;}
  131. .imgb{width: 22rpx;height: 28rpx;}
  132. }
  133. }
  134. .txt{font-weight: 500;font-size: 26rpx;color: #666666;line-height: 34rpx;}
  135. .teptxt{font-weight: 500;font-size: 30rpx;color: #000000;line-height: 42rpx;margin-bottom:20rpx;padding-top: 8rpx;}
  136. }
  137. }
  138. // 新闻
  139. .artlist{width: 100%;padding: 22rpx 0rpx;border-bottom: 2rpx solid #E6E6E6;
  140. .tit{font-weight: bold;font-size: 30rpx;color: #161A1E;margin-bottom: 16rpx;}
  141. .txt{font-weight: 500;font-size: 24rpx;color: #666666;}
  142. .nfoot{
  143. image{width: 24rpx;height: 16rpx;margin-right: 10rpx;}
  144. text{font-weight: 500;font-size:24rpx;color: #949695;}
  145. }
  146. }
  147. .avideo{padding:40rpx 0 28rpx;border-bottom: 2rpx solid #E6E6E6;
  148. video{width: 100%;height: 342rpx;margin-bottom: 16rpx;}
  149. .tit{font-weight: bold;font-size: 30rpx;color: #161A1E;margin-bottom: 12rpx;}
  150. .nfoot{
  151. image{width: 24rpx;height: 16rpx;margin-right: 10rpx;}
  152. text{font-weight: 500;font-size:24rpx;color: #949695;}
  153. }
  154. }
  155. // 无数据
  156. .nodata{display: flex;flex-direction: column;align-items: center;padding-top: 120rpx;
  157. image{width: 470rpx;height: 470rpx;margin-bottom: 4rpx;}
  158. view{font-size: 26rpx;color: #666666;font-weight: 500;line-height: 42rpx;}
  159. }
  160. </style>