Commit d78e0e8d by hank

fix bug

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