鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
2.5 KiB

  1. <template>
  2. <view class="flex card">
  3. <view>
  4. <uv-checkbox-group
  5. v-model="selectCheckboxValue"
  6. @change="onSelectChange"
  7. >
  8. <uv-checkbox
  9. size="36rpx"
  10. icon-size="36rpx"
  11. activeColor="#00A9FF"
  12. :name="1"
  13. ></uv-checkbox>
  14. </uv-checkbox-group>
  15. </view>
  16. <view class="info">
  17. <view class="flex name">
  18. <view>{{ data.name }}</view>
  19. <view :class="['tag', `tag-${type}`]">{{ typeDesc }}</view>
  20. </view>
  21. <view class="id">{{ data.cerNo }}</view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. data: {
  29. type: Object,
  30. default() {
  31. return {}
  32. }
  33. },
  34. },
  35. data() {
  36. return {
  37. selectCheckboxValue: [],
  38. }
  39. },
  40. computed: {
  41. isSelected: {
  42. set(val) {
  43. this.selectCheckboxValue = val ? [1]: []
  44. if (this.data.isSelected == val) {
  45. return
  46. }
  47. this.$emit('selectChange', val)
  48. },
  49. get() {
  50. return this.selectCheckboxValue.length ? true : false
  51. }
  52. },
  53. typeDesc() {
  54. const { periodId } = this.data
  55. return this.configList.periodList?.find?.(item => item.id === periodId)?.title
  56. },
  57. type() {
  58. if (this.typeDesc == '青少年') {
  59. return 1
  60. }
  61. if (this.typeDesc == '儿童') {
  62. return 2
  63. }
  64. return 0
  65. },
  66. },
  67. watch: {
  68. data: {
  69. handler(val) {
  70. this.isSelected = val.isSelected
  71. },
  72. immediate: true,
  73. deep: true,
  74. }
  75. },
  76. methods: {
  77. onSelectChange(val) {
  78. this.isSelected = val.length ? true : false
  79. },
  80. }
  81. }
  82. </script>
  83. <style scoped lang="scss">
  84. .card {
  85. justify-content: flex-start;
  86. column-gap: 24rpx;
  87. padding: 24rpx;
  88. background: #F9F9F9;
  89. }
  90. .info {
  91. .name {
  92. justify-content: flex-start;
  93. column-gap: 24rpx;
  94. font-size: 32rpx;
  95. color: #181818;
  96. .tag {
  97. padding: 2rpx 14rpx;
  98. font-size: 24rpx;
  99. color: #00A9FF;
  100. background: #E9F8FF;
  101. border: 2rpx solid #00A9FF;
  102. border-radius: 8rpx;
  103. &-1 {
  104. color: #03C25C;
  105. background: #E9FFF5;
  106. border-color: #03C25C;
  107. }
  108. &-2 {
  109. color: #EE6E05;
  110. background: #FFEFE9;
  111. border-color: #EE6E05;
  112. }
  113. }
  114. }
  115. .id {
  116. margin-top: 8rpx;
  117. font-size: 28rpx;
  118. color: #9B9B9B;
  119. }
  120. }
  121. </style>