teamph.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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. // let arr = res.data.list
  181. let arr = res.data.list.sort(function(a, b) {
  182. return b.count -a.count
  183. })
  184. navitem.list = navitem.list.concat(arr)
  185. if (navitem.limit == res.data.list.length) {
  186. navitem.loadingType = 'more'
  187. } else {
  188. navitem.loadingType = 'noMore'
  189. }
  190. navitem.loaded = true
  191. }).catch(err => {
  192. navitem.loaded = false
  193. })
  194. }
  195. }
  196. }
  197. </script>
  198. <style lang="scss" scoped>
  199. .nav {
  200. width: 750rpx;
  201. height: 88rpx;
  202. position: fixed;
  203. top: 0;
  204. left: 0;
  205. z-index: 999;
  206. .nav-item {
  207. line-height: 88rpx;
  208. width: 50%;
  209. text-align: center;
  210. font-size: 30rpx;
  211. font-weight: 500;
  212. color: #333333;
  213. height: 100%;
  214. }
  215. .action {
  216. font-weight: bold;
  217. position: relative;
  218. &::after {
  219. content: '';
  220. width: 50rpx;
  221. height: 6rpx;
  222. background: #FE5B38;
  223. border-radius: 3rpx;
  224. position: absolute;
  225. left: 0;
  226. right: 0;
  227. bottom: 6rpx;
  228. margin: auto;
  229. }
  230. }
  231. background-color: #fff;
  232. }
  233. .ph-top {
  234. width: 750rpx;
  235. height: 555rpx;
  236. background-color: #fc6795;
  237. position: relative;
  238. .yy {
  239. width: 261rpx;
  240. height: 195rpx;
  241. position: absolute;
  242. top: 131rpx;
  243. left: 0;
  244. right: 0;
  245. margin: auto;
  246. }
  247. .ph-m {
  248. width: 233rpx;
  249. height: 100rpx;
  250. border-radius: 20rpx 20rpx 0 0;
  251. background-color: #fff;
  252. position: absolute;
  253. top: 70rpx;
  254. left: 0;
  255. right: 0;
  256. margin: auto;
  257. }
  258. .ph {
  259. height: 360rpx;
  260. width: 702rpx;
  261. background-color: #fff;
  262. border-radius: 20rpx;
  263. align-items: flex-end;
  264. position: absolute;
  265. bottom: 65rpx;
  266. left: 0;
  267. right: 0;
  268. margin: auto;
  269. .ph-item {
  270. flex-grow: 1;
  271. flex-direction: column;
  272. justify-content: flex-end;
  273. padding-bottom: 30rpx;
  274. .item-logo {
  275. width: 90rpx;
  276. height: 90rpx;
  277. position: relative;
  278. .avt {
  279. width: 100%;
  280. height: 100%;
  281. border-radius: 50%;
  282. background-color: #eee;
  283. }
  284. }
  285. .gj-logo {
  286. width: 120rpx;
  287. height: 120rpx;
  288. background-color: #eee;
  289. border-radius: 50%;
  290. &::after {
  291. content: '';
  292. width: 51rpx;
  293. height: 49rpx;
  294. position: absolute;
  295. top: -15rpx;
  296. right: -15rpx;
  297. background: url($base-url + '/resource/icon/gj.png') no-repeat;
  298. background-size: 100% 100%;
  299. }
  300. }
  301. .yj-logo {
  302. &::after {
  303. content: '';
  304. width: 37rpx;
  305. height: 35rpx;
  306. position: absolute;
  307. top: -12rpx;
  308. right: -12rpx;
  309. background: url($base-url + '/resource/icon/yj.png') no-repeat;
  310. background-size: 100% 100%;
  311. }
  312. }
  313. .jj-logo {
  314. &::after {
  315. content: '';
  316. width: 37rpx;
  317. height: 35rpx;
  318. position: absolute;
  319. top: -12rpx;
  320. right: -12rpx;
  321. background: url($base-url + '/resource/icon/jj.png') no-repeat;
  322. background-size: 100% 100%;
  323. }
  324. }
  325. .item-name {
  326. font-size: 28rpx;
  327. font-weight: bold;
  328. color: #3F454B;
  329. margin: 15rpx 0 10rpx;
  330. }
  331. .item-id {
  332. font-size: 24rpx;
  333. font-weight: 400;
  334. color: #606972;
  335. }
  336. .item-tit {
  337. font-size: 24rpx;
  338. font-weight: 500;
  339. color: #999999;
  340. margin: 25rpx 0 15rpx;
  341. }
  342. .item-val {
  343. font-size: 30rpx;
  344. font-weight: 500;
  345. color: #FA2740;
  346. }
  347. }
  348. }
  349. }
  350. .grop-item {
  351. margin: auto;
  352. width: 702rpx;
  353. height: 150rpx;
  354. border-bottom: 1px solid #F0F0F0;
  355. .item-logo {
  356. width: 90rpx;
  357. height: 90rpx;
  358. border-radius: 50%;
  359. background-color: #eee;
  360. margin: 0 20rpx;
  361. }
  362. .item-info {
  363. flex-grow: 1;
  364. }
  365. .item-info {
  366. .info-name {
  367. margin-bottom: 10rpx;
  368. font-size: 28rpx;
  369. font-weight: bold;
  370. color: #3F454B;
  371. }
  372. .info-id {
  373. font-size: 24rpx;
  374. font-weight: 400;
  375. color: #606972;
  376. }
  377. }
  378. .item-tg {
  379. flex-shrink: 0;
  380. .tg-tit {
  381. font-size: 24rpx;
  382. font-weight: 500;
  383. color: #999999;
  384. }
  385. .tg-val {
  386. font-size: 28rpx;
  387. font-weight: 500;
  388. color: #FA2740;
  389. margin-bottom: 10rpx;
  390. text-align: center;
  391. }
  392. }
  393. }
  394. </style>