manage-people.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="manage-people">
  3. <custom-nav ref="ltm" :title="title" />
  4. <view class="content">
  5. <view class="chart">
  6. <view class="switch">
  7. <text :class="{ active: active === 7 }" @tap="switchChart(7)">7日</text>
  8. <text :class="{ active: active === 15 }" @tap="switchChart(15)">15日</text>
  9. <text :class="{ active: active === 30 }" @tap="switchChart(30)">30日</text>
  10. </view>
  11. <view class="chart-line">
  12. <chart-line :chartData="chartData" color="#F59C05" background="#FDECD0" unit="人" />
  13. </view>
  14. </view>
  15. <view class="kingkong">
  16. <navigator v-for="(item, index) in operationList" :url="item.url" :key="index">
  17. <image :src="item.image"></image>
  18. <text>{{ item.name }}</text>
  19. </navigator>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import { _API_TeamChart } from '@/apis/team.js'
  26. import chartLine from '@/components/charts/chart-line.vue'
  27. export default {
  28. components: {
  29. chartLine
  30. },
  31. data() {
  32. return {
  33. title: '人员管理',
  34. chartData: {},
  35. active: 15,
  36. operationList: [
  37. {
  38. name: '团队管理',
  39. url: '../../pages/team-manage/team-manage',
  40. image: '../../static/index/index/team-manage.png'
  41. },
  42. {
  43. name: '团队业绩',
  44. url: '../../pages/team-achievement/team-achievement',
  45. image: '../../static/index/index/team-achievement.png'
  46. },
  47. {
  48. name: '我的邀请',
  49. url: '../../pages/my-invite/my-invite',
  50. image: '../../static/index/index/my-invite.png'
  51. },
  52. {
  53. name: '注册审核',
  54. url: '../../pages/register-examine/register-examine',
  55. image: '../../static/index/index/register-examine.png'
  56. },
  57. {
  58. name: '邀请代理',
  59. url: '../../pages/invite-proxy/invite-proxy',
  60. image: '../../static/index/index/invite-proxy.png'
  61. },
  62. ]
  63. }
  64. },
  65. created() {
  66. uni.startPullDownRefresh()
  67. },
  68. onPullDownRefresh() {
  69. this.request()
  70. },
  71. methods: {
  72. switchChart(active) {
  73. this.active = active
  74. this.request()
  75. },
  76. request() { // 网络请求方法
  77. this.$refs.ltm.loading()
  78. uni.startPullDownRefresh()
  79. _API_TeamChart({ day: this.active }).then(res => {
  80. const data = { categories: [], series: [{ data: [] }] }
  81. data.categories = res.data.date
  82. data.series[0].data = res.data.data
  83. this.chartData = data
  84. }).catch(() => {
  85. this.$refs.ltm.toast('网络崩溃了,请下拉刷试试')
  86. }).finally(() => uni.stopPullDownRefresh())
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss">
  92. .manage-people {
  93. @include page();
  94. .content {
  95. background: #FFFFFF;
  96. .chart {
  97. @include flex(column);
  98. height: 720rpx;
  99. background: #FDECD0;
  100. .switch {
  101. @include flex();
  102. width: 100%;
  103. height: 110rpx;
  104. text {
  105. @include flex();
  106. height: 46rpx;
  107. width: 100rpx;
  108. font-size: 28rpx;
  109. border-radius: 23rpx;
  110. color: $app-base-color;
  111. border: 2rpx solid $app-base-color;
  112. &.active {
  113. color: #FFFFFF;
  114. background: $app-base-color;
  115. }
  116. }
  117. text:nth-child(2) {
  118. margin: 0 55rpx;
  119. }
  120. }
  121. .chart-line {
  122. flex: 1;
  123. width: 100%;
  124. box-sizing: border-box;
  125. padding: 0 10rpx;
  126. }
  127. }
  128. }
  129. }
  130. </style>