repairs.vue 8.6 KB

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