ManuscriptDissemination.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="manuscriptIssued">
  3. <el-loading></el-loading>
  4. <el-breadcrumb separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item>全媒体平台</el-breadcrumb-item>
  6. <el-breadcrumb-item>稿件传播量排行榜</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <div class="groupType">
  9. <el-row class="mb-4">
  10. <el-button
  11. v-for="cur in tabs.btns"
  12. :key="cur.value"
  13. :class="cur.value == btnFocus ? 'btnFocus' : ''"
  14. @click="handleClick(cur)"
  15. >{{ cur.label }}</el-button
  16. >
  17. </el-row>
  18. </div>
  19. <div class="card-rank">
  20. <div>
  21. <h4>{{title}}日榜</h4>
  22. <el-table
  23. :data="dayData"
  24. header-row-class-name="card-tabs-header"
  25. >
  26. <el-table-column align="center" prop="name" :label="subTitle" />
  27. <el-table-column align="center" prop="cnt" label="传播量" />
  28. </el-table>
  29. </div>
  30. <div>
  31. <h4>{{title}}周榜</h4>
  32. <el-table
  33. :data="weekData"
  34. header-row-class-name="card-tabs-header"
  35. >
  36. <el-table-column align="center" prop="name" :label="subTitle" />
  37. <el-table-column align="center" prop="cnt" label="传播量" />
  38. </el-table>
  39. </div>
  40. <div>
  41. <h4>{{title}}月榜</h4>
  42. <el-table
  43. :data="monthData"
  44. header-row-class-name="card-tabs-header"
  45. >
  46. <el-table-column align="center" prop="name" :label="subTitle" />
  47. <el-table-column align="center" prop="cnt" label="传播量" />
  48. </el-table>
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import { getArticlePv } from "@/api/index";
  55. const ElLoading = require("element-plus/lib/el-loading/index");
  56. import "element-plus/lib/theme-chalk/el-loading.css";
  57. export default {
  58. name: "ManuscriptDissemination",
  59. data() {
  60. return {
  61. activeName: 1,
  62. btnFocus: "center",
  63. title:"分中心",
  64. subTitle:"中心名称",
  65. tabs: {
  66. name: "稿件传播量排行榜",
  67. code: 1,
  68. btns: [
  69. {
  70. label: "分中心榜",
  71. value: "center",
  72. title:"中心名称"
  73. },
  74. {
  75. label: "人员榜",
  76. value: "user",
  77. title:"人员名称"
  78. },
  79. // {
  80. // label: "中心内部榜",
  81. // value: 2,
  82. // title:"中心名称"
  83. // },
  84. {
  85. label: "部门内部人员榜",
  86. value: "depart",
  87. title:"部门名称"
  88. },
  89. ],
  90. },
  91. dayData: [],
  92. weekData: [],
  93. monthData: [],
  94. };
  95. },
  96. mounted() {
  97. this.setTableData();
  98. },
  99. methods: {
  100. handleClick(e) {
  101. this.title=e.label.substring(0,e.label.length-1);
  102. this.btnFocus = e.value;
  103. this.subTitle = e.title;
  104. this.setTableData();
  105. },
  106. setTableData() {
  107. const that = this;
  108. this.load = ElLoading.default.service();
  109. getArticlePv({ type: this.btnFocus })
  110. .then((res) => {
  111. const { day, week, month } = res;
  112. that.dayData = day;
  113. that.weekData = week;
  114. that.monthData = month;
  115. that.load.close();
  116. })
  117. .catch((err) => {
  118. that.dayData = [];
  119. that.weekData = [];
  120. that.monthData = [];
  121. console.log("catch", err);
  122. });
  123. },
  124. },
  125. };
  126. </script>
  127. <style>
  128. .manuscriptIssued {
  129. margin: 10px;
  130. }
  131. .card-tabs,
  132. .el-tabs__header {
  133. padding: 0 100px;
  134. }
  135. .groupType{
  136. padding: 15px 10px;
  137. box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.12);
  138. }
  139. .card-rank {
  140. padding: 10px 15px;
  141. box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
  142. display: flex;
  143. align-items: flex-start;
  144. justify-content: space-between;
  145. }
  146. .card-rank > div {
  147. width: 32%;
  148. }
  149. h4 {
  150. text-align: left;
  151. color: #e18116;
  152. margin-bottom: 50px;
  153. font-weight: bold;
  154. }
  155. .card-tabs-header th {
  156. background: #f5f7fa !important;
  157. }
  158. .btnFocus {
  159. color:#FFF !important;
  160. border-color:#409eff !important;
  161. background-color:#409eff !important;
  162. }
  163. </style>