cangp.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="container">
  3. <view class="topNav">
  4. <view class="hgHeight">
  5. </view>
  6. <view class="flex">
  7. <view class="titleItem" @click="tabList(0)" :class="{action:onIndex==0}">
  8. 我的盲盒
  9. </view>
  10. <view class="titleItem" @click="tabList(1)" :class="{action:onIndex==1}">
  11. NFT合成
  12. </view>
  13. </view>
  14. </view>
  15. <!-- 我的盲盒 -->
  16. <view class="ls" v-show="onIndex==0">
  17. <view class="ll" v-for="(item,index) in mh.list">
  18. <!-- <image class="imgBox" src="" mode="scaleToFill"></image> -->
  19. <view class="title clamp margin-t-20">
  20. 盲盒首发
  21. </view>
  22. <view class="tip flex margin-t-10">
  23. <view class="clamp">官方发行</view>
  24. <view class="buttom" @click="navTo(item)">打开</view>
  25. </view>
  26. </view>
  27. <u-loadmore class='clearFloat' lineColor='#FFFFFF' iconColor='#FFFFFF' color="#FFFFFF" :status="mh.loadingType" />
  28. </view>
  29. <!-- NFT合成 -->
  30. <view class="ls" v-show="onIndex==1">
  31. <u-loadmore class='clearFloat' lineColor='#FFFFFF' iconColor='#FFFFFF' color="#FFFFFF" :status="nft.loadingType" />
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. mapState
  38. } from 'vuex';
  39. // #ifdef H5
  40. import {
  41. weixindata
  42. } from '@/utils/wxAuthorized';
  43. // #endif
  44. export default {
  45. data() {
  46. return {
  47. onIndex: 0, //当前选中的分类
  48. // 盲盒里诶啊哦
  49. mh: {
  50. page: 1,
  51. limit: 10,
  52. list: [{}, {}, {}, {}],
  53. loaded: false,
  54. loadingType: 'loadmore'
  55. },
  56. // nft合成列表
  57. nft: {
  58. page: 1,
  59. limit: 10,
  60. list: [],
  61. loaded: false,
  62. loadingType: 'loadmore'
  63. }
  64. };
  65. },
  66. computed: {
  67. ...mapState(['loginInterceptor', 'baseURL']),
  68. ...mapState('user', ['hasLogin', 'userInfo'])
  69. },
  70. onLoad: function(option) {},
  71. methods: {
  72. info() {
  73. },
  74. tabList(index) {
  75. // 保存当前选中的对象
  76. this.onIndex = index;
  77. },
  78. // 加载盲盒
  79. lodingMh(source) {
  80. let navItem = this.mh.list;
  81. if (source === 'tabChange' && navItem.loaded === true) {
  82. //tab切换只有第一次需要加载数据
  83. return;
  84. }
  85. if (navItem.loadingType === 'loading') {
  86. //防止重复加载
  87. return;
  88. }
  89. // 修改当前对象状态为加载中
  90. navItem.loadingType = 'loading';
  91. cashList({
  92. page: navItem.page,
  93. limit: navItem.limit,
  94. pm: state
  95. })
  96. .then(({
  97. data
  98. }) => {
  99. if (data.list.length > 0) {
  100. navItem.orderList = navItem.orderList.concat(data.list);
  101. navItem.page++;
  102. }
  103. if (navItem.limit == data.list.length) {
  104. //判断是否还有数据, 有改为 more, 没有改为noMore
  105. navItem.loadingType = 'loadmore';
  106. return;
  107. } else {
  108. //判断是否还有数据, 有改为 more, 没有改为noMore
  109. navItem.loadingType = 'nomore';
  110. }
  111. uni.hideLoading();
  112. navItem.loaded = true;
  113. })
  114. .catch(e => {
  115. console.log(e);
  116. });
  117. },
  118. navTo(url) {
  119. uni.switchTab({
  120. url
  121. })
  122. },
  123. }
  124. };
  125. </script>
  126. <style lang="scss">
  127. page {
  128. width: 750rpx;
  129. min-height: 100%;
  130. background: #111111;
  131. }
  132. .container {
  133. /* #ifdef APP */
  134. padding-top: var(--status-bar-height);
  135. /* #endif */
  136. }
  137. .topNav {
  138. position: fixed;
  139. top: 0;
  140. left: 0;
  141. right: 0;
  142. z-index: 999;
  143. padding: 30rpx;
  144. background-color: #181820;
  145. .hgHeight{
  146. height: var(--status-bar-height);
  147. }
  148. .titleItem {
  149. width: 336rpx;
  150. height: 80rpx;
  151. border-radius: 10rpx;
  152. text-align: center;
  153. line-height: 80rpx;
  154. font-size: $font-base;
  155. color: #FFFFFF;
  156. border: 1px solid #FFFFFF;
  157. &.action {
  158. font-weight: bold;
  159. color: #9F570E;
  160. background: linear-gradient(270deg, #FFE7C4, #FFCE8A);
  161. }
  162. }
  163. }
  164. .ls {
  165. color: #FFFFFF;
  166. padding: 30rpx;
  167. padding-top: 140rpx;
  168. .clearFloat {
  169. clear: both;
  170. }
  171. .ll:nth-child(even) {
  172. margin-left: 30rpx;
  173. }
  174. .ll {
  175. width: 330rpx;
  176. line-height: 1;
  177. margin-bottom: 30rpx;
  178. float: left;
  179. .imgBox {
  180. background-color: #1D1D22;
  181. width: 330rpx;
  182. height: 330rpx;
  183. }
  184. .title {
  185. font-size: $font-sm;
  186. }
  187. .tip {
  188. font-size: $font-sm - 4rpx;
  189. .buttom {
  190. width: 98rpx;
  191. padding: 10rpx 0;
  192. text-align: center;
  193. background: linear-gradient(270deg, #FFE7C4, #FFCE8A);
  194. border-radius: 20rpx;
  195. color: #9F570E;
  196. }
  197. }
  198. }
  199. }
  200. </style>