微信选取图片api调整
This commit is contained in:
parent
ca8ddc2446
commit
2cf2c98e5d
|
|
@ -711,10 +711,9 @@
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res)
|
|
||||||
// 上传图片
|
// 上传图片
|
||||||
res.tempFilePaths.forEach((tmpPath) => {
|
res.tempFiles.forEach((fileObj) => {
|
||||||
this.$request.uploadFile(tmpPath).then((url) => {
|
this.$request.uploadFile(fileObj.tempFilePath).then((url) => {
|
||||||
// 存入缓存
|
// 存入缓存
|
||||||
imgList.push(url);
|
imgList.push(url);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -531,14 +531,15 @@
|
||||||
this.specialSkill[index].insurEndDate = e[1];
|
this.specialSkill[index].insurEndDate = e[1];
|
||||||
},
|
},
|
||||||
async chooseImage(e, imgList) {
|
async chooseImage(e, imgList) {
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 1, //默认9
|
count: 1, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// 上传图片
|
// 上传图片
|
||||||
res.tempFilePaths.forEach((tmpPath) => {
|
res.tempFiles.forEach((fileObj) => {
|
||||||
this.$request.uploadFile(tmpPath).then((url) => {
|
this.$request.uploadFile(fileObj.tempFilePath).then((url) => {
|
||||||
// 存入缓存
|
// 存入缓存
|
||||||
imgList.push(url);
|
imgList.push(url);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -744,13 +744,14 @@
|
||||||
chooseImgList(e, imgListField, cropWidth, cropHeight) {
|
chooseImgList(e, imgListField, cropWidth, cropHeight) {
|
||||||
this.cropWidth = cropWidth && cropWidth > 0 ? cropWidth : this.sysInfo.windowWidth * 2;
|
this.cropWidth = cropWidth && cropWidth > 0 ? cropWidth : this.sysInfo.windowWidth * 2;
|
||||||
this.cropHeight = cropHeight && cropHeight > 0 ? cropHeight : this.sysInfo.windowWidth * 2 * 1.15;
|
this.cropHeight = cropHeight && cropHeight > 0 ? cropHeight : this.sysInfo.windowWidth * 2 * 1.15;
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 1, //默认9
|
count: 1, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res.tempFilePaths.forEach((tmpUrl, index) => {
|
res.tempFiles.forEach((fileObj, index) => {
|
||||||
this.url2Crop = tmpUrl;
|
this.url2Crop = fileObj.tempFilePath;
|
||||||
this.curImgListField = imgListField;
|
this.curImgListField = imgListField;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -773,8 +774,9 @@
|
||||||
this.url2Crop = "";
|
this.url2Crop = "";
|
||||||
},
|
},
|
||||||
chooseImgNoCrop(e, imgListField) {
|
chooseImgNoCrop(e, imgListField) {
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 9, //默认9
|
count: 9, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
|
@ -782,10 +784,10 @@
|
||||||
title: '上传中',
|
title: '上传中',
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
res.tempFilePaths.forEach((tmpUrl, index) => {
|
res.tempFiles.forEach((fileObj, index) => {
|
||||||
this.$request.uploadFile(tmpUrl).then((url) => {
|
this.$request.uploadFile(fileObj.tempFilePath).then((url) => {
|
||||||
this.formData[imgListField].push(url);
|
this.formData[imgListField].push(url);
|
||||||
if (index === res.tempFilePaths.length - 1) {
|
if (index === res.tempFiles.length - 1) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -108,15 +108,20 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
chooseImage(e) {
|
chooseImage(e) {
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 9, //默认9
|
count: 9, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
let tempFilePaths = [];
|
||||||
|
res.tempFiles.forEach((fileObj) => {
|
||||||
|
tempFilePaths.push(fileObj.tempFilePath)
|
||||||
|
})
|
||||||
if (this.imgList.length != 0) {
|
if (this.imgList.length != 0) {
|
||||||
this.imgList = this.imgList.concat(res.tempFilePaths)
|
this.imgList = this.imgList.concat(tempFilePaths)
|
||||||
} else {
|
} else {
|
||||||
this.imgList = res.tempFilePaths
|
this.imgList = tempFilePaths
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -99,15 +99,20 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
chooseImgList(e) {
|
chooseImgList(e) {
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 9, //默认9
|
count: 9, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
let tempFilePaths = [];
|
||||||
|
res.tempFiles.forEach((fileObj) => {
|
||||||
|
tempFilePaths.push(fileObj.tempFilePath)
|
||||||
|
})
|
||||||
if (this.formData.imgList.length != 0) {
|
if (this.formData.imgList.length != 0) {
|
||||||
this.formData.imgList = this.formData.imgList.concat(res.tempFilePaths)
|
this.formData.imgList = this.formData.imgList.concat(tempFilePaths)
|
||||||
} else {
|
} else {
|
||||||
this.formData.imgList = res.tempFilePaths
|
this.formData.imgList = tempFilePaths
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,9 @@
|
||||||
this.order = orderInfo;
|
this.order = orderInfo;
|
||||||
},
|
},
|
||||||
chooseImgList(e, imgList) {
|
chooseImgList(e, imgList) {
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 12 - imgList.length, //默认9
|
count: 12 - imgList.length, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
|
@ -105,10 +106,10 @@
|
||||||
title: '上传中',
|
title: '上传中',
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
res.tempFilePaths.forEach((tmpUrl, index) => {
|
res.tempFiles.forEach((fileObj, index) => {
|
||||||
this.$request.uploadFile(tmpUrl).then((url) => {
|
this.$request.uploadFile(fileObj.tempFilePath).then((url) => {
|
||||||
imgList.push(url);
|
imgList.push(url);
|
||||||
if (index === res.tempFilePaths.length - 1) {
|
if (index === res.tempFiles.length - 1) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,9 @@
|
||||||
this.reasonType = e.detail.value;
|
this.reasonType = e.detail.value;
|
||||||
},
|
},
|
||||||
chooseImgList(e, imgList) {
|
chooseImgList(e, imgList) {
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 3 - imgList.length, //默认9
|
count: 3 - imgList.length, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
|
@ -100,10 +101,10 @@
|
||||||
title: '上传中',
|
title: '上传中',
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
res.tempFilePaths.forEach((tmpUrl, index) => {
|
res.tempFiles.forEach((fileObj, index) => {
|
||||||
this.$request.uploadFile(tmpUrl).then((url) => {
|
this.$request.uploadFile(fileObj.tempFilePath).then((url) => {
|
||||||
imgList.push(url);
|
imgList.push(url);
|
||||||
if (index === res.tempFilePaths.length - 1) {
|
if (index === res.tempFiles.length - 1) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,20 @@
|
||||||
uni.$emit(this.$globalFun.HIDE_MODAL, e);
|
uni.$emit(this.$globalFun.HIDE_MODAL, e);
|
||||||
},
|
},
|
||||||
chooseImage(e) {
|
chooseImage(e) {
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 1, //默认9
|
count: 1, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
let tempFilePaths = [];
|
||||||
|
res.tempFiles.forEach((fileObj) => {
|
||||||
|
tempFilePaths.push(fileObj.tempFilePath)
|
||||||
|
})
|
||||||
if (this.imgList.length != 0) {
|
if (this.imgList.length != 0) {
|
||||||
this.imgList = this.imgList.concat(res.tempFilePaths)
|
this.imgList = this.imgList.concat(tempFilePaths)
|
||||||
} else {
|
} else {
|
||||||
this.imgList = res.tempFilePaths
|
this.imgList = tempFilePaths
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -73,15 +73,20 @@
|
||||||
this.toWho = toWho;
|
this.toWho = toWho;
|
||||||
},
|
},
|
||||||
chooseImgList(e) {
|
chooseImgList(e) {
|
||||||
uni.chooseImage({
|
uni.chooseMedia({
|
||||||
count: 9, //默认9
|
count: 9, //默认9
|
||||||
|
mediaType: ['image'],
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
let tempFilePaths = [];
|
||||||
|
res.tempFiles.forEach((fileObj) => {
|
||||||
|
tempFilePaths.push(fileObj.tempFilePath);
|
||||||
|
})
|
||||||
if (this.imgList.length != 0) {
|
if (this.imgList.length != 0) {
|
||||||
this.imgList = this.imgList.concat(res.tempFilePaths)
|
this.imgList = this.imgList.concat(tempFilePaths)
|
||||||
} else {
|
} else {
|
||||||
this.imgList = res.tempFilePaths
|
this.imgList = tempFilePaths
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue