repairs.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. <template>
  2. <view class="container">
  3. <!-- 公告区域 -->
  4. <view class="notice">
  5. <uni-notice-bar show-icon single speed="50" :scrollable="true" background-color="#fff" color="#000" text="今日14:00系统更新请不要进行报修!" />
  6. </view>
  7. <view class="gap"></view>
  8. <!-- 报修区域 -->
  9. <view class="box_item">
  10. <view class="item_title">
  11. 报修区域
  12. <text>*</text>
  13. </view>
  14. <view class="item_info" @click="handleSelectArea">请选择报修区域</view>
  15. <view class="item_icon" @click="handleSelectArea">
  16. <img src="../../static/images/repairsImg/right.png" />
  17. </view>
  18. </view>
  19. <!-- 详细地址区域 -->
  20. <view class="box_item">
  21. <view class="item_title">
  22. 详细地址
  23. <text>*</text>
  24. </view>
  25. <view class="item_info">
  26. <view class="item_input">
  27. <input placeholder-style="color:#CCCCCC" type="text" placeholder="请输入详细地址" />
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 报修物品区域 -->
  32. <view class="box_item">
  33. <view class="item_title">
  34. 报修物品
  35. <text>*</text>
  36. </view>
  37. <view class="item_info" @click="handleSelectGoods">请选择报修物品</view>
  38. <view class="item_icon" @click="handleSelectGoods">
  39. <img src="../../static/images/repairsImg/right.png" />
  40. </view>
  41. </view>
  42. <!-- 故障描述 -->
  43. <view class="box_item2">
  44. <view class="item2_title">
  45. 故障描述
  46. <text>*</text>
  47. </view>
  48. <view class="item2_info">
  49. <view class="item2_textarea">
  50. <textarea placeholder-style="color:#CCCCCC" placeholder="请输入故障描述"></textarea>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 报修录音区域 -->
  55. <view class="box_item">
  56. <view class="item_title">报修录音</view>
  57. <view class="item_info">
  58. <view class="info_icon" @click="handleRecording">
  59. <img src="../../static/images/repairsImg/voice.png" />
  60. </view>
  61. <view class="info_tips" @click="handleRecording">点击录音</view>
  62. </view>
  63. </view>
  64. <!-- 录音弹窗区域 -->
  65. <uni-popup ref="popup_recording">
  66. <view class="popup_recording">
  67. <recording />
  68. </view>
  69. </uni-popup>
  70. <!-- 上传照片区域 -->
  71. <view class="box_item3">
  72. <view class="item3_title">
  73. 上传照片
  74. <text>(可上传三张,请上传局部图和区域图)</text>
  75. </view>
  76. <uni-file-picker
  77. ref="filePicker"
  78. limit="3"
  79. v-model="imgList"
  80. fileMediatype="image"
  81. :image-styles="imageStyles"
  82. mode="grid"
  83. @select="select"
  84. @delete="handleDelete"
  85. ></uni-file-picker>
  86. </view>
  87. <!-- 报修姓名区域 -->
  88. <view class="box_item">
  89. <view class="item_title">
  90. 报修姓名
  91. <text>*</text>
  92. </view>
  93. <view class="item_info">
  94. <view class="item_input">
  95. <input placeholder-style="color:#CCCCCC" type="text" placeholder="请输入报修姓名" />
  96. </view>
  97. </view>
  98. </view>
  99. <!-- 联系电话区域 -->
  100. <view class="box_item">
  101. <view class="item_title">
  102. 联系电话
  103. <text>*</text>
  104. </view>
  105. <view class="item_info">
  106. <view class="item_input">
  107. <input placeholder-style="color:#CCCCCC" type="text" placeholder="请输入联系电话" />
  108. </view>
  109. </view>
  110. </view>
  111. <!-- 底部区域 -->
  112. <view class="foot">
  113. <view class="foot_btn">确认提交</view>
  114. <view class="foot_phone" @click="handleCallPhone('13820846714')">紧急电话 5661626</view>
  115. <view class="foot_phone" @click="handleCallPhone('13820846714')">服务监督电话 5661626</view>
  116. </view>
  117. <!-- 消息通知按钮区域 -->
  118. <view class="fixed" @tap="handleClickFixed">
  119. <view class="fixed_box">
  120. <img src="../../static/images/repairsImg/message.png" />
  121. 消息通知
  122. </view>
  123. </view>
  124. <!-- 用于图片压缩的canvas画布 -->
  125. <canvas
  126. :style="{
  127. width: cw + 'px',
  128. height: cw + 'px',
  129. position: 'absolute',
  130. zIndex: -1,
  131. left: '-10000rpx',
  132. top: '-10000rpx'
  133. }"
  134. canvas-id="zipCanvas"
  135. ></canvas>
  136. <!--画布结束-->
  137. </view>
  138. </template>
  139. <script>
  140. import recording from '../components/recording2.vue'
  141. // 图片压缩方法
  142. import getLessLimitSizeImage from '../util/imageCompress.js'
  143. export default {
  144. components: {
  145. recording
  146. },
  147. data() {
  148. return {
  149. // 显示的图片数据
  150. imgList: [],
  151. // 上传的图片数据
  152. subImgList: [],
  153. // 图片上传框的样式
  154. imageStyles: {
  155. width: 60,
  156. height: 60,
  157. border: {
  158. color: '#ccc',
  159. width: 1,
  160. style: 'dashed',
  161. radius: '9px'
  162. }
  163. },
  164. //画板边长默认是屏幕宽度,正方形画布
  165. cw: uni.getSystemInfoSync().windowWidth
  166. }
  167. },
  168. methods: {
  169. // 选择图片回调
  170. select(e) {
  171. console.log(e)
  172. e.tempFiles.forEach((item) => {
  173. //这里的id和页面中写的html代码的canvas的id要一致
  174. let canvasId = 'zipCanvas'
  175. //原图的路径
  176. let imagePath = item.path
  177. //大小限制1024kb
  178. let limitSize = 1024
  179. //初始绘画区域是画布自身的宽度也就是屏幕宽度
  180. let drawWidth = uni.getSystemInfoSync().windowWidth
  181. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, (resPath) => {
  182. uni.showLoading({
  183. title: '上传中'
  184. })
  185. uni.uploadFile({
  186. url: `https://jiangxih3cpartner.com/reporting/file/fileUpDown`,
  187. filePath: resPath,
  188. name: 'file',
  189. success: (uploadFileRes) => {
  190. subImgList.value.push(JSON.parse(uploadFileRes.data).data.join())
  191. imgList.value.push({
  192. url: item.path,
  193. name: ''
  194. })
  195. uni.hideLoading()
  196. },
  197. fail: () => {
  198. uni.showToast({
  199. title: '上传失败',
  200. icon: 'error'
  201. })
  202. }
  203. })
  204. })
  205. })
  206. },
  207. // 删除图片回调
  208. handleDelete(e) {
  209. // console.log(e);
  210. const num = imgList.value.findIndex((v) => v.url === e.tempFilePath)
  211. subImgList.value.splice(num, 1)
  212. imgList.value.splice(num, 1)
  213. },
  214. // 点击报修区域回调
  215. handleSelectArea() {
  216. uni.navigateTo({
  217. url: '/pagesRepairs/selectArea/selectArea'
  218. })
  219. },
  220. // 点击报修物品回调
  221. handleSelectGoods() {
  222. uni.navigateTo({
  223. url: '/pagesRepairs/selectGoods/selectGoods'
  224. })
  225. },
  226. // 点击消息通知按钮回调
  227. handleClickFixed() {
  228. uni.navigateTo({
  229. url: '/pagesRepairs/message/message'
  230. })
  231. },
  232. // 点击电话号码回调
  233. handleCallPhone(phone) {
  234. console.log(phone)
  235. uni.makePhoneCall({
  236. phoneNumber: phone
  237. })
  238. },
  239. // 点击录音按钮回调
  240. handleRecording() {
  241. this.$refs.popup_recording.open('bottom')
  242. }
  243. }
  244. }
  245. </script>
  246. <style lang="scss" scoped>
  247. .container {
  248. width: 100vw;
  249. height: calc(100vh - 152rpx);
  250. overflow-y: auto;
  251. .notice {
  252. height: 90rpx;
  253. }
  254. .gap {
  255. height: 12rpx;
  256. background-color: #f2f2f2;
  257. }
  258. .box_item {
  259. display: flex;
  260. align-items: center;
  261. margin: 0 30rpx;
  262. height: 105rpx;
  263. font-size: 28rpx;
  264. border-bottom: 1rpx solid #e6e6e6;
  265. .item_title {
  266. width: 190rpx;
  267. font-weight: bold;
  268. text {
  269. margin-left: 5rpx;
  270. color: #d43030;
  271. }
  272. }
  273. .item_info {
  274. flex: 1;
  275. display: flex;
  276. padding: 0 10rpx;
  277. color: #cccccc;
  278. .item_input {
  279. width: 100%;
  280. height: 105rpx;
  281. input {
  282. height: 105rpx;
  283. line-height: 105rpx;
  284. color: #000;
  285. }
  286. }
  287. .info_icon {
  288. display: flex;
  289. justify-content: center;
  290. align-items: center;
  291. width: 79rpx;
  292. height: 37rpx;
  293. border-radius: 33rpx;
  294. border: 1rpx solid #e6e6e6;
  295. img {
  296. width: 26rpx;
  297. height: 26rpx;
  298. }
  299. }
  300. .info_tips {
  301. margin-left: 33rpx;
  302. font-size: 28rpx;
  303. color: #cccccc;
  304. }
  305. }
  306. .item_icon {
  307. width: 38rpx;
  308. height: 38rpx;
  309. img {
  310. width: 100%;
  311. height: 100%;
  312. }
  313. }
  314. }
  315. .box_item2 {
  316. display: flex;
  317. align-items: center;
  318. margin: 0 30rpx;
  319. height: 237rpx;
  320. font-size: 28rpx;
  321. border-bottom: 1rpx solid #e6e6e6;
  322. .item2_title {
  323. width: 190rpx;
  324. font-weight: bold;
  325. text {
  326. margin-left: 5rpx;
  327. color: #d43030;
  328. }
  329. }
  330. .item2_info {
  331. flex: 1;
  332. padding: 0 10rpx;
  333. .item2_textarea {
  334. display: flex;
  335. align-items: center;
  336. width: 100%;
  337. height: 237rpx;
  338. textarea {
  339. box-sizing: border-box;
  340. padding: 20rpx;
  341. width: 500rpx;
  342. height: 176rpx;
  343. border: 1rpx solid #e6e6e6;
  344. border-radius: 6rpx;
  345. }
  346. }
  347. }
  348. }
  349. .box_item3 {
  350. margin: 0 30rpx;
  351. height: 246rpx;
  352. border-bottom: 1rpx solid #e6e6e6;
  353. .item3_title {
  354. height: 95rpx;
  355. line-height: 95rpx;
  356. font-size: 28rpx;
  357. font-weight: bold;
  358. text {
  359. font-size: 24rpx;
  360. color: #808080;
  361. font-weight: 400;
  362. }
  363. }
  364. }
  365. .foot {
  366. display: flex;
  367. flex-direction: column;
  368. align-items: center;
  369. margin: 0 30rpx;
  370. height: 407rpx;
  371. .foot_btn {
  372. margin-top: 167rpx;
  373. width: 100%;
  374. height: 100rpx;
  375. line-height: 100rpx;
  376. text-align: center;
  377. color: #fff;
  378. font-size: 32rpx;
  379. border-radius: 12rpx;
  380. background-color: #6fb6b8;
  381. }
  382. .foot_phone {
  383. margin-top: 30rpx;
  384. color: #b3b3b3;
  385. font-size: 24rpx;
  386. }
  387. }
  388. .fixed {
  389. z-index: 2;
  390. position: fixed;
  391. right: 0;
  392. bottom: 155rpx;
  393. display: flex;
  394. justify-content: center;
  395. align-items: center;
  396. width: 211rpx;
  397. height: 90rpx;
  398. border-radius: 150rpx 0 0 150rpx;
  399. border: 1rpx solid #d9d9d9;
  400. background-color: #fff;
  401. box-shadow: 0 0 7rpx #d9d9d9;
  402. .fixed_box {
  403. display: flex;
  404. align-items: center;
  405. font-size: 28rpx;
  406. img {
  407. margin-right: 10rpx;
  408. width: 38rpx;
  409. height: 38rpx;
  410. }
  411. }
  412. }
  413. .popup_recording {
  414. width: 100%;
  415. height: 460rpx;
  416. background-color: #fff;
  417. }
  418. }
  419. </style>