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 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <!-- 设备激活2-上传图片 -->
  2. <template>
  3. <view class="main" :style="{minHeight: height+'px'}">
  4. <view class="item-row">
  5. <view class="item-left">
  6. <view class="title">车身照</view>
  7. <view class="desc">上传汽车的45度车身照片</view>
  8. <view class="flag"><text>拍摄示例</text> </view>
  9. </view>
  10. <view class="item-right" @click="chooseImage(1)">
  11. <image :src="state.headstockImg ?state.headstockImg: defHeadstockImg"
  12. :data-url="state.headstockImg ?state.headstockImg: defHeadstockImg">
  13. </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. <image :src="state.installImg ?state.installImg: defInstallImg"></image>
  24. </view>
  25. </view> -->
  26. <view class="hint" style="margin-top: 40rpx;">
  27. <image :src="`${$imgUrl}common/icon-hint.png`" class="icon"></image>
  28. <view>请打开手机蓝牙后再进行下一步操作。</view>
  29. </view>
  30. <view class="hint">
  31. <image :src="`${$imgUrl}common/icon-hint.png`" class="icon"></image>
  32. <view>运营和服务规则中:车载单元(OBU),安装在车辆内部(风挡玻璃或仪表台上)。</view>
  33. </view>
  34. <view class="open-tips">
  35. <view class="tip-title">开启蓝牙</view>
  36. <view class="item-tips">
  37. <view class="item-title">方式一</view>
  38. <view class="item">
  39. <view class="point"></view>打开手机的【设置】菜单。
  40. </view>
  41. <view class="item">
  42. <view class="point"></view>在【设置】菜单中,找到【蓝牙】选项。
  43. </view>
  44. <view class="item">
  45. <view class="point"></view>点击【蓝牙】选项,然后打开蓝牙开关。
  46. </view>
  47. </view>
  48. <view class="item-tips">
  49. <view class="item-title">方式二</view>
  50. <view class="item">
  51. <view class="point"></view>下拉打开通知栏。
  52. </view>
  53. <view class="item">
  54. <view class="point"></view>然后打开蓝牙开关。
  55. </view>
  56. </view>
  57. </view>
  58. <view class="action">
  59. <button type="default" class="ui-btn" @click="gotoNextStep">
  60. 下一步
  61. </button>
  62. </view>
  63. </view>
  64. </template>
  65. <script setup>
  66. import {
  67. reactive
  68. } from "vue";
  69. import {
  70. msg,
  71. navTo,
  72. uploadFile
  73. } from '@/utils/utils';
  74. import {
  75. fileURL
  76. } from "@/datas/fileURL.js";
  77. import {
  78. getItem
  79. } from "@/utils/storage";
  80. const imgURL = `${fileURL}image/`;
  81. import {
  82. requestNew
  83. } from "@/utils/network/request.js";
  84. import {
  85. stringToJson
  86. } from "@/utils/network/encryption.js";
  87. import {
  88. activeImgUpload
  89. } from "@/utils/network/api.js";
  90. import {
  91. onLoad
  92. } from '@dcloudio/uni-app'
  93. const height = uni.getSystemInfoSync().windowHeight
  94. const defHeadstockImg = imgURL + "issuance/chetou.png";
  95. const defInstallImg = imgURL + "issuance/shebei.png";
  96. const state = reactive({
  97. headstockImg: null, //车头照
  98. installImg: null, //安装照
  99. id: null,
  100. orderId: null,
  101. openId: null,
  102. transfer: 0,
  103. isAfter: ''
  104. });
  105. onLoad((option) => {
  106. //读取传入 存储的数据orderInfo
  107. let orderData = getItem("orderInfo");
  108. state.id = orderData.id;
  109. state.orderId = orderData.orderId;
  110. state.openId = getItem("openId");
  111. state.transfer = option.transfer
  112. state.isAfter = option.isAfter
  113. console.log(state);
  114. })
  115. //选择图片
  116. const chooseImage = (type) => {
  117. uni.chooseImage({
  118. count: 1,
  119. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  120. sourceType: ['camera'],
  121. success: function(res) {
  122. console.log(res.tempFilePaths);
  123. uploadFile(res.tempFilePaths[0], "", "").then((data) => {
  124. if (type === 1) { //车头照
  125. state.headstockImg = data;
  126. } else { //安装照
  127. state.installImg = data;
  128. }
  129. })
  130. }
  131. });
  132. }
  133. //下一步
  134. const gotoNextStep = () => {
  135. if (!state.headstockImg || !state.installImg) {
  136. msg('请按照要求上传图片!');
  137. return;
  138. }
  139. uni.openBluetoothAdapter()
  140. /* 判断是否打开蓝牙 */
  141. uni.getBluetoothAdapterState({
  142. success(res) {
  143. //如果res.avaliable==false 说明没打开蓝牙 反之则打开
  144. if (res.available == false) {
  145. uni.showToast({
  146. title: '请打开手机蓝牙',
  147. icon: "error",
  148. duration: 2000
  149. })
  150. return
  151. } else {
  152. // const options = {
  153. // type: 2,
  154. // data: {
  155. // orderId: state.orderId,
  156. // vehicleBodyImgUrl: state.headstockImg,
  157. // installImgUrl: state.installImg,
  158. // orderSource: "WECHAT",
  159. // openId: state.openId,
  160. // },
  161. // method: "POST",
  162. // showLoading: true,
  163. // };
  164. // requestNew(activeImgUpload, options).then((res) => {
  165. navTo(`/pages/bluetooth/bluetooth?routeType=1&transfer=${state.transfer}&isAfter=${state.isAfter}`)
  166. // });
  167. }
  168. }
  169. })
  170. }
  171. </script>
  172. <style>
  173. page {
  174. background: #F3F3F3;
  175. }
  176. </style>
  177. <style lang="scss" scoped>
  178. .main {
  179. background: #E9EDF0;
  180. padding-bottom:160rpx;
  181. position: relative;
  182. box-sizing: border-box;
  183. .action {
  184. position: absolute;
  185. bottom: 0rpx;
  186. left: 0;
  187. height: 128rpx;
  188. background-color: #fff;
  189. border-radius: 30rpx 30rpx 0 0;
  190. width: 100vw;
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. flex-direction: column;
  195. }
  196. .item-row {
  197. width: 690rpx;
  198. height: 240rpx;
  199. margin: 30rpx auto 0;
  200. display: flex;
  201. justify-content: space-between;
  202. background: white;
  203. padding: 30rpx;
  204. border-radius: 20rpx;
  205. box-sizing: border-box;
  206. .item-left {
  207. .title {
  208. margin-top: 24rpx;
  209. font-size: 32rpx;
  210. color: #111;
  211. font-weight: bold;
  212. }
  213. .desc {
  214. font-size: 24rpx;
  215. color: #999;
  216. margin-top: 6rpx;
  217. }
  218. .flag {
  219. width: 100rpx;
  220. height: 30rpx;
  221. line-height: 30rpx;
  222. margin-top: 20rpx;
  223. border-radius: 5rpx;
  224. text-align: center;
  225. font-size: 20rpx;
  226. border: 1rpx solid #CCB375;
  227. font-family: SourceHanSansSC, SourceHanSansSC;
  228. color: #CCB375;
  229. }
  230. }
  231. .item-right {
  232. width: 288rpx;
  233. height: 174rpx;
  234. position: relative;
  235. image {
  236. position: relative;
  237. z-index: 10;
  238. width: 100%;
  239. height: 174rpx;
  240. }
  241. }
  242. .empty-node {
  243. position: absolute;
  244. z-index: 0;
  245. width: 100%;
  246. height: 100%;
  247. }
  248. }
  249. .hint {
  250. display: flex;
  251. flex-direction: row;
  252. justify-content: center;
  253. font-size: 28rpx;
  254. color: #545454;
  255. padding: 0px 30rpx;
  256. margin-top: 20rpx;
  257. align-items: center;
  258. .icon {
  259. width: 30rpx;
  260. height: 30rpx;
  261. margin-right: 10rpx;
  262. }
  263. view {
  264. width: calc(100% - 36rpx);
  265. }
  266. }
  267. .btn {
  268. margin: 60rpx 40rpx;
  269. }
  270. }
  271. .open-tips {
  272. width: 94%;
  273. margin: 20rpx auto;
  274. font-size: 30rpx;
  275. .tip-title {
  276. font-family: MicrosoftYaHei;
  277. font-size: 32rpx;
  278. color: #111111;
  279. line-height: 35px;
  280. }
  281. }
  282. .item-tips {
  283. margin-top: 10rpx;
  284. overflow: hidden;
  285. .item-title {
  286. font-family: MicrosoftYaHei;
  287. font-size: 28rpx;
  288. color: #111111;
  289. line-height: 35rpx;
  290. }
  291. .item {
  292. font-family: MicrosoftYaHei;
  293. font-size: 28rpx;
  294. color: #999999;
  295. line-height: 48rpx;
  296. display: flex;
  297. align-items: center;
  298. margin-top: 10rpx;
  299. .point {
  300. flex-shrink: 0;
  301. width: 10rpx;
  302. height: 10rpx;
  303. background: #A0A0A0;
  304. margin-right: 16rpx;
  305. border-radius: 50%;
  306. }
  307. }
  308. }
  309. </style>