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.

131 lines
3.0 KiB

4 months ago
4 months ago
3 months ago
  1. <template>
  2. <view class="content">
  3. <up-navbar title="选择类型" @rightClick="rightClick" :autoBack="true"></up-navbar>
  4. <view class="tit">请选择需要学习的题库类型</view>
  5. <view class="ul">
  6. <view class="li" v-for="(item,index) in tabData" :key="index" @click="chooseCar(item)" :class="{active: item.name==currentCar}">
  7. <view class="checkBox" v-if="item.name==currentCar">
  8. <image src="@/static/images/dg.png" mode=""></image>
  9. </view>
  10. <view class="icon" :style="item.style">
  11. <image :src="item.icon" mode=""></image>
  12. </view>
  13. <view class="name">{{item.name}}</view>
  14. <view class="carType">{{ item.type }}</view>
  15. </view>
  16. </view>
  17. <view class="btnBox">
  18. <oneBtn text="确 定" @oneBtnClick="oneBtnClick"></oneBtn>
  19. </view>
  20. </view>
  21. </template>
  22. <script setup>
  23. import {
  24. ref,
  25. reactive
  26. } from 'vue';
  27. import {
  28. onLoad,
  29. onReady
  30. } from "@dcloudio/uni-app"
  31. const rightClick = () => {
  32. console.log('rightClick');
  33. };
  34. const tabData = ref([
  35. {name: '小车', type: 'C1/C2/C3', style: 'width: 114rpx;height: 61rpx;', icon: new URL('@/static/images/car4.png', import.meta.url).href, id: '1'},
  36. {name: '货车', type: 'A2/B2', style: 'width: 106rpx;height: 68rpx;', icon: new URL('@/static/images/car2.png', import.meta.url).href, id: '1'},
  37. {name: '客车', type: 'A1/B1/A3', style: 'width: 106rpx;height: 68rpx;', icon: new URL('@/static/images/car1.png', import.meta.url).href, id: '1'},
  38. {name: '摩托车', type: 'D/E/F', style: 'width: 102rpx;height: 73rpx;', icon: new URL('@/static/images/car3.png', import.meta.url).href, id: '1'},
  39. ])
  40. const currentCar = ref('小车')
  41. function chooseCar(item) {
  42. currentCar.value = item.name
  43. }
  44. function oneBtnClick() {
  45. uni.navigateTo({
  46. url: '/pages/exercises/theoryStudy/theoryStudy'
  47. })
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. image {
  52. display: block;
  53. width: 100%;
  54. height: 100%;
  55. }
  56. .btnBox {
  57. position: fixed;
  58. bottom: 70rpx;
  59. left: 0;
  60. padding: 20px;
  61. width: 100%;
  62. }
  63. .content {
  64. width: 100%;
  65. up-navbar {
  66. }
  67. .tit {
  68. padding: 40rpx 0;
  69. font-size: 36rpx;
  70. color: #333;
  71. font-weight: 700;
  72. }
  73. .ul {
  74. display: flex;
  75. flex-wrap: wrap;
  76. padding: 0 20px;
  77. justify-content: space-between;
  78. .li {
  79. width: 190rpx;
  80. height: 190rpx;
  81. border-radius: 10rpx;
  82. padding-top: 20rpx;
  83. position: relative;
  84. display: flex;align-items: center;justify-content: center;margin: 30rpx 0rpx 0 0 ;flex-direction: column;
  85. &.active {
  86. background: #EDF8FF;
  87. }
  88. .checkBox {
  89. position: absolute;
  90. top: 0;
  91. right: 0;
  92. width: 36rpx;
  93. height: 36rpx;
  94. background: #4DBEFF;
  95. border-radius: 0px 10rpx 0px 10rpx;
  96. display: flex;
  97. align-items: center;
  98. justify-content: center;
  99. image {
  100. display: block;
  101. width: 32rpx;
  102. height: 23rpx;
  103. }
  104. }
  105. .icon {
  106. }
  107. .name {
  108. font-size: 28rpx;
  109. margin: 4rpx 0;
  110. }
  111. .carType {
  112. font-size: 24rpx;
  113. color: #ccc;
  114. }
  115. }
  116. }
  117. }
  118. </style>