| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {uploadImage} from "@/common/upload"; |
| | | |
| | | function groupBy(array, key){ |
| | | return array.reduce((acc, item) => { |
| | | const groupKey = String(item[key]); |
| | |
| | | }, |
| | | mapList: {}, |
| | | activeActive: {}, |
| | | |
| | | isHk:false, |
| | | |
| | | }; |
| | | }, |
| | |
| | | this.amapPlugin = new amap.AMapWX({ |
| | | key: this.mapApiKey |
| | | }); |
| | | |
| | | // 获取 URL 参数 |
| | | if (options.id) { |
| | | //this.getList(); |
| | |
| | | this.form.tripTime = this.getCurrentDateTime(); |
| | | |
| | | } |
| | | |
| | | this.getLocation(); |
| | | }, |
| | | created() { |
| | | // this.getList(); |
| | |
| | | this.amapPlugin.getRegeo({ |
| | | location:`${longitude},${latitude}`, |
| | | success: (data) => { |
| | | this.form.address = data[0].name; |
| | | let datum = data[0]; |
| | | if (datum.regeocodeData){ |
| | | if (datum.regeocodeData.addressComponent){ |
| | | let province = datum.regeocodeData.addressComponent.province; |
| | | this.isHk = province.indexOf("香港") != -1; |
| | | } |
| | | } |
| | | this.form.address = datum.name; |
| | | }, |
| | | fail: (err) => { |
| | | console.error("SDK调用失败:", err); |
| | |
| | | sizeType: ['original', 'compressed'], |
| | | sourceType: ['album', 'camera'], |
| | | success: (res) => { |
| | | const tempFilePaths = res.tempFilePaths; |
| | | const imgUrl = tempFilePaths[0]; |
| | | uploadImage(imgUrl,this.isHk).then(res2=>{ |
| | | this.uploadAreas[index].imageUrl = res2.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 => { |