fix: 下载文件修改

dev_1.0.0
xiangcongshuai 11 months ago
parent b235b577d6
commit f2a2414fb8

@ -15,7 +15,9 @@ const { logout, userAvatar } = useNav();
import { CaretBottom } from "@element-plus/icons-vue"; import { CaretBottom } from "@element-plus/icons-vue";
const { route } = useNav(); const { route } = useNav();
const userName = ref(""); const userName = ref("");
const headPicId = ref("");
const router = useRouter(); const router = useRouter();
import { downloadFile } from "@/api/system";
const defaultActive = computed(() => const defaultActive = computed(() =>
!isAllEmpty(route.meta?.activePath) ? route.meta.activePath : route.path !isAllEmpty(route.meta?.activePath) ? route.meta.activePath : route.path
); );
@ -138,6 +140,7 @@ const changeRouter = item => {
onMounted(() => { onMounted(() => {
const userInfo: any = getUserInfo(); const userInfo: any = getUserInfo();
userName.value = JSON.parse(userInfo).username; userName.value = JSON.parse(userInfo).username;
headPicId.value = JSON.parse(userInfo).headPicId;
}); });
</script> </script>
@ -191,7 +194,7 @@ onMounted(() => {
<el-dropdown class="user-set" trigger="click"> <el-dropdown class="user-set" trigger="click">
<span class="user-set-main"> <span class="user-set-main">
<!-- <img class="head" :src="userAvatar" :style="avatarsStyle" /> --> <!-- <img class="head" :src="userAvatar" :style="avatarsStyle" /> -->
<el-avatar :size="36" :src="userAvatar" /> <el-avatar :size="36" :src="downloadFile(headPicId)" />
<p>{{ `欢迎您,${userName}` }}</p> <p>{{ `欢迎您,${userName}` }}</p>
<el-icon><CaretBottom /></el-icon> <el-icon><CaretBottom /></el-icon>
</span> </span>

@ -55,7 +55,18 @@ const getDeatils = async id => {
const closeDialog = () => { const closeDialog = () => {
dialogVisible.value = false; dialogVisible.value = false;
}; };
const downLoadFile = item => {}; const downloadFile = (url, fileName) => {
const link = document.createElement("a");
link.href = url;
link.download = fileName;
link.click();
};
const downLoadFile = item => {
downloadFile(
`/know-sub/file/downloadFile?fileId=${item.fileBlobId}`,
item.fileName
);
};
</script> </script>
<template> <template>
@ -222,6 +233,7 @@ const downLoadFile = item => {};
display: flex; display: flex;
font-size: 16px; font-size: 16px;
color: #333333; color: #333333;
cursor: pointer;
.link { .link {
color: #0052d9; color: #0052d9;
} }

@ -46,7 +46,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
proxy: { proxy: {
// 类型: Record<string, string | ProxyOp 为开发服务器配置自定义代理规则 // 类型: Record<string, string | ProxyOp 为开发服务器配置自定义代理规则
"/know-sub/": { "/know-sub/": {
target: "http://192.168.10.138:1180/", target: "http://192.168.10.25:9201/",
changeOrigin: true, changeOrigin: true,
secure: false secure: false
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow

Loading…
Cancel
Save