HomePage.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div>
  3. <div class="menu-title">
  4. 概览
  5. </div>
  6. <div class="home-box">
  7. <div class="counts-box">
  8. <div class="count-item" v-for="(value, key) in count" :key="key">
  9. <div>{{ key }}</div>
  10. <div>{{ value }}</div>
  11. </div>
  12. </div>
  13. <div class="chart-box">
  14. <div class="title">正反馈率</div>
  15. <div id="chart"></div>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import request from '@/utils/request';
  22. var _this;
  23. export default {
  24. name: "homePage",
  25. data() {
  26. return {
  27. count: {
  28. '用户': '2,636',
  29. '物品': '51,754',
  30. '总反馈': '267,610',
  31. '正面反馈': '120,927',
  32. '负面反馈': '51,123'
  33. }
  34. }
  35. },
  36. mounted() {
  37. _this = this;
  38. _this.initChart();
  39. },
  40. methods: {
  41. initChart() {
  42. let dom = document.getElementById("chart");
  43. let chart = _this.$echarts.init(dom);
  44. chart.setOption({
  45. grid: {
  46. left: '3%',
  47. right: '3%'
  48. },
  49. xAxis: {
  50. type: 'category',
  51. data: ['05/01', '05/02', '05/03', '05/04', '05/05', '05/06', '05/07']
  52. },
  53. yAxis: {
  54. type: 'value'
  55. },
  56. series: [
  57. {
  58. name: 'like',
  59. data: [0.1, 0.23, 0.52, 0.44, 0.49, 0.78, 1],
  60. type: 'line'
  61. },
  62. {
  63. name: 'star',
  64. data: [0.92, 0.7, 0.65, 0.44, 0.55, 0.55, 0.78],
  65. type: 'line'
  66. }
  67. ]
  68. });
  69. }
  70. }
  71. }
  72. </script>
  73. <style scoped lang="scss">
  74. .content-box > div {
  75. height: 100%;
  76. }
  77. .home-box {
  78. padding: 0 30px;
  79. height: calc(100% - 160px);
  80. .chart-box {
  81. background-color: #fff;
  82. box-shadow: 0px 5px 12px 1px rgba(105, 105, 105, 0.12);
  83. border-radius: 10px;
  84. overflow: hidden;
  85. margin-top: 30px;
  86. height: calc(100% - 200px);
  87. #chart {
  88. width: 100%;
  89. height: calc(100% - 60px);
  90. }
  91. .title {
  92. width: 100%;
  93. height: 60px;
  94. line-height: 60px;
  95. padding-left: 20px;
  96. font-size: 18px;
  97. color: #626672;
  98. border-bottom: 1px solid rgba(105, 105, 105, 0.12);
  99. }
  100. }
  101. .counts-box {
  102. display: flex;
  103. justify-content: space-between;
  104. .count-item {
  105. width: 18%;
  106. height: 165px;
  107. background-color: #fff;
  108. box-shadow: 0px 5px 12px 1px rgba(105, 105, 105, 0.12);
  109. text-align: center;
  110. border-radius: 10px;
  111. &:hover {
  112. transform: scale(1.03);
  113. }
  114. > div:first-child {
  115. font-size: 18px;
  116. padding-top: 35px;
  117. color: rgba(103, 109, 122, 0.58);
  118. }
  119. > div:last-child {
  120. font-size: 40px;
  121. color: #3e4c5c;
  122. padding-top: 25px;
  123. }
  124. }
  125. }
  126. }
  127. </style>