wujingjing
2024-12-31 8d83544ff6e123df4facf40c446e7d9bf4a522b6
src/views/project/yw/dataManage/viewKnowBase/ViewFile.vue
@@ -1,4 +1,57 @@
<template><div>123</div></template>
<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"></script>
<style scoped lang="scss"></style>
<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>