From 2232ef6f3c526af832e33a591576fdf5077905cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BF=97=E5=BC=BA?= <357099073@qq.com> Date: Fri, 17 Jul 2026 11:00:33 +0800 Subject: [PATCH] =?UTF-8?q?backend=E5=A2=9E=E5=8A=A0=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E7=AE=80=E7=A7=B0=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/tools/notebook/components/edit.vue | 24 + backend/src/views/tools/notebook/index.vue | 15 + go/controllers/backend_notebook.go | 7 +- go/controllers/platform_notebook.go | 629 +++++++++--------- go/models/platform_notebook.go | 41 +- go/models/system_tenant.go | 47 +- go/services/login_verify_code.go | 464 ++++++------- go/services/platform_auth.go | 313 +++++---- go/services/tenant_lookup.go | 43 ++ .../views/tools/notebook/components/edit.vue | 24 + platform/src/views/tools/notebook/index.vue | 15 + sql/alter_notebook_add_pinned.sql | 14 + sql/yz_platform_notebook.sql | 2 + test-output.txt | 24 + 14 files changed, 916 insertions(+), 746 deletions(-) create mode 100644 go/services/tenant_lookup.go create mode 100644 sql/alter_notebook_add_pinned.sql create mode 100644 test-output.txt diff --git a/backend/src/views/tools/notebook/components/edit.vue b/backend/src/views/tools/notebook/components/edit.vue index f25e9a7..06f353e 100644 --- a/backend/src/views/tools/notebook/components/edit.vue +++ b/backend/src/views/tools/notebook/components/edit.vue @@ -15,6 +15,16 @@ +
+ +
+
@@ -38,6 +48,7 @@ const emit = defineEmits(['save-success', 'create-success']); const noteTitle = ref(''); const noteContent = ref(''); +const pinned = ref(false); const loading = ref(false); const isNew = ref(false); @@ -47,6 +58,7 @@ const loadNote = async () => { isNew.value = true; noteTitle.value = '新建笔记'; noteContent.value = ''; + pinned.value = false; return; } @@ -58,6 +70,7 @@ const loadNote = async () => { if (response.code === 200) { noteTitle.value = response.data.title || '无标题'; noteContent.value = response.data.content || ''; + pinned.value = Number(response.data.pinned) === 1; } else { ElMessage.error('加载笔记失败'); } @@ -84,6 +97,7 @@ const handleSave = async () => { const response = await createNotebook({ title: noteTitle.value, content: noteContent.value, + pinned: pinned.value ? 1 : 0, }); if (response.code === 200) { @@ -98,6 +112,7 @@ const handleSave = async () => { const response = await updateNotebook(props.noteId, { title: noteTitle.value, content: noteContent.value, + pinned: pinned.value ? 1 : 0, }); if (response.code === 200) { @@ -175,6 +190,15 @@ onMounted(() => { } } +.editor-toolbar { + min-height: 42px; + padding: 8px 20px; + display: flex; + align-items: center; + border-bottom: 1px solid var(--el-border-color-lighter); + background: var(--el-bg-color); +} + .editor-body { flex: 1; padding: 20px; diff --git a/backend/src/views/tools/notebook/index.vue b/backend/src/views/tools/notebook/index.vue index 6252f37..ffd7836 100644 --- a/backend/src/views/tools/notebook/index.vue +++ b/backend/src/views/tools/notebook/index.vue @@ -28,6 +28,15 @@ >
{{ note.title || '无标题' }} + + 置顶 +