From b0665d6d40d2a3bda86bd25d71df19255dc8254a Mon Sep 17 00:00:00 2001 From: helen Date: Tue, 24 Dec 2024 16:06:13 +0800 Subject: [PATCH] bug --- src/views/manage/noteManage/index.vue | 86 +++++++++++++++------------ 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/src/views/manage/noteManage/index.vue b/src/views/manage/noteManage/index.vue index 1705c37..4aded15 100644 --- a/src/views/manage/noteManage/index.vue +++ b/src/views/manage/noteManage/index.vue @@ -87,29 +87,30 @@ - + @@ -145,11 +146,11 @@
预 览 - 存草稿 + 存草稿
取 消 - 提 交 + 提 交
@@ -222,20 +223,12 @@ const props = defineProps({ }); const addressvalue = ref(''); -const statusoptions = [ - { - value: '1', - label: '审核中' - }, - { - value: '2', - label: '已发布' - }, - { - value: '0', - label: '未发布' - } -]; +const statusoptions = ref([ + { label: '已发布', value: 3 }, + { label: '审核中', value: 2 }, + { label: '未发布', value: 0 }, + { label: '草稿', value: 1 } +]); const dialog = reactive({ visible: false, title: '' @@ -418,27 +411,42 @@ const contenttext = async (row?: NotebookVO) => { concentdialog.visible = true; }; /** 提交按钮 */ -const submitForm = () => { +const submitForm = async(type) => { form.value.tagId = tagvalue.value.join(','); form.value.location = addressvalue.value.join(','); form.value.cover = ''; - form.value.status = 1; + form.value.status = Number(type); form.value.content = form.value.content == '


' ? '' : form.value.content; - notebookFormRef.value?.validate(async (valid: boolean) => { - if (valid) { - buttonLoading.value = true; - if (form.value.id) { - await updateNotebook(form.value).finally(() => (buttonLoading.value = false)); - } else { - await addNotebook(form.value).finally(() => (buttonLoading.value = false)); - } - console.log(form.value.cover); - - proxy?.$modal.msgSuccess('操作成功'); - dialog.visible = false; - await getList(); + if(type == 1){ + buttonLoading.value = true; + if (form.value.id) { + await updateNotebook(form.value).finally(() => (buttonLoading.value = false)); + } else { + await addNotebook(form.value).finally(() => (buttonLoading.value = false)); } - }); + console.log(form.value.cover); + + proxy?.$modal.msgSuccess('操作成功'); + await getList(); + }else{ + notebookFormRef.value?.validate(async (valid: boolean) => { + if (valid) { + buttonLoading.value = true; + if (form.value.id) { + await updateNotebook(form.value).finally(() => (buttonLoading.value = false)); + } else { + await addNotebook(form.value).finally(() => (buttonLoading.value = false)); + } + console.log(form.value.cover); + + proxy?.$modal.msgSuccess('操作成功'); + dialog.visible = false; + await getList(); + } + }); + } + + }; /** 删除按钮操作 */