health_report.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. onPullDownRefresh() {
  64. this.find_health_report()
  65. },
  66. methods: {
  67. async find_health_report() {
  68. let idCard = uni.getStorageSync('idCard')
  69. uni.showLoading({
  70. title: '加载中'
  71. });
  72. let {
  73. data,
  74. code
  75. } = await this.$api.find_health_report({
  76. idCard
  77. })
  78. if (code == 0) {
  79. // console.log(data)
  80. this.dataAll = data || {}
  81. uni.hideLoading();
  82. uni.stopPullDownRefresh()
  83. } else {
  84. uni.hideLoading();
  85. uni.stopPullDownRefresh()
  86. }
  87. },
  88. tabactive(i) {
  89. this.tab_index = i
  90. uni.pageScrollTo({ //滚动条初始化
  91. scrollTop: 0,
  92. duration: 0
  93. });
  94. },
  95. resttop() {
  96. uni.pageScrollTo({ //滚动条初始化
  97. scrollTop: 0,
  98. duration: 300
  99. });
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. page {
  106. background: #F5F9FF;
  107. }
  108. .tab {
  109. &-box {
  110. background: #D7E6F8;
  111. border-radius: 12rpx;
  112. }
  113. &-item {
  114. color: #4B4B4B;
  115. transition: all .3s;
  116. }
  117. &-item-active {
  118. background: #FFFFFF !important;
  119. box-shadow: 0px 2px 4px 0px #B2D2FD;
  120. border-radius: 6px;
  121. }
  122. &-content {
  123. top: 20vh;
  124. transition: all .4s;
  125. opacity: 0;
  126. left: 0vw;
  127. &-active {
  128. opacity: 1;
  129. top: 0vw;
  130. z-index: 1;
  131. }
  132. &-hidden {
  133. height: 30vh;
  134. overflow: hidden;
  135. }
  136. }
  137. }
  138. .sticky-nav {
  139. position: sticky;
  140. top: 80rpx;
  141. z-index: 999;
  142. }
  143. </style>