teamph.vue 8.8 KB

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