2023-12-14 10:15:23 +08:00
|
|
|
|
<template>
|
2023-12-20 21:52:42 +08:00
|
|
|
|
<div class="article-box">
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<el-row :gutter="20" class="top-div">
|
|
|
|
|
|
<el-col :span="5">
|
|
|
|
|
|
<el-row class="art-info-left">
|
2025-04-12 23:18:06 +08:00
|
|
|
|
<el-col :span="24" v-if="discuss.discussType=='Article'">
|
2025-02-06 12:54:48 +08:00
|
|
|
|
<InfoCard header="文章信息" text="展开" hideDivider="true" :isPadding="false" style="padding: 10px">
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<template #content>
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<el-button
|
2025-02-04 15:47:59 +08:00
|
|
|
|
style="width: 100%; margin-bottom: 0.8rem"
|
|
|
|
|
|
@click="loadDiscuss(true)"
|
|
|
|
|
|
>主题首页
|
|
|
|
|
|
</el-button
|
2023-12-14 17:57:07 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-button
|
2025-02-04 15:47:59 +08:00
|
|
|
|
v-if="isAddArticle && isArticleUser"
|
|
|
|
|
|
@click="addArticle('00000000-0000-0000-0000-000000000000')"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
style="width: 100%; margin-bottom: 0.8rem; margin-left: 0"
|
|
|
|
|
|
>添加子文章
|
|
|
|
|
|
</el-button
|
2023-12-14 17:57:07 +08:00
|
|
|
|
>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<!--目录在这里 -->
|
2025-02-06 12:54:48 +08:00
|
|
|
|
<el-scrollbar style="height:600px;overflow-y: auto;">
|
2024-01-07 22:31:52 +08:00
|
|
|
|
<TreeArticleInfo
|
2025-02-04 15:47:59 +08:00
|
|
|
|
:data="articleData"
|
|
|
|
|
|
@remove="delArticle"
|
|
|
|
|
|
@update="updateArticle"
|
|
|
|
|
|
@create="addNextArticle"
|
|
|
|
|
|
@handleNodeClick="handleNodeClick"
|
|
|
|
|
|
:currentNodeKey="currentNodeKey"
|
|
|
|
|
|
:isArticleUser="isArticleUser"
|
2024-01-07 22:31:52 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</el-scrollbar>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</InfoCard>
|
|
|
|
|
|
</el-col>
|
2025-04-12 23:18:06 +08:00
|
|
|
|
|
|
|
|
|
|
<el-col :span="24" v-if="discuss.discussType=='Reward'">
|
|
|
|
|
|
<InfoCard header="悬赏信息" text="有偿" hideDivider="true" :isPadding="true" style="padding: 10px">
|
|
|
|
|
|
<template #content>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
当前状态:
|
|
|
|
|
|
<el-tag
|
|
|
|
|
|
v-if="discuss.rewardData.isResolved"
|
|
|
|
|
|
type="success"
|
|
|
|
|
|
effect="dark"
|
|
|
|
|
|
round
|
|
|
|
|
|
>已解决</el-tag>
|
|
|
|
|
|
|
|
|
|
|
|
<el-tag
|
|
|
|
|
|
v-else
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
effect="dark"
|
|
|
|
|
|
round
|
|
|
|
|
|
>未解决</el-tag>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<el-divider/>
|
|
|
|
|
|
<p>参考价格:{{discuss.rewardData.minValue}}~{{discuss.rewardData.maxValue}}RMB</p>
|
|
|
|
|
|
<el-divider/>
|
|
|
|
|
|
<p style="color: #AB9AAA">联系作者:</p>
|
|
|
|
|
|
<p>{{discuss.rewardData.contact}}</p>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</InfoCard>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<el-col :span="24">
|
2025-02-06 12:54:48 +08:00
|
|
|
|
<InfoCard :items="authorList" :isPadding="false" header="作者分享" height="410" text="更多" style="padding:0 20px">
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<template #item="temp">
|
2025-02-04 15:23:20 +08:00
|
|
|
|
<ThemeData :themeData="temp"/>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</InfoCard>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="14">
|
|
|
|
|
|
<el-row class="left-div">
|
|
|
|
|
|
<el-col :span="24">
|
2025-02-04 15:47:59 +08:00
|
|
|
|
<Breadcrumb :breadcrumbsList="breadcrumbsList" class="breadcrumb"/>
|
2025-04-12 23:18:06 +08:00
|
|
|
|
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<AvatarInfo
|
2025-02-04 15:47:59 +08:00
|
|
|
|
:size="50"
|
|
|
|
|
|
:showWatching="true"
|
|
|
|
|
|
:time="discuss.creationTime"
|
|
|
|
|
|
:userInfo="discuss.user"
|
2023-12-14 17:57:07 +08:00
|
|
|
|
></AvatarInfo>
|
2025-04-12 23:18:06 +08:00
|
|
|
|
|
|
|
|
|
|
<h2> <DiscussTypeLable style="margin-right: 8px;height: 35px;" v-model="discuss.discussType" /> {{ discuss.title }}</h2>
|
2025-02-04 15:47:59 +08:00
|
|
|
|
<h5 class="subtitle">{{ discuss.introduction }}</h5>
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<el-image
|
2025-02-04 15:47:59 +08:00
|
|
|
|
:preview-src-list="[getUrl(discuss.cover)]"
|
|
|
|
|
|
v-if="discuss.cover"
|
|
|
|
|
|
:src="getUrl(discuss.cover)"
|
|
|
|
|
|
style="width: 150px; height: 150px"
|
2023-12-14 17:57:07 +08:00
|
|
|
|
/>
|
2025-04-12 23:18:06 +08:00
|
|
|
|
|
|
|
|
|
|
<div v-if="discuss.discussType=='Reward'">
|
|
|
|
|
|
<el-divider/>
|
|
|
|
|
|
<p style="color: red">通过”悬赏主题“发布问题,双方达成一致并解决问题后,建议有偿提供RMB给解决人员</p>
|
|
|
|
|
|
<p style="color: red">社区只提供解决问题平台,不参与任何交易,请自行联系</p>
|
|
|
|
|
|
</div>
|
2025-02-04 15:47:59 +08:00
|
|
|
|
<el-divider/>
|
2025-04-12 23:18:06 +08:00
|
|
|
|
<el-skeleton :rows="10" animated v-if="discuss.content==undefined" />
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<ArticleContentInfo
|
2025-02-04 15:47:59 +08:00
|
|
|
|
:code="discuss.content ?? ''"
|
2023-12-14 17:57:07 +08:00
|
|
|
|
></ArticleContentInfo>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2025-02-04 15:47:59 +08:00
|
|
|
|
<el-divider class="tab-divider"/>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
|
|
|
|
|
<el-space :size="10" :spacer="spacer">
|
2025-02-04 15:47:59 +08:00
|
|
|
|
<AgreeInfo :data="discuss"/>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<el-button icon="Star" text> 0</el-button>
|
|
|
|
|
|
<el-button icon="Share" text> 分享</el-button>
|
|
|
|
|
|
<el-button icon="Operation" text> 操作</el-button>
|
|
|
|
|
|
</el-space>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<el-col :span="24" class="comment">
|
2025-02-04 15:47:59 +08:00
|
|
|
|
<CommentInfo :isComment="isDisabledCreateComment"/>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
2025-02-04 15:47:59 +08:00
|
|
|
|
<BottomInfo/>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="5">
|
|
|
|
|
|
<el-row class="right-div">
|
|
|
|
|
|
<el-col :span="24">
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<InfoCard
|
2025-02-04 15:47:59 +08:00
|
|
|
|
class="art-info-right"
|
|
|
|
|
|
header="主题信息"
|
|
|
|
|
|
text="更多"
|
|
|
|
|
|
hideDivider="true"
|
2023-12-14 17:57:07 +08:00
|
|
|
|
>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<template #content>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<ul class="art-info-ul">
|
|
|
|
|
|
<li>
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<el-button
|
2025-02-04 15:47:59 +08:00
|
|
|
|
type="primary"
|
|
|
|
|
|
size="default"
|
2025-04-12 23:18:06 +08:00
|
|
|
|
v-if="isEditTheme && isArticleUser&&discuss.discussType=='Article'"
|
2025-02-04 15:47:59 +08:00
|
|
|
|
@click="updateHander(route.params.discussId)"
|
|
|
|
|
|
>编辑
|
|
|
|
|
|
</el-button
|
2023-12-14 17:57:07 +08:00
|
|
|
|
>
|
2025-04-12 23:18:06 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
type="warning"
|
|
|
|
|
|
size="default"
|
|
|
|
|
|
v-if="isEditTheme && isArticleUser&&discuss.discussType=='Reward'&&discuss.rewardData.isResolved==false"
|
|
|
|
|
|
@click="updateSolveHander(route.params.discussId)"
|
|
|
|
|
|
>设置已解决
|
|
|
|
|
|
</el-button
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<el-button
|
2025-02-04 15:47:59 +08:00
|
|
|
|
style="margin-left: 1rem"
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
v-if="isRemoveTheme && isArticleUser"
|
|
|
|
|
|
@click="delHander(route.params.discussId)"
|
|
|
|
|
|
>删除
|
|
|
|
|
|
</el-button
|
2023-12-14 17:57:07 +08:00
|
|
|
|
>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</li>
|
|
|
|
|
|
<li>分类: <span>主题</span></li>
|
|
|
|
|
|
标签:
|
|
|
|
|
|
<el-tag type="success">主题</el-tag>
|
|
|
|
|
|
<el-tag type="info">资源</el-tag>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</InfoCard>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
|
<InfoCard class="art-info-right" header="目录" hideDivider="true">
|
|
|
|
|
|
<template #content>
|
|
|
|
|
|
<div>
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<el-empty
|
2025-02-04 15:47:59 +08:00
|
|
|
|
:image-size="100"
|
|
|
|
|
|
style="padding: 20px 0"
|
|
|
|
|
|
v-if="catalogueData.length == 0"
|
|
|
|
|
|
description="无目录"
|
2023-12-14 17:57:07 +08:00
|
|
|
|
/>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<ul v-else class="art-info-ul">
|
|
|
|
|
|
<li v-for="(item, i) in catalogueData" :key="i">
|
2023-12-14 17:57:07 +08:00
|
|
|
|
<el-button
|
2025-02-04 15:47:59 +08:00
|
|
|
|
style="width: 100%; justify-content: left"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
text
|
|
|
|
|
|
>{{ `${i + 1} : ${item}` }}
|
|
|
|
|
|
</el-button
|
2023-12-14 17:57:07 +08:00
|
|
|
|
>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</InfoCard>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="24">
|
2025-02-06 12:54:48 +08:00
|
|
|
|
<InfoCard :items="themeList" :isPadding="false" header="推荐主题" text="更多" height="500" style="padding:0 20px">
|
2023-12-14 10:15:23 +08:00
|
|
|
|
<template #item="temp">
|
2025-02-04 15:23:20 +08:00
|
|
|
|
<ThemeData :themeData="temp"/>
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</InfoCard>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
2025-02-04 15:47:59 +08:00
|
|
|
|
import {h, ref, onMounted, watch, computed} from "vue";
|
2023-12-14 10:15:23 +08:00
|
|
|
|
import AvatarInfo from "@/components/AvatarInfo.vue";
|
|
|
|
|
|
import InfoCard from "@/components/InfoCard.vue";
|
|
|
|
|
|
import ArticleContentInfo from "@/components/ArticleContentInfo.vue";
|
|
|
|
|
|
import CommentInfo from "@/components/CommentInfo.vue";
|
2023-12-14 17:57:07 +08:00
|
|
|
|
import BottomInfo from "@/components/BottomInfo.vue";
|
2023-12-14 10:15:23 +08:00
|
|
|
|
import TreeArticleInfo from "@/components/TreeArticleInfo.vue";
|
2025-02-04 15:47:59 +08:00
|
|
|
|
import {useRoute, useRouter} from "vue-router";
|
2023-12-14 17:57:07 +08:00
|
|
|
|
import AgreeInfo from "@/components/AgreeInfo.vue";
|
2025-04-12 23:18:06 +08:00
|
|
|
|
import DiscussTypeLable from "@/components/DiscussTypeLable.vue";
|
|
|
|
|
|
import {get as discussGet, del as discussDel,setResolve} from "@/apis/discussApi.js";
|
2023-12-14 17:57:07 +08:00
|
|
|
|
import {
|
|
|
|
|
|
all as articleall,
|
|
|
|
|
|
del as articleDel,
|
|
|
|
|
|
get as articleGet,
|
|
|
|
|
|
} from "@/apis/articleApi.js";
|
2023-12-17 11:57:46 +08:00
|
|
|
|
import Breadcrumb from "@/components/Breadcrumb/index.vue";
|
2025-02-04 15:47:59 +08:00
|
|
|
|
import {getPermission} from "@/utils/auth";
|
2023-12-22 21:49:38 +08:00
|
|
|
|
import useUserStore from "@/stores/user.js";
|
2025-02-04 15:23:20 +08:00
|
|
|
|
import ThemeData from "@/views/home/components/RecommendTheme/index.vue";
|
2025-02-04 15:47:59 +08:00
|
|
|
|
import {getRecommendedTopic, getAuthorTopic} from "@/apis/analyseApi";
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//数据定义
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
const router = useRouter();
|
2025-02-04 15:47:59 +08:00
|
|
|
|
const spacer = h(ElDivider, {direction: "vertical"});
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//子文章数据
|
|
|
|
|
|
const articleData = ref([]);
|
|
|
|
|
|
//主题内容
|
|
|
|
|
|
const discuss = ref({});
|
2025-02-04 15:23:20 +08:00
|
|
|
|
//推荐主题
|
2025-02-04 15:47:59 +08:00
|
|
|
|
const themeList = ref([]);
|
2025-02-04 15:23:20 +08:00
|
|
|
|
//作者主题
|
2025-02-04 15:47:59 +08:00
|
|
|
|
const authorList = ref([]);
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//封面url
|
2023-12-14 17:57:07 +08:00
|
|
|
|
const getUrl = (str) => {
|
|
|
|
|
|
return `${import.meta.env.VITE_APP_BASEAPI}/file/${str}`;
|
|
|
|
|
|
};
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
|
|
|
|
|
//当前默认选择的子文章
|
2023-12-14 17:57:07 +08:00
|
|
|
|
const currentNodeKey = route.params.articleId;
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//目录数据
|
|
|
|
|
|
const catalogueData = ref([]);
|
|
|
|
|
|
|
2023-12-17 11:57:46 +08:00
|
|
|
|
// 面包屑导航列表
|
|
|
|
|
|
const breadcrumbsList = ref([]);
|
2024-01-04 20:40:57 +08:00
|
|
|
|
const resultRouters = ["index", "discuss", "themeCover"];
|
|
|
|
|
|
breadcrumbsList.value = route.matched[0].children
|
2025-02-04 15:47:59 +08:00
|
|
|
|
.filter((item) => resultRouters.includes(item.name))
|
|
|
|
|
|
.sort((a, b) => {
|
|
|
|
|
|
return resultRouters.indexOf(a.name) - resultRouters.indexOf(b.name);
|
|
|
|
|
|
});
|
2024-01-04 20:40:57 +08:00
|
|
|
|
|
2023-12-17 11:57:46 +08:00
|
|
|
|
// 当前文章名称
|
|
|
|
|
|
const currentArticle = ref("");
|
|
|
|
|
|
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//子文章初始化
|
|
|
|
|
|
const loadArticleData = async () => {
|
2023-12-14 17:57:07 +08:00
|
|
|
|
const response = await articleall(route.params.discussId);
|
2023-12-14 10:15:23 +08:00
|
|
|
|
articleData.value = response.data;
|
2023-12-14 17:57:07 +08:00
|
|
|
|
};
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
|
|
|
|
|
//主题初始化
|
2023-12-21 23:59:25 +08:00
|
|
|
|
const isDisabledCreateComment = ref(false);
|
2023-12-22 21:49:38 +08:00
|
|
|
|
const isArticleUser = ref(false);
|
2025-02-04 15:47:59 +08:00
|
|
|
|
const {isHasPermission: isAddArticle} = getPermission("bbs:article:add");
|
|
|
|
|
|
const {isHasPermission: isEditTheme} = getPermission("bbs:discuss:update");
|
|
|
|
|
|
const {isHasPermission: isRemoveTheme} = getPermission("bbs:discuss:del");
|
2023-12-14 10:15:23 +08:00
|
|
|
|
const loadDiscuss = async (isRewrite) => {
|
|
|
|
|
|
if (isRewrite) {
|
|
|
|
|
|
//跳转路由
|
|
|
|
|
|
router.push(`/article/${route.params.discussId}`);
|
|
|
|
|
|
}
|
|
|
|
|
|
discuss.value = (await discussGet(route.params.discussId)).data;
|
2023-12-21 23:59:25 +08:00
|
|
|
|
isDisabledCreateComment.value = discuss.value.isDisabledCreateComment;
|
2023-12-22 21:49:38 +08:00
|
|
|
|
isArticleUser.value = discuss.value?.user?.id === useUserStore().id;
|
2023-12-14 10:15:23 +08:00
|
|
|
|
if (route.params.articleId != "") {
|
|
|
|
|
|
const response = await articleGet(route.params.articleId);
|
|
|
|
|
|
discuss.value.content = response.data.content;
|
|
|
|
|
|
}
|
2024-01-04 20:40:57 +08:00
|
|
|
|
breadcrumbsList.value[1].path = "/discuss/" + discuss.value.plateId;
|
2024-01-04 20:58:00 +08:00
|
|
|
|
breadcrumbsList.value[1].meta.title = discuss.value.plate.name;
|
2023-12-14 10:15:23 +08:00
|
|
|
|
ContentHander();
|
|
|
|
|
|
};
|
|
|
|
|
|
//加载文章及目录
|
|
|
|
|
|
const ContentHander = () => {
|
|
|
|
|
|
//加载目录
|
|
|
|
|
|
var reg = /(#{1,6})\s(.*)/g;
|
|
|
|
|
|
|
2023-12-14 17:57:07 +08:00
|
|
|
|
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, "");
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
}
|
2023-12-14 17:57:07 +08:00
|
|
|
|
};
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//添加树型子文章
|
|
|
|
|
|
const addArticle = (parentArticleId) => {
|
|
|
|
|
|
//跳转路由
|
|
|
|
|
|
var routerPer = {
|
|
|
|
|
|
path: "/editArt",
|
|
|
|
|
|
query: {
|
|
|
|
|
|
operType: "create",
|
|
|
|
|
|
artType: "article",
|
|
|
|
|
|
discussId: route.params.discussId,
|
|
|
|
|
|
parentArticleId: parentArticleId,
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
router.push(routerPer);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//删除主题
|
|
|
|
|
|
const delHander = async (ids) => {
|
|
|
|
|
|
ElMessageBox.confirm(`确定是否删除编号[${ids}]的主题吗?`, "警告", {
|
|
|
|
|
|
confirmButtonText: "确认",
|
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
|
type: "warning",
|
|
|
|
|
|
}).then(async () => {
|
|
|
|
|
|
const response = await discussDel(ids);
|
|
|
|
|
|
//删除成功后,跳转到主页
|
|
|
|
|
|
router.push("/index");
|
|
|
|
|
|
ElMessage({
|
|
|
|
|
|
type: "success",
|
|
|
|
|
|
message: "删除成功",
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
2025-04-12 23:18:06 +08:00
|
|
|
|
//设置已解决
|
|
|
|
|
|
const updateSolveHander=(discussId)=>{
|
|
|
|
|
|
ElMessageBox.confirm(`确定要将此悬赏主题设置已解决吗?`, "警告", {
|
|
|
|
|
|
confirmButtonText: "确认",
|
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
|
type: "warning",
|
|
|
|
|
|
}).then(async () => {
|
|
|
|
|
|
await setResolve(discussId);
|
|
|
|
|
|
ElMessage({
|
|
|
|
|
|
type: "success",
|
|
|
|
|
|
message: "设置成功",
|
|
|
|
|
|
});
|
|
|
|
|
|
await loadDiscuss();
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//更新操作
|
|
|
|
|
|
const updateHander = (discussId) => {
|
|
|
|
|
|
//跳转路由
|
|
|
|
|
|
var routerPer = {
|
|
|
|
|
|
path: "/editArt",
|
|
|
|
|
|
query: {
|
|
|
|
|
|
operType: "update",
|
|
|
|
|
|
artType: "discuss",
|
|
|
|
|
|
discussId: discussId,
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
router.push(routerPer);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//跳转添加子菜单
|
|
|
|
|
|
const addNextArticle = (node, data) => {
|
|
|
|
|
|
//跳转路由
|
|
|
|
|
|
var routerPer = {
|
|
|
|
|
|
path: "/editArt",
|
|
|
|
|
|
query: {
|
|
|
|
|
|
operType: "create",
|
|
|
|
|
|
artType: "article",
|
|
|
|
|
|
discussId: data.discussId,
|
|
|
|
|
|
parentArticleId: data.id,
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
router.push(routerPer);
|
2023-12-14 17:57:07 +08:00
|
|
|
|
};
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
|
|
|
|
|
//跳转更新子菜单
|
|
|
|
|
|
const updateArticle = (node, data) => {
|
|
|
|
|
|
//跳转路由
|
|
|
|
|
|
var routerPer = {
|
|
|
|
|
|
path: "/editArt",
|
|
|
|
|
|
query: {
|
|
|
|
|
|
operType: "update",
|
|
|
|
|
|
artType: "article",
|
|
|
|
|
|
discussId: data.discussId,
|
|
|
|
|
|
parentArticleId: data.parentId,
|
2023-12-14 17:57:07 +08:00
|
|
|
|
articleId: data.id,
|
2023-12-14 10:15:23 +08:00
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
router.push(routerPer);
|
2023-12-14 17:57:07 +08:00
|
|
|
|
};
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//单机节点
|
2023-12-14 17:57:07 +08:00
|
|
|
|
const handleNodeClick = async (data) => {
|
2023-12-17 11:57:46 +08:00
|
|
|
|
currentArticle.value = data?.name;
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//跳转路由
|
|
|
|
|
|
|
|
|
|
|
|
router.push(`/article/${route.params.discussId}/${data.id}`);
|
|
|
|
|
|
|
2025-02-12 22:25:27 +08:00
|
|
|
|
|
2023-12-14 17:57:07 +08:00
|
|
|
|
};
|
2023-12-14 10:15:23 +08:00
|
|
|
|
//删除子文章
|
|
|
|
|
|
const delArticle = (node, data) => {
|
|
|
|
|
|
ElMessageBox.confirm(`确定是否删除编号[${data.id}]的子文章吗?`, "警告", {
|
|
|
|
|
|
confirmButtonText: "确认",
|
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
|
type: "warning",
|
|
|
|
|
|
}).then(async () => {
|
|
|
|
|
|
await articleDel(data.id);
|
|
|
|
|
|
await loadArticleData();
|
|
|
|
|
|
|
|
|
|
|
|
ElMessage({
|
|
|
|
|
|
type: "success",
|
|
|
|
|
|
message: "删除成功",
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
2023-12-14 17:57:07 +08:00
|
|
|
|
};
|
2025-02-04 15:47:59 +08:00
|
|
|
|
const loadThemeData = async () => {
|
2025-02-04 15:23:20 +08:00
|
|
|
|
const {data: themeData} = await getRecommendedTopic();
|
|
|
|
|
|
themeList.value = themeData;
|
|
|
|
|
|
}
|
2025-02-04 15:47:59 +08:00
|
|
|
|
const loadAuthorData = async () => {
|
2025-02-04 15:23:20 +08:00
|
|
|
|
const {data: authorData} = await getAuthorTopic(discuss.value.user.id);
|
|
|
|
|
|
authorList.value = authorData;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
await loadDiscuss();
|
|
|
|
|
|
await loadArticleData();
|
2025-02-04 15:23:20 +08:00
|
|
|
|
await loadAuthorData();
|
|
|
|
|
|
await loadThemeData();
|
2023-12-14 10:15:23 +08:00
|
|
|
|
});
|
2025-02-12 22:25:27 +08:00
|
|
|
|
|
2025-02-04 15:23:20 +08:00
|
|
|
|
|
2023-12-17 11:57:46 +08:00
|
|
|
|
watch(
|
2025-02-04 15:47:59 +08:00
|
|
|
|
() => currentArticle.value,
|
|
|
|
|
|
(val) => {
|
|
|
|
|
|
if (val !== "") {
|
|
|
|
|
|
breadcrumbsList.value[3] = {
|
|
|
|
|
|
name: "article",
|
|
|
|
|
|
path: "/article/:discussId",
|
|
|
|
|
|
meta: {
|
|
|
|
|
|
title: currentArticle.value,
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2023-12-17 11:57:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
watch(
|
2025-02-12 22:25:27 +08:00
|
|
|
|
() => route.params,
|
2025-02-04 15:47:59 +08:00
|
|
|
|
async (val) => {
|
2025-02-12 22:25:27 +08:00
|
|
|
|
if (val.articleId !=="")
|
|
|
|
|
|
{
|
|
|
|
|
|
const response = await articleGet(route.params.articleId);
|
|
|
|
|
|
discuss.value.content = response.data.content;
|
|
|
|
|
|
ContentHander();
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (val.discussId !== "") {
|
2025-02-04 15:47:59 +08:00
|
|
|
|
discuss.value = (await discussGet(route.params.discussId)).data;
|
|
|
|
|
|
}
|
2023-12-17 11:57:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
);
|
2025-02-12 22:25:27 +08:00
|
|
|
|
//路由发送变化,重新加载
|
|
|
|
|
|
// watch(() => route.params, async () => {
|
|
|
|
|
|
// await loadDiscuss();
|
|
|
|
|
|
// await loadArticleData();
|
|
|
|
|
|
// await loadAuthorData();
|
|
|
|
|
|
// await loadThemeData();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// )
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</script>
|
2023-12-21 12:56:06 +08:00
|
|
|
|
<style scoped lang="scss">
|
2024-03-03 15:58:19 +08:00
|
|
|
|
|
2025-02-04 15:47:59 +08:00
|
|
|
|
.subtitle {
|
|
|
|
|
|
color: #999AAA;
|
2024-03-03 15:58:19 +08:00
|
|
|
|
margin: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.article-box {
|
2025-02-04 15:23:20 +08:00
|
|
|
|
width: 1500px;
|
2023-12-20 21:52:42 +08:00
|
|
|
|
height: 100%;
|
2025-02-04 15:47:59 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.comment {
|
|
|
|
|
|
min-height: 40rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.art-info-left .el-col {
|
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.art-info-ul span {
|
|
|
|
|
|
margin-left: 1rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.art-info-ul .el-tag {
|
|
|
|
|
|
margin-left: 1rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.art-info-ul {
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
li {
|
|
|
|
|
|
list-style: none;
|
|
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.art-info-right {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.left-div .el-col {
|
2025-08-04 22:35:45 +08:00
|
|
|
|
background-color: #1D1E1F;
|
2023-12-20 21:52:42 +08:00
|
|
|
|
min-height: 12rem;
|
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.right-div .el-col {
|
2025-08-04 22:35:45 +08:00
|
|
|
|
background-color: #1D1E1F;
|
2023-12-20 21:52:42 +08:00
|
|
|
|
min-height: 10rem;
|
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.left-top-div .el-col {
|
|
|
|
|
|
min-height: 2rem;
|
|
|
|
|
|
background-color: #fafafa;
|
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.top-div {
|
|
|
|
|
|
padding-top: 1rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.left-top-div {
|
|
|
|
|
|
font-size: small;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
line-height: 2rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
h2 {
|
|
|
|
|
|
margin-bottom: 0.5em;
|
2025-08-04 22:35:45 +08:00
|
|
|
|
color: #fff;
|
2023-12-20 21:52:42 +08:00
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
|
line-height: 1.35;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.left-div .el-col {
|
|
|
|
|
|
padding: 1.4rem 1.4rem 0.5rem 1.4rem;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.el-space {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
|
justify-content: space-evenly;
|
|
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.tab-divider {
|
|
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
|
}
|
2023-12-17 11:57:46 +08:00
|
|
|
|
|
2023-12-20 21:52:42 +08:00
|
|
|
|
.breadcrumb {
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
}
|
2023-12-17 11:57:46 +08:00
|
|
|
|
}
|
2023-12-14 10:15:23 +08:00
|
|
|
|
</style>
|