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.

LicensePlateColor.vue 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div style="padding-left: 30px;margin-top: 10px;">
  3. <div class="container">
  4. <div class="numberplate" v-for="(item,index) in items" :key="index" @click="checkNumberplateColor(item)">
  5. <image class="numberplate-bg" :src="`${fileURL}image/issueActivation/${item.src}.png`"></image>
  6. <view class="numberplate-name" :style="`color:${item.color}`">
  7. <text style="font-size:24rpx">{{numberplate ? numberplate : item.title }}</text>
  8. </view>
  9. <image :src="`${fileURL}image/issueActivation/${item.checkSrc}.png`" class="numberplate-icon-check"
  10. v-if="item.id === curCheckId"></image>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15. <script setup lang='ts'>
  16. import {
  17. ref
  18. } from 'vue'
  19. import {
  20. fileURL
  21. } from '@/static/js/network/api.js';
  22. const emit = defineEmits([
  23. "numberplateResult"
  24. ])
  25. /* 选择车牌颜色 */
  26. const checkNumberplateColor = (item) => {
  27. curCheckId.value = item.id;
  28. emit('numberplateResult', item)
  29. }
  30. const numberplate = ref('') //车牌号
  31. const curCheckId = ref(-1) //当前选择的车牌
  32. const items = [ //车牌颜色
  33. {
  34. src: 'bg-blue',
  35. checkSrc: 'icon-select-blue',
  36. id: 0,
  37. color: '#ffffff',
  38. title: '蓝色'
  39. },
  40. {
  41. src: 'bg-green',
  42. checkSrc: 'icon-select-green',
  43. id: 4,
  44. color: '#ffffff',
  45. title: '渐变绿色'
  46. },
  47. {
  48. src: 'bg-orange',
  49. checkSrc: 'icon-select-orange',
  50. id: 1,
  51. color: '#ffffff',
  52. title: '黄色'
  53. },
  54. {
  55. src: 'bg-yellow_green',
  56. checkSrc: 'icon-select-yellow_green',
  57. id: 5,
  58. color: '#ffffff',
  59. title: '黄绿双拼色'
  60. },
  61. {
  62. src: 'bg-black',
  63. checkSrc: 'icon-select-black',
  64. id: 2,
  65. color: '#ffffff',
  66. title: '黑色'
  67. },
  68. {
  69. src: 'bg-white',
  70. checkSrc: 'icon-select-white',
  71. id: 3,
  72. color: '#000000',
  73. title: '白色'
  74. },
  75. {
  76. src: 'bg-white_blue',
  77. checkSrc: 'icon-select-blue',
  78. id: 6,
  79. color: '#ffffff',
  80. title: '蓝白渐变'
  81. },
  82. {
  83. src: 'green',
  84. checkSrc: 'icon-green',
  85. id: 11,
  86. color: '#ffffff',
  87. title: '绿色'
  88. },
  89. {
  90. src: 'rad',
  91. checkSrc: 'icon-select-red',
  92. id: 12,
  93. color: '#ffffff',
  94. title: '红色'
  95. }
  96. ]
  97. </script>
  98. <style lang='scss' scoped>
  99. .flex-bg {
  100. display: flex;
  101. flex-direction: row;
  102. flex-wrap: wrap;
  103. justify-content: space-between;
  104. align-content: flex-start;
  105. line-height: 10px;
  106. }
  107. .numberplate {
  108. width: 200rpx;
  109. height: 80rpx;
  110. }
  111. .item {
  112. background-color: $uni-bg-color-mask;
  113. }
  114. .container {
  115. display: flex;
  116. flex-wrap: wrap;
  117. justify-content: flex-start;
  118. align-items: center;
  119. gap: 10px;
  120. /* 根据实际情况调整间距大小 */
  121. }
  122. .numberplate {
  123. display: flex;
  124. justify-content: center;
  125. align-items: center;
  126. margin-bottom: 10rpx;
  127. position: relative;
  128. &:nth-child(even){
  129. margin-right: 0rpx;
  130. }
  131. &-bg{
  132. width: 200rpx;
  133. height: 80rpx;
  134. }
  135. &-name{
  136. font-size: 30rpx;
  137. color: white;
  138. position: absolute;
  139. line-height: 80rpx;
  140. }
  141. &-icon-check{
  142. width: 40rpx;
  143. height: 40rpx;
  144. position: absolute;
  145. right: -12rpx;
  146. bottom: -12rpx;
  147. }
  148. }
  149. </style>