car.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="fs-car" :class="modelValue ? 'show' : ''">
  3. <view class="fs-car-header">
  4. <view class="fs-car-header-btn" @click="handleClose">
  5. 关闭
  6. </view>
  7. </view>
  8. <view class="fs-car-inner">
  9. <view class="swiper-item">
  10. <view class="swiper-item-inner" v-for="(item, index) in keyboardList" :key="index">
  11. <view v-if="item !== '#' && item !== 'del'" @click="handleAction(item)" class="swiper-item-word">{{item}}</view>
  12. <view v-if="item == 'del'" class="swiper-item-del" @click="handleAction(item)">
  13. <fs-icon type="icon-backspace" size="50rpx"></fs-icon>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script setup>
  21. import { ref, computed, watch } from 'vue'
  22. const props = defineProps({
  23. modelValue: Boolean,
  24. index: {
  25. type: Number,
  26. default: 0
  27. }
  28. })
  29. const emits = defineEmits(['update:modelValue', 'update:index', 'change', 'close'])
  30. const keyboard1 = ['晋','京','津','冀','蒙','辽','吉','黑','沪','苏','浙','皖','闽','赣','鲁','豫','鄂','湘','粤','桂','琼','渝','川','贵','云','藏','陕','甘','青','宁','新','台','港','澳','#','#','#','#','#','#','del'
  31. ]
  32. const keyboard2 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S','T', 'U', 'V', 'W', 'X', 'Y', 'Z','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','del'
  33. ]
  34. const keyboard3 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',1,2,3,4,5,6,7,8,9,0,'使','领','学','#','#','del'
  35. ]
  36. let keyboardList = computed(() => {
  37. if (props.index === 0) {
  38. return keyboard1
  39. } else if (props.index === 1) {
  40. return keyboard2
  41. } else {
  42. return keyboard3
  43. }
  44. })
  45. const handleAction = item => {
  46. emits('change', item)
  47. }
  48. const handleClose = () => {
  49. emits('close')
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. $height: 750rpx;
  54. .fs-car {
  55. position: fixed;
  56. bottom: 0;
  57. left: 0;
  58. right: 0;
  59. z-index: 999;
  60. background-color: #d7d8dc;
  61. height: $height;
  62. transform: translateY(100%);
  63. transition: all .3s;
  64. &-header {
  65. height: 80rpx;
  66. display: flex;
  67. justify-content: flex-end;
  68. align-items: center;
  69. padding-top: 25rpx;
  70. padding-right: 25rpx;
  71. box-sizing: border-box;
  72. &-btn {
  73. background: #fff;
  74. height: 65rpx;
  75. line-height: 65rpx;
  76. padding: 0 15rpx;
  77. border-radius: 8rpx;
  78. }
  79. }
  80. &-inner {
  81. height: calc($height - 80rpx);
  82. width: 100%;
  83. .swiper-item {
  84. height: calc($height - 80rpx);
  85. width: 100%;
  86. display: flex;
  87. justify-content: space-between;
  88. flex-wrap: wrap;
  89. padding: 25rpx;
  90. box-sizing: border-box;
  91. .swiper-item-inner {
  92. width: calc(100% / 6);
  93. display: flex;
  94. justify-content: center;
  95. align-items: center;
  96. height: 75rpx;
  97. margin-bottom: calc(((100% / 6) - 40rpx) / 5);
  98. .swiper-item-word {
  99. width: 100rpx;
  100. height: 75rpx;
  101. border-radius: 8rpx;
  102. background-color: #f0f1f5;
  103. font-size: 33rpx;
  104. line-height: 75rpx;
  105. text-align: center;
  106. color: #222;
  107. font-weight: bold;
  108. transition: all 0.2s;
  109. box-shadow: 1px 0 25px #dfdfdf, 0 1px 0 #cfcfcf, 0 1px 0 #bfbfbf, 0 1px 1px #6f6f6f;
  110. &:active {
  111. opacity: 0.8;
  112. background-color: #ffffff;
  113. transform: translateY(-5rpx);
  114. }
  115. }
  116. .swiper-item-del {
  117. width: 100rpx;
  118. height: 75rpx;
  119. border-radius: 8rpx;
  120. background-color: #f0f1f5;
  121. transition: all 0.2s;
  122. box-shadow: 1px 0 25px #dfdfdf, 0 1px 0 #cfcfcf, 0 1px 0 #bfbfbf, 0 1px 1px #6f6f6f;
  123. display: flex;
  124. justify-content: center;
  125. align-items: center;
  126. &:active {
  127. opacity: 0.8;
  128. background-color: #ffffff;
  129. transform: translateY(-5rpx);
  130. }
  131. }
  132. }
  133. }
  134. }
  135. }
  136. .show {
  137. transform: translateY(0);
  138. }
  139. </style>