猫妈狗爸伴宠师小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
3.4 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view class="my-level">
  3. <view class="my-level-need">
  4. <cardTitle :cardTitle="cardName"></cardTitle>
  5. <view :class="['my-level-content','mt20', baseList.length == 1 ? 'flex-rowc' : 'flex-b']">
  6. <view :class="i == 1 ? '' : 'flex-colc'" v-for="(item,i) in baseList" :key="i">
  7. <view class="color-999 size-28">{{item.title}}</view>
  8. <view class="mt20 size-28">{{item.num}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. </view>
  13. <view>
  14. <up-swiper
  15. :list="level_list"
  16. previousMargin="10"
  17. nextMargin="10"
  18. circular
  19. :autoplay="false"
  20. radius="10"
  21. height="440rpx"
  22. keyName="paramValueImage"
  23. img-mode="aspectFit"
  24. :current="currentIndex"
  25. @change="swiperChange"></up-swiper>
  26. <!-- <image src="" mode="aspectFit"></image> -->
  27. </view>
  28. </template>
  29. <script setup>
  30. import cardTitle from '../../components/cardTitle.vue'
  31. import {
  32. ref,
  33. reactive,
  34. onMounted,
  35. computed,
  36. } from "vue"
  37. const props = defineProps({
  38. dataInfo : {
  39. default : () => {
  40. return {}
  41. }
  42. }
  43. })
  44. let currentIndex = ref(0)
  45. const level_list = computed(() => {
  46. return props.dataInfo.level_list
  47. })
  48. const cardName = ref("距离下一等级要求")
  49. const baseList = ref([
  50. // {
  51. // title: '仍需至少注册',
  52. // num: "20人"
  53. // },
  54. ]);
  55. const list3 = reactive([
  56. '/static/images/levelImage/1.jpeg',
  57. '/static/images/levelImage/2.jpg',
  58. ]);
  59. onMounted(() => {
  60. currentIndex.value = props.dataInfo.info.userHhRole
  61. swiperChange({
  62. current : props.dataInfo.info.userHhRole,
  63. })
  64. })
  65. const swiperChange = (index) => {
  66. if(!props.dataInfo || !props.dataInfo.level_list) return
  67. let current = index.current + 1
  68. if(!props.dataInfo.level_list[current]){
  69. // if(index.current == (props.dataInfo.level_list.length - 1)){
  70. baseList.value = [{
  71. title: '已达到最高等级',
  72. num: ""
  73. }]
  74. return
  75. }
  76. let level = props.dataInfo.level_list[current]
  77. let info = props.dataInfo.info
  78. let register_users_sum = props.dataInfo.register_users_sum || 0
  79. let order_users_sum = props.dataInfo.order_users_sum || 0
  80. baseList.value = []
  81. // if(index.current <= info.userHhRole){
  82. // baseList.value.push({
  83. // title: '已达成',
  84. // num: ""
  85. // })
  86. // return
  87. // }
  88. if(level.paramCondition){
  89. baseList.value.push({
  90. title: '仍需至少注册',
  91. num: (level.paramCondition - register_users_sum) + "人"
  92. })
  93. }
  94. if(level.needOrderUserNum){
  95. if(baseList.value.length > 0){
  96. baseList.value.push({
  97. title: '或',
  98. num: ""
  99. })
  100. }
  101. baseList.value.push({
  102. title: '仍需至少下单',
  103. num: (level.needOrderUserNum - order_users_sum) + "人"
  104. })
  105. }
  106. // switch (index.current) {
  107. // case 0:
  108. // baseList.value = [{
  109. // title: '仍需至少注册',
  110. // num: "20人"
  111. // }]
  112. // break;
  113. // case 1:
  114. // baseList.value = [{
  115. // title: '仍需至少注册',
  116. // num: "20人"
  117. // },
  118. // {
  119. // title: '或',
  120. // num: " "
  121. // },
  122. // {
  123. // title: '仍需至少下单',
  124. // num: "5人"
  125. // }
  126. // ]
  127. // break;
  128. // case 2:
  129. // break;
  130. // case 3:
  131. // break;
  132. // case 4:
  133. // break;
  134. // }
  135. }
  136. </script>
  137. <style scoped lang="scss">
  138. @import "../index.scss";
  139. // .comp-card{
  140. // &-head{
  141. // .line{
  142. // width: 11rpx;
  143. // height: 38rpx;
  144. // background-color: #FFBF60;
  145. // border-radius: 6rpx;
  146. // }
  147. // .title{
  148. // font-weight: bold;
  149. // }
  150. // }
  151. // }
  152. </style>