chore: project blank

This commit is contained in:
xiaojunnuo
2026-02-27 23:09:50 +08:00
parent 316537eb4d
commit e17f381b1f
7 changed files with 289 additions and 55 deletions

View File

@@ -820,6 +820,17 @@ export default {
admin: "Admin",
},
},
project: {
noProjectJoined: "You haven't joined any projects yet",
applyToJoin: "Please apply to join a project to start using",
systemProjects: "System Project List",
createdAt: "Created At",
applyJoin: "Apply to Join",
noSystemProjects: "No system projects available",
fetchFailed: "Failed to fetch project list",
applySuccess: "Application successful, waiting for admin approval",
applyFailed: "Application failed, please try again later",
},
addonSelector: {
select: "Select",
placeholder: "select please",

View File

@@ -836,4 +836,15 @@ export default {
admin: "管理员",
},
},
project: {
noProjectJoined: "您还没有加入任何项目",
applyToJoin: "请申请加入项目以开始使用",
systemProjects: "系统项目列表",
createdAt: "创建时间",
applyJoin: "申请加入",
noSystemProjects: "暂无系统项目",
fetchFailed: "获取项目列表失败",
applySuccess: "申请成功,等待管理员审核",
applyFailed: "申请失败,请稍后重试",
},
};

View File

@@ -9,7 +9,8 @@ import { useSettingStore } from "/@/store/settings";
import { usePermissionStore } from "/@/plugin/permission/store.permission";
import util from "/@/plugin/permission/util.permission";
import { useUserStore } from "/@/store/user";
import { useProjectStore } from "../store/project";
export const PROJECT_BLANK_PATH = "/certd/project/blank";
function buildAccessedMenus(menus: any) {
if (menus == null) {
return;
@@ -124,6 +125,20 @@ function setupAccessGuard(router: Router) {
};
}
return true;
} else {
// 如果是项目模式
const projectStore = useProjectStore();
if (projectStore.isEnterprise) {
//加载我的项目
await projectStore.init();
if (!projectStore.currentProject && to.path !== PROJECT_BLANK_PATH) {
//没有项目
return {
path: PROJECT_BLANK_PATH,
replace: true,
};
}
}
}
});
}

View File

