BUG 27124
This commit is contained in:
@@ -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,31 +121,39 @@ export default {
|
|||||||
uni.showLoading({title: '上传中'})
|
uni.showLoading({title: '上传中'})
|
||||||
let formData = new FormData()
|
let formData = new FormData()
|
||||||
formData.append('file', img)
|
formData.append('file', img)
|
||||||
this.$http.post(this.action, formData, {
|
if (this.manual) {
|
||||||
params: {type: this.type},
|
this.$emit('manual', img)
|
||||||
}).then((res) => {
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
if (res?.data) {
|
} else {
|
||||||
this.$emit('data', res.data)
|
this.$http.post(this.action, formData, {
|
||||||
this.$u.toast('上传成功!')
|
params: {type: this.type},
|
||||||
if (this.action == '/app/wxcp/upload/uploadFile') {
|
}).then((res) => {
|
||||||
this.$emit('update:mediaId', res.data?.media?.mediaId)
|
uni.hideLoading()
|
||||||
this.$emit('update:fileId', res.data.file.id)
|
if (res?.data) {
|
||||||
this.fileList.push(res.data.file)
|
this.$emit('data', res.data)
|
||||||
} else if (this.action == '/admin/file/add2') {
|
this.$u.toast('上传成功!')
|
||||||
let info = res.data
|
if (this.action == '/app/wxcp/upload/uploadFile') {
|
||||||
this.$emit('update:fileId', info?.id)
|
this.$emit('update:mediaId', res.data?.media?.mediaId)
|
||||||
this.fileList.push(res.data)
|
this.$emit('update:fileId', res.data.file.id)
|
||||||
|
this.fileList.push(res.data.file)
|
||||||
|
} else if (this.action == '/admin/file/add2') {
|
||||||
|
let info = res.data
|
||||||
|
this.$emit('update:fileId', info?.id)
|
||||||
|
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("list", this.fileList)
|
||||||
|
} else {
|
||||||
|
this.$u.toast(res.msg)
|
||||||
}
|
}
|
||||||
this.$emit("update:def", this.fileList)
|
}).catch(err => {
|
||||||
this.$emit("list", this.fileList)
|
this.$u.toast(err)
|
||||||
} else {
|
uni.hideLoading()
|
||||||
this.$u.toast(res.msg)
|
})
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
|
||||||
this.$u.toast(err)
|
|
||||||
uni.hideLoading()
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
handleReUpload(i) {
|
handleReUpload(i) {
|
||||||
this.upload(() => this.remove(i))
|
this.upload(() => this.remove(i))
|
||||||
|
|||||||
Reference in New Issue
Block a user