From 1b9d58f222e014b2edc29976e73dd66c0230b804 Mon Sep 17 00:00:00 2001 From: Double-_-Z <2492419643@qq.com> Date: Thu, 5 Dec 2024 16:21:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=AE=A1=E7=90=86-=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=A4=8D=E5=88=B6=E5=92=8C=E9=A2=84=E8=A7=88=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/editor/index.vue | 7 ++++- src/i18n/lang/en.ts | 1 + src/i18n/lang/zh-cn.ts | 1 + src/i18n/lang/zh-tw.ts | 1 + src/router/index.ts | 10 ++++++- src/router/route.ts | 10 ++++++- src/views/article/content.vue | 51 +++++++++++++++++++++++++++++++++ src/views/article/index.vue | 27 +++++++++++++++++ 8 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 src/views/article/content.vue diff --git a/src/components/editor/index.vue b/src/components/editor/index.vue index ca99c44..b927cd2 100644 --- a/src/components/editor/index.vue +++ b/src/components/editor/index.vue @@ -1,7 +1,7 @@ + + + @@ -97,6 +103,9 @@ const moduleList = ref([]); // 标签列表 const labelList = ref([]); +// 基本路径 +const viteUrl = import.meta.env.VITE_API_URL; + // 引入 api 请求接口 const artApi = articleApi(); @@ -171,11 +180,29 @@ const toEditArticle = (row: any) => { router.push({ path: '/article/edit', query: { id:row.id, moduleName: row.moduleName, labelName: row.labelName } }); } +// 复制链接 +const copyLink = (row: any) => { + if(row.id == null||row.id == ''){ ElMessage.warning('链接为空');return;} + var aux = document.createElement("input"); + aux.setAttribute("value", `${viteUrl}#article/content?id=${row.id}`); + document.body.appendChild(aux); + aux.select(); + document.execCommand("copy"); + document.body.removeChild(aux); + ElMessage.success('复制成功'); + aux.remove(); +} + // 文章详情 const toShowDetail = (row: any) => { router.push({ path: '/article/detail' , query: { id:row.id, moduleName: row.moduleName, labelName: row.labelName } }); } +// 预览 +const toPreview = (row: any) => { + window.open(`${viteUrl}#article/content?id=${row.id}`); +} + // 文章删除 const deleteArticle = (id: number) => { ElMessageBox.confirm('确定要删除该文章吗?', '提示', {