index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <el-col :span="24" class="con">
  10. <el-col :span="24" class="list" v-for="(item, index) in lists" :key="index">
  11. <el-col :span="11" class="video">
  12. <el-image :src="item.image_path" style="width:100%;height:100%;border-radius: 10px;" v-if="item.image_path"></el-image>
  13. <el-image v-else style="width:100%;height:100%">
  14. <div slot="error" class="image-slot">
  15. <el-image :src="url1" style="width:100%;height:100%;border-radius: 10px;"></el-image>
  16. </div>
  17. </el-image>
  18. </el-col>
  19. <el-col :span="13" class="text">
  20. <el-col :span="24" class="title">{{ item.title }}</el-col>
  21. <el-col :span="24" class="desc">{{ item.desc }}</el-col>
  22. <el-col :span="24" class="time">{{ item.create_time }}</el-col>
  23. </el-col>
  24. </el-col>
  25. </el-col>
  26. </el-col>
  27. </el-col>
  28. </el-row>
  29. </div>
  30. </template>
  31. <script>
  32. import { mapState, createNamespacedHelpers } from 'vuex';
  33. import NavBar from '@/layout/common/topInfo.vue';
  34. const { mapActions: channel } = createNamespacedHelpers('channel');
  35. export default {
  36. metaInfo() {
  37. return { title: this.$route.meta.title };
  38. },
  39. name: 'index',
  40. props: {},
  41. components: {
  42. NavBar,
  43. },
  44. data: function() {
  45. return {
  46. // 头部标题
  47. title: '',
  48. // meta为true
  49. isleftarrow: '',
  50. // 返回
  51. navShow: true,
  52. //列表
  53. lists: [],
  54. url1: require('@/assets/222.png'),
  55. };
  56. },
  57. created() {
  58. this.search();
  59. },
  60. methods: {
  61. ...channel(['query', 'fetch']),
  62. async search() {
  63. const res = await this.query();
  64. console.log(res);
  65. if (this.$checkRes(res)) {
  66. this.$set(this, `lists`, res.data);
  67. }
  68. },
  69. },
  70. computed: {
  71. ...mapState(['user']),
  72. },
  73. mounted() {
  74. this.title = this.$route.meta.title;
  75. this.isleftarrow = this.$route.meta.isleftarrow;
  76. },
  77. metaInfo() {
  78. return { title: this.$route.meta.title };
  79. },
  80. watch: {},
  81. };
  82. </script>
  83. <style lang="less" scoped>
  84. .style {
  85. width: 100%;
  86. min-height: 667px;
  87. position: relative;
  88. background-color: #f9fafc;
  89. }
  90. .top {
  91. height: 46px;
  92. overflow: hidden;
  93. }
  94. .main {
  95. .con {
  96. padding: 10px;
  97. background: #f1f1f1;
  98. min-height: 620px;
  99. .list {
  100. padding: 10px;
  101. background-color: #fff;
  102. height: 120px;
  103. border-radius: 5px;
  104. margin: 0 0 10px 0;
  105. position: relative;
  106. .video {
  107. height: 100%;
  108. .el-image {
  109. /deep/.image-slot {
  110. width: 100%;
  111. height: 100%;
  112. }
  113. }
  114. }
  115. .text {
  116. padding-left: 15px;
  117. .title {
  118. font-size: 16px;
  119. font-weight: bolder;
  120. overflow: hidden;
  121. text-overflow: ellipsis;
  122. white-space: nowrap;
  123. }
  124. .desc {
  125. margin-top: 9px;
  126. overflow: hidden;
  127. text-overflow: ellipsis;
  128. display: -webkit-box;
  129. -webkit-line-clamp: 3;
  130. -webkit-box-orient: vertical;
  131. font-size: 12px;
  132. }
  133. .time {
  134. font-size: 12px;
  135. position: absolute;
  136. bottom: 10px;
  137. }
  138. }
  139. }
  140. }
  141. }
  142. </style>