You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

115 line
3.9 KiB

  1. <template>
  2. <el-main class="main-container">
  3. <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
  4. <el-breadcrumb-item class="location">您的位置:</el-breadcrumb-item>
  5. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  6. <el-breadcrumb-item @click.native="goToList()">行业动态</el-breadcrumb-item>
  7. <el-breadcrumb-item v-if="isShow">详情</el-breadcrumb-item>
  8. </el-breadcrumb>
  9. <el-row class="card_menu">
  10. <el-col :span="4">
  11. <el-card class="box-card" shadow="never" :body-style="{ padding: '10px 0'}">
  12. <div slot="header">
  13. <span>行业动态</span>
  14. </div>
  15. <!-- <div class="menu-item active"><router-link to="/vip-service">会员服务</router-link></div> -->
  16. <div class="menu-item" v-for="(item, index) in titleList" :key="index"
  17. :class="{'active' : (index == activeIndex)}" @click="changeType(index)">
  18. {{item.channelName}}</div>
  19. </el-card>
  20. </el-col>
  21. <el-col :span="20" style="padding: 0 10px;">
  22. <el-card shadow="never" style="margin: 0 10px;" v-if="!isShow">
  23. <ul style="list-style: none">
  24. <li style="padding: 10px;border-bottom: 1px solid #eee;margin: 5px 0"
  25. v-for="(item,index) in dataList" :key="index" @click="goToDetail(item)">{{ index+1 }}、{{item.title}}<span style="float:right">{{item.publishTime}}</span></li>
  26. </ul>
  27. <el-pagination
  28. background
  29. layout="prev, pager, next"
  30. :total="total" prev-text="上一页" next-text="下一页" style="float: right;margin: 10px">
  31. </el-pagination>
  32. </el-card>
  33. <el-card class="article" shadow="never" style="border-radius: 8px" v-if="isShow">
  34. <h2 class="title">{{activeItem.title}}</h2>
  35. <div class="info">作者:{{activeItem.author}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发布日期:{{activeItem.publishTime}}</div>
  36. <div class="content" v-html="activeItem.content"></div>
  37. </el-card>
  38. </el-col>
  39. </el-row>
  40. </el-main>
  41. </template>
  42. <script>
  43. import {getChannelInformationsRequest, getChannelsRequest, getChannelSecond,
  44. getDetailRequest} from "../api/data";
  45. export default {
  46. data () {
  47. return {
  48. titleList: [],
  49. activeIndex: 0,
  50. dataList: [],
  51. total: 0,
  52. isShow: false,
  53. activeItem: {}
  54. }
  55. },
  56. methods: {
  57. goToList(){
  58. this.isShow = false
  59. this.$forceUpdate()
  60. },
  61. goToDetail(item){
  62. this.isShow = true
  63. this.activeItem = {...item}
  64. },
  65. async getChannelsRequest(){
  66. let res = await getChannelsRequest({current:1,size:100})
  67. if(res.code == 200){
  68. res.data.records.map((item) => {
  69. if(item.channelName == '行业动态'){
  70. this.getChannelSecond(item.id)
  71. }
  72. })
  73. }
  74. },
  75. async getChannelSecond(id){
  76. let res = await getChannelSecond(id)
  77. if(res.code == 200){
  78. // console.log(JSON.stringify(res.data))
  79. this.titleList = res.data
  80. if(this.titleList && this.titleList[0]){
  81. this.getChannelInformationsRequest(this.titleList[0].id)
  82. }
  83. }
  84. },
  85. async getChannelInformationsRequest(id){
  86. let res = await getChannelInformationsRequest({channelId: id})
  87. if(res.code == 200){
  88. this.dataList = res.data.records
  89. this.total = res.data.total
  90. this.dataList.map((item) => {
  91. item.publishTime = this.$moment().format("YYYY-MM-DD")
  92. })
  93. }
  94. },
  95. changeType(index){
  96. this.activeIndex = index;
  97. this.isShow = false
  98. this.getChannelInformationsRequest(this.titleList[index].id)
  99. }
  100. },
  101. mounted() {
  102. this.getChannelsRequest()
  103. }
  104. }
  105. </script>
  106. <style>
  107. </style>