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.0KB

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