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