gaoceng.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <div id="gaoceng">
  3. <el-row>
  4. <el-col :span="24" class="top">
  5. <el-col :span="10">
  6. <el-image style="width:100%;height:40px;" :src="left"></el-image>
  7. </el-col>
  8. <el-col :span="4" class="topTitle">
  9. {{ title }}
  10. </el-col>
  11. <el-col :span="10">
  12. <el-image style="width:100%;height:40px;" :src="right"></el-image>
  13. </el-col>
  14. </el-col>
  15. <el-col :span="24" class="info">
  16. <el-col :span="12" class="carousel" v-loading="loading">
  17. <el-carousel height="400">
  18. <el-carousel-item class="infoList" v-for="(item, index) in infoList" :key="index" @click.native="turnTo(item)">
  19. <el-image style="width:100%;height:400px;" :src="item.pic" v-if="item.pic"></el-image>
  20. <el-image style="width:100%;height:400px;" :src="noPic" v-else></el-image>
  21. <span class="textOver">{{ item.title }}</span>
  22. </el-carousel-item>
  23. </el-carousel>
  24. </el-col>
  25. <el-col :span="12" style="height:400px;" v-loading="loading">
  26. <el-col :span="24" class="newsList" v-for="(item, index) in infosList" :key="index" @click.native="turnTo(item)">
  27. <el-col :span="20" class="title">
  28. <p class="textOver">
  29. <i class="el-icon-s-flag icon"></i><span>{{ item.title }}</span>
  30. </p>
  31. </el-col>
  32. <el-col :span="4" class="date">
  33. {{ item.publish_time }}
  34. </el-col>
  35. </el-col>
  36. </el-col>
  37. </el-col>
  38. </el-row>
  39. </div>
  40. </template>
  41. <script>
  42. import _ from 'lodash';
  43. export default {
  44. name: 'gaoceng',
  45. props: {
  46. carouselList: null,
  47. newsList: null,
  48. },
  49. components: {},
  50. data: () => ({
  51. title: '高层声音',
  52. left: require('@/assets/messageLeft.jpg'),
  53. right: require('@/assets/messageRight.jpg'),
  54. infoList: [],
  55. infosList: [],
  56. loading: true,
  57. noPic: require('@/assets/noPic3.png'),
  58. }),
  59. watch: {
  60. carouselList: {
  61. handler(val) {
  62. if (val) {
  63. this.assignData(val);
  64. }
  65. },
  66. },
  67. newsList: {
  68. handler(val) {
  69. if (val) {
  70. this.assignDatas(val);
  71. }
  72. },
  73. },
  74. },
  75. created() {},
  76. computed: {},
  77. methods: {
  78. assignData(data) {
  79. let columns = _.get(data, 'children');
  80. this.$set(this, `infoList`, columns);
  81. this.loading = false;
  82. },
  83. assignDatas(data) {
  84. let columns = _.get(data, 'children');
  85. this.$set(this, `infosList`, columns);
  86. this.loading = false;
  87. },
  88. turnTo(item) {
  89. if (item.url !== undefined) {
  90. window.location.href = item.url;
  91. } else {
  92. let route = this.$route.path;
  93. this.$router.push({ path: `/memberDetail?id=${item.id}` });
  94. }
  95. },
  96. },
  97. filters: {
  98. getDate(meta) {
  99. let createdAt = _.get(meta, `createdAt`);
  100. let date = new Date(createdAt)
  101. .toLocaleDateString()
  102. .replace('/', '-')
  103. .replace('/', '-');
  104. return date;
  105. },
  106. },
  107. };
  108. </script>
  109. <style lang="less" scoped>
  110. p {
  111. padding: 0;
  112. margin: 0;
  113. }
  114. .textOver {
  115. overflow: hidden;
  116. text-overflow: ellipsis;
  117. white-space: nowrap;
  118. }
  119. .top {
  120. height: 40px;
  121. line-height: 40px;
  122. margin: 0 0 40px 0;
  123. }
  124. .top .topTitle {
  125. font-size: 38px;
  126. color: #bd010b;
  127. text-align: center;
  128. font-weight: bold;
  129. font-family: '微软雅黑';
  130. }
  131. .info {
  132. height: 400px;
  133. }
  134. .info .carousel {
  135. height: 400px;
  136. overflow: hidden;
  137. }
  138. /deep/.el-carousel__indicators {
  139. display: none;
  140. }
  141. /deep/.el-carousel__container {
  142. height: 400px;
  143. }
  144. .info .carousel span {
  145. position: absolute;
  146. bottom: 0;
  147. left: 0;
  148. width: 100%;
  149. height: 40px;
  150. line-height: 40px;
  151. color: #fff;
  152. background-color: #0000004f;
  153. font-size: 16px;
  154. padding: 0 10px;
  155. }
  156. .newsList {
  157. padding: 10px 0px 10px 20px;
  158. }
  159. .newsList .title p {
  160. font-size: 18px;
  161. color: #5d5d5d;
  162. padding: 0 15px 0 0;
  163. }
  164. .newsList .title p .icon {
  165. color: #bd010b;
  166. margin: 0 15px 0 0;
  167. }
  168. .newsList .date {
  169. font-size: 18px;
  170. color: #5d5d5d;
  171. }
  172. .newsList:hover {
  173. cursor: pointer;
  174. }
  175. .newsList:hover .title p {
  176. color: #bd010b;
  177. }
  178. .newsList:hover .date {
  179. color: #bd010b;
  180. }
  181. .infoList:hover {
  182. cursor: pointer;
  183. }
  184. </style>