SelectStudents.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="select-stu">
  3. <view v-for="(item,index) in list" :key="index" class="select-stu-item">
  4. <view @click.stop="open(item)" class="select-stu-item-title">
  5. <view class="select-stu-item-title-icon">
  6. <uni-icons v-if="item.open" color="#999" type="bottom" size="14"></uni-icons>
  7. <uni-icons v-else color="#999" type="forward" size="14"></uni-icons>
  8. </view>
  9. <view class="">
  10. {{item.title}}
  11. </view>
  12. <view @click.stop="allItem(item)" class="select-stu-item-title-radio">
  13. <view v-if="item.show" class="select-stu-item-title-radio-true">
  14. <uni-icons color="#fff" type="checkmarkempty" size="12"></uni-icons>
  15. </view>
  16. <view v-else class="select-stu-item-title-radio-false">
  17. </view>
  18. </view>
  19. </view>
  20. <uni-transition ref="ani" custom-class="transition" :mode-class="['fade', 'slide-right']" :show="item.open">
  21. <view class="child">
  22. <view @click="selectItem(item1)" v-for="(item1,index1) in item.children" :key="index1"
  23. class="child-item">
  24. <view class="child-item-radio">
  25. <view v-if="item1.show" class="select-stu-item-title-radio-true">
  26. <uni-icons color="#fff" type="checkmarkempty" size="12"></uni-icons>
  27. </view>
  28. <view v-else class="select-stu-item-title-radio-false">
  29. </view>
  30. </view>
  31. <view class="child-item-img">
  32. <image style="width: 100%;height: 100%;border: 50%;" src="@/static/image/female.png"
  33. mode=""></image>
  34. </view>
  35. <view style="margin-left: 32rpx;font-size: 24rpx;" class="">
  36. <view class="">
  37. {{item1.title}}
  38. </view>
  39. <view style="color: #999;" class="">
  40. {{item1.id}}
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </uni-transition>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. name: "SelectStudents",
  52. props: {
  53. list: {
  54. type: Array,
  55. default: () => []
  56. }
  57. },
  58. data() {
  59. return {
  60. };
  61. },
  62. methods: {
  63. open(item) {
  64. item.open = !item.open
  65. this.$emit('update:list', this.list)
  66. },
  67. selectItem(item) {
  68. item.show = !item.show
  69. this.$emit('update:list', this.list)
  70. },
  71. allItem(item) {
  72. item.show = !item.show
  73. if (item.show) {
  74. item.children.forEach(item1 => {
  75. item1.show = true
  76. })
  77. } else {
  78. item.children.forEach(item1 => {
  79. item1.show = false
  80. })
  81. }
  82. this.$emit('update:list', this.list)
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .child-item {
  89. width: 100%;
  90. display: flex;
  91. padding: 24rpx 0;
  92. align-items: center;
  93. .child-item-img {
  94. width: 80rpx;
  95. height: 80rpx;
  96. margin-left: 32rpx;
  97. }
  98. .child-item-radio {
  99. .select-stu-item-title-radio-true {
  100. width: 36rpx;
  101. box-sizing: border-box;
  102. height: 36rpx;
  103. border-radius: 50%;
  104. background-color: rgba(5, 204, 161, 1);
  105. text-align: center;
  106. line-height: 36rpx;
  107. font-size: 24rpx;
  108. color: #fff;
  109. }
  110. .select-stu-item-title-radio-false {
  111. width: 36rpx;
  112. box-sizing: border-box;
  113. height: 36rpx;
  114. border-radius: 50%;
  115. border: 1px solid rgba(5, 204, 161, 1);
  116. }
  117. }
  118. }
  119. .select-stu {
  120. width: 100%;
  121. }
  122. .select-stu-item {
  123. width: 100%;
  124. .select-stu-item-title {
  125. display: flex;
  126. height: 80rpx;
  127. align-items: center;
  128. }
  129. .select-stu-item-title-icon {
  130. margin-right: 10rpx;
  131. }
  132. .select-stu-item-title-radio {
  133. display: flex;
  134. align-items: center;
  135. margin-left: 10rpx;
  136. justify-content: center;
  137. .select-stu-item-title-radio-true {
  138. width: 36rpx;
  139. box-sizing: border-box;
  140. height: 36rpx;
  141. border-radius: 50%;
  142. background-color: rgba(5, 204, 161, 1);
  143. text-align: center;
  144. line-height: 36rpx;
  145. font-size: 24rpx;
  146. color: #fff;
  147. }
  148. .select-stu-item-title-radio-false {
  149. width: 36rpx;
  150. box-sizing: border-box;
  151. height: 36rpx;
  152. border-radius: 50%;
  153. border: 1px solid rgba(5, 204, 161, 1);
  154. }
  155. }
  156. }
  157. </style>