Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

98 linhas
3.2 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>新闻资讯</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <el-row class="card_menu">
  9. <el-col :span="4">
  10. <el-card class="box-card" shadow="never" :body-style="{ padding: '10px 0'}">
  11. <div slot="header">
  12. <span>新闻资讯</span>
  13. </div>
  14. <!-- <div class="menu-item active"><router-link to="/vip-service">会员服务</router-link></div> -->
  15. <div class="menu-item" v-for="(item, index) in titleList" :key="index"
  16. :class="{'active' : (index == activeIndex)}" @click="changeType(index)">
  17. {{item.channelName}}</div>
  18. </el-card>
  19. </el-col>
  20. <el-col :span="20">
  21. <el-card shadow="never" style="margin: 0 10px;">
  22. <ul style="list-style: none">
  23. <li style="padding: 10px;border-bottom: 1px solid #eee;margin: 5px 0"
  24. v-for="(item,index) in dataList" :key="index">{{ index+1 }}、{{item.title}}<span style="float:right">{{item.publishTime}}</span></li>
  25. </ul>
  26. <el-pagination
  27. background
  28. layout="prev, pager, next"
  29. :total="total" prev-text="上一页" next-text="下一页" style="float: right;margin: 10px">
  30. </el-pagination>
  31. </el-card>
  32. </el-col>
  33. </el-row>
  34. </el-main>
  35. </template>
  36. <script>
  37. import {getChannelInformationsRequest, getChannelsRequest, getChannelSecond,
  38. getDetailRequest} from "../api/data";
  39. export default {
  40. data () {
  41. return {
  42. titleList: [],
  43. activeIndex: 0,
  44. dataList: [],
  45. total: 0
  46. }
  47. },
  48. methods: {
  49. async getChannelsRequest(){
  50. let res = await getChannelsRequest({current:1,size:100})
  51. if(res.code == 200){
  52. res.data.records.map((item) => {
  53. if(item.channelName == '新闻资讯'){
  54. this.getChannelSecond(item.id)
  55. }
  56. })
  57. }
  58. },
  59. async getChannelSecond(id){
  60. let res = await getChannelSecond(id)
  61. if(res.code == 200){
  62. // console.log(JSON.stringify(res.data))
  63. this.titleList = res.data
  64. if(this.titleList && this.titleList[0]){
  65. this.getChannelInformationsRequest(this.titleList[0].id)
  66. }
  67. }
  68. },
  69. async getChannelInformationsRequest(id){
  70. let res = await getChannelInformationsRequest({channelId: id})
  71. if(res.code == 200){
  72. this.dataList = res.data.records
  73. this.total = res.data.total
  74. this.dataList.map((item) => {
  75. item.publishTime = this.$moment().format("YYYY-MM-DD")
  76. })
  77. }
  78. },
  79. changeType(index){
  80. this.activeIndex = index;
  81. this.getChannelInformationsRequest(this.titleList[index].id)
  82. }
  83. },
  84. mounted() {
  85. this.getChannelsRequest()
  86. }
  87. }
  88. </script>
  89. <style>
  90. </style>