mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
chore: 首页数据统计项目显示
This commit is contained in:
@@ -136,27 +136,29 @@ function createService() {
|
||||
*/
|
||||
function createRequestFunction(service: any) {
|
||||
return function (config: any) {
|
||||
const configDefault = {
|
||||
const configDefault: any = {
|
||||
headers: {
|
||||
"Content-Type": get(config, "headers.Content-Type", "application/json"),
|
||||
} as any,
|
||||
timeout: 30000,
|
||||
baseURL: env.API,
|
||||
data: {},
|
||||
params: {},
|
||||
};
|
||||
const projectStore = useProjectStore();
|
||||
|
||||
if (projectStore.isEnterprise && !config.url.startsWith("/sys") && !config.url.startsWith("http")) {
|
||||
configDefault.headers["project-id"] = projectStore.currentProjectId;
|
||||
}
|
||||
|
||||
const userStore = useUserStore();
|
||||
const token = userStore.getToken;
|
||||
if (token != null) {
|
||||
// @ts-ignore
|
||||
configDefault.headers.Authorization = token;
|
||||
}
|
||||
return service(Object.assign(configDefault, config));
|
||||
Object.assign(configDefault, config);
|
||||
|
||||
if (projectStore.isEnterprise && !config.url.startsWith("/sys") && !config.url.startsWith("http")) {
|
||||
configDefault.params.projectId = projectStore.currentProjectId;
|
||||
}
|
||||
return service(configDefault);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ import NotificationSelector from "../views/certd/notification/notification-selec
|
||||
import EmailSelector from "./email-selector/index.vue";
|
||||
import ValidTimeFormat from "./valid-time-format.vue";
|
||||
import ProjectSelector from "./project-selector/index.vue";
|
||||
import ProjectCurrent from "./project-selector/project-current.vue";
|
||||
|
||||
export default {
|
||||
install(app: any) {
|
||||
app.component(
|
||||
@@ -47,5 +49,6 @@ export default {
|
||||
app.use(vip);
|
||||
app.use(Plugins);
|
||||
app.component("ProjectSelector", ProjectSelector);
|
||||
app.component("ProjectCurrent", ProjectCurrent);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<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 || "..." }}
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, onMounted } from "vue";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { useDicts } from "/@/views/certd/dicts";
|
||||
defineOptions({
|
||||
name: "ProjectCurrent",
|
||||
});
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
// onMounted(async () => {
|
||||
// await projectStore.reload();
|
||||
// });
|
||||
|
||||
const { projectPermissionDict } = useDicts();
|
||||
|
||||
const currentIcon = computed(() => {
|
||||
return projectPermissionDict.dataMap[projectStore.currentProject?.permission || ""]?.icon || "";
|
||||
});
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
@@ -35,6 +35,11 @@
|
||||
<a-divider type="vertical" />
|
||||
<vip-button mode="nav" style="font-size: 12px"></vip-button>
|
||||
</template>
|
||||
|
||||
<template v-if="settingsStore.isEnterprise">
|
||||
<a-divider type="vertical" />
|
||||
<project-current></project-current>
|
||||
</template>
|
||||
<template v-if="settingsStore.isComm">
|
||||
<a-divider type="vertical" />
|
||||
<suite-card class="m-0"></suite-card>
|
||||
|
||||
Reference in New Issue
Block a user