|
|
@@ -44,6 +44,7 @@ import {
|
|
44
|
44
|
getKnowledgeContentDetail,
|
|
45
|
45
|
queryKnowledgeContentlist,
|
|
46
|
46
|
} from '#/api/knowledge/content';
|
|
|
47
|
+import { queryKnowledgeCategoryDetail } from '#/api/knowledge/category';
|
|
47
|
48
|
import {
|
|
48
|
49
|
addrecord,
|
|
49
|
50
|
queryPublishRecordlist,
|
|
|
@@ -60,9 +61,7 @@ const userId = userStore.userInfo?.userId;
|
|
60
|
61
|
// 路由实例
|
|
61
|
62
|
const router = useRouter();
|
|
62
|
63
|
const route = useRoute();
|
|
63
|
|
-const { classId, classname, classicon } = route.params;
|
|
64
|
|
-console.log(route.params);
|
|
65
|
|
-
|
|
|
64
|
+const { classId } = route.params;
|
|
66
|
65
|
// 菜单折叠状态
|
|
67
|
66
|
const isCollapse = ref(false);
|
|
68
|
67
|
|
|
|
@@ -78,6 +77,7 @@ const commentsloading = ref(true);
|
|
78
|
77
|
const centerloading = ref(false);
|
|
79
|
78
|
const isEdit = ref(false);
|
|
80
|
79
|
const ChapterId = ref(null);
|
|
|
80
|
+const KnowledgeDetails = ref({}) as any;
|
|
81
|
81
|
// 查询章节数据
|
|
82
|
82
|
const chapterDatafn = async () => {
|
|
83
|
83
|
chapterDataloading.value = true;
|
|
|
@@ -85,7 +85,6 @@ const chapterDatafn = async () => {
|
|
85
|
85
|
const res = await queryKnowledgeContentlist(classId);
|
|
86
|
86
|
if (res.code === 200) {
|
|
87
|
87
|
console.log('章节数据', res.data);
|
|
88
|
|
-
|
|
89
|
88
|
chapterData.value = res.data || [];
|
|
90
|
89
|
handleChapterClick({ id: chapterData.value[0]?.id });
|
|
91
|
90
|
}
|
|
|
@@ -134,7 +133,18 @@ const queryrecordfn = async () => {
|
|
134
|
133
|
commentsloading.value = false;
|
|
135
|
134
|
}
|
|
136
|
135
|
};
|
|
|
136
|
+// 查询知识分类详情
|
|
|
137
|
+const queryKnowledgeCategoryDetailfn = async () => {
|
|
|
138
|
+ try {
|
|
|
139
|
+ const res = await queryKnowledgeCategoryDetail(classId);
|
|
|
140
|
+ KnowledgeDetails.value = res;
|
|
|
141
|
+ } catch (error) {
|
|
|
142
|
+ console.log(error);
|
|
|
143
|
+ }
|
|
|
144
|
+};
|
|
|
145
|
+
|
|
137
|
146
|
onMounted(() => {
|
|
|
147
|
+ queryKnowledgeCategoryDetailfn();
|
|
138
|
148
|
chapterDatafn();
|
|
139
|
149
|
querycommentfn();
|
|
140
|
150
|
addrecordfn();
|
|
|
@@ -169,7 +179,7 @@ const toggleCollapse = () => {
|
|
169
|
179
|
// 提醒弹框
|
|
170
|
180
|
const notificationDialogVisible = ref(false);
|
|
171
|
181
|
const notificationContent = ref('');
|
|
172
|
|
-const notificationRecipients = ref([]);
|
|
|
182
|
+const notificationRecipients = ref([]) as any;
|
|
173
|
183
|
|
|
174
|
184
|
// 打开提醒弹框
|
|
175
|
185
|
const openNotificationDialog = () => {
|
|
|
@@ -237,7 +247,7 @@ const formatTime = (d: Date) =>
|
|
237
|
247
|
d.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' });
|
|
238
|
248
|
const computedEditHistoryData = computed(() => {
|
|
239
|
249
|
const dayMap = new Map<string, any[]>();
|
|
240
|
|
- editHistoryData.value.forEach((item:any) => {
|
|
|
250
|
+ editHistoryData.value.forEach((item: any) => {
|
|
241
|
251
|
const day = formatDayOffset(item.createTime);
|
|
242
|
252
|
if (!dayMap.has(day)) dayMap.set(day, []);
|
|
243
|
253
|
dayMap.get(day)!.push({
|
|
|
@@ -258,7 +268,7 @@ const queryPublishRecordlistfn = async () => {
|
|
258
|
268
|
try {
|
|
259
|
269
|
const res = await queryPublishRecordlist({
|
|
260
|
270
|
categoryId: classId,
|
|
261
|
|
- contentId:ChapterId.value
|
|
|
271
|
+ contentId: ChapterId.value,
|
|
262
|
272
|
});
|
|
263
|
273
|
editHistoryData.value = res?.rows || [];
|
|
264
|
274
|
} catch (error) {
|
|
|
@@ -299,7 +309,7 @@ const selectHistoryRecord = (record: any) => {
|
|
299
|
309
|
};
|
|
300
|
310
|
|
|
301
|
311
|
// 点击章节
|
|
302
|
|
-const handleChapterClick = async (node:any) => {
|
|
|
312
|
+const handleChapterClick = async (node: any) => {
|
|
303
|
313
|
centerloading.value = true;
|
|
304
|
314
|
ChapterId.value = node.id;
|
|
305
|
315
|
if (!isEdit.value) isEdit.value = true;
|
|
|
@@ -338,7 +348,7 @@ const addEditDialogVisible = ref(false);
|
|
338
|
348
|
const addiseditTitle = ref('');
|
|
339
|
349
|
const editvaloraddId = ref({});
|
|
340
|
350
|
// 添加章节
|
|
341
|
|
-const addChapter = (data) => {
|
|
|
351
|
+const addChapter = (data: any) => {
|
|
342
|
352
|
addEditDialogVisible.value = true;
|
|
343
|
353
|
addiseditTitle.value = '新增章节';
|
|
344
|
354
|
editvaloraddId.value = {
|
|
|
@@ -348,14 +358,14 @@ const addChapter = (data) => {
|
|
348
|
358
|
};
|
|
349
|
359
|
};
|
|
350
|
360
|
// 编辑章节
|
|
351
|
|
-const editChapter = (node) => {
|
|
|
361
|
+const editChapter = (node: any) => {
|
|
352
|
362
|
addEditDialogVisible.value = true;
|
|
353
|
363
|
addiseditTitle.value = '编辑章节';
|
|
354
|
364
|
editvaloraddId.value = node;
|
|
355
|
365
|
};
|
|
356
|
366
|
|
|
357
|
367
|
// 删除章节
|
|
358
|
|
-const deleteChapter = async (node) => {
|
|
|
368
|
+const deleteChapter = async (node: any) => {
|
|
359
|
369
|
try {
|
|
360
|
370
|
await deleteKnowledgeContent(node.id);
|
|
361
|
371
|
await chapterDatafn();
|
|
|
@@ -374,7 +384,9 @@ const submitComment = async () => {
|
|
374
|
384
|
await addComment({
|
|
375
|
385
|
targetId: Number(classId),
|
|
376
|
386
|
targetType: 'knowledge',
|
|
377
|
|
- attachments: commentImages.value.map((item) => item.fileName).join(','),
|
|
|
387
|
+ attachments: commentImages.value
|
|
|
388
|
+ .map((item: any) => item.fileName)
|
|
|
389
|
+ .join(','),
|
|
378
|
390
|
content: newComment.value,
|
|
379
|
391
|
});
|
|
380
|
392
|
newComment.value = '';
|
|
|
@@ -446,11 +458,11 @@ const handleUploadSuccess = (file: any) => {
|
|
446
|
458
|
}
|
|
447
|
459
|
};
|
|
448
|
460
|
// 移除上传的图片
|
|
449
|
|
-const removeImage = (index: number) => {
|
|
|
461
|
+const removeImage = (index: any) => {
|
|
450
|
462
|
commentImages.value = [];
|
|
451
|
463
|
uploadRef?.value?.clearFiles();
|
|
452
|
464
|
};
|
|
453
|
|
-const navigateToEdit = (id: number) => {
|
|
|
465
|
+const navigateToEdit = (id: any) => {
|
|
454
|
466
|
router.push(`/knowledge/detail/edit/${id}/${ChapterId.value}`);
|
|
455
|
467
|
};
|
|
456
|
468
|
const addMenu = () => {
|
|
|
@@ -522,7 +534,7 @@ const isImage = (url: string) => {
|
|
522
|
534
|
if (!url) return false;
|
|
523
|
535
|
try {
|
|
524
|
536
|
const cleanUrl = url.split('?')[0];
|
|
525
|
|
- const ext = cleanUrl.split('.').pop()?.toLowerCase() ?? '';
|
|
|
537
|
+ const ext = cleanUrl?.split('.').pop()?.toLowerCase() ?? '';
|
|
526
|
538
|
return imageExt.has(ext);
|
|
527
|
539
|
} catch {
|
|
528
|
540
|
return false;
|
|
|
@@ -537,7 +549,7 @@ const nonImageList = computed(() => {
|
|
537
|
549
|
: selectedChapter.value.attachmentUrl
|
|
538
|
550
|
? [selectedChapter.value.attachmentUrl]
|
|
539
|
551
|
: [];
|
|
540
|
|
- const result = urls.filter((u) => !isImage(u));
|
|
|
552
|
+ const result = urls.filter((u: any) => !isImage(u));
|
|
541
|
553
|
return result;
|
|
542
|
554
|
});
|
|
543
|
555
|
</script>
|
|
|
@@ -597,16 +609,16 @@ const nonImageList = computed(() => {
|
|
597
|
609
|
<div class="knowledge-info">
|
|
598
|
610
|
<div class="knowledge-icon">
|
|
599
|
611
|
<span
|
|
600
|
|
- v-if="classicon?.includes('iconfont')"
|
|
601
|
|
- :class="classicon?.split(',')[0] || ''"
|
|
|
612
|
+ v-if="KnowledgeDetails?.icon?.includes('iconfont')"
|
|
|
613
|
+ :class="KnowledgeDetails?.icon?.split(',')[0] || ''"
|
|
602
|
614
|
:style="{
|
|
603
|
|
- color: `#${classicon?.split(',')[1] || ''}`,
|
|
|
615
|
+ color: `${KnowledgeDetails?.icon?.split(',')[1] || ''}`,
|
|
604
|
616
|
fontSize: '30px',
|
|
605
|
617
|
}"
|
|
606
|
618
|
></span>
|
|
607
|
|
- <img v-else :src="classicon" alt="" />
|
|
|
619
|
+ <img v-else :src="KnowledgeDetails?.iconUrl?.[0] || ''" alt="" />
|
|
608
|
620
|
</div>
|
|
609
|
|
- <div class="knowledge-title">{{ classname }}</div>
|
|
|
621
|
+ <div class="knowledge-title">{{ KnowledgeDetails?.name }}</div>
|
|
610
|
622
|
</div>
|
|
611
|
623
|
|
|
612
|
624
|
<!-- 主页按钮 -->
|