flat: 修改传说中的Attachment

This commit is contained in:
Apcallover
2024-04-22 15:59:25 +08:00
parent d71c5171f4
commit ab94467da4
2 changed files with 7 additions and 18 deletions

View File

@@ -25,7 +25,7 @@ export async function uploadFile(file) {
} }
header[website.tokenName] = "bearer " + token header[website.tokenName] = "bearer " + token
uni.uploadFile({ uni.uploadFile({
url: `${baseUrl}/api/jobslink-api/resource/file/upload/file?bussinessType=5`, url: `${baseUrl}/api/jobslink-api/resource/file/save?bussinessType=5`,
header, header,
filePath: file.url, filePath: file.url,
// formData: formdata, // formData: formdata,
@@ -36,7 +36,7 @@ export async function uploadFile(file) {
}) => { }) => {
const resp = JSON.parse(data) const resp = JSON.parse(data)
if (statusCode === 200 && resp.code === 200) { if (statusCode === 200 && resp.code === 200) {
resolve(resp) resolve(resp.msg)
} else { } else {
reject(new Error('数据异常')) reject(new Error('数据异常'))
} }

View File

@@ -39,15 +39,10 @@
}, },
computed: { computed: {
ImgUrl(val) { ImgUrl(val) {
if (this.value) { return this.value ? [{
const url = this.value.split('|') name: 'img.jpg',
return [{ url: this.value
name: 'img', }] : []
url: url[url.length - 1]
}]
} else {
return []
}
} }
}, },
methods: { methods: {
@@ -57,13 +52,7 @@
name name
}) { }) {
// this.$emit("input", file); // this.$emit("input", file);
uploadFile(file).then((fileObj) => { uploadFile(file).then((url) => {
const {
id,
path
} = fileObj.data
const url = `${id}|${path}$`
console.log(url)
this.$emit("input", url); this.$emit("input", url);
}) })
}, },