index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div class="dashboard-editor-container">
  3. <!--网站,内容,公共栏目数量 start------------------------------------------>
  4. <el-row :gutter="32">
  5. <el-col :xs="24" :sm="24" :lg="8">
  6. <div class="topWindowBox">
  7. <div class="twbTitle">
  8. <div class="twbIconbgRed">
  9. <img src="@/assets/index/twbIconbgBlue.png"/>
  10. </div>
  11. 网站数量
  12. </div>
  13. <div class="twbNumber">{{topData.website.count}}</div>
  14. <!-- <div class="twbStatus"><img src="@/assets/index/arrow-up.png"/> +12% <span>较上周</span></div> -->
  15. </div>
  16. </el-col>
  17. <el-col :xs="24" :sm="24" :lg="8">
  18. <div class="topWindowBox">
  19. <div class="twbTitle">
  20. <div class="twbIconbgBlue">
  21. <img src="@/assets/index/twbIconbgRed.png"/>
  22. </div>
  23. 文章发布数量
  24. </div>
  25. <div class="twbNumber">{{topData.article.count}}</div>
  26. <!-- <div class="twbStatus"><img src="@/assets/index/arrow-up.png"/> +18% <span>较昨天</span></div> -->
  27. </div>
  28. </el-col>
  29. <el-col :xs="24" :sm="24" :lg="8">
  30. <div class="topWindowBox">
  31. <div class="twbTitle">
  32. <div class="twbIconbgPurple">
  33. <img src="@/assets/index/twbIconbgPurple.png"/>
  34. </div>
  35. 公共栏目数量
  36. </div>
  37. <div class="twbNumber">{{topData.category.count}}</div>
  38. <!-- <div class="twbStatusDown"><img src="@/assets/index/arrow-down.png"/> -2% <span>较上个月</span></div> -->
  39. </div>
  40. </el-col>
  41. </el-row>
  42. <!--网站,内容,公共栏目数量 end------------------------------------------>
  43. <!--chart start------------------------------------------>
  44. <el-row :gutter="32">
  45. <el-col :xs="24" :sm="24" :lg="16">
  46. <div class="chartBox">
  47. <div class="chartTitle">平台文章增长数量</div>
  48. <el-row style="background:#fff;padding:16px 16px 0;">
  49. <line-chart :chart-data="chartData.lineChartData"/>
  50. </el-row>
  51. </div>
  52. </el-col>
  53. <el-col :xs="24" :sm="24" :lg="8">
  54. <div class="chartBox">
  55. <div class="chartTitle">用户类型</div>
  56. <div class="chart-wrapper">
  57. <ring-chart :chart-data="chartData.ringChartData"/>
  58. </div>
  59. </div>
  60. </el-col>
  61. </el-row>
  62. <!--chart end------------------------------------------>
  63. </div>
  64. </template>
  65. <script>
  66. // import GithubCorner from '@/components/GithubCorner'
  67. // import PanelGroup from './components/PanelGroup'
  68. import LineChart from './components/LineChart'//折线图
  69. // import RaddarChart from './components/RaddarChart'
  70. // import PieChart from './components/PieChart'
  71. // import BarChart from './components/BarChart'
  72. // import TransactionTable from './components/TransactionTable'
  73. // import TodoList from './components/TodoList'
  74. // import BoxCard from './components/BoxCard'
  75. import RingChart from './components/RingChart'//圆环图
  76. export default {
  77. name: 'DashboardAdmin',
  78. components: {
  79. // GithubCorner,
  80. // PanelGroup,
  81. LineChart,
  82. // RaddarChart,
  83. // PieChart,
  84. // BarChart,
  85. // TransactionTable,
  86. // TodoList,
  87. // BoxCard,
  88. RingChart
  89. },
  90. data() {
  91. return {
  92. topData:{
  93. website:{//网站
  94. count:0,//总数
  95. growth_rate:0//增长数
  96. },
  97. article:{//文章
  98. count:0,//总数
  99. growth_rate:0//增长数
  100. },
  101. category:{//栏目
  102. count:0,//总数
  103. growth_rate:0//增长数
  104. }
  105. },
  106. chartData:{
  107. lineChartData:[],//折线图数据
  108. ringChartData:[]//圆环图数据
  109. }
  110. }
  111. },
  112. methods: {
  113. getData(){
  114. //获取首页数据
  115. this.$store.dispatch('public/getAdminIndex').then(res=> {
  116. this.topData.article.count = res.data.article.count;
  117. this.topData.category.count = res.data.category.count;
  118. this.topData.website.count = res.data.website.count;
  119. this.chartData.lineChartData = res.data.monthArticle;
  120. this.chartData.ringChartData = res.data.userType;
  121. console.log(this.chartData.lineChartData)
  122. console.log(this.chartData.ringChartData)
  123. }).catch(() => {
  124. this.$message({
  125. type: 'warning',
  126. message: '网络错误,请重试!'
  127. });
  128. })
  129. },
  130. },
  131. mounted(){
  132. this.getData()
  133. }
  134. }
  135. </script>
  136. <style lang="less" scoped>
  137. @title: #212227;
  138. @bgColor: #FFFFFF;
  139. .topWindowBox{
  140. background:@bgColor;
  141. border-Radius:20px;
  142. height:160px;
  143. width:100%;
  144. margin-bottom:30px;
  145. padding:25px;
  146. box-sizing: border-box;
  147. .twbTitle {
  148. display:flex;
  149. align-items: center;
  150. font-size:16px;
  151. color:@title;
  152. .twbIconbgRed,.twbIconbgBlue,.twbIconbgPurple{
  153. width: 40px;
  154. height: 40px;
  155. border-radius: 50%;
  156. margin-right: 15px;
  157. }
  158. // .twbIconbgRed {
  159. // background: #EA79BA;
  160. // }
  161. // .twbIconbgBlue {
  162. // background: #6DACE7;
  163. // }
  164. // .twbIconbgPurple{
  165. // background: #AA7AEB;
  166. // }
  167. }
  168. .twbNumber {
  169. font-size: 30px;
  170. margin-top:32px;
  171. font-weight: 1000;
  172. }
  173. .twbStatus,.twbStatusDown {
  174. font-size:14px;
  175. margin-top: 35px;
  176. display:flex;
  177. img {
  178. display: block;
  179. margin-right: 4px;
  180. }
  181. span {
  182. color:#707B81;
  183. margin-left: 8px;
  184. }
  185. }
  186. .twbStatus {
  187. color:#23C581;
  188. }
  189. .twbStatusDown {
  190. color:#E74545
  191. }
  192. }
  193. .chartBox {
  194. width: 100%;
  195. height: 440px;
  196. border-radius: 20px;
  197. overflow: hidden;
  198. background-color: @bgColor;
  199. .chartTitle {
  200. color: @title;
  201. padding: 30px 30px 0 30px;
  202. font-size: 16px;
  203. }
  204. }
  205. .dashboard-editor-container {
  206. padding: 32px;
  207. background-color: rgb(240, 242, 245);
  208. position: relative;
  209. .github-corner {
  210. position: absolute;
  211. top: 0px;
  212. border: 0;
  213. right: 0;
  214. }
  215. .chart-wrapper {
  216. background: #fff;
  217. padding: 16px 16px 0;
  218. margin-bottom: 32px;
  219. }
  220. }
  221. @media (max-width:1024px) {
  222. .chart-wrapper {
  223. padding: 8px;
  224. }
  225. }
  226. </style>