fortune.vue 2.9 KB

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