fortune.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="content">
  3. <custom-layout ref="layout" :showBottom="true" title="启运" v-model="dataList"
  4. @layoutquery="onQueryList" @scroll="onScroll">
  5. <template #content>
  6. <fortune-info />
  7. <up-sticky offset-top="0" customNav-height="0" :bg-color="scrollTop > 170 ? bgColor:''">
  8. <up-tabs :list="tabs" :line-height="0" :active-style="{'fontSize':'30rpx','fontWeight':'600'}"></up-tabs>
  9. </up-sticky>
  10. <view class="demo-uni-row">
  11. <view class="demo-uni-col" v-for="(item,index) in dataList" :key="index"></view>
  12. </view>
  13. </template>
  14. </custom-layout>
  15. </view>
  16. </template>
  17. <script setup>
  18. import {
  19. ref,
  20. computed,
  21. onMounted
  22. } from 'vue';
  23. import {
  24. onShow
  25. } from "@dcloudio/uni-app";
  26. import {
  27. storeToRefs
  28. } from 'pinia'
  29. import {
  30. useSystemStore
  31. } from "@/store/index.js"
  32. const store = useSystemStore()
  33. // 引入组件
  34. import fortuneInfo from './components/fortuneInfo.vue'
  35. // 引入状态管理参数
  36. const {
  37. bgColor
  38. } = storeToRefs(store)
  39. // 定义变量内容
  40. const searchValue = ref(1)
  41. const tabs = ref([{
  42. state: -1,
  43. name: '热门新款',
  44. },
  45. {
  46. state: 1,
  47. name: '简约'
  48. },
  49. {
  50. state: 2,
  51. name: '卡通'
  52. },
  53. {
  54. state: 3,
  55. name: '复古'
  56. },
  57. {
  58. state: 4,
  59. name: '运动'
  60. },
  61. {
  62. state: 5,
  63. name: '艺术'
  64. }, {
  65. state: 6,
  66. name: '节日'
  67. }
  68. ])
  69. const activeIndex = ref(-1)
  70. const tabClick = (index, name) => {
  71. console.log(index, name);
  72. }
  73. // 业务列表
  74. const dataList = ref([{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, ])
  75. const num = ref(1)
  76. const layout = ref()
  77. const onQueryList = (event) => {
  78. const {
  79. pageNo,
  80. pageSize
  81. } = event
  82. if (pageNo > 1) {
  83. if (num.value < 2) {
  84. num.value++
  85. layout.value.complete(dataList.value);
  86. } else {
  87. layout.value.complete([]);
  88. }
  89. } else {
  90. num.value = 2
  91. layout.value.complete(dataList.value);
  92. }
  93. }
  94. // 检测页面滚动
  95. const scrollTop = ref(0)
  96. const onScroll = (event) => {
  97. scrollTop.value = event
  98. }
  99. // 生命中期
  100. onMounted(() => {
  101. })
  102. </script>
  103. <style lang="scss" scoped>
  104. .fortune_list {
  105. margin-top: 30rpx;
  106. background-color: #fff;
  107. border-radius: 40rpx 40rpx 0rpx 0rpx;
  108. }
  109. // ======导航标签right标签=======
  110. .tabs_list_box {
  111. padding: 0 26rpx;
  112. width: 100vw;
  113. box-sizing: border-box;
  114. background: var(--bgColor);
  115. .tabs-rigth-fixed {
  116. background: rgba(149, 250, 213, 1);
  117. border-radius: 50rpx;
  118. height: 40rpx;
  119. line-height: 40rpx;
  120. display: flex;
  121. align-items: center;
  122. padding: 0 6rpx;
  123. box-sizing: border-box;
  124. font-size: 20rpx;
  125. font-family: SmileySans-Oblique-2;
  126. text {
  127. font-weight: 600;
  128. }
  129. }
  130. }
  131. // ======liet样式=======
  132. .demo-uni-row {
  133. width: 100%;
  134. padding: 0 26rpx;
  135. margin-top: 20rpx;
  136. box-sizing: border-box;
  137. display: flex;
  138. flex-wrap: wrap;
  139. .demo-uni-col {
  140. width: calc((100% / 3) - 8rpx);
  141. height: 400rpx;
  142. background-color: #ccc;
  143. border-radius: 13px;
  144. margin-bottom: 10rpx;
  145. &:nth-child(3n - 1) {
  146. margin-right: 10rpx;
  147. margin-left: 10rpx;
  148. }
  149. }
  150. }
  151. </style>