health_report.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="">
  3. <view class=" tab position-relative">
  4. <view class="mx-3 mt-3 tab-box centerY text-center fs-14 font-bold">
  5. <view @click="tabactive(index)" v-for="(item,index) in ['健康报告','全年检查计划','检测结果']"
  6. :class="{'tab-item w-33 m-2 py-2':true,'tab-item-active ': tab_index==index}" :key="index">
  7. <view class="my-1">
  8. {{item}}
  9. </view>
  10. </view>
  11. </view>
  12. <view class="position-relative px-3" style="height: 50vh;" ref="ccc">
  13. <view
  14. :class="{'w-100 tab-content position-absolute':true,'tab-content-active': tab_index==0,'tab-content-hidden':tab_index!==0}">
  15. <report :propData="dataAll" />
  16. </view>
  17. <view
  18. :class="{'w-100 tab-content position-absolute':true,'tab-content-active': tab_index==1,'tab-content-hidden':tab_index!==1}">
  19. <annual-inspection-plan :propData="dataAll" />
  20. </view>
  21. <view
  22. :class="{'w-100 tab-content position-absolute':true,'tab-content-active': tab_index==2,'tab-content-hidden':tab_index!==2}">
  23. <detection-result :propData="dataAll" />
  24. </view>
  25. </view>
  26. <view class="" @click="resttop" v-if="isshowbtntop"
  27. style="position: fixed;transform: rotate(180deg);width: 100rpx;bottom:100rpx;right: 0;z-index: 999;">
  28. <view class="picbox">
  29. <image class="picimg" src="@/static/img/other/xl.png" mode=""></image>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import Report from './component/report.vue';
  37. import DetectionResult from './component/detection_result.vue'
  38. import AnnualInspectionPlan from './component/annual_inspection_plan.vue'
  39. export default {
  40. components: {
  41. Report,
  42. DetectionResult,
  43. AnnualInspectionPlan
  44. },
  45. data() {
  46. return {
  47. tab_index: 0,
  48. isshowbtntop: false,
  49. dataAll: {}
  50. }
  51. },
  52. onPageScroll: function(e) { //nvue暂不支持滚动监听,可用bindingx代替
  53. // console.log("滚动距离为:" + e.scrollTop);
  54. if (e.scrollTop >= 500) {
  55. this.isshowbtntop = true
  56. } else {
  57. this.isshowbtntop = false
  58. }
  59. },
  60. onLoad() {
  61. this.find_health_report()
  62. },
  63. methods: {
  64. async find_health_report() {
  65. let idCard = uni.getStorageSync('idCard')
  66. uni.showLoading({
  67. title: '加载中'
  68. });
  69. let {
  70. data,
  71. code
  72. } = await this.$api.find_health_report({
  73. idCard
  74. })
  75. if (code == 0) {
  76. console.log(data)
  77. this.dataAll = data || {}
  78. uni.hideLoading();
  79. } else {
  80. uni.hideLoading();
  81. uni.stopPullDownRefresh()
  82. }
  83. },
  84. tabactive(i) {
  85. this.tab_index = i
  86. uni.pageScrollTo({ //滚动条初始化
  87. scrollTop: 0,
  88. duration: 0
  89. });
  90. },
  91. resttop() {
  92. uni.pageScrollTo({ //滚动条初始化
  93. scrollTop: 0,
  94. duration: 300
  95. });
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. page {
  102. background: #F5F9FF;
  103. }
  104. .tab {
  105. &-box {
  106. background: #D7E6F8;
  107. border-radius: 12rpx;
  108. }
  109. &-item {
  110. color: #4B4B4B;
  111. transition: all .3s;
  112. }
  113. &-item-active {
  114. background: #FFFFFF !important;
  115. box-shadow: 0px 2px 4px 0px #B2D2FD;
  116. border-radius: 6px;
  117. }
  118. &-content {
  119. top: 20vh;
  120. transition: all .4s;
  121. opacity: 0;
  122. left: 0vw;
  123. &-active {
  124. opacity: 1;
  125. top: 0vw;
  126. z-index: 1;
  127. }
  128. &-hidden {
  129. height: 30vh;
  130. overflow: hidden;
  131. }
  132. }
  133. }
  134. .sticky-nav {
  135. position: sticky;
  136. top: 80rpx;
  137. z-index: 999;
  138. }
  139. </style>