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

@ -55,7 +55,18 @@ const getDeatils = async id => {
const closeDialog = () => {
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>
<template>
@ -222,6 +233,7 @@ const downLoadFile = item => {};
display: flex;
font-size: 16px;
color: #333333;
cursor: pointer;
.link {
color: #0052d9;
}

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

Loading…
Cancel
Save