zhidao.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <div id="zhidao">
  3. <el-row style="width:540px;height:369px;" v-loading="loading">
  4. <el-col :span="24" class="top">
  5. <el-col :span="20" class="topTit">
  6. <span> {{ zhidaoList.title || title }}</span>
  7. </el-col>
  8. <el-col :span="4" class="topLink">
  9. <el-link :underline="false" @click="$router.push({ path: path, query: { title: zhidaoList.title } })"
  10. >more<i class="el-icon-d-arrow-right"></i
  11. ></el-link>
  12. </el-col>
  13. </el-col>
  14. <el-col :span="24" class="info">
  15. <el-col :span="24" class="list" v-for="(item, index) in infoList" :key="index" @click.native="turnTo(item)">
  16. <el-col :span="19" class="title">
  17. <p class="textOver"><i class="el-icon-caret-right icon"></i>{{ item.title }}</p>
  18. </el-col>
  19. <el-col :span="5" class="date">
  20. {{ item.publish_time }}
  21. </el-col>
  22. </el-col>
  23. </el-col>
  24. </el-row>
  25. </div>
  26. </template>
  27. <script>
  28. import _ from 'lodash';
  29. export default {
  30. name: 'zhidao',
  31. props: {
  32. zhidaoList: null,
  33. },
  34. components: {},
  35. data: () => ({
  36. loading: true,
  37. title: '就业指导',
  38. infoList: [],
  39. path: undefined,
  40. }),
  41. watch: {
  42. zhidaoList: {
  43. handler(val) {
  44. if (val) this.assignData(val);
  45. },
  46. },
  47. },
  48. created() {},
  49. computed: {},
  50. methods: {
  51. assignData(data) {
  52. let columns = _.get(data, 'children');
  53. let notice = [];
  54. for (const item of columns) {
  55. if (!this.path) this.path = item.path;
  56. let zhidaoList = _.get(item, `children`);
  57. if (zhidaoList) {
  58. notice = notice.concat(notice, zhidaoList);
  59. }
  60. }
  61. this.$set(this, `infoList`, notice);
  62. this.loading = false;
  63. },
  64. turnTo(item) {
  65. if (item.url !== undefined) {
  66. window.location.href = item.url;
  67. } else {
  68. let route = this.$route.path;
  69. this.$router.push({ path: `/detail?id=${item.id}` });
  70. }
  71. },
  72. },
  73. filters: {
  74. getDate(meta) {
  75. let createdAt = _.get(meta, `createdAt`);
  76. let date = new Date(createdAt)
  77. .toLocaleDateString()
  78. .replace('/', '-')
  79. .replace('/', '-');
  80. return date;
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="less" scoped>
  86. p {
  87. padding: 0;
  88. margin: 0;
  89. }
  90. .textOver {
  91. overflow: hidden;
  92. text-overflow: ellipsis;
  93. white-space: nowrap;
  94. }
  95. .top {
  96. height: 39px;
  97. line-height: 39px;
  98. border-bottom: 1px solid #176ebb;
  99. }
  100. .top .topTit span {
  101. display: inline-block;
  102. width: 110px;
  103. height: 39px;
  104. line-height: 39px;
  105. text-align: center;
  106. color: #fff;
  107. font-size: 16px;
  108. background-color: #176ebb;
  109. }
  110. .top .topLink {
  111. height: 39px;
  112. line-height: 39px;
  113. text-align: center;
  114. }
  115. .top .topLink .el-link {
  116. height: 39px;
  117. line-height: 39px;
  118. text-align: center;
  119. color: #000;
  120. font-size: 16px;
  121. text-transform: uppercase;
  122. }
  123. .top .topLink:hover .el-link {
  124. color: #a32324;
  125. }
  126. .list {
  127. padding: 8px 10px;
  128. }
  129. .list .title {
  130. font-size: 16px;
  131. }
  132. .list .title .icon {
  133. float: left;
  134. padding: 4px 4px;
  135. // color: #176ebb;
  136. }
  137. .list .date {
  138. font-size: 16px;
  139. }
  140. .list:hover {
  141. cursor: pointer;
  142. }
  143. .list:hover .title {
  144. color: #a32324;
  145. }
  146. .list:hover .date {
  147. color: #a32324;
  148. }
  149. </style>