service.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div id="service">
  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> {{ serviceList.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: serviceList.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="$router.push({ path: `/detail?id=${item.id}` })">
  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: 'service',
  31. props: {
  32. serviceList: null,
  33. },
  34. components: {},
  35. data: () => ({
  36. title: '档案服务',
  37. loading: true,
  38. infoList: [],
  39. path: undefined,
  40. }),
  41. watch: {
  42. serviceList: {
  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 serviceList = _.get(item, `children`);
  57. if (serviceList) {
  58. notice = notice.concat(notice, serviceList);
  59. }
  60. }
  61. this.$set(this, `infoList`, notice);
  62. this.loading = false;
  63. },
  64. },
  65. filters: {
  66. getDate(meta) {
  67. let createdAt = _.get(meta, `createdAt`);
  68. let date = new Date(createdAt)
  69. .toLocaleDateString()
  70. .replace('/', '-')
  71. .replace('/', '-');
  72. return date;
  73. },
  74. },
  75. };
  76. </script>
  77. <style lang="less" scoped>
  78. p {
  79. padding: 0;
  80. margin: 0;
  81. }
  82. .textOver {
  83. overflow: hidden;
  84. text-overflow: ellipsis;
  85. white-space: nowrap;
  86. }
  87. .top {
  88. height: 39px;
  89. line-height: 39px;
  90. border-bottom: 1px solid #176ebb;
  91. }
  92. .top .topTit span {
  93. display: inline-block;
  94. width: 110px;
  95. height: 39px;
  96. line-height: 39px;
  97. text-align: center;
  98. color: #fff;
  99. font-size: 16px;
  100. background-color: #176ebb;
  101. }
  102. .top .topLink {
  103. height: 39px;
  104. line-height: 39px;
  105. text-align: center;
  106. }
  107. .top .topLink .el-link {
  108. height: 39px;
  109. line-height: 39px;
  110. text-align: center;
  111. color: #000;
  112. font-size: 16px;
  113. text-transform: uppercase;
  114. }
  115. .top .topLink:hover .el-link {
  116. color: #a32324;
  117. }
  118. .list {
  119. padding: 8px 10px;
  120. }
  121. .list .title {
  122. font-size: 16px;
  123. }
  124. .list .title .icon {
  125. float: left;
  126. padding: 4px 4px;
  127. // color: #176ebb;
  128. }
  129. .list .date {
  130. font-size: 16px;
  131. }
  132. .list:hover {
  133. cursor: pointer;
  134. }
  135. .list:hover .title {
  136. color: #a32324;
  137. }
  138. .list:hover .date {
  139. color: #a32324;
  140. }
  141. </style>