feat: add author field
This commit is contained in:
parent
257a112eae
commit
04f33808d5
3 changed files with 43 additions and 10 deletions
|
|
@ -17,6 +17,7 @@ const fileFormData = ref<{
|
|||
description?: string
|
||||
keyword?: string[]
|
||||
category?: string[]
|
||||
author?: string
|
||||
}>({})
|
||||
const fileFormType = ref<'edit' | 'create'>('create')
|
||||
const fileFormError = ref<{ fileExist?: boolean; fileName2Long?: boolean }>({})
|
||||
|
|
@ -68,7 +69,7 @@ function checkFileExist(name: string, except?: string) {
|
|||
}
|
||||
|
||||
function checkFileName2Long(name: string, except?: string) {
|
||||
return Boolean(name.length > 85)
|
||||
return name !== except && Boolean(name.length > 85)
|
||||
}
|
||||
|
||||
async function submitFileForm(
|
||||
|
|
@ -79,6 +80,7 @@ async function submitFileForm(
|
|||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
author: string
|
||||
},
|
||||
force = false,
|
||||
) {
|
||||
|
|
@ -101,6 +103,7 @@ async function submitFileForm(
|
|||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
author: value.author,
|
||||
})
|
||||
} else {
|
||||
await updateFile(
|
||||
|
|
@ -110,6 +113,7 @@ async function submitFileForm(
|
|||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
author: value.author,
|
||||
},
|
||||
value.file,
|
||||
)
|
||||
|
|
@ -132,11 +136,15 @@ async function submitFileForm(
|
|||
v-model:description="fileFormData.description"
|
||||
v-model:keyword="fileFormData.keyword"
|
||||
v-model:category="fileFormData.category"
|
||||
v-model:author="fileFormData.author"
|
||||
@reset="() => (fileFormError = {})"
|
||||
@filechange="
|
||||
(name: string) => {
|
||||
;(fileFormError.fileExist = checkFileExist(name, fileNameLabel)),
|
||||
(fileFormError.fileName2Long = checkFileName2Long(name, fileNameLabel))
|
||||
(fileFormError.fileName2Long = checkFileName2Long(
|
||||
name,
|
||||
fileNameLabel,
|
||||
))
|
||||
}
|
||||
"
|
||||
@submit="submitFileForm"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue