This commit is contained in:
liuye
2024-09-23 17:41:02 +08:00
parent a312d3e34b
commit d536af9311
13 changed files with 610 additions and 143 deletions

View File

@@ -57,7 +57,15 @@ export default {
preview: Boolean,
size: {default: 10 * 1024 * 1024},
disabled: Boolean,
sourceType: {default: () => ['album', 'camera']}
sourceType: {default: () => ['album', 'camera']},
withoutToken: {
type: Boolean,
default: false,
},
imgUrlHttp: {
type: String,
default: '',
},
},
computed: {
...mapState(['token']),
@@ -140,6 +148,7 @@ export default {
} else {
this.$http.post(this.api, formData, {
params: {type: this.type},
withoutToken: this.withoutToken
}).then((res) => {
if (res?.data) {
this.$emit('data', res.data)
@@ -162,6 +171,8 @@ export default {
this.fileList.push(res.data)
} else if (this.api == '/admin/file/add-portrait') {
this.fileList.push({url: res.data?.split(";")?.[0], id: res.data?.split(";")?.[1]})
}else if (this.api == '/common/upload') { //图片url回显需先拼接imgUrlHttp
this.fileList.push({url: this.imgUrlHttp + res.data.fileName, fileName: res.data.originalFilename, filePath: this.imgUrlHttp + res.data.fileName})
}
this.$emit("update:def", this.fileList)
this.$emit("list", this.fileList)