BUG 27124

This commit is contained in:
aixianling
2022-02-10 16:24:29 +08:00
parent 77414cadfd
commit af184d3f98

View File

@@ -54,7 +54,7 @@ export default {
action: {default: '/app/wxcp/upload/uploadFile'}, action: {default: '/app/wxcp/upload/uploadFile'},
preview: Boolean, preview: Boolean,
size: {default: 10 * 1024 * 1024}, size: {default: 10 * 1024 * 1024},
disabled: Boolean disabled: Boolean,
}, },
computed: { computed: {
...mapState(['token']), ...mapState(['token']),
@@ -121,6 +121,10 @@ export default {
uni.showLoading({title: '上传中'}) uni.showLoading({title: '上传中'})
let formData = new FormData() let formData = new FormData()
formData.append('file', img) formData.append('file', img)
if (this.manual) {
this.$emit('manual', img)
uni.hideLoading()
} else {
this.$http.post(this.action, formData, { this.$http.post(this.action, formData, {
params: {type: this.type}, params: {type: this.type},
}).then((res) => { }).then((res) => {
@@ -136,6 +140,8 @@ export default {
let info = res.data let info = res.data
this.$emit('update:fileId', info?.id) this.$emit('update:fileId', info?.id)
this.fileList.push(res.data) this.fileList.push(res.data)
} else if (this.action == '/admin/file/add-portrait') {
this.fileList.push({url: res.data?.split(";")?.[0], id: res.data?.split(";")?.[1]})
} }
this.$emit("update:def", this.fileList) this.$emit("update:def", this.fileList)
this.$emit("list", this.fileList) this.$emit("list", this.fileList)
@@ -146,6 +152,8 @@ export default {
this.$u.toast(err) this.$u.toast(err)
uni.hideLoading() uni.hideLoading()
}) })
}
}, },
handleReUpload(i) { handleReUpload(i) {
this.upload(() => this.remove(i)) this.upload(() => this.remove(i))