修复上传组件
This commit is contained in:
@@ -51,7 +51,7 @@ export default {
|
||||
fileId: String,
|
||||
mediaId: String,
|
||||
def: {default: () => []},
|
||||
action: {default: '/app/wxcp/upload/uploadFile'},
|
||||
action: {default: '/admin/file/add'},
|
||||
preview: Boolean,
|
||||
size: {default: 10 * 1024 * 1024},
|
||||
disabled: Boolean,
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
uni.hideLoading()
|
||||
} else {
|
||||
uni.uploadFile({
|
||||
url: this.$instance.defaults.baseURL + '/admin/file/add',
|
||||
url: this.$instance.defaults.baseURL + this.action,
|
||||
filePath: img,
|
||||
name: 'file',
|
||||
header: {
|
||||
@@ -137,10 +137,10 @@ export default {
|
||||
if (res?.data) {
|
||||
this.$emit('data', res.data)
|
||||
this.$u.toast('上传成功!')
|
||||
if (this.action == '/app/wxcp/upload/uploadFile') {
|
||||
this.$emit('update:mediaId', res.data?.media?.mediaId)
|
||||
this.$emit('update:fileId', res.data.file.id)
|
||||
this.fileList.push(res.data.file)
|
||||
if (this.action == '/admin/file/add') {
|
||||
this.fileList.push({url: res.data?.split(";")?.[0], id: res.data?.split(";")?.[1]})
|
||||
this.$emit('input', [...this.fileList])
|
||||
this.$emit('change', [...this.fileList])
|
||||
} else if (this.action == '/admin/file/add2') {
|
||||
let info = res.data
|
||||
this.$emit('update:fileId', info?.id)
|
||||
@@ -150,8 +150,6 @@ export default {
|
||||
}
|
||||
this.$emit("update:def", this.fileList)
|
||||
this.$emit("list", this.fileList)
|
||||
this.$emit('input', [...this.fileList])
|
||||
this.$emit('change', [...this.fileList])
|
||||
} else {
|
||||
this.$u.toast(res.msg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user