prince_rank.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view class="cu-modal bottom-modal" :class="{ show: visible }">
  3. <view class="prince-rank-mask" @click="close"></view>
  4. <view class="cu-dialog wrapper">
  5. <view class="paddingY25 flex-align-center relative">
  6. <image
  7. v-if="tabIndex == 0"
  8. :src="resource.prince_this_title_active"
  9. class="title"
  10. />
  11. <image
  12. v-else
  13. :src="resource.prince_this_title"
  14. class="title"
  15. @click="tabIndex = 0"
  16. />
  17. <image
  18. v-if="tabIndex == 1"
  19. :src="resource.prince_last_title_active"
  20. class="title marginL40"
  21. />
  22. <image
  23. v-else
  24. :src="resource.prince_last_title"
  25. class="title marginL40"
  26. @click="tabIndex = 1"
  27. />
  28. <image :src="resource.icon_x" class="x" @click="close" />
  29. </view>
  30. <view v-if="tabIndex == 0" style="height: 348px">
  31. <scroll-view
  32. style="height: 300px"
  33. scroll-y
  34. v-if="tableData && tableData.length > 0"
  35. >
  36. <view
  37. v-for="(item, index) in tableData"
  38. :key="index"
  39. class="cell flex-align"
  40. style="margin-bottom: 10px"
  41. >
  42. <view class="index bold color-white">{{ index + 1 }}</view>
  43. <image
  44. v-if="index === 0"
  45. class="rank_flag translateY"
  46. :src="resource.prince_rank_1"
  47. />
  48. <image
  49. v-if="index === 1"
  50. class="rank_flag translateY"
  51. :src="resource.prince_rank_2"
  52. />
  53. <image
  54. v-if="index === 2"
  55. class="rank_flag translateY"
  56. :src="resource.prince_rank_3"
  57. />
  58. <image
  59. :src="item.avatar"
  60. style="width: 52rpx; height: 52rpx; border-radius: 26rpx"
  61. />
  62. <view class="color-white font2 marginL12 flex1">{{ item.nickname }}</view>
  63. <view class="flex-shrink0 num">{{ item.quantity }}源力值</view>
  64. </view>
  65. </scroll-view>
  66. <empty v-if="!tableData || tableData.length === 0" :top="0" />
  67. <view v-if="tabIndex == 0 && myData" class="cell my flex-align">
  68. <image
  69. v-if="myData.quantity >= luckKing.reachLuckQuantity && myData.index === 0"
  70. class="rank_flag translateY"
  71. :src="resource.prince_rank_1"
  72. />
  73. <image
  74. v-else-if="
  75. myData.quantity >= luckKing.reachLuckQuantity && myData.index === 1
  76. "
  77. class="rank_flag translateY"
  78. :src="resource.prince_rank_2"
  79. />
  80. <image
  81. v-else-if="
  82. myData.quantity >= luckKing.reachLuckQuantity && myData.index === 2
  83. "
  84. class="rank_flag translateY"
  85. :src="resource.prince_rank_3"
  86. />
  87. <view
  88. v-if="myData.quantity < luckKing.reachLuckQuantity"
  89. class="index color-white"
  90. >
  91. 未在进阶区
  92. </view>
  93. <view
  94. v-else-if="
  95. myData.quantity >= luckKing.reachLuckQuantity && myData.index < 50
  96. "
  97. class="index bold color-white"
  98. >
  99. {{ myData.index + 1 }}
  100. </view>
  101. <view v-else class="index"></view>
  102. <image
  103. :src="myData.avatar"
  104. style="width: 52rpx; height: 52rpx; border-radius: 26rpx"
  105. />
  106. <view class="color-white font2 marginL12 flex1">{{ myData.nickname }}</view>
  107. <view class="flex-shrink0 num">{{ myData.quantity }}源力值</view>
  108. </view>
  109. </view>
  110. <view v-if="tabIndex == 1" style="height: 348px">
  111. <view v-if="pre" class="text-center paddingB10 color-white">
  112. 共瓜分{{ pre.magicQuantity }}源石
  113. </view>
  114. <scroll-view
  115. style="height: 300px"
  116. scroll-y
  117. v-if="pre && pre.periodKingList && pre.periodKingList.length > 0"
  118. >
  119. <view
  120. v-for="(item, index) in pre.periodKingList"
  121. :key="index"
  122. class="cell flex-align"
  123. style="margin-bottom: 10px"
  124. >
  125. <view class="index bold color-white">{{ index + 1 }}</view>
  126. <image
  127. v-if="index === 0"
  128. class="rank_flag translateY"
  129. :src="resource.prince_rank_1"
  130. />
  131. <image
  132. v-if="index === 1"
  133. class="rank_flag translateY"
  134. :src="resource.prince_rank_2"
  135. />
  136. <image
  137. v-if="index === 2"
  138. class="rank_flag translateY"
  139. :src="resource.prince_rank_3"
  140. />
  141. <image
  142. :src="item.avatar"
  143. style="width: 52rpx; height: 52rpx; border-radius: 26rpx"
  144. />
  145. <view class="color-white font2 marginL12 flex1">{{ item.nickname }}</view>
  146. <view class="flex-shrink0 num">瓜分{{ item.magicQuantity }}源石</view>
  147. </view>
  148. </scroll-view>
  149. <empty
  150. v-if="!pre || !pre.periodKingList || pre.periodKingList.length === 0"
  151. :top="0"
  152. />
  153. </view>
  154. </view>
  155. </view>
  156. </template>
  157. <script>
  158. import pageMixin from '@/mixin/page'
  159. import resource from '@/utils/resource'
  160. import empty from '@/components/empty'
  161. export default {
  162. // mixins: [pageMixin],
  163. components: { empty },
  164. props: {
  165. poolId: Number,
  166. luckKing: Object
  167. },
  168. data() {
  169. return {
  170. tabIndex: 0,
  171. tableData: null,
  172. pre: null,
  173. resource,
  174. visible: false,
  175. refreshing: false,
  176. myData: null
  177. }
  178. },
  179. methods: {
  180. show() {
  181. this.$parent.$parent.$parent.lock = true
  182. this.visible = true
  183. this.refresh()
  184. },
  185. close() {
  186. this.$parent.$parent.$parent.lock = false
  187. this.visible = false
  188. this.tableData = null
  189. this.myData = null
  190. this.pre = null
  191. },
  192. refresh() {
  193. this.loadData()
  194. this.getPre()
  195. },
  196. async getPre() {
  197. const res = await this.$service.award.preKing(this.poolId)
  198. this.pre = res
  199. },
  200. async loadData(loading = false) {
  201. const res = await this.$service.award.kingUser(this.poolId, loading)
  202. if (res) {
  203. this.tableData = res.periodKingList
  204. if (res.myPeriodKing) {
  205. let my = res.myPeriodKing
  206. let flag = 50
  207. for (let i = 0; i < this.tableData.length; i++) {
  208. if (my.userId === this.tableData[i].userId) {
  209. flag = i
  210. break
  211. }
  212. }
  213. my.index = flag
  214. this.myData = my
  215. }
  216. }
  217. }
  218. }
  219. }
  220. </script>
  221. <style lang="scss" scoped>
  222. .prince-rank-mask {
  223. position: absolute;
  224. left: 0;
  225. right: 0;
  226. top: 0;
  227. bottom: 0;
  228. }
  229. .wrapper {
  230. padding: 0 28rpx 64rpx;
  231. background: #171b1e;
  232. border-radius: 15px 15px 2px 2px;
  233. .title {
  234. width: 176rpx;
  235. height: 28rpx;
  236. }
  237. .x {
  238. position: absolute;
  239. right: 28rpx;
  240. top: 50%;
  241. margin-top: -16rpx;
  242. width: 32rpx;
  243. height: 32rpx;
  244. }
  245. .cell {
  246. position: relative;
  247. height: 48px;
  248. background: rgba(34, 35, 53, 0.6);
  249. border-radius: 4px;
  250. border: 1px solid rgba(255, 255, 255, 0.1);
  251. padding-left: 13px;
  252. padding-right: 48px;
  253. .index {
  254. width: 82px;
  255. }
  256. .num {
  257. color: #44e5e3;
  258. font-size: 12px;
  259. }
  260. &.my {
  261. background: rgba(91, 92, 116, 0.6);
  262. border: 1px solid rgba(255, 255, 255, 0.1);
  263. }
  264. .rank_flag {
  265. width: 21px;
  266. height: 20px;
  267. position: absolute;
  268. left: 35px;
  269. }
  270. }
  271. .user-wrapper {
  272. width: 280rpx;
  273. height: 324rpx;
  274. position: relative;
  275. margin-top: -10px;
  276. .bg-user {
  277. position: absolute;
  278. width: 280rpx;
  279. height: 324rpx;
  280. left: 0;
  281. top: 0;
  282. }
  283. .tx {
  284. border: 1px solid #00a2e7;
  285. width: 60px;
  286. height: 60px;
  287. border-radius: 30px;
  288. }
  289. .bg-text-wrapper {
  290. width: 164rpx;
  291. height: 50rpx;
  292. position: relative;
  293. margin-top: 10px;
  294. .bg-text {
  295. position: absolute;
  296. left: 0;
  297. top: 0;
  298. width: 164rpx;
  299. height: 50rpx;
  300. }
  301. }
  302. }
  303. .item {
  304. width: 200rpx;
  305. height: 238rpx;
  306. position: relative;
  307. border-radius: 8rpx;
  308. overflow: hidden;
  309. .goods-wrapper {
  310. position: absolute;
  311. right: 0;
  312. top: 0;
  313. width: 100%;
  314. height: 100%;
  315. }
  316. .image {
  317. width: 200rpx;
  318. height: 238rpx;
  319. }
  320. }
  321. }
  322. </style>