gaoceng.vue 4.1 KB

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