list.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div id="list">
  3. <el-row>
  4. <el-col :span="24" class="main" :style="{ height: clientHeight + 'px' }">
  5. <el-col :span="24" class="one" v-if="type == '0'">
  6. <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detailBtn(item)">
  7. <el-col :span="24" class="title">
  8. {{ item.title }}
  9. </el-col>
  10. <el-col :span="24" class="other">
  11. <el-col :span="24" class="origin">
  12. 信息来源:<span>{{ item.origin || '系统管理员' }}</span>
  13. </el-col>
  14. <el-col :span="24" class="date">
  15. <el-col :span="20" class="left">
  16. 更新时间:<span>{{ item.create_time || item.renew_time || '暂无时间' }}</span>
  17. </el-col>
  18. <el-col :span="4" class="right"> <i class="el-icon-view"></i>{{ item.read >= 10000 ? '1万+' : item.read }} </el-col>
  19. </el-col>
  20. </el-col>
  21. </el-col>
  22. </el-col>
  23. <el-col :span="24" class="two" v-else-if="type == '1'">
  24. <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detailBtn(item)">
  25. <el-col :span="17" class="title">
  26. <el-col :span="24" class="text">
  27. {{ item.title }}
  28. </el-col>
  29. <el-col :span="24" class="other">
  30. <el-col :span="20" class="left">
  31. {{ item.origin || '系统管理员' }}
  32. </el-col>
  33. <el-col :span="4" class="right"> <i class="el-icon-view"></i>{{ item.read >= 10000 ? '1万+' : item.read }} </el-col>
  34. </el-col>
  35. </el-col>
  36. <el-col :span="7" class="image">
  37. <el-image :src="item.imgUrl[0].url">
  38. <div slot="error" class="image-slot">
  39. <img :src="noImg" alt="" />
  40. </div>
  41. </el-image>
  42. </el-col>
  43. </el-col>
  44. </el-col>
  45. <el-col :span="24" class="thr" v-else-if="type == '2'">
  46. <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detailBtn(item)">
  47. <el-col :span="24" class="title">
  48. {{ item.title }}
  49. </el-col>
  50. <el-col :span="24" class="video">
  51. <video
  52. controls="controls"
  53. preload="meta"
  54. x-webkit-airplay="true"
  55. webkit-playsinline="true"
  56. playsinline="true"
  57. x5-video-player-type="h5"
  58. x5-video-player-fullscreen="true"
  59. controlsList="nodownload"
  60. :src="item.fileUrl[0].url"
  61. loop="loop"
  62. >
  63. <source src="movie.ogg" type="video/ogg" />
  64. <source src="movie.mp4" type="video/mp4" />
  65. </video>
  66. </el-col>
  67. <el-col :span="24" class="other">
  68. <el-col :span="20" class="left">{{ item.origin || '系统管理员' }}{{ item.create_time || item.renew_time || '暂无时间' }}</el-col>
  69. <el-col :span="4" class="right"><i class="el-icon-view"></i>{{ item.read >= 10000 ? '1万+' : item.read }}</el-col>
  70. </el-col>
  71. </el-col>
  72. </el-col>
  73. <el-col :span="24" class="thr" v-else-if="type == '3'">
  74. <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detailBtn(item)">
  75. <el-col :span="24" class="title">
  76. {{ item.title }}
  77. </el-col>
  78. <el-col :span="24" class="video">
  79. <video
  80. controls="controls"
  81. preload="meta"
  82. x-webkit-airplay="true"
  83. webkit-playsinline="true"
  84. playsinline="true"
  85. x5-video-player-type="h5"
  86. x5-video-player-fullscreen="true"
  87. controlsList="nodownload"
  88. :src="item.fileUrl[0].url"
  89. loop="loop"
  90. >
  91. <source src="movie.ogg" type="video/ogg" />
  92. <source src="movie.mp4" type="video/mp4" />
  93. </video>
  94. </el-col>
  95. <el-col :span="24" class="other">
  96. <el-col :span="20" class="left">{{ item.origin || '系统管理员' }}{{ item.create_time || item.renew_time || '暂无时间' }}</el-col>
  97. <el-col :span="4" class="right"><i class="el-icon-view"></i>{{ item.read >= 10000 ? '1万+' : item.read }}</el-col>
  98. </el-col>
  99. </el-col>
  100. </el-col>
  101. <van-sticky container="list" :offset-top="clientHeight + 60">
  102. <page :total="total" :limit="limit" @search="search"></page>
  103. </van-sticky>
  104. </el-col>
  105. </el-row>
  106. </div>
  107. </template>
  108. <script>
  109. import page from '@/layout/common/page.vue';
  110. import { mapState, createNamespacedHelpers } from 'vuex';
  111. const { mapActions: service } = createNamespacedHelpers('service');
  112. export default {
  113. name: 'list',
  114. props: {
  115. type: { type: String, default: '0' },
  116. },
  117. components: { page },
  118. data: function() {
  119. return {
  120. noImg: require('@a/noImg.jpg'),
  121. clientHeight: '',
  122. list: [],
  123. total: 0,
  124. limit: '5',
  125. };
  126. },
  127. created() {
  128. this.search();
  129. },
  130. mounted() {
  131. let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 150;
  132. this.$set(this, `clientHeight`, clientHeight);
  133. },
  134. methods: {
  135. ...service(['query']),
  136. async search({ skip = 0 } = {}) {
  137. const res = await this.query({ skip, limit: this.limit, type: this.type });
  138. if (this.$checkRes(res)) {
  139. this.$set(this, `list`, res.data);
  140. this.$set(this, `total`, res.total);
  141. }
  142. },
  143. detailBtn(data) {
  144. this.$router.push({ path: '/adminServe/edit', query: { id: data.id } });
  145. },
  146. },
  147. computed: {
  148. ...mapState(['user', 'menuParams']),
  149. pageTitle() {
  150. return `${this.$route.meta.title}`;
  151. },
  152. },
  153. metaInfo() {
  154. return { title: this.$route.meta.title };
  155. },
  156. };
  157. </script>
  158. <style lang="less" scoped>
  159. .main {
  160. margin: 10px 0 0 0;
  161. padding: 0 5px;
  162. .one {
  163. .list {
  164. background-color: #fff;
  165. margin: 0 0 10px 0;
  166. padding: 8px;
  167. border-radius: 5px;
  168. .title {
  169. font-size: 16px;
  170. overflow: hidden;
  171. text-overflow: ellipsis;
  172. -webkit-line-clamp: 2;
  173. word-break: break-all;
  174. display: -webkit-box;
  175. -webkit-box-orient: vertical;
  176. margin: 0 0 4px 0;
  177. }
  178. .other {
  179. .origin {
  180. font-size: 14px;
  181. color: #666;
  182. margin: 0 0 5px 0;
  183. span {
  184. color: #000;
  185. }
  186. }
  187. .date {
  188. font-size: 14px;
  189. color: #666;
  190. margin: 0 0 5px 0;
  191. span {
  192. color: #000;
  193. }
  194. .right {
  195. text-align: right;
  196. color: #000;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. .two {
  203. .list {
  204. background-color: #fff;
  205. margin: 0 0 10px 0;
  206. padding: 8px;
  207. border-radius: 5px;
  208. position: relative;
  209. .title {
  210. padding: 0 5px 0 0;
  211. .text {
  212. font-size: 16px;
  213. overflow: hidden;
  214. text-overflow: ellipsis;
  215. -webkit-line-clamp: 2;
  216. word-break: break-all;
  217. display: -webkit-box;
  218. -webkit-box-orient: vertical;
  219. margin: 0 0 4px 0;
  220. padding: 0 5px 0 0;
  221. }
  222. .other {
  223. font-size: 14px;
  224. color: #666;
  225. position: relative;
  226. top: 25px;
  227. .right {
  228. text-align: right;
  229. height: 20px;
  230. line-height: 25px;
  231. }
  232. }
  233. }
  234. .image {
  235. .el-image {
  236. float: right;
  237. width: 100%;
  238. height: 100%;
  239. border-radius: 5px;
  240. }
  241. /deep/.image-slot img {
  242. width: 100%;
  243. height: 100%;
  244. vertical-align: top;
  245. }
  246. }
  247. }
  248. }
  249. .thr {
  250. .list {
  251. background-color: #fff;
  252. margin: 0 0 10px 0;
  253. padding: 8px;
  254. border-radius: 5px;
  255. .title {
  256. font-size: 15px;
  257. margin: 0 0 5px 0;
  258. }
  259. .video {
  260. margin: 0 0 5px 0;
  261. border: 1px solid #f1f1f1;
  262. video {
  263. float: left;
  264. width: 100%;
  265. height: 100%;
  266. }
  267. }
  268. .other {
  269. font-size: 14px;
  270. color: #666;
  271. .right {
  272. text-align: right;
  273. }
  274. }
  275. }
  276. }
  277. }
  278. </style>