mirror of
https://github.com/certd/certd.git
synced 2026-04-14 12:30:54 +08:00
fix: 修复偶尔下载证书报未授权的错误
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
</template>
|
||||
<div class="rounded pl-3 pr-3 px-2 py-1 flex-center flex pointer items-center bg-accent h-10 button-text" title="当前项目">
|
||||
<!-- <fs-icon icon="ion:apps" class="mr-1"></fs-icon> -->
|
||||
<fs-icon :icon="currentIcon" class="mr-5"></fs-icon>
|
||||
当前项目:{{ projectStore.currentProject?.name || "..." }}
|
||||
<fs-icon :icon="currentIcon" class="ml-5"></fs-icon>
|
||||
</div>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<a-tag color="green" class="flex-center flex pointer items-center button-text" title="当前项目">
|
||||
<!-- <fs-icon icon="ion:apps" class="mr-1"></fs-icon> -->
|
||||
<fs-icon :icon="currentIcon" class="mr-5"></fs-icon>
|
||||
当前项目:{{ projectStore.currentProject?.name || "..." }}
|
||||
<fs-icon :icon="currentIcon" class="ml-5"></fs-icon>
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { useDicts } from "../../dicts";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
@@ -39,6 +40,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const { myProjectDict } = useDicts();
|
||||
const settingStore = useSettingStore();
|
||||
const projectStore = useProjectStore();
|
||||
const userStore = useUserStore();
|
||||
const model = useModal();
|
||||
const viewCert = async (row: any) => {
|
||||
const cert = await api.GetCert(row.id);
|
||||
@@ -140,7 +142,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
notification.error({ message: t("certd.certificateNotGenerated") });
|
||||
return;
|
||||
}
|
||||
window.open("/api/monitor/cert/download?id=" + row.id);
|
||||
let url = "/api/monitor/cert/download?id=" + row.id;
|
||||
if (projectStore.isEnterprise) {
|
||||
url += `&projectId=${projectStore.currentProject?.id}`;
|
||||
}
|
||||
url += `&token=${userStore.getToken}`;
|
||||
window.open(url);
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -3,8 +3,12 @@ import { notification } from "ant-design-vue";
|
||||
import CertView from "/@/views/certd/pipeline/cert-view.vue";
|
||||
import { env } from "/@/utils/util.env";
|
||||
import { useModal } from "/@/use/use-modal";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
|
||||
export function useCertViewer() {
|
||||
const projectStore = useProjectStore();
|
||||
const userStore = useUserStore();
|
||||
const model = useModal();
|
||||
const viewCert = async (id: number) => {
|
||||
const cert = await api.GetCert(id);
|
||||
@@ -33,7 +37,11 @@ export function useCertViewer() {
|
||||
content: () => {
|
||||
const children = [];
|
||||
for (const file of files) {
|
||||
const downloadUrl = `${env.API}/pi/history/download?pipelineId=${id}&fileId=${file.id}`;
|
||||
let downloadUrl = `${env.API}/pi/history/download?pipelineId=${id}&fileId=${file.id}`;
|
||||
if (projectStore.isEnterprise) {
|
||||
downloadUrl += `&projectId=${projectStore.currentProject?.id}`;
|
||||
}
|
||||
downloadUrl += `&token=${userStore.getToken}`;
|
||||
children.push(
|
||||
<div>
|
||||
<div class={"flex-o m-5"}>
|
||||
|
||||
Reference in New Issue
Block a user