cause.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div id="cause">
  3. <el-row>
  4. <el-col :span="24" v-if="enterList && enterList.length > 0">
  5. <el-tabs v-model="activeName" type="border-card" :before-leave="handleClick">
  6. <el-tab-pane v-for="(item, index) in enterList" :key="index">
  7. <span slot="label">{{ item.title }}</span>
  8. <el-col :span="24" v-for="(tag, index) in item.children" :key="index" class="enterList">
  9. <el-col :span="20" class="title textOver">
  10. <el-link :underline="false" @click="$router.push({ path: `/info/detail?id=${tag.id}` })">{{ tag.title }} </el-link>
  11. </el-col>
  12. <el-col :span="4" class="time">
  13. {{ tag.publish_time }}
  14. </el-col>
  15. </el-col>
  16. </el-tab-pane>
  17. </el-tabs>
  18. <el-link :inderline="false" class="moreLink" :style="`color:${Color}`" @click="moreClick()">MORE<i class="el-icon-video-play"></i> </el-link>
  19. </el-col>
  20. <el-col :span="24" v-else>
  21. <no-data></no-data>
  22. </el-col>
  23. </el-row>
  24. </div>
  25. </template>
  26. <script>
  27. import noData from '@publics/src/layout/noData.vue';
  28. export default {
  29. name: 'cause',
  30. props: {
  31. enterList: null,
  32. },
  33. components: {
  34. noData,
  35. },
  36. data: () => ({
  37. activeName: '',
  38. Color: '#850000',
  39. }),
  40. created() {},
  41. computed: {},
  42. methods: {
  43. moreClick() {
  44. let to = this.enterList[`${this.activeName}`];
  45. if (!to) return false;
  46. if (to.type === 'bugList') this.$router.push({ path: `/info/list/${to.content_id}?news_type=0` });
  47. if (to.type === 'column') this.$router.push({ path: `/info/list/${to.id}` });
  48. },
  49. handleClick(active, old) {
  50. //略过加载时处理,只有点击后才会走判断逻辑
  51. if (!old) return true;
  52. let to = this.enterList[`${active}`];
  53. if (!to) return false;
  54. if (to.type === 'bugList' || to.type === 'column') return true;
  55. if (to.type === 'url') window.open(to.url);
  56. if (to.type === 'content') this.$router.push({ path: `/info/detail?id=${to.content_id}` });
  57. },
  58. },
  59. };
  60. </script>
  61. <style lang="less" scoped>
  62. .moreLink {
  63. position: absolute;
  64. top: 10px;
  65. right: 10px;
  66. color: #850000;
  67. }
  68. /deep/.el-tabs__header {
  69. margin: 0;
  70. }
  71. /deep/.el-tabs--border-card > .el-tabs__content {
  72. padding: 0;
  73. }
  74. .talksList {
  75. padding: 12px 10px;
  76. border-bottom: 1px dashed #ccc;
  77. }
  78. .talksList .title .el-link {
  79. font-size: 18px;
  80. }
  81. .textOver {
  82. overflow: hidden;
  83. text-overflow: ellipsis;
  84. white-space: nowrap;
  85. }
  86. .enterList {
  87. padding: 10px;
  88. border-bottom: 1px dashed #ccc;
  89. }
  90. .enterList .title .el-link {
  91. font-size: 18px;
  92. }
  93. .enterList .time {
  94. font-size: 18px;
  95. text-align: right;
  96. }
  97. .teacherList {
  98. padding: 10px;
  99. border-bottom: 1px dashed #ccc;
  100. }
  101. .teacherList .title .el-link {
  102. font-size: 18px;
  103. }
  104. .teacherList .time {
  105. font-size: 18px;
  106. text-align: right;
  107. }
  108. </style>