rotationBottom.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view
  3. class="rotation-wraper"
  4. :style="{
  5. height:
  6. tktype == 1
  7. ? `calc(100% - 256rpx - 168rpx)`
  8. : `calc(100% - 256rpx - 440rpx)`,
  9. }"
  10. >
  11. <view class="rotation-wraper-left">
  12. <view
  13. class="rotation-wraper-left__item"
  14. v-for="(item, index) in alreadyList"
  15. :key="item.sfBid"
  16. @click="clickHandler(item, index)"
  17. :class="{ active: index === currentIndex }"
  18. >{{ item.sfDisplayname || item.sfName }}</view
  19. >
  20. </view>
  21. <view class="rotation-wraper-right">
  22. <scroll-view
  23. scroll-y="true"
  24. enable-flex="true"
  25. scroll-with-animation
  26. class="server-page__list-scroll"
  27. :scroll-into-view="activeMenuId"
  28. >
  29. <rotationCard
  30. v-for="item in alreadyList"
  31. :item="item"
  32. :tktype="tktype"
  33. :key="item.sfBid"
  34. :id="'tab' + item.sfBid"
  35. />
  36. </scroll-view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import rotationCard from './rotationCard.vue';
  42. export default {
  43. name: 'rotationBottom',
  44. props: {
  45. alreadyList: {
  46. type: Array,
  47. default: () => [],
  48. },
  49. tktype: {
  50. type: Number,
  51. default: 1,
  52. },
  53. activeIndex: {
  54. type: Number,
  55. default: 0,
  56. },
  57. },
  58. data() {
  59. return {
  60. currentIndex: 0,
  61. currentItem: {},
  62. activeMenuId: '',
  63. };
  64. },
  65. watch: {
  66. activeIndex() {
  67. this.currentIndex = 0;
  68. const firstItem = this.alreadyList[0];
  69. this.activeMenuId = `tab${firstItem?.sfBid}`;
  70. },
  71. },
  72. components: {
  73. rotationCard,
  74. },
  75. methods: {
  76. clickHandler(item, index) {
  77. this.currentItem = item;
  78. this.currentIndex = index;
  79. this.activeMenuId = `tab${item.sfBid}`;
  80. },
  81. },
  82. };
  83. </script>
  84. <style scoped lang="scss">
  85. .server-page__list-scroll {
  86. height: 100%;
  87. overflow: hidden;
  88. }
  89. .rotation-wraper {
  90. display: flex;
  91. justify-content: space-between;
  92. position: relative;
  93. height: calc(100% - 256rpx - 168rpx);
  94. padding-bottom: 128rpx;
  95. overflow-y: hidden;
  96. .rotation-wraper-left {
  97. width: 240rpx;
  98. border-radius: 16rpx;
  99. background-color: #ffffff;
  100. height: 100%;
  101. background: #ffffff;
  102. overflow-y: auto;
  103. padding-top: 12rpx;
  104. &__item {
  105. height: 96rpx;
  106. line-height: 96rpx;
  107. padding: 0 32rpx;
  108. color: #364d46;
  109. font-family: 'Source Han Sans CN VF';
  110. font-size: 28rpx;
  111. font-weight: 400;
  112. }
  113. }
  114. .active {
  115. background: #f5f6fa;
  116. color: #14a478;
  117. font-family: 'Source Han Sans CN VF';
  118. font-size: 28rpx;
  119. font-weight: 700;
  120. }
  121. .rotation-wraper-right {
  122. width: calc(100% - 240rpx - 64rpx);
  123. margin-right: 32rpx;
  124. overflow-y: scroll;
  125. }
  126. }
  127. </style>