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.

operation-upload.vue 5.1KB

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