selectArea.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="container">
  3. <!-- 顶部选择校区区域 -->
  4. <view class="top">
  5. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" activeColor="#6FB6B8"></uni-segmented-control>
  6. </view>
  7. <view class="gap"></view>
  8. <!-- 主体内容区域 -->
  9. <view class="body">
  10. <!-- 左边区域 -->
  11. <view class="body_left">
  12. <view class="body_left_item" :class="{ active: active_left === index }" v-for="(item, index) in leftList" :key="index" @click="handleChange(index)">
  13. {{ item }}
  14. </view>
  15. </view>
  16. <!-- 右边区域 -->
  17. <view class="body_right">
  18. <view class="body_right_item" :class="{ active: active_right === index }" v-for="(item, index) in rightList" :key="index" @click="handleChange2(index)">
  19. {{ item }}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. items: ['黄家湖校区', '墨轩湖校区'],
  30. current: 0,
  31. leftList: ['教学楼', '行政楼', '综合楼', '科技楼', '学生宿舍', '其他'],
  32. rightList: ['1栋', '2栋', '3栋', '4栋', '5栋', '6栋', '7栋', '8栋', '体育场', '篮球场', '其他'],
  33. active_left: 0,
  34. active_right: 0
  35. }
  36. },
  37. methods: {
  38. onClickItem(e) {
  39. if (this.current != e.currentIndex) {
  40. this.current = e.currentIndex
  41. console.log(this.current)
  42. }
  43. },
  44. handleChange(index) {
  45. this.active_left = index
  46. },
  47. handleChange2(index) {
  48. this.active_right = index
  49. uni.navigateBack(1)
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. .container {
  56. width: 100vw;
  57. height: 100vh;
  58. .top {
  59. height: 100rpx;
  60. }
  61. .gap {
  62. height: 10rpx;
  63. background-color: #f2f2f2;
  64. }
  65. .body {
  66. display: flex;
  67. height: calc(100vh - 110rpx);
  68. .body_left {
  69. box-sizing: border-box;
  70. padding: 15rpx;
  71. width: 198rpx;
  72. border-right: 1rpx solid #ccc;
  73. overflow-y: auto;
  74. .body_left_item {
  75. width: 100%;
  76. height: 80rpx;
  77. line-height: 80rpx;
  78. text-align: center;
  79. font-size: 28rpx;
  80. overflow: hidden;
  81. white-space: nowrap;
  82. text-overflow: ellipsis;
  83. }
  84. .active {
  85. color: #6fb6b8;
  86. }
  87. }
  88. .body_right {
  89. box-sizing: border-box;
  90. padding: 30rpx 40rpx;
  91. width: 552rpx;
  92. overflow-y: auto;
  93. .body_right_item {
  94. float: left;
  95. box-sizing: border-box;
  96. margin: 0 12rpx 28rpx 0;
  97. padding: 10rpx 30rpx;
  98. height: 50rpx;
  99. line-height: 30rpx;
  100. text-align: center;
  101. color: #808080;
  102. font-size: 28rpx;
  103. border-radius: 53rpx;
  104. background-color: #e6e6e6;
  105. overflow: hidden;
  106. white-space: nowrap;
  107. text-overflow: ellipsis;
  108. }
  109. .active {
  110. color: #fff;
  111. background-color: #6fb6b8;
  112. }
  113. }
  114. }
  115. }
  116. ::v-deep .segmented-control {
  117. height: 100rpx;
  118. }
  119. </style>