@@ -42,6 +42,17 @@ export const certdResources = [
permission: "sys:settings:edit",
},
},
{
title: "certd.sysResources.myProjectBlank",
name: "MyProjectBlank",
path: "/certd/project/blank",
component: "/certd/project/blank.vue",
meta: {
isMenu: false,
show: true,
icon: "ion:apps",
},
},
{
title: "certd.pipeline",
name: "PipelineManager",

View File

@@ -13,6 +13,7 @@ export type ProjectItem = {
export const useProjectStore = defineStore("app.project", () => {
const myProjects = ref([]);
const inited = ref(false);
const lastProjectId = LocalStorage.get("currentProjectId");
const currentProjectId = ref(lastProjectId); // 直接调用
@@ -66,13 +67,16 @@ export const useProjectStore = defineStore("app.project", () => {
}
async function reload() {
const projects = await api.MyProjectList();
myProjects.value = projects;
debugger;
inited.value = false;
await init();
}
async function init() {
if (!myProjects.value) {
await reload();
debugger;
if (!inited.value) {
await loadMyProjects();
inited.value = true;
}
return myProjects.value;
}

View File

@@ -0,0 +1,122 @@
<template>
<fs-page class="page-cert">
<template #header>
<div class="title">
{{ t("certd.sysResources.myProjectManager") }}
</div>
</template>
<div class="blank-container">
<div class="project-list-container">
<h3 class="text-lg font-medium mb-4">{{ t("certd.project.systemProjects") }}</h3>
<a-card v-for="project in projects" :key="project.id" :bordered="false" class="project-card">
<div class="project-card-content">
<div class="project-info">
<h4 class="text-md font-medium">{{ project.name }}</h4>
<p class="text-gray-500 text-sm">{{ t("certd.project.createdAt") }}: {{ formatDate(project.createTime) }}</p>
</div>
<a-button type="primary" @click="applyToJoin(project.id)">{{ t("certd.project.applyJoin") }}</a-button>
</div>
</a-card>
<div v-if="projects.length === 0" class="no-projects"></div>
</div>
</div>
</fs-page>
</template>
<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { useI18n } from "/src/locales";
import { message } from "ant-design-vue";
import { request } from "/src/api/service";
const { t } = useI18n();
const projects = ref<any[]>([]);
const getSystemProjects = async () => {
try {
// 假设这里调用获取系统项目列表的API
const response = await request({
url: "/enterprise/project/list",
method: "post",
data: { type: "system" }, // 假设type=system表示系统项目
});
projects.value = response || [];
} catch (error) {
message.error(t("certd.project.fetchFailed"));
console.error("获取项目列表失败:", error);
}
};
const applyToJoin = async (projectId: number) => {
try {
// 假设这里调用申请加入项目的API
await request({
url: "/enterprise/project/apply",
method: "post",
data: { projectId },
});
message.success(t("certd.project.applySuccess"));
// 申请成功后可以刷新页面或跳转到项目列表
} catch (error) {
message.error(t("certd.project.applyFailed"));
console.error("申请加入项目失败:", error);
}
};
const formatDate = (dateString: string) => {
if (!dateString) return "";
const date = new Date(dateString);
return date.toLocaleString();
};
onMounted(() => {
getSystemProjects();
});
</script>
<style lang="less">
.blank-container {
padding: 24px;
max-width: 1200px;
margin: 0 auto;
}
.empty-state {
margin-bottom: 48px;
text-align: center;
}
.empty-description {
margin-top: 16px;
}
.project-list-container {
margin-top: 32px;
}
.project-card {
margin-bottom: 16px;
transition: all 0.3s;
&:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
}
.project-card-content {
display: flex;
justify-content: space-between;
align-items: center;
}
.project-info {
flex: 1;
}
.no-projects {
margin-top: 24px;
padding: 48px 0;
text-align: center;
}
</style>

160
pnpm-lock.yaml generated
View File

@@ -49,7 +49,7 @@ importers:
packages/core/acme-client:
dependencies:
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../basic
'@peculiar/x509':
specifier: ^1.11.0
@@ -213,11 +213,11 @@ importers:
packages/core/pipeline:
dependencies:
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../basic
'@certd/plus-core':
specifier: ^1.38.9
version: link:../../pro/plus-core
specifier: ^1.38.12
version: 1.38.12
dayjs:
specifier: ^1.11.7
version: 1.11.13
@@ -412,7 +412,7 @@ importers:
packages/libs/lib-k8s:
dependencies:
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/basic
'@kubernetes/client-node':
specifier: 0.21.0
@@ -452,20 +452,20 @@ importers:
packages/libs/lib-server:
dependencies:
'@certd/acme-client':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/pipeline
'@certd/plugin-lib':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../plugins/plugin-lib
'@certd/plus-core':
specifier: ^1.38.9
version: link:../../pro/plus-core
specifier: ^1.38.12
version: 1.38.12
'@midwayjs/cache':
specifier: 3.14.0
version: 3.14.0
@@ -610,16 +610,16 @@ importers:
packages/plugins/plugin-cert:
dependencies:
'@certd/acme-client':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/pipeline
'@certd/plugin-lib':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../plugin-lib
psl:
specifier: ^1.9.0
@@ -683,17 +683,17 @@ importers:
specifier: ^3.964.0
version: 3.964.0(aws-crt@1.26.2)
'@certd/acme-client':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/pipeline
'@certd/plus-core':
specifier: ^1.38.9
version: link:../../pro/plus-core
specifier: ^1.38.12
version: 1.38.12
'@kubernetes/client-node':
specifier: 0.21.0
version: 0.21.0
@@ -783,16 +783,16 @@ importers:
packages/pro/commercial-core:
dependencies:
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../../core/basic
'@certd/lib-server':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../../libs/lib-server
'@certd/pipeline':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../../core/pipeline
'@certd/plus-core':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../plus-core
'@midwayjs/core':
specifier: 3.20.11
@@ -865,16 +865,16 @@ importers:
packages/pro/plugin-plus:
dependencies:
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../../core/pipeline
'@certd/plugin-lib':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../../plugins/plugin-lib
'@certd/plus-core':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../plus-core
crypto-js:
specifier: ^4.2.0
@@ -950,7 +950,7 @@ importers:
packages/pro/plus-core:
dependencies:
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.8
version: link:../../core/basic
dayjs:
specifier: ^1.11.7
@@ -1246,10 +1246,10 @@ importers:
version: 0.1.3(zod@3.24.4)
devDependencies:
'@certd/lib-iframe':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../libs/lib-iframe
'@certd/pipeline':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/pipeline
'@rollup/plugin-commonjs':
specifier: ^25.0.7
@@ -1444,47 +1444,47 @@ importers:
specifier: ^3.990.0
version: 3.990.0(aws-crt@1.26.2)
'@certd/acme-client':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/basic
'@certd/commercial-core':
specifier: ^1.38.9
version: link:../../pro/commercial-core
specifier: ^1.38.12
version: 1.38.12(better-sqlite3@11.10.0)(mysql2@3.14.1)(pg@8.16.0)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.100)(typescript@5.9.3))
'@certd/cv4pve-api-javascript':
specifier: ^8.4.2
version: 8.4.2
'@certd/jdcloud':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../libs/lib-jdcloud
'@certd/lib-huawei':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../libs/lib-huawei
'@certd/lib-k8s':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../libs/lib-k8s
'@certd/lib-server':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../libs/lib-server
'@certd/midway-flyway-js':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../libs/midway-flyway-js
'@certd/pipeline':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../core/pipeline
'@certd/plugin-cert':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../plugins/plugin-cert
'@certd/plugin-lib':
specifier: ^1.38.9
specifier: ^1.38.12
version: link:../../plugins/plugin-lib
'@certd/plugin-plus':
specifier: ^1.38.9
version: link:../../pro/plugin-plus
specifier: ^1.38.12
version: 1.38.12
'@certd/plus-core':
specifier: ^1.38.9
version: link:../../pro/plus-core
specifier: ^1.38.12
version: 1.38.12
'@google-cloud/publicca':
specifier: ^1.3.0
version: 1.3.0(encoding@0.1.13)
@@ -2820,9 +2820,18 @@ packages:
'@better-scroll/zoom@2.5.1':
resolution: {integrity: sha512-aGvFY5ooeZWS4RcxQLD+pGLpQHQxpPy0sMZV3yadcd2QK53PK9gS4Dp+BYfRv8lZ4/P2LoNEhr6Wq1DN6+uPlA==}
'@certd/commercial-core@1.38.12':
resolution: {integrity: sha512-kP4vM3F+D6TME9NYSM7Q1YqTx6Ig1dseWQUFVf7GnfG9E3A2odaRwmeYwy5QomChF0vbPHPkJqOtfYv9WItikQ==}
'@certd/cv4pve-api-javascript@8.4.2':
resolution: {integrity: sha512-udGce7ewrVl4DmZvX+17PjsnqsdDIHEDatr8QP0AVrY2p+8JkaSPW4mXCKiLGf82C9K2+GXgT+qNIqgW7tfF9Q==}
'@certd/plugin-plus@1.38.12':
resolution: {integrity: sha512-I0aQAzIRaDFSwM2vb/ycLqaNjVcb/fWUOgmX/BpHEnN446oNk5+pl8d4KFE+OMzEDQcwOwZhdXhjrOsskqY3PA==}
'@certd/plus-core@1.38.12':
resolution: {integrity: sha512-2BKhInDmMrH4l/WRKcSq7E6PA4ANcE1PVMIVoWlhSnnW+sghYUioymRaSoGTxJYfSvGHlLrqZXAassQHAzm98g==}
'@certd/vue-js-cron-core@6.0.3':
resolution: {integrity: sha512-kqzoAMhYz9j6FGNWEODRYtt4NpUEUwjpkU89z5WVg2tCtOcI5VhwyUGOd8AxiBCRfd6PtXvzuqw85PaOps9wrQ==}
@@ -15028,12 +15037,63 @@ snapshots:
dependencies:
'@better-scroll/core': 2.5.1
'@certd/commercial-core@1.38.12(better-sqlite3@11.10.0)(mysql2@3.14.1)(pg@8.16.0)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.100)(typescript@5.9.3))':
dependencies:
'@certd/basic': link:packages/core/basic
'@certd/lib-server': link:packages/libs/lib-server
'@certd/pipeline': link:packages/core/pipeline
'@certd/plus-core': 1.38.12
'@midwayjs/core': 3.20.11
'@midwayjs/koa': 3.20.13
'@midwayjs/logger': 3.4.2
'@midwayjs/typeorm': 3.20.11
dayjs: 1.11.13
typeorm: 0.3.24(better-sqlite3@11.10.0)(mysql2@3.14.1)(pg@8.16.0)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.100)(typescript@5.9.3))
transitivePeerDependencies:
- '@google-cloud/spanner'
- '@sap/hana-client'
- babel-plugin-macros
- better-sqlite3
- hdb-pool
- ioredis
- mongodb
- mssql
- mysql2
- oracledb
- pg
- pg-native
- pg-query-stream
- redis
- reflect-metadata
- sql.js
- sqlite3
- supports-color
- ts-node
- typeorm-aurora-data-api-driver
'@certd/cv4pve-api-javascript@8.4.2':
dependencies:
debug: 4.4.3(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
'@certd/plugin-plus@1.38.12':
dependencies:
'@certd/basic': link:packages/core/basic
'@certd/pipeline': link:packages/core/pipeline
'@certd/plugin-lib': link:packages/plugins/plugin-lib
'@certd/plus-core': 1.38.12
crypto-js: 4.2.0
dayjs: 1.11.13
form-data: 4.0.2
jsrsasign: 11.1.0
querystring: 0.2.1
'@certd/plus-core@1.38.12':
dependencies:
'@certd/basic': link:packages/core/basic
dayjs: 1.11.13
'@certd/vue-js-cron-core@6.0.3':
dependencies:
mustache: 4.2.0
@@ -20599,13 +20659,13 @@ snapshots:
resolve: 1.22.10
semver: 6.3.1
eslint-plugin-prettier@3.4.1(eslint-config-prettier@8.10.0(eslint@7.32.0))(eslint@7.32.0)(prettier@2.8.8):
eslint-plugin-prettier@3.4.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@7.32.0)(prettier@2.8.8):
dependencies:
eslint: 7.32.0
prettier: 2.8.8
prettier-linter-helpers: 1.0.0
optionalDependencies:
eslint-config-prettier: 8.10.0(eslint@7.32.0)
eslint-config-prettier: 8.10.0(eslint@8.57.0)
eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@8.57.0)(prettier@2.8.8):
dependencies:
@@ -23009,7 +23069,7 @@ snapshots:
eslint: 7.32.0
eslint-config-prettier: 8.10.0(eslint@7.32.0)
eslint-plugin-node: 11.1.0(eslint@7.32.0)
eslint-plugin-prettier: 3.4.1(eslint-config-prettier@8.10.0(eslint@7.32.0))(eslint@7.32.0)(prettier@2.8.8)
eslint-plugin-prettier: 3.4.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@7.32.0)(prettier@2.8.8)
execa: 5.1.1
inquirer: 7.3.3
json5: 2.2.3