rotationBottom.vue 3.1 KB

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