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