fragmentsList.wxml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <import src="../../modal/dialogBrainLack.wxml" />
  2. <import src="../../modal/dialogNoRank.wxml" />
  3. <image class="head" src="{{banner}}">
  4. <view class="head-button" bindtap="goToPoster"></view>
  5. </image>
  6. <view class="scroll-view-bg">
  7. <scroll-view scroll-y scroll-with-animation scroll-into-view="{{scrollBottomId}}">
  8. <view wx:for="{{fragmentsList}}" wx:for-index="i" wx:key=" ">
  9. <view class="fragment-bg" bindtap="goToPK" id="{{'a' + i}}">
  10. <image class="fragment-icon" src="{{'../../resource/fragments_list_' + (i > currentFragment ? 'n' : 's') + '_' + i + '.png'}}"></image>
  11. <view class="fragment-content">
  12. <view class="fragment-content-top">
  13. <view class="fragment-content-name">{{fragmentsList[i].name}}</view>
  14. <image class="fragment-content-icon" src="../../resource/ic_brain_coin.png"></image>
  15. <view class="fragment-content-consume">{{tools.changeUnits(fragmentsList[i].cellRankCost)}}</view>
  16. </view>
  17. <!-- 已完成段位 -->
  18. <view wx:if="{{i < currentFragment}}" class="fragment-content-bottom">
  19. <image wx:for="{{tools.starNum(fragmentsList[i].star)}}" wx:key = " " class="fragment-content-star" src="../../resource/fragments_list_star_s.png"></image>
  20. </view>
  21. <!-- 当前段位 -->
  22. <view wx:elif="{{i == currentFragment}}" class="fragment-content-bottom">
  23. <image wx:if="{{i == allFragmentsNum - 1}}" class="fragment-content-star" src="../../resource/fragments_list_star_s.png"></image>
  24. <view wx:if="{{i == allFragmentsNum - 1}}" class="fragment-content-fragment-top">* {{currentStarNum}}</view>
  25. <image wx:for="{{tools.starNum(fragmentsList[i].star)}}" wx:for-index="sn" wx:key = " " class="fragment-content-star" src="{{tools.starImg(currentStarNum, sn)}}"></image>
  26. </view>
  27. <!-- 未开启段位 -->
  28. <view wx:else class="fragment-content-bottom">
  29. <image wx:if="{{i == allFragmentsNum - 1}}" class="fragment-content-star" src="../../resource/fragments_list_star_s.png"></image>
  30. <view wx:if="{{i == allFragmentsNum - 1}}" class="fragment-content-fragment-top">* 0</view>
  31. <image wx:for="{{tools.starNum(fragmentsList[i].star)}}" wx:key = " " class="fragment-content-star-bg" src="../../resource/fragments_list_star_n.png"></image>
  32. </view>
  33. </view>
  34. </view>
  35. <view wx:if="{{i > currentFragment}}" class="fragment-shade"></view>
  36. <view class="fragment-interval"></view>
  37. </view>
  38. </scroll-view>
  39. </view>
  40. <view class="ranking-view">我的世界排名为{{rank}}名</view>
  41. <view class="bottom-button" bindtap="goToRecord">
  42. <view class="bottom-button-title">查看脑力排行榜</view>
  43. <image class="bottom-button-icon" src="../../resource/fragments_arrow.png"></image>
  44. </view>
  45. <template is="dialogBrainLack" data="{{...dialogBrainLack}}"/>
  46. <template is="dialogNoRank" data="{{...dialogRank}}"/>
  47. <wxs module="tools">
  48. var starNum = function(n) {
  49. var arr = []
  50. for (var i = 0; i < n; i ++) {
  51. arr += i
  52. }
  53. return arr
  54. }
  55. var starImg = function(c, n) {
  56. if (c > n) {
  57. return "../../resource/fragments_list_star_s.png"
  58. } else {
  59. return "../../resource/fragments_list_star_n.png"
  60. }
  61. }
  62. var changeUnits = function(u) {
  63. if (u >= 10000) {
  64. return u / 10000 + "亿"
  65. } else {
  66. return u + "万"
  67. }
  68. }
  69. module.exports.starNum = starNum
  70. module.exports.starImg = starImg
  71. module.exports.changeUnits = changeUnits
  72. </wxs>