diff --git a/Yi.Bbs.Vue3/src/views/Article.vue b/Yi.Bbs.Vue3/src/views/Article.vue
index aa607e5a..ee75a243 100644
--- a/Yi.Bbs.Vue3/src/views/Article.vue
+++ b/Yi.Bbs.Vue3/src/views/Article.vue
@@ -7,12 +7,27 @@
- 首页
- 添加子文章
+ 首页
+ 添加子文章
-
+
@@ -37,50 +52,70 @@
-
+
{{ discuss.title }}
-
+
-
-
+
-
+
0
分享
操作
-
-
+
-
+
-
-
- 编辑
- 删除
+ 编辑
+ 删除
- 分类: 主题
标签:
@@ -95,11 +130,20 @@
-
+
-
- {{ `${i + 1} : ${item}`
- }}
+ {{ `${i + 1} : ${item}` }}
@@ -131,42 +175,44 @@ import AvatarInfo from "@/components/AvatarInfo.vue";
import InfoCard from "@/components/InfoCard.vue";
import ArticleContentInfo from "@/components/ArticleContentInfo.vue";
import CommentInfo from "@/components/CommentInfo.vue";
-import BottomInfo from '@/components/BottomInfo.vue'
+import BottomInfo from "@/components/BottomInfo.vue";
import TreeArticleInfo from "@/components/TreeArticleInfo.vue";
import { useRoute, useRouter } from "vue-router";
-import AgreeInfo from '@/components/AgreeInfo.vue'
+import AgreeInfo from "@/components/AgreeInfo.vue";
import { get as discussGet, del as discussDel } from "@/apis/discussApi.js";
-import { all as articleall, del as articleDel, get as articleGet } from "@/apis/articleApi.js";
+import {
+ all as articleall,
+ del as articleDel,
+ get as articleGet,
+} from "@/apis/articleApi.js";
//数据定义
const route = useRoute();
const router = useRouter();
const spacer = h(ElDivider, { direction: "vertical" });
const items = [{ user: "用户1" }, { user: "用户2" }, { user: "用户3" }];
-
//子文章数据
const articleData = ref([]);
//主题内容
const discuss = ref({});
//封面url
-const getUrl= (str)=>{
-return `${import.meta.env.VITE_APP_BASEAPI}/file/${str}`
-}
+const getUrl = (str) => {
+ return `${import.meta.env.VITE_APP_BASEAPI}/file/${str}`;
+};
//当前默认选择的子文章
-const currentNodeKey=route.params.articleId;
+const currentNodeKey = route.params.articleId;
//目录数据
const catalogueData = ref([]);
//子文章初始化
const loadArticleData = async () => {
- const response= await articleall(route.params.discussId)
+ const response = await articleall(route.params.discussId);
articleData.value = response.data;
-}
+};
//主题初始化
const loadDiscuss = async (isRewrite) => {
-
if (isRewrite) {
//跳转路由
router.push(`/article/${route.params.discussId}`);
@@ -183,16 +229,15 @@ const ContentHander = () => {
//加载目录
var reg = /(#{1,6})\s(.*)/g;
- if(discuss.value.content)
- {
- var myArray = discuss.value.content.match(reg);
- if (myArray != null) {
- catalogueData.value = myArray.map((x) => {
- return x.replace(/#/g, "").replace(/\s/g, "");
- });
+ if (discuss.value.content) {
+ var myArray = discuss.value.content.match(reg);
+ if (myArray != null) {
+ catalogueData.value = myArray.map((x) => {
+ return x.replace(/#/g, "").replace(/\s/g, "");
+ });
+ }
}
- }
-}
+};
//添加树型子文章
const addArticle = (parentArticleId) => {
//跳转路由
@@ -251,7 +296,7 @@ const addNextArticle = (node, data) => {
},
};
router.push(routerPer);
-}
+};
//跳转更新子菜单
const updateArticle = (node, data) => {
@@ -263,22 +308,21 @@ const updateArticle = (node, data) => {
artType: "article",
discussId: data.discussId,
parentArticleId: data.parentId,
- articleId: data.id
+ articleId: data.id,
},
};
router.push(routerPer);
-}
+};
//单机节点
-const handleNodeClick = async(data) => {
-
+const handleNodeClick = async (data) => {
//跳转路由
router.push(`/article/${route.params.discussId}/${data.id}`);
- const response=await articleGet(data.id);
+ const response = await articleGet(data.id);
discuss.value.content = response.data.content;
ContentHander();
-}
+};
//删除子文章
const delArticle = (node, data) => {
ElMessageBox.confirm(`确定是否删除编号[${data.id}]的子文章吗?`, "警告", {
@@ -286,7 +330,6 @@ const delArticle = (node, data) => {
cancelButtonText: "取消",
type: "warning",
}).then(async () => {
-
await articleDel(data.id);
await loadArticleData();
@@ -295,14 +338,13 @@ const delArticle = (node, data) => {
message: "删除成功",
});
});
-
-}
+};
onMounted(async () => {
await loadDiscuss();
await loadArticleData();
});
-