|
|
@@ -56,11 +56,17 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
},
|
|
|
+ item: {
|
|
|
+ type: Object,
|
|
|
+ default: {},
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
shows: false,
|
|
|
url: '',
|
|
|
+ addressesRemark: '',
|
|
|
+ localIdsArr: [],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -72,7 +78,7 @@ export default {
|
|
|
let that = this;
|
|
|
let wx = this.wx;
|
|
|
let qiyeData;
|
|
|
- let addressesRemark = '';
|
|
|
+ this.addressesRemark = '';
|
|
|
var map = new TMap.Map('allmap', {
|
|
|
zoom: 14,
|
|
|
center: new TMap.LatLng(39.986785, 116.301012),
|
|
|
@@ -119,10 +125,10 @@ export default {
|
|
|
geocoder.getAddress({ location: location }).then(
|
|
|
function (result) {
|
|
|
var addresses = result.result.formatted_addresses;
|
|
|
- addressesRemark = addresses.recommend;
|
|
|
+ that.addressesRemark = addresses.recommend;
|
|
|
},
|
|
|
function (err) {
|
|
|
- addressesRemark = '';
|
|
|
+ that.addressesRemark = '';
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
@@ -133,42 +139,53 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
wx.chooseImage({
|
|
|
- count: 1,
|
|
|
+ count: 5,
|
|
|
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
defaultCameraMode: 'normal', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
|
|
|
isSaveToAlbum: 0,
|
|
|
success: function (res) {
|
|
|
- var localIds = '';
|
|
|
- if (res.localIds != undefined) {
|
|
|
- localIds = res.localIds[0];
|
|
|
- } else {
|
|
|
- localIds = res.localId;
|
|
|
- }
|
|
|
+ let localIds = res.localIds;
|
|
|
// andriod中localId可以作为img标签的src属性显示图片;
|
|
|
// iOS应当使用 getLocalImgData 获取图片base64数据,从而用于img标签的显示(在img标签内使用 wx.chooseImage 的 localid 显示可能会不成功)
|
|
|
- wx.uploadImage({
|
|
|
- localId: localIds, // 需要上传的图片的本地ID,由chooseImage接口获得
|
|
|
- isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
- success: function (res) {
|
|
|
- that.uploadImagev(res.serverId, addressesRemark);
|
|
|
- },
|
|
|
- });
|
|
|
+ that.localIdsArr = [];
|
|
|
+ that.syncUpload(localIds);
|
|
|
+ // wx.uploadImage({
|
|
|
+ // localId: localIds, // 需要上传的图片的本地ID,由chooseImage接口获得
|
|
|
+ // isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
+ // success: function (res) {
|
|
|
+ // that.uploadImagev(res.serverId, addressesRemark);
|
|
|
+ // },
|
|
|
+ // });
|
|
|
},
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- uploadImagev(meidaId, addressesRemark) {
|
|
|
- var that = this;
|
|
|
+ syncUpload(localIds) {
|
|
|
+ if (!localIds.length) {
|
|
|
+ this.uploadImagev(this.localIdsArr);
|
|
|
+ } else {
|
|
|
+ var localId = localIds.pop();
|
|
|
+ wx.uploadImage({
|
|
|
+ localId: localId,
|
|
|
+ isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
+ success: (res) => {
|
|
|
+ this.localIdsArr.push(res.serverId);
|
|
|
+ this.syncUpload(localIds);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadImagev(meidaIds) {
|
|
|
var form = {
|
|
|
- mediaId: meidaId,
|
|
|
- customId: that.customId,
|
|
|
- summaryId: that.summaryId,
|
|
|
- locationRemark: addressesRemark,
|
|
|
+ mediaIds: meidaIds,
|
|
|
+ customId: this.customId,
|
|
|
+ summaryId: this.summaryId,
|
|
|
+ locationRemark: this.addressesRemark,
|
|
|
};
|
|
|
- var loind1 = that.$toast.loading({
|
|
|
+ var loind1 = this.$toast.loading({
|
|
|
duration: 0,
|
|
|
message: '上传中...',
|
|
|
forbidClick: true,
|
|
|
@@ -179,19 +196,31 @@ export default {
|
|
|
}
|
|
|
addPhotov(form).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
- that.imgArr = res.data.url;
|
|
|
+ // that.imgArr = res.data.url;
|
|
|
loind1.clear();
|
|
|
- that.$toast('上传成功!');
|
|
|
- that.$emit('newimgarr', {
|
|
|
- fileUrl: res.data.url,
|
|
|
- id: res.data.fileId,
|
|
|
- fileType: res.fileType,
|
|
|
- fileName: res.fileName,
|
|
|
- type: that.type,
|
|
|
- index: that.indexImg,
|
|
|
+ this.$toast('上传成功!');
|
|
|
+ let urlArr = [];
|
|
|
+ let idArr = [];
|
|
|
+ res.data.forEach((val) => {
|
|
|
+ urlArr.push({
|
|
|
+ fileUrl: val.url,
|
|
|
+ id: val.fileId,
|
|
|
+ // fileType: val.fileType,
|
|
|
+ // fileName: val.fileName,
|
|
|
+ type: this.type,
|
|
|
+ index: this.indexImg,
|
|
|
+ });
|
|
|
+ idArr.push(val.fileId);
|
|
|
});
|
|
|
+ if (this.item.fileInfoList == null || this.item.fileInfoList == undefined) {
|
|
|
+ this.item.fileInfoList = [];
|
|
|
+ this.item.fileIdList = [];
|
|
|
+ }
|
|
|
+ this.item.fileInfoList = this.item.fileInfoList.concat(urlArr);
|
|
|
+ this.item.fileIdList = this.item.fileIdList.concat(idArr);
|
|
|
+ this.$emit('newimgarr');
|
|
|
} else {
|
|
|
- that.$toast('上传失败!');
|
|
|
+ this.$toast('上传失败!');
|
|
|
}
|
|
|
});
|
|
|
},
|