From ea460c3623fe158279b798fd0b163fb44b490054 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 17 Mar 2024 22:59:31 +0800 Subject: [PATCH] :rocket: Realm alpha --- .../src/components/publish/ArticleEditor.vue | 35 ++++++-- .../src/components/publish/MomentEditor.vue | 83 +++++++++++-------- .../components/publish/parts/PublishArea.vue | 37 +++++++++ pkg/views/src/components/realms/RealmList.vue | 12 ++- 4 files changed, 127 insertions(+), 40 deletions(-) create mode 100644 pkg/views/src/components/publish/parts/PublishArea.vue diff --git a/pkg/views/src/components/publish/ArticleEditor.vue b/pkg/views/src/components/publish/ArticleEditor.vue index 2dc09d7..c720d01 100644 --- a/pkg/views/src/components/publish/ArticleEditor.vue +++ b/pkg/views/src/components/publish/ArticleEditor.vue @@ -66,7 +66,7 @@

Your content will visible for public at

- {{ data.publishedAt ? new Date(data.publishedAt).toLocaleString() : new Date().toLocaleString() }} + {{ data.published_at ? new Date(data.published_at).toLocaleString() : new Date().toLocaleString() }}

@@ -85,14 +85,27 @@ + + + + - + + Your article has been published. @@ -108,27 +121,38 @@ import { request } from "@/scripts/request" import { useEditor } from "@/stores/editor" import { getAtk } from "@/stores/userinfo" -import { reactive, ref, watch } from "vue" +import { computed, reactive, ref, watch } from "vue"; import { useRouter } from "vue-router" import PlannedPublish from "@/components/publish/parts/PlannedPublish.vue" import Media from "@/components/publish/parts/Media.vue" +import PublishArea from "@/components/publish/parts/PublishArea.vue"; const editor = useEditor() const dialogs = reactive({ plan: false, categories: false, - media: false + media: false, + area: false, }) const data = ref({ title: "", content: "", description: "", + realm_id: null, published_at: null, attachments: [] }) +const currentRealm = computed(() => { + if(data.value.realm_id) { + return editor.availableRealms.find((e) => e.id === data.value.realm_id) + } else { + return null + } +}) + const router = useRouter() const error = ref(null) @@ -146,7 +170,8 @@ async function postArticle(evt: SubmitEvent) { console.log(payload) if (!payload.content) return if (!payload.title || !payload.description) return - if (!payload.publishedAt) payload.publishedAt = new Date().toISOString() + if (!payload.published_at) payload.published_at = new Date().toISOString() + if (!payload.realm_id) payload.realm_id = undefined const url = editor.related.edit_to ? `/api/p/articles/${editor.related.edit_to?.id}` : "/api/p/articles" const method = editor.related.edit_to ? "PUT" : "POST" diff --git a/pkg/views/src/components/publish/MomentEditor.vue b/pkg/views/src/components/publish/MomentEditor.vue index 85ba905..e6c287a 100644 --- a/pkg/views/src/components/publish/MomentEditor.vue +++ b/pkg/views/src/components/publish/MomentEditor.vue @@ -40,6 +40,18 @@ /> + + + @@ -54,6 +66,7 @@ + Your post has been published. @@ -66,66 +79,70 @@