普兆健康管家前端代码仓库
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.

144 lines
3.7 KiB

  1. <template>
  2. <view>
  3. <!-- 搜索栏 -->
  4. <view class="search">
  5. <uv-search
  6. v-model="keyword"
  7. placeholder="请输入要查询的内容"
  8. placeholderColor="#C6C6C6"
  9. searchIconColor="#8B8B8B"
  10. :searchIconSize="40"
  11. :inputStyle="{
  12. 'font-family': 'PingFang SC',
  13. 'font-weight': 400,
  14. 'font-size': '28rpx',
  15. 'line-height': 1.4,
  16. 'padding': '12rpx 0',
  17. }"
  18. bgColor="#fff"
  19. :showAction="false"
  20. @search="search"
  21. ></uv-search>
  22. </view>
  23. <view class="section">
  24. <view class="section-header">
  25. <!-- todo -->
  26. <sectionHeader :title="`直播 · 05月11日 12:00`" @showAll="jumpToLive"></sectionHeader>
  27. </view>
  28. <view style="padding: 0 32rpx;">
  29. <courseLiveCard v-for="item in liveList" :key="item.id" :data="item"></courseLiveCard>
  30. </view>
  31. </view>
  32. <view class="section">
  33. <sectionHeader title="推荐课程" @showAll="jumpToRecommendCourse"></sectionHeader>
  34. <!-- <courseRecommendView></courseRecommendView> -->
  35. <productCustomView :type="2" :list="list" @categoryChange="onCategoryChange"></productCustomView>
  36. </view>
  37. <!-- todo: check -->
  38. <!-- <view class="section section-custom">
  39. <sectionHeader title="自选课程" @showAll="jumpToCustomCourse"></sectionHeader>
  40. <slot name="custom"></slot>
  41. </view> -->
  42. </view>
  43. </template>
  44. <script>
  45. import sectionHeader from '../sectionHeader.vue'
  46. import courseLiveCard from './courseLiveCard.vue'
  47. import courseRecommendView from './courseRecommendView.vue'
  48. import productCustomView from '@/pages_order/product/productCustomView.vue'
  49. export default {
  50. components: {
  51. sectionHeader,
  52. courseLiveCard,
  53. courseRecommendView,
  54. productCustomView,
  55. },
  56. data() {
  57. return {
  58. keyword: '',
  59. liveList: [],
  60. list: [],
  61. queryParams: {
  62. pageNo: 1,
  63. pageSize: 10,
  64. type: 2, // 产品类型(0营养剂,1预约,2课程)
  65. },
  66. }
  67. },
  68. created() {
  69. // todo: fetch
  70. this.liveList = [
  71. {
  72. id: '001',
  73. url: '',
  74. startTime: '2025-07-25 19:30:00',
  75. },
  76. ]
  77. this.getData()
  78. },
  79. methods: {
  80. async getData() {
  81. try {
  82. const queryParams = {
  83. pageNo: 1,
  84. // todo: check
  85. pageSize: 6,
  86. type: 2, // 产品类型(0营养剂,1预约,2课程)
  87. homeRecommend: 'Y',
  88. }
  89. this.list = (await this.$fetch('getProductList', queryParams))?.records || []
  90. } catch (err) {
  91. }
  92. },
  93. onCategoryChange(e) {
  94. const { classId } = e || {}
  95. if (classId) {
  96. this.queryParams.classId = classId
  97. } else {
  98. delete this.queryParams.classId
  99. }
  100. this.queryParams.pageNo = 1
  101. this.queryParams.pageSize = 10
  102. this.getData()
  103. },
  104. // 搜素
  105. search() {
  106. // todo: check
  107. uni.navigateTo({
  108. url: `/pages_order/product/productList?type=2&search=${this.keyword}&title=课程`
  109. })
  110. // this.keyword = ''
  111. },
  112. jumpToLive() {
  113. // todo
  114. return
  115. uni.navigateTo({
  116. url: `/pages_order/product/productList?type=2&title=直播`
  117. })
  118. },
  119. jumpToRecommendCourse() {
  120. uni.navigateTo({
  121. url: `/pages_order/product/productList?type=2&homeRecommend=Y&title=推荐课程`
  122. })
  123. },
  124. // todo: check
  125. jumpToCustomCourse() {
  126. uni.navigateTo({
  127. url: `/pages_order/product/productList?type=2&title=自选课程`
  128. })
  129. },
  130. },
  131. }
  132. </script>
  133. <style scoped lang="scss">
  134. @import '../styles/tab.scss';
  135. </style>