123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <template>
- <view class="">
- <view class=" tab position-relative">
- <view class="mx-3 mt-3 tab-box centerY text-center fs-14 font-bold">
- <view @click="tabactive(index)" v-for="(item,index) in ['健康报告','全年检查计划','检测结果']"
- :class="{'tab-item w-33 m-2 py-2':true,'tab-item-active ': tab_index==index}" :key="index">
- <view class="my-1">
- {{item}}
- </view>
- </view>
- </view>
- <view class="position-relative px-3" style="height: 50vh;" ref="ccc">
- <view
- :class="{'w-100 tab-content position-absolute':true,'tab-content-active': tab_index==0,'tab-content-hidden':tab_index!==0}">
- <report :propData="dataAll" />
- </view>
- <view
- :class="{'w-100 tab-content position-absolute':true,'tab-content-active': tab_index==1,'tab-content-hidden':tab_index!==1}">
- <annual-inspection-plan :propData="dataAll" />
- </view>
- <view
- :class="{'w-100 tab-content position-absolute':true,'tab-content-active': tab_index==2,'tab-content-hidden':tab_index!==2}">
- <detection-result :propData="dataAll" />
- </view>
- </view>
- <view class="" @click="resttop" v-if="isshowbtntop"
- style="position: fixed;transform: rotate(180deg);width: 100rpx;bottom:100rpx;right: 0;z-index: 999;">
- <view class="picbox">
- <image class="picimg" src="@/static/img/other/xl.png" mode=""></image>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import Report from './component/report.vue';
- import DetectionResult from './component/detection_result.vue'
- import AnnualInspectionPlan from './component/annual_inspection_plan.vue'
- export default {
- components: {
- Report,
- DetectionResult,
- AnnualInspectionPlan
- },
- data() {
- return {
- tab_index: 0,
- isshowbtntop: false,
- dataAll: {}
- }
- },
- onPageScroll: function(e) { //nvue暂不支持滚动监听,可用bindingx代替
- // console.log("滚动距离为:" + e.scrollTop);
- if (e.scrollTop >= 500) {
- this.isshowbtntop = true
- } else {
- this.isshowbtntop = false
- }
- },
- onLoad() {
- this.find_health_report()
- },
- onPullDownRefresh() {
- this.find_health_report()
- },
- methods: {
- async find_health_report() {
- let idCard = uni.getStorageSync('idCard')
- uni.showLoading({
- title: '加载中'
- });
- let {
- data,
- code
- } = await this.$api.find_health_report({
- idCard
- })
- if (code == 0) {
- // console.log(data)
- this.dataAll = data || {}
- uni.hideLoading();
- uni.stopPullDownRefresh()
- } else {
- uni.hideLoading();
- uni.stopPullDownRefresh()
- }
- },
- tabactive(i) {
- this.tab_index = i
- uni.pageScrollTo({ //滚动条初始化
- scrollTop: 0,
- duration: 0
- });
- },
- resttop() {
- uni.pageScrollTo({ //滚动条初始化
- scrollTop: 0,
- duration: 300
- });
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background: #F5F9FF;
- }
- .tab {
- &-box {
- background: #D7E6F8;
- border-radius: 12rpx;
- }
- &-item {
- color: #4B4B4B;
- transition: all .3s;
- }
- &-item-active {
- background: #FFFFFF !important;
- box-shadow: 0px 2px 4px 0px #B2D2FD;
- border-radius: 6px;
- }
- &-content {
- top: 20vh;
- transition: all .4s;
- opacity: 0;
- left: 0vw;
- &-active {
- opacity: 1;
- top: 0vw;
- z-index: 1;
- }
- &-hidden {
- height: 30vh;
- overflow: hidden;
- }
- }
- }
- .sticky-nav {
- position: sticky;
- top: 80rpx;
- z-index: 999;
- }
- </style>
|