danwei.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div id="danwei">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-tabs v-model="activeName" type="border-card" :before-leave="handleClick">
  6. <el-tab-pane v-for="(item, index) in danweiList" :key="index">
  7. <span slot="label">{{ item.title }}</span>
  8. <el-col :span="24" v-for="(tag, index) in item.children" :key="index" class="shiyeList">
  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.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-row>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. name: 'danwei',
  26. props: {
  27. danweiList: null,
  28. },
  29. components: {},
  30. data: () => ({
  31. activeName: '',
  32. Color: '#850000',
  33. }),
  34. created() {},
  35. computed: {},
  36. methods: {
  37. moreClick() {
  38. let to = this.danweiList[`${this.activeName}`];
  39. if (!to) return false;
  40. if (to.type === 'bugList') this.$router.push({ path: `/info/list/${to.content_id}?news_type=0` });
  41. if (to.type === 'column') this.$router.push({ path: `/info/list/${to.id}` });
  42. },
  43. handleClick(active, old) {
  44. //略过加载时处理,只有点击后才会走判断逻辑
  45. if (!old) return true;
  46. let to = this.danweiList[`${active}`];
  47. if (!to) return false;
  48. if (to.type === 'bugList' || to.type === 'column') return true;
  49. if (to.type === 'url') window.open(to.url);
  50. if (to.type === 'content') this.$router.push({ path: `/info/detail?id=${to.content_id}` });
  51. },
  52. },
  53. };
  54. </script>
  55. <style lang="less" scoped>
  56. .moreLink {
  57. position: absolute;
  58. top: 10px;
  59. right: 10px;
  60. color: #850000;
  61. }
  62. /deep/.el-tabs__header {
  63. margin: 0;
  64. }
  65. /deep/.el-tabs--border-card > .el-tabs__content {
  66. padding: 0;
  67. }
  68. .talksList {
  69. padding: 12px 10px;
  70. border-bottom: 1px dashed #ccc;
  71. }
  72. .talksList .title .el-link {
  73. font-size: 18px;
  74. }
  75. .textOver {
  76. overflow: hidden;
  77. text-overflow: ellipsis;
  78. white-space: nowrap;
  79. }
  80. .shiyeList {
  81. padding: 10px;
  82. border-bottom: 1px dashed #ccc;
  83. }
  84. .shiyeList .title .el-link {
  85. font-size: 18px;
  86. }
  87. .shiyeList .time {
  88. font-size: 18px;
  89. text-align: right;
  90. }
  91. </style>