health_report.vue 3.3 KB

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