From 5cf2e4d20881c69b62fa3c9d26e668ec543d1c84 Mon Sep 17 00:00:00 2001 From: dj <1042039504@qq.com> Date: Fri, 11 Apr 2025 18:21:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(article-management):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在文章管理页面添加公告附件列表 - 实现附件上传和展示功能- 优化 Tinymce 组件,支持附件上传事件 --- src/components/Tinymce.vue | 6 +++++- src/views/article-management/add.vue | 24 ++++++++++++++++++++++-- src/views/article-management/detail.vue | 4 ++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/components/Tinymce.vue b/src/components/Tinymce.vue index c38dcd4..ebe3971 100644 --- a/src/components/Tinymce.vue +++ b/src/components/Tinymce.vue @@ -38,7 +38,7 @@ import 'tinymce/plugins/wordcount' import 'tinymce/plugins/autosave' import '@/assets/axupimgs/plugin.js'//多图上传插件 -const emit = defineEmits(['update:value']) +const emit = defineEmits(['update:value','getFiles']) const props = defineProps({ //默认值 value: { @@ -78,6 +78,7 @@ const props = defineProps({ default: 500 } }) +const fileLists=ref([]) const content = ref(props.value); const imgUrl = ref(); // const apiKey = reactive("v4zo4n22oanvco29ws5drh0pecuf3gh53clx53cccj3grjwg"); @@ -168,6 +169,9 @@ const init = reactive({ type: res.code === 1000 ? 'success' : 'error' }) loading.close() + console.log("🚀 ~ file:res.data ", res.data) + fileLists.value.push(res.data) + emit('getFiles',fileLists.value) const fileUrl = res.data.url; // '?fileId='+res.data.id+ callback(fileUrl + '?fileName=' + res.data.originalFilename, {text: file.name, title: file.name}); diff --git a/src/views/article-management/add.vue b/src/views/article-management/add.vue index e74a49f..d6cec6e 100644 --- a/src/views/article-management/add.vue +++ b/src/views/article-management/add.vue @@ -27,10 +27,26 @@ - + + + + + +
+
+ {{index+1}}{{item.originalFilename}} +
+
+
+
+
@@ -54,6 +70,7 @@ const loading = ref(false) const showTinymce = ref(true) const fundForm = ref() const formData = ref({}) +const articleFile = ref({}) const routerName = ref(router.currentRoute.value.name) const rules = reactive({ articleTitle: [{required: true, message: '请输入文章标题', trigger: ['blur', 'change']}], @@ -64,7 +81,10 @@ const rules = reactive({ const handleBack = () => { history.back() } - +const getFiles=(filelist)=>{ + console.log("🚀 ~ file:filelist ", filelist) + articleFile.value=filelist +} const submitParam = (item) => { return { articleContent: item.articleContent, diff --git a/src/views/article-management/detail.vue b/src/views/article-management/detail.vue index 993d97c..03152a9 100644 --- a/src/views/article-management/detail.vue +++ b/src/views/article-management/detail.vue @@ -10,7 +10,7 @@ -
+
@@ -43,7 +43,7 @@ const clickHandle = (e) => { fileName } // handleDownload(fileId,fileName) - download(item) + // download(item) // }else { // e.preventDefault() // }