index.vue 2.7 KB

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