部分下载文件功能添加

This commit is contained in:
2026-09-23 13:45:06 +08:00
parent 0e42842611
commit 86a3520ecb
6 changed files with 36 additions and 32 deletions
@@ -3,7 +3,7 @@
import { ref, computed, h, watch } from 'vue';
import { Icon } from '@iconify/vue'
import { useThemeStore } from '@/store/modules/theme';
import { tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { tagTextColor, tagBgColor, tagBorderColor, downloadFileFun } from '@/utils/common';
import { localStg } from '@/utils/storage';
import { useChangeStore } from '@/store/modules/change';
import { AiError, aiTypeJudge, aiLevelScore, aiApplication } from "@/service/api/ai";
@@ -346,8 +346,10 @@ const handleScoreChange = (val:number,index:number) => {
totalScore.value = score;
}
// 下载PDF
const downloadPdf = () => window.$message?.success(`演示:${previewFile.value} 已下载`);
// 下载
const downloadFile = (file:any) => {
downloadFileFun(file?.file_url, file?.doc_name || file?.file_name);
};
// 自定义渲染展开图标
const renderSwitcherIcon = (node:any) => {
// 如果节点没有 children 或 children 为空数组,则不显示图标
@@ -794,7 +796,7 @@ defineExpose({form, questions, applyAiResult, generateLevel: useAiLevel})
</template>
<template #footer>
<div class="flex justify-end gap-[10px]">
<NButton ghost size="small" @click="downloadPdf">
<NButton ghost size="small" @click="downloadFile(previewFile)">
<Icon icon="material-symbols:download" class="size-16px" /> 下载
</NButton>
<NButton size="small" type="primary" @click="previewFile = null">关闭</NButton>