teamph.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <view class="content">
  3. <view class="nav flex">
  4. <view class="nav-item" v-for="(item,index) in navList" @click="navClick(index)"
  5. :class="{'action': index == currentIndex}">
  6. {{item.title}}
  7. </view>
  8. </view>
  9. <view class="" style="height: 88rpx;">
  10. </view>
  11. <empty v-if="navList[currentIndex].list.length == 0"></empty>
  12. <!-- 顶部123 -->
  13. <view class="ph-top" v-if="navList[currentIndex].list.length > 0">
  14. <view class="ph-m"></view>
  15. <view class="ph flex">
  16. <view class="ph-item flex">
  17. <view class="item-logo yj-logo">
  18. <image :src="navList[currentIndex].list[1].auth_info.avatar || navList[currentIndex].list[1].avatar || ''" mode="" class="avt"></image>
  19. </view>
  20. <view class="item-name clamp">
  21. {{navList[currentIndex].list[1].auth_info.name || navList[currentIndex].list[1].nickname || '暂无'}}
  22. </view>
  23. <view class="item-id">
  24. ID: {{navList[currentIndex].list[1].uid || '0'}}
  25. </view>
  26. <view class="item-tit">
  27. 团队数
  28. </view>
  29. <view class="item-val">
  30. {{navList[currentIndex].list[1].invite_count || '0'}}
  31. </view>
  32. </view>
  33. <view class="ph-item flex">
  34. <view class="item-logo gj-logo">
  35. <image :src="navList[currentIndex].list[0].auth_info.avatar || navList[currentIndex].list[0].avatar || ''" mode="" class="avt"></image>
  36. </view>
  37. <view class="item-name clamp">
  38. {{navList[currentIndex].list[0].auth_info.name ||navList[currentIndex].list[0].nickname || '暂无'}}
  39. </view>
  40. <view class="item-id">
  41. ID: {{navList[currentIndex].list[0].uid || '0'}}
  42. </view>
  43. <view class="item-tit">
  44. 团队数
  45. </view>
  46. <view class="item-val">
  47. {{navList[currentIndex].list[0].invite_count || '0'}}
  48. </view>
  49. </view>
  50. <view class="ph-item flex">
  51. <view class="item-logo jj-logo">
  52. <image :src="navList[currentIndex].list[2].auth_info.avatar || navList[currentIndex].list[2].avatar || ''" mode="" class="avt"></image>
  53. </view>
  54. <view class="item-name clamp">
  55. {{navList[currentIndex].list[2].auth_info.name || navList[currentIndex].list[2].nickname || '暂无'}}
  56. </view>
  57. <view class="item-id">
  58. ID: {{navList[currentIndex].list[2].uid || '0'}}
  59. </view>
  60. <view class="item-tit">
  61. 团队数
  62. </view>
  63. <view class="item-val">
  64. {{navList[currentIndex].list[2].invite_count || '0'}}
  65. </view>
  66. </view>
  67. </view>
  68. <image src="../../static/icon/yy.png" mode="" class="yy"></image>
  69. </view>
  70. <scroll-view scroll-y="true" class="grop-list" :style="{'height': max_height}"
  71. @scrolltolower="getInviterRanking()" v-if="navList[currentIndex].list.length > 0">
  72. <view class="grop-item flex" v-for="(item,index) in showList" v-if="index !=0 && index != 1 && index != 2">
  73. <view class="item-xh">
  74. {{index + 1}}
  75. </view>
  76. <image :src="item.auth_info.avatar || item.avatar" mode="" class="item-logo"></image>
  77. <view class="item-info">
  78. <view class="info-name">
  79. {{item.auth_info.name || item.nickname || '微信用户'}}
  80. </view>
  81. <view class="info-id">
  82. ID: {{item.uid}}
  83. </view>
  84. </view>
  85. <view class="item-tg">
  86. <view class="tg-val">
  87. {{item.invite_count || 0}}
  88. </view>
  89. <view class="tg-tit">
  90. 团队数
  91. </view>
  92. </view>
  93. </view>
  94. <uni-load-more :status="navList[currentIndex].loadingType"></uni-load-more>
  95. </scroll-view>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. getInviterRanking
  101. } from '@/api/user.js'
  102. export default {
  103. data() {
  104. return {
  105. max_height: '',
  106. navList: [
  107. {
  108. title: '月排行',
  109. time: (new Date(new Date(new Date().getFullYear(), new Date().getMonth(), 1).setHours(0, 0, 0))
  110. .getTime() / 1000).toFixed(0),
  111. times: ((new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).setHours(23, 59, 59,
  112. 59)) / 1000).toFixed(0),
  113. list: [],
  114. page: 1,
  115. limit: 10,
  116. loadingType: 'more',
  117. loaded: false
  118. },{
  119. title: '周排行',
  120. time: ((new Date().setHours(0, 0, 0) - (new Date().getDay() - 1) * 24 * 60 * 60 * 1000) / 1000)
  121. .toFixed(0),
  122. times: ((new Date().setHours(0, 0, 0) + (7 - new Date().getDay()) * 24 * 60 * 60 * 1000) /
  123. 1000).toFixed(0),
  124. list: [],
  125. page: 1,
  126. limit: 10,
  127. loadingType: 'more',
  128. loaded: false
  129. }
  130. ],
  131. currentIndex: 0,
  132. }
  133. },
  134. onLoad() {
  135. this.getInviterRanking()
  136. },
  137. computed: {
  138. showList() {
  139. return this.navList[this.currentIndex].list
  140. }
  141. },
  142. onShow() {
  143. },
  144. onReachBottom() {
  145. },
  146. onReady() {
  147. var obj = this;
  148. uni.getSystemInfo({
  149. success: resu => {
  150. const query = uni.createSelectorQuery();
  151. query.select('.grop-list').boundingClientRect();
  152. query.exec(function(res) {
  153. obj.max_height = resu.windowHeight - res[0].top + 'px';
  154. });
  155. },
  156. fail: res => {}
  157. });
  158. },
  159. methods: {
  160. navClick(index) {
  161. this.currentIndex = index
  162. this.getInviterRanking()
  163. },
  164. getInviterRanking() {
  165. let that = this
  166. let navitem = that.navList[that.currentIndex]
  167. if (navitem.loadingType == 'loading' || navitem.loadingType == 'noMore') {
  168. return
  169. }
  170. if (navitem.loaded) {
  171. return
  172. }
  173. navitem.loadingType = 'loading'
  174. getInviterRanking({
  175. time: navitem.time,
  176. times: navitem.times,
  177. page: navitem.page,
  178. pageSize: navitem.limit
  179. }).then(res => {
  180. console.log(res);
  181. // let arr = res.data.list
  182. let arr = res.data.list.sort(function(a, b) {
  183. return b.count -a.count
  184. })
  185. navitem.list = navitem.list.concat(arr)
  186. if (navitem.limit == res.data.list.length) {
  187. navitem.loadingType = 'more'
  188. } else {
  189. navitem.loadingType = 'noMore'
  190. }
  191. navitem.loaded = true
  192. }).catch(err => {
  193. navitem.loaded = false
  194. })
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .nav {
  201. width: 750rpx;
  202. height: 88rpx;
  203. position: fixed;
  204. top: 0;
  205. left: 0;
  206. z-index: 999;
  207. .nav-item {
  208. line-height: 88rpx;
  209. width: 50%;
  210. text-align: center;
  211. font-size: 30rpx;
  212. font-weight: 500;
  213. color: #333333;
  214. height: 100%;
  215. }
  216. .action {
  217. font-weight: bold;
  218. position: relative;
  219. &::after {
  220. content: '';
  221. width: 50rpx;
  222. height: 6rpx;
  223. background: #FE5B38;
  224. border-radius: 3rpx;
  225. position: absolute;
  226. left: 0;
  227. right: 0;
  228. bottom: 6rpx;
  229. margin: auto;
  230. }
  231. }
  232. background-color: #fff;
  233. }
  234. .ph-top {
  235. width: 750rpx;
  236. height: 555rpx;
  237. background-color: #fc6795;
  238. position: relative;
  239. .yy {
  240. width: 261rpx;
  241. height: 195rpx;
  242. position: absolute;
  243. top: 131rpx;
  244. left: 0;
  245. right: 0;
  246. margin: auto;
  247. }
  248. .ph-m {
  249. width: 233rpx;
  250. height: 100rpx;
  251. border-radius: 20rpx 20rpx 0 0;
  252. background-color: #fff;
  253. position: absolute;
  254. top: 70rpx;
  255. left: 0;
  256. right: 0;
  257. margin: auto;
  258. }
  259. .ph {
  260. height: 360rpx;
  261. width: 702rpx;
  262. background-color: #fff;
  263. border-radius: 20rpx;
  264. align-items: flex-end;
  265. position: absolute;
  266. bottom: 65rpx;
  267. left: 0;
  268. right: 0;
  269. margin: auto;
  270. .ph-item {
  271. flex-grow: 1;
  272. flex-direction: column;
  273. justify-content: flex-end;
  274. padding-bottom: 30rpx;
  275. .item-logo {
  276. width: 90rpx;
  277. height: 90rpx;
  278. position: relative;
  279. .avt {
  280. width: 100%;
  281. height: 100%;
  282. border-radius: 50%;
  283. background-color: #eee;
  284. }
  285. }
  286. .gj-logo {
  287. width: 120rpx;
  288. height: 120rpx;
  289. background-color: #eee;
  290. border-radius: 50%;
  291. &::after {
  292. content: '';
  293. width: 51rpx;
  294. height: 49rpx;
  295. position: absolute;
  296. top: -15rpx;
  297. right: -15rpx;
  298. background: url($base-url + '/resource/icon/gj.png') no-repeat;
  299. background-size: 100% 100%;
  300. }
  301. }
  302. .yj-logo {
  303. &::after {
  304. content: '';
  305. width: 37rpx;
  306. height: 35rpx;
  307. position: absolute;
  308. top: -12rpx;
  309. right: -12rpx;
  310. background: url($base-url + '/resource/icon/yj.png') no-repeat;
  311. background-size: 100% 100%;
  312. }
  313. }
  314. .jj-logo {
  315. &::after {
  316. content: '';
  317. width: 37rpx;
  318. height: 35rpx;
  319. position: absolute;
  320. top: -12rpx;
  321. right: -12rpx;
  322. background: url($base-url + '/resource/icon/jj.png') no-repeat;
  323. background-size: 100% 100%;
  324. }
  325. }
  326. .item-name {
  327. font-size: 28rpx;
  328. font-weight: bold;
  329. color: #3F454B;
  330. margin: 15rpx 0 10rpx;
  331. }
  332. .item-id {
  333. font-size: 24rpx;
  334. font-weight: 400;
  335. color: #606972;
  336. }
  337. .item-tit {
  338. font-size: 24rpx;
  339. font-weight: 500;
  340. color: #999999;
  341. margin: 25rpx 0 15rpx;
  342. }
  343. .item-val {
  344. font-size: 30rpx;
  345. font-weight: 500;
  346. color: #FA2740;
  347. }
  348. }
  349. }
  350. }
  351. .grop-item {
  352. margin: auto;
  353. width: 702rpx;
  354. height: 150rpx;
  355. border-bottom: 1px solid #F0F0F0;
  356. .item-logo {
  357. width: 90rpx;
  358. height: 90rpx;
  359. border-radius: 50%;
  360. background-color: #eee;
  361. margin: 0 20rpx;
  362. }
  363. .item-info {
  364. flex-grow: 1;
  365. }
  366. .item-info {
  367. .info-name {
  368. margin-bottom: 10rpx;
  369. font-size: 28rpx;
  370. font-weight: bold;
  371. color: #3F454B;
  372. }
  373. .info-id {
  374. font-size: 24rpx;
  375. font-weight: 400;
  376. color: #606972;
  377. }
  378. }
  379. .item-tg {
  380. flex-shrink: 0;
  381. .tg-tit {
  382. font-size: 24rpx;
  383. font-weight: 500;
  384. color: #999999;
  385. }
  386. .tg-val {
  387. font-size: 28rpx;
  388. font-weight: 500;
  389. color: #FA2740;
  390. margin-bottom: 10rpx;
  391. text-align: center;
  392. }
  393. }
  394. }
  395. </style>