From 0b77abf35aa17e157268675e1693506698956865 Mon Sep 17 00:00:00 2001 From: KUN1007 Date: Thu, 3 Aug 2023 13:09:21 +0800 Subject: [PATCH] feat: topic reply --- src/components/WangEditor.vue | 29 ++------- .../setting-panel/KUNGalgameSettingPanel.vue | 1 - src/layout/KUNGalgameAPP.vue | 17 ++++++ src/store/modules/topic.ts | 29 +++++++++ src/views/edit/Edit.vue | 2 +- src/views/edit/components/Button.vue | 51 ++-------------- src/views/edit/components/Partition.vue | 61 +++++++++++++++++++ .../topic/content/components/ReplyPanel.vue | 47 ++++++++++++++ .../topic/content/components/TopicFooter.vue | 16 ++++- 9 files changed, 178 insertions(+), 75 deletions(-) create mode 100644 src/store/modules/topic.ts create mode 100644 src/views/edit/components/Partition.vue create mode 100644 src/views/topic/content/components/ReplyPanel.vue diff --git a/src/components/WangEditor.vue b/src/components/WangEditor.vue index b42a870f..28c6d97f 100644 --- a/src/components/WangEditor.vue +++ b/src/components/WangEditor.vue @@ -8,6 +8,9 @@ import { IDomEditor } from '@wangeditor/editor' import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue' import { Editor, Toolbar } from '@wangeditor/editor-for-vue' +const props = defineProps(['height']) +const editorHeight = `height: ${props.height}px` + const editorRef = shallowRef(undefined) const valueHtml = ref('

hello

') @@ -19,9 +22,6 @@ const editorConfig = { MENU_CONF: { uploadImage: { server: 'http://127.0.0.1:10007/upload/img', - // server: '/api/upload-img-10s', // test timeout - // server: '/api/upload-img-failed', // test failed - // server: '/api/xxx', // test 404 timeout: 5 * 1000, // 5s @@ -33,27 +33,6 @@ const editorConfig = { maxFileSize: 10 * 1024 * 1024, // 10M base64LimitSize: 5 * 1024, // insert base64 format, if file's size less than 5kb - - // onBeforeUpload(file) { - // console.log('onBeforeUpload', file) - - // return file // will upload this file - // // return false // prevent upload - // }, - // onProgress(progress) { - // console.log('onProgress', progress) - // }, - // onSuccess(file, res) { - // console.log('onSuccess', file, res) - // }, - // onFailed(file, res) { - // alert(res.message) - // console.log('onFailed', file, res) - // }, - // onError(file, err, res) { - // alert(err.message) - // console.error('onError', file, err, res) - // }, }, }, } @@ -82,7 +61,7 @@ onBeforeUnmount(() => {
{ display: flex; color: var(--kungalgame-font-color-3); border: 1px solid var(--kungalgame-blue-1); - overflow: hidden; } .container { position: relative; diff --git a/src/layout/KUNGalgameAPP.vue b/src/layout/KUNGalgameAPP.vue index 7a17fb5c..6e8d125a 100644 --- a/src/layout/KUNGalgameAPP.vue +++ b/src/layout/KUNGalgameAPP.vue @@ -3,12 +3,29 @@ // 导入动画 import 'animate.css' +import { defineAsyncComponent } from 'vue' + import { currBackground } from '@/hooks/useBackgroundPicture' import KUNGalgameTopBar from '@/components/TopBar/KUNGalgameTopBar.vue' + +// 导入帖子页面 store +import { useKUNGalgameTopicStore } from '@/store/modules/topic' +import { storeToRefs } from 'pinia' + +// 异步导入帖子页回复面板,提升首页加载速度 +const ReplyPanel = defineAsyncComponent( + () => import('@/views/topic/content/components/ReplyPanel.vue') +) + +// 使用帖子页面的 store +const settingsStore = useKUNGalgameTopicStore() +const { isEdit } = storeToRefs(settingsStore)