index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="flex-col" :style="{height: winHeight + 'px'}">
  3. <!-- #ifdef MP -->
  4. <view class="cart_nav">
  5. <nav-bar iconColor='#fff' ref="navBarRef" navTitle="游戏搭子" backgroundColor="#FF6702" :isBackgroundColor="false">
  6. </nav-bar>
  7. </view>
  8. <!-- #endif -->
  9. <view class='newsList tui-skeleton flex-col' style="background-color: #fff;flex: 1;">
  10. <view class='nav flex-around-center'>
  11. <view class='item flex-center' v-for="(item,index) in navList" :key="index" :class='active==item.id?"on":""' @click='tabSelect(item.id, index)'>
  12. <view class="line1">{{item.name}}</view>
  13. <view class='line' v-show="active==item.id"></view>
  14. </view>
  15. </view>
  16. <view class='list' style="flex: 1;">
  17. <template v-if="active == 1">
  18. </template>
  19. <template v-if="active == 2">
  20. </template>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. // +----------------------------------------------------------------------
  27. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  28. // +----------------------------------------------------------------------
  29. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  30. // +----------------------------------------------------------------------
  31. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  32. // +----------------------------------------------------------------------
  33. // | Author: CRMEB Team <admin@crmeb.com>
  34. // +----------------------------------------------------------------------
  35. import navBar from '@/components/navBar';
  36. import animationType from '@/utils/animationType.js'
  37. import tuiSkeleton from '@/components/base/tui-skeleton.vue';
  38. import {
  39. getAddressList
  40. } from '@/api/user.js';
  41. let app = getApp();
  42. export default {
  43. components: {
  44. tuiSkeleton,
  45. navBar
  46. },
  47. data() {
  48. return {
  49. winHeight: 0,
  50. isNodes: 0, //控制什么时候开始抓取元素节点,只要数值改变就重新抓取
  51. autoplay: true,
  52. navList: [{
  53. id: 1,
  54. name: '本校'
  55. }, {
  56. id: 2,
  57. name: '同城'
  58. }],
  59. active: 1,
  60. scrollLeft: 0,
  61. addressItem: {}
  62. };
  63. },
  64. onLoad() {
  65. let that = this;
  66. uni.getSystemInfo({
  67. success: function(res) {
  68. that.winHeight = res.windowHeight
  69. },
  70. });
  71. this.getaddressInfo()
  72. },
  73. /**
  74. * 生命周期函数--监听页面显示
  75. */
  76. onShow: function() {
  77. let that = this;
  78. uni.$on('addressItem', function(res) {
  79. that.$set(that, 'addressItem', res);
  80. })
  81. },
  82. methods: {
  83. tabSelect(active, e) {
  84. this.active = active;
  85. },
  86. /*
  87. * 获取默认收货地址或者获取某条地址信息
  88. */
  89. getaddressInfo: function() {
  90. getAddressList().then(res => {
  91. console.log('地址', res)
  92. if (res.code = 200) {
  93. if (res.data.length !== 0) {
  94. this.addressItem = res.data.find(item => item.isDefault === true) || {} // this.addressItem = res.data[0];
  95. } else {
  96. this.addressItem = {}
  97. }
  98. console.log('默认地址', this.addressItem)
  99. }
  100. })
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. .courie {
  107. padding: 14rpx 24rpx 0 24rpx;
  108. font-weight: 500;
  109. font-size: 23rpx;
  110. color: $bg-color-primary;
  111. background-color: #fff;
  112. image {
  113. width: 46rpx;
  114. height: 46rpx;
  115. margin-right: 15rpx;
  116. }
  117. }
  118. .newsList .swiper {
  119. width: 100%;
  120. position: relative;
  121. box-sizing: border-box;
  122. padding: 0 30rpx;
  123. }
  124. .newsList .swiper swiper {
  125. width: 100%;
  126. height: 365rpx;
  127. position: relative;
  128. }
  129. .newsList .swiper .slide-image {
  130. width: 100%;
  131. height: 335rpx;
  132. border-radius: 14rpx;
  133. }
  134. // #ifdef MP-WEIXIN
  135. .newsList .swiper .wx-swiper-dot {
  136. width: 12rpx !important;
  137. height: 12rpx !important;
  138. border-radius: 0;
  139. transform: rotate(-45deg);
  140. transform-origin: 0 100%;
  141. }
  142. .newsList .swiper .wx-swiper-dot~.wx-swiper-dot {
  143. margin-left: 5rpx;
  144. }
  145. .newsList .swiper .wx-swiper-dots.wx-swiper-dots-horizontal {
  146. margin-bottom: -15rpx;
  147. }
  148. // #endif
  149. // #ifdef APP-PLUS || H5
  150. .newsList .swiper .uni-swiper-dot {
  151. width: 12rpx !important;
  152. height: 12rpx !important;
  153. border-radius: 0;
  154. transform: rotate(-45deg);
  155. transform-origin: 0 100%;
  156. }
  157. .newsList .swiper .uni-swiper-dot~.uni-swiper-dot {
  158. margin-left: 5rpx;
  159. }
  160. .newsList .swiper .uni-swiper-dots.uni-swiper-dots-horizontal {
  161. margin-bottom: -15rpx;
  162. }
  163. // #endif
  164. .newsList .nav {
  165. padding: 0 100rpx;
  166. width: 100%;
  167. height: 96rpx;
  168. white-space: nowrap;
  169. box-sizing: border-box;
  170. padding-top: 43rpx;
  171. border-top-right-radius: 23rpx;
  172. background-color: #fff;
  173. }
  174. .newsList .nav .item {
  175. // max-width: 156rpx;
  176. display: inline-block;
  177. font-size: 32rpx;
  178. color: #999;
  179. }
  180. .newsList .nav .item.on {
  181. font-weight: 600;
  182. font-size: 35rpx;
  183. color: #141414;
  184. }
  185. .newsList .nav .item~.item {
  186. margin-left: 46rpx;
  187. }
  188. .newsList .nav .item .line {
  189. // width: 24rpx;
  190. height: 10rpx;
  191. border-radius: 6rpx;
  192. margin: 10rpx auto 0 auto;
  193. background: linear-gradient( 90deg, #BC86FF 0%, #914CE7 100%);
  194. }
  195. .newsList .nav .item .line1 {
  196. font-weight: 500;
  197. font-size: 31rpx;
  198. color: #B2B2B2;
  199. }
  200. </style>