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.

car-card.vue 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view class="main" :style="{height: height+'px'}">
  3. <view class="item-row">
  4. <view class="item-left">
  5. <view class="title">行驶证正面</view>
  6. <view class="desc">补传行驶证正面</view>
  7. <view class="flag"><text>拍摄示例</text> </view>
  8. </view>
  9. <view class="item-right" @click="chooseImage(1)">
  10. <view class="empty-node"></view>
  11. <image :src="state.headstockImg ?? defHeadstockImg" :data-url="state.headstockImg ?? defHeadstockImg">
  12. </image>
  13. </view>
  14. </view>
  15. <view class="item-row">
  16. <view class="item-left">
  17. <view class="title">行驶证副面</view>
  18. <view class="desc">补传行驶证副面</view>
  19. <view class="flag"><text>拍摄示例</text> </view>
  20. </view>
  21. <view class="item-right" @click="chooseImage(2)">
  22. <view class="empty-node"></view>
  23. <image :src="state.installImg ?? defInstallImg"></image>
  24. </view>
  25. </view>
  26. <view class="btn">
  27. <submit-button @submit="saveHandle" title="保存"></submit-button>
  28. </view>
  29. </view>
  30. </template>
  31. <script lang="ts" setup>
  32. import {
  33. reactive
  34. } from "vue";
  35. import {
  36. msg,
  37. navTo
  38. } from '@/utils/utils';
  39. import {
  40. fileURL
  41. } from "@/datas/fileURL.js";
  42. const height = uni.getSystemInfoSync().windowHeight
  43. const defHeadstockImg = `${fileURL}image/applyCard/car-zhu.png`;
  44. const defInstallImg = `${fileURL}image/applyCard/car-fu.png`;
  45. const state = reactive({
  46. headstockImg: null,
  47. installImg: null
  48. });
  49. //选择图片
  50. const chooseImage = (type: number) => {
  51. uni.chooseImage({
  52. count: 1,
  53. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  54. //sourceType: ['album','camera'],
  55. success: function(res) {
  56. console.log(res.tempFilePaths);
  57. if (type === 1) {
  58. state.headstockImg = res.tempFilePaths[0];
  59. } else {
  60. state.installImg = res.tempFilePaths[0];
  61. }
  62. }
  63. });
  64. }
  65. //下一步
  66. const saveHandle = () => {
  67. if (!state.headstockImg || !state.installImg) {
  68. msg('请按照要求上传图片!');
  69. return;
  70. }
  71. msg('保存成功')
  72. }
  73. </script>
  74. <style>
  75. page {
  76. background: #F3F3F3;
  77. }
  78. </style>
  79. <style lang="scss" scoped>
  80. .main {
  81. overflow: hidden;
  82. .item-row {
  83. display: flex;
  84. justify-content: space-between;
  85. margin-top: 30rpx;
  86. background: white;
  87. padding: 30rpx;
  88. border-radius: 20rpx;
  89. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  90. margin: 30rpx;
  91. .item-left {
  92. .title {
  93. font-size: 34rpx;
  94. color: #333;
  95. font-weight: bold;
  96. }
  97. .desc {
  98. font-size: 24rpx;
  99. color: #999;
  100. margin: 10rpx 0;
  101. }
  102. .flag {
  103. width: 110rpx;
  104. height: 45rpx;
  105. line-height: 42rpx;
  106. color: #0A8F8A;
  107. margin-top: 16rpx;
  108. border-radius: 6rpx;
  109. text-align: center;
  110. font-size: 20rpx;
  111. background: #D9F8F1;
  112. }
  113. }
  114. .item-right {
  115. width: 295rpx;
  116. height: 188rpx;
  117. position: relative;
  118. image {
  119. position: relative;
  120. z-index: 10;
  121. width: 100%;
  122. height: 188rpx;
  123. }
  124. &::before {
  125. content: '';
  126. position: absolute;
  127. width: 22rpx;
  128. height: 22rpx;
  129. border: 4rpx solid #21BEB1;
  130. border-bottom: none;
  131. border-right: none;
  132. z-index: 0;
  133. left: -4rpx;
  134. top: -4rpx;
  135. }
  136. &::after {
  137. content: '';
  138. position: absolute;
  139. width: 22rpx;
  140. height: 22rpx;
  141. border: 4rpx solid #21BEB1;
  142. border-top: none;
  143. border-right: none;
  144. z-index: 0;
  145. left: -4rpx;
  146. bottom: -4rpx;
  147. }
  148. }
  149. .empty-node {
  150. position: absolute;
  151. z-index: 0;
  152. width: 100%;
  153. height: 100%;
  154. &::before {
  155. content: '';
  156. position: absolute;
  157. width: 22rpx;
  158. height: 22rpx;
  159. border: 4rpx solid #21BEB1;
  160. border-left: none;
  161. border-bottom: none;
  162. z-index: 0;
  163. right: -4rpx;
  164. top: -4rpx;
  165. }
  166. &::after {
  167. content: '';
  168. position: absolute;
  169. width: 22rpx;
  170. height: 22rpx;
  171. border: 4rpx solid #21BEB1;
  172. border-top: none;
  173. border-left: none;
  174. z-index: 0;
  175. right: -4rpx;
  176. bottom: -4rpx;
  177. }
  178. }
  179. }
  180. .hint {
  181. display: flex;
  182. flex-direction: row;
  183. justify-content: center;
  184. font-size: 26rpx;
  185. color: #666666;
  186. padding: 0px 30rpx;
  187. margin-top: 60rpx;
  188. .icon {
  189. width: 36rpx;
  190. height: 36rpx;
  191. margin-right: 10rpx;
  192. }
  193. view {
  194. width: calc(100% - 36rpx);
  195. }
  196. }
  197. .btn {
  198. margin: 470rpx 40rpx 30rpx;
  199. }
  200. }
  201. </style>