| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {uploadImage} from "@/common/upload"; |
| | | |
| | | function groupBy(array, key){ |
| | | return array.reduce((acc, item) => { |
| | | const groupKey = String(item[key]); |
| | |
| | | sizeType: ['original', 'compressed'], |
| | | sourceType: ['album', 'camera'], |
| | | success: (res) => { |
| | | const tempFilePaths = res.tempFilePaths; |
| | | const imgUrl = tempFilePaths[0]; |
| | | uploadImage(imgUrl).then(res2=>{ |
| | | this.uploadAreas[index].imageUrl = res.url; |
| | | // const tempFilePath = res.tempFilePaths[0]; |
| | | // // 上传图片到服务器 |
| | | // this.uploadAreaPic(tempFilePath, index); |
| | | }) |
| | | |
| | | const tempFilePath = res.tempFilePaths[0]; |
| | | // 上传图片到服务器 |
| | | this.uploadAreaPic(tempFilePath, index); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | // 验证是否至少上传了一张图片 |
| | | // 收集所有上传的图片地址(用逗号分隔) |
| | | |
| | | const voucherUrls = this.uploadAreas.map(item => item.imageUrl && item.imageUrl !== '').join(','); |
| | | const voucherUrls = this.uploadAreas.filter(item => item.imageUrl!=='').map(item => item.imageUrl).join(','); |
| | | this.form.voucherUrl = voucherUrls; |
| | | |
| | | this.$refs.uForm.validate().then(res => { |