index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="home">
  3. <TopCard :info="info" />
  4. <!-- tab导航栏 -->
  5. <view class="tabs">
  6. <view v-for="(item, index) in navList" :key="index" class="tab" :class="{'is-active': tabCurId === item.id}"
  7. @click="tabClick(index)">
  8. {{item.text}}
  9. </view>
  10. </view>
  11. <swiper :current="tabCurId" class="swiper-box" duration="300" @change="onChangeTab">
  12. <swiper-item class="tab-content" v-for="(_tabItem,tabIndex) in navList" :key="tabIndex">
  13. <!-- <pub-list-scroll :loaded="loaded" :text="loadText" :status="status"> -->
  14. <CfStatus v-if="tabCurId==0" />
  15. <!-- </pub-list-scroll> -->
  16. </swiper-item>
  17. </swiper>
  18. </view>
  19. </template>
  20. <script lang="ts" setup>
  21. import { ref, nextTick, onMounted } from 'vue'
  22. import TopCard from './TopCard.vue'
  23. import CfStatus from './CfStatus.vue'
  24. const topCardRef = ref()
  25. const info = ref({
  26. name: '陈*丽',
  27. addr: '成都市大竹林街道*************',
  28. sex: '女',
  29. text: '近三个月就诊记录',
  30. idCard: '************** 9253',
  31. date: '2024-04-22'
  32. })
  33. const tabCurId = ref(0)//当前tab选中Id
  34. // const loaded = ref(false)
  35. // const status = ref('loading')
  36. // const loadText = ref('数据加载中...')
  37. const navList = ref([{
  38. id: 0,
  39. text: '处方状态',
  40. },
  41. {
  42. id: 1,
  43. text: '物流信息',
  44. },
  45. {
  46. id: 2,
  47. text: '处方内容',
  48. },
  49. {
  50. id: 3,
  51. text: '处方评价',
  52. }
  53. ])
  54. const swiperBoxStyle = () => {
  55. let _h = `calc(100% - 72rpx - ${topCardRef.value?.offsetHeight})`;
  56. console.log("_h", _h)
  57. return {
  58. height: '200px',
  59. };
  60. };
  61. //顶部tab点击
  62. const tabClick = (idx : number) => {
  63. tabCurId.value = idx;
  64. }
  65. //滑动标签页
  66. const onChangeTab = (e) => {
  67. let _inx = e.detail.current;
  68. tabClick(_inx);
  69. }
  70. onMounted(() => {
  71. })
  72. </script>
  73. <style lang="scss" scoped>
  74. .home {
  75. display: flex;
  76. flex-direction: column;
  77. height: 100%;
  78. .tabs {
  79. margin: $uni-spacing-row-s4 0 $uni-spacing-row-s3;
  80. height: 88rpx;
  81. background-color: #fff;
  82. padding: 0 24rpx;
  83. @include flex-between;
  84. .tab {
  85. height: 100%;
  86. @include flex-center;
  87. &.is-active {
  88. color: $uni-color-primary;
  89. position: relative;
  90. &::after {
  91. content: '';
  92. position: absolute;
  93. bottom: 0;
  94. left: 0;
  95. background: $uni-color-primary;
  96. width: 100%;
  97. height: 4rpx;
  98. }
  99. }
  100. }
  101. }
  102. .swiper-box {
  103. flex: 1;
  104. .tab-content {
  105. :deep(.pub-loading) {
  106. height: 100%;
  107. }
  108. }
  109. }
  110. }
  111. </style>