gerson
2024-11-01 edb0321d349bcea2501a4b1a65f5e5e667ffd474
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<template>
    <div class="w100 h100">
        <div class="mb-[10px] flex flex-shrink-0 items-center">
            <el-button style="margin-left: 8px; width: 40px" link @click="handleShowKnowledge">
                <el-icon style="font-size: 24px !important">
                    <ArrowLeft />
                </el-icon>
            </el-button>
            <span class="text-[24px] text-[#26244c] font-[700]">{{ knowledge_title }}</span>
        </div>
        <div class="w100 bg-[#fff] overflow-auto set-table-height">
            <NormalTextCom :data="sampleData"></NormalTextCom>
        </div>
    </div>
</template>
 
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { get_knowledge_file_text } from '/@/api/knowledge/group';
import NormalTextCom from '/@/components/chat/chatComponents/normalTextCom/NormalTextCom.vue';
const route = useRoute();
const router = useRouter();
const sampleData = ref('');
const knowledge_title = ref('查看文档');
//返回到知识库查看页面
const handleShowKnowledge = () => {
    router.back();
};
const getViewFile = async (file_id) => {
    const res = await get_knowledge_file_text({
        file_id: file_id,
    });
    if (res.json_ok) {
        const data = res.value;
        sampleData.value = data;
    } else {
        sampleData.value = '';
    }
};
onMounted(() => {
    const { id } = route.query;
    if (id == null) return;
    getViewFile(id);
});
</script>
<style scoped lang="scss">
.set-table-height {
    background: #fff;
    border-radius: 16px;
    height: calc(100% - 50px);
    margin-top: 12px;
    overflow-y: auto;
    padding: 20px 24px;
    box-sizing: border-box;
}
</style>