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

145 lines
3.4 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="page__view">
  3. <navbar bgColor="#FFFFFF" >
  4. <image class="nav-icon" :src="configList.icon_nav_dark" mode="widthFix"></image>
  5. </navbar>
  6. <view class="content">
  7. <view id="productSwiper" class="swiper">
  8. <productSwiper :autoplay="autoplay.productSwiper"></productSwiper>
  9. </view>
  10. <view class="section">
  11. <sectionHeader title="个性推荐" desc="Personal Recommendation"></sectionHeader>
  12. <view id="recommendSwiper" class="swiper">
  13. <recommend-swiper :autoplay="autoplay.recommendSwiper"></recommend-swiper>
  14. </view>
  15. <health-records-intro></health-records-intro>
  16. </view>
  17. <view class="section">
  18. <achievement-intro></achievement-intro>
  19. </view>
  20. <view class="section">
  21. <sectionHeader title="团队成员背景" desc="Background of Team Members"></sectionHeader>
  22. <team-bg-intro></team-bg-intro>
  23. </view>
  24. <view class="section">
  25. <sectionHeader desc="Background of Team Members">
  26. <template #title>
  27. 关注我们<br/>参与更多健康活动
  28. </template>
  29. </sectionHeader>
  30. <follow-us-intro></follow-us-intro>
  31. </view>
  32. </view>
  33. <tabber select="home" />
  34. </view>
  35. </template>
  36. <script>
  37. import tabber from '@/components/base/tabbar.vue'
  38. import sectionHeader from '@/components/home/sectionHeader.vue'
  39. import productSwiper from '@/components/home/productSwiper.vue'
  40. import recommendSwiper from '@/pages_order/home/recommendSwiper.vue'
  41. import healthRecordsIntro from '@/pages_order/home/healthRecordsIntro.vue'
  42. import achievementIntro from '@/pages_order/home/achievementIntro.vue'
  43. import teamBgIntro from '@/pages_order/home/teamBgIntro.vue'
  44. import followUsIntro from '@/pages_order/home/followUsIntro.vue'
  45. export default {
  46. components: {
  47. productSwiper,
  48. sectionHeader,
  49. recommendSwiper,
  50. healthRecordsIntro,
  51. achievementIntro,
  52. teamBgIntro,
  53. followUsIntro,
  54. tabber,
  55. },
  56. data() {
  57. return {
  58. isMounted: false,
  59. observer: null,
  60. autoplay: {
  61. productSwiper: false,
  62. recommendSwiper: false,
  63. },
  64. }
  65. },
  66. onLoad() {
  67. if(uni.getStorageSync('token')){
  68. this.$store.commit('getUserInfo')
  69. }
  70. },
  71. onShow() {
  72. if (this.isMounted) {
  73. this.observeElement()
  74. }
  75. },
  76. mounted() {
  77. this.observeElement()
  78. this.isMounted = true
  79. },
  80. unmounted() {
  81. this.observer.disconnect()
  82. },
  83. onHide() {
  84. this.observer.disconnect()
  85. this.observer = null
  86. this.autoplay.productSwiper = false
  87. this.autoplay.recommendSwiper = false
  88. },
  89. methods: {
  90. observeElement() {
  91. this.observer = uni.createIntersectionObserver(this, { observeAll: true, thresholds: [0, 1] });
  92. this.observer.relativeTo('.content').observe('.swiper', res => {
  93. if (res.intersectionRatio === 0) {
  94. this.autoplay[res.id] = false
  95. } else if (res.intersectionRatio === 1) {
  96. this.autoplay[res.id] = true
  97. }
  98. })
  99. },
  100. },
  101. }
  102. </script>
  103. <style scoped lang="scss">
  104. .page__view {
  105. width: 100vw;
  106. min-height: 100vh;
  107. background-color: $uni-bg-color;
  108. position: relative;
  109. }
  110. .nav-icon {
  111. width: 200rpx;
  112. height: auto;
  113. vertical-align: top;
  114. }
  115. .content {
  116. width: 100vw;
  117. height: calc(100vh - (var(--status-bar-height) + 120rpx) - (env(safe-area-inset-bottom) + 120rpx));
  118. padding: 70rpx 0 182rpx 0;
  119. // padding-bottom: calc(env(safe-area-inset-bottom) + 120rpx + 182rpx);
  120. box-sizing: border-box;
  121. overflow-x: hidden;
  122. overflow-y: auto;
  123. }
  124. .section {
  125. margin-top: 80rpx;
  126. }
  127. </style>