index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="dashboard-container">
  3. <div class="scoped-rank">
  4. <div class="sr-top-left">
  5. <dv-decoration-3 style="width:250px;height:30px;" />
  6. <div style="width: 100%;padding-top: 10px;text-align: center;">{{timeTips}}{{sysUser.nickname}}</div>
  7. </div>
  8. <div class="sr-top-right">
  9. <dv-decoration-12 style="width:150px;height:150px;margin-left: 20px;" />
  10. <dv-decoration-11 style="width:200px;height:60px;color: #1dc1f5;">楼盘点击总榜</dv-decoration-11>
  11. </div>
  12. <dv-decoration-10 style="width:100%;height:5px;margin: 30px 0;"/>
  13. <dv-border-box-1>
  14. <div class="sr-wrap">
  15. <dv-scroll-ranking-board :config="config" style="width:500px;height:300px" />
  16. </div>
  17. </dv-border-box-1>
  18. <dv-decoration-6 style="width:100%;height:30px;margin: 30px 0;" />
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import { mapGetters } from 'vuex'
  24. export default {
  25. name: 'Dashboard',
  26. data () {
  27. return {
  28. config: {
  29. data: [],
  30. unit: '次',
  31. },
  32. timeTips: '',
  33. }
  34. },
  35. created () {
  36. let now = new Date()
  37. let hour = now.getHours()
  38. if(hour < 6){this.timeTips = '凌晨好!'}
  39. else if (hour < 9){this.timeTips = '早上好!'}
  40. else if (hour < 12){this.timeTips = '上午好!'}
  41. else if (hour < 14){this.timeTips = '中午好!'}
  42. else if (hour < 17){this.timeTips = '下午好!'}
  43. else if (hour < 19){this.timeTips = '傍晚好!'}
  44. else if (hour < 22){this.timeTips = '晚上好!'}
  45. this.$api.other.admindexranklist().then(res => {
  46. console.log(res)
  47. const estateClickRank = res.estate_click_rank || []
  48. const newArr = estateClickRank.map(item => {
  49. return {
  50. value: Number(item.click_num),
  51. name: item.estate_name,
  52. }
  53. })
  54. let config = this.config
  55. config.data = [...newArr]
  56. this.config = {...config}
  57. })
  58. },
  59. computed: {
  60. ...mapGetters([
  61. 'sysUser',
  62. ])
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. // .dashboard {
  68. // &-container {
  69. // margin: 30px;
  70. // }
  71. // &-text {
  72. // font-size: 30px;
  73. // line-height: 46px;
  74. // }
  75. // }
  76. .dashboard-container {
  77. width: 100%;
  78. height: calc(100vh - 84px);
  79. background: #1f2d3d;
  80. }
  81. .scoped-rank {
  82. width: 600px;
  83. box-sizing: border-box;
  84. padding: 20px;
  85. display: inline-block;
  86. .sr-top-left {
  87. display: inline-block;
  88. vertical-align: middle;
  89. padding-right: 20px;
  90. color: #1e9bec;
  91. font-weight: bold;
  92. }
  93. .sr-top-right {
  94. display: inline-block;
  95. vertical-align: middle;
  96. width: 200px;
  97. }
  98. .sr-wrap {
  99. padding: 30px;
  100. }
  101. }
  102. </style>