Commit d78e0e8d by hank

fix bug

parent 21bc4d14
......@@ -181,29 +181,27 @@ export default {
};
},
methods: {
uploadFile(type) {
if (type === "iamge") {
window.wx.chooseImage({
count: 1, // 默认9
sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
success: function(res) {
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
console.log(localIds);
}
});
}
if (type === "video") {
window.wx.chooseImage({
count: 1, // 默认9
sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
success: function(res) {
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
console.log(localIds);
uploadFile(data) {
this.$toast.loading({
mask: true,
duration: 0,
message: "上传中..."
});
upload(data)
.then(res => {
// this.schemaData[this.dataKey].value = res.data.data;
if (this.itemKey) {
this.setSchemaListData(res.data.data);
} else {
this.setSchemaData(res.data.data);
}
this.$toast.clear();
})
.catch(e => {
console.log(e);
this.$toast.clear();
this.$toast("上传失败");
});
}
},
onBlur() {
window.scrollTo(0, 0);
......@@ -248,7 +246,12 @@ export default {
return getHostUrl(this.frameUrl, dataUrl);
},
uploadAfter(file) {
this.VueCropperOption.img = file.content;
// console.log(file);
if (String(file.file.type).indexOf("image") !== -1) {
this.VueCropperOption.img = file.content;
} else {
this.uploadFile(file.file);
}
},
checkboxChange(value) {
console.log(this.schemaData, value);
......@@ -269,30 +272,9 @@ export default {
saveCropper() {
this.VueCropperOption.img = "";
this.$refs.cropper.getCropBlob(data => {
console.log(data)
// do something
this.$toast.loading({
mask: true,
duration: 0,
message: "上传中..."
});
upload(data)
.then(res => {
// this.schemaData[this.dataKey].value = res.data.data;
if (this.itemKey) {
this.setSchemaListData(res.data.data);
} else {
this.setSchemaData(res.data.data);
}
this.$toast.clear();
})
.catch(e => {
console.log(e);
this.$toast.clear();
this.$toast("上传失败");
});
this.VueCropperOption.preImg = data;
console.log(data);
// do something
this.uploadFile(data);
});
},
setSelectData(item, index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment