feat: 将创建与编辑项目调整为独立居中弹窗
Some checks are pending
Build and Release / Build Release Package (tar.gz, amd64, linux) (push) Waiting to run
Build and Release / Build Release Package (tar.gz, arm64, linux) (push) Waiting to run
Build and Release / Build Release Package (zip, amd64, windows) (push) Waiting to run

This commit is contained in:
xuans 2026-10-19 16:44:34 +08:00
parent 5d0b45c337
commit 9f7e4af2db
2 changed files with 176 additions and 34 deletions

View File

@ -531,40 +531,170 @@
font-size: 13px;
}
.project-editor {
display: grid;
grid-template-columns: minmax(200px, 1fr) minmax(300px, 2fr);
align-items: end;
gap: 16px;
margin-bottom: 20px;
padding: 18px;
border: 1px solid #e2e8f0;
border-radius: 14px;
background: #f8fafc;
.project-modal-backdrop {
position: fixed;
inset: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
background: rgba(15, 23, 42, 0.45);
backdrop-filter: blur(4px);
box-sizing: border-box;
}
.project-editor h3 {
grid-column: 1 / -1;
margin: 0;
font-size: 16px;
.project-modal {
width: min(100%, 540px);
max-height: calc(100vh - 40px);
overflow-y: auto;
padding: 28px;
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 18px;
box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.04);
box-sizing: border-box;
}
.project-modal .modal-heading {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 22px;
padding-bottom: 16px;
border-bottom: 1px solid #f1f5f9;
}
.project-modal .modal-heading .eyebrow {
margin: 0 0 6px;
color: #64748b;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.05em;
}
.project-modal .modal-heading h2 {
margin: 0;
font-size: 20px;
font-weight: 700;
color: #0f172a;
letter-spacing: -0.02em;
}
.project-modal .close-button {
width: 32px;
height: 32px;
padding: 0;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #f8fafc;
color: #64748b;
font-size: 20px;
line-height: 1;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.15s ease;
}
.project-modal .close-button:hover:not(:disabled) {
background: #f1f5f9;
color: #0f172a;
}
.project-editor .project-actions {
grid-column: 1 / -1;
margin-top: 6px;
}
.project-editor label {
.project-editor {
display: flex;
flex-direction: column;
gap: 6px;
gap: 16px;
margin: 0;
padding: 0;
border: none;
background: transparent;
}
.project-editor .field {
display: flex;
flex-direction: column;
gap: 8px;
font-size: 13px;
font-weight: 600;
color: #334155;
}
.project-editor .field input,
.project-editor .field textarea {
box-sizing: border-box;
width: 100%;
padding: 10px 14px;
border: 1px solid #cbd5e1;
border-radius: 10px;
font-size: 14px;
color: #0f172a;
background: #ffffff;
transition: border-color 0.15s ease, box-shadow 0.15s ease;
font-family: inherit;
}
.project-editor .field input:focus,
.project-editor .field textarea:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.project-editor .field textarea {
resize: vertical;
min-height: 84px;
line-height: 1.5;
}
.project-modal .modal-actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
margin-top: 8px;
padding-top: 16px;
border-top: 1px solid #f1f5f9;
}
.project-modal .secondary-button {
padding: 9px 18px;
border: 1px solid #cbd5e1;
border-radius: 10px;
background: #ffffff;
color: #475569;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.15s ease;
}
.project-modal .secondary-button:hover:not(:disabled) {
background: #f8fafc;
color: #0f172a;
border-color: #94a3b8;
}
.project-modal .primary-button {
padding: 9px 20px;
border: 1px solid #2563eb;
border-radius: 10px;
background: #2563eb;
color: #ffffff;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.15s ease;
}
.project-modal .primary-button:hover:not(:disabled) {
background: #1d4ed8;
border-color: #1d4ed8;
}
.project-help {
display: inline-flex;
align-items: center;

View File

@ -27,19 +27,31 @@ const {
<p v-if="projectError" class="project-error" role="alert">{{ projectError }}</p>
<p v-if="lifecycleError" class="project-error" role="alert">{{ lifecycleError }}</p>
<p v-if="lifecycleNotice" class="project-notice" role="status">{{ lifecycleNotice }}</p>
<form v-if="projectEditor" class="project-editor" aria-label="项目资料" @submit.prevent="saveProject">
<h3>{{ projectEditor.create ? "创建项目" : "编辑项目" }}</h3>
<label>项目名称
<input v-model="projectEditor.name" required maxlength="128" autocomplete="off" :disabled="savingProject" />
</label>
<label>项目说明
<textarea v-model="projectEditor.description" maxlength="4096" rows="2" :disabled="savingProject"></textarea>
</label>
<div class="project-actions">
<button class="project-primary" type="submit" :disabled="savingProject || loadingProjects || savingMember">{{ savingProject ? "正在保存……" : "保存项目" }}</button>
<button type="button" :disabled="savingProject" @click="cancelProjectAction">取消</button>
</div>
</form>
<div v-if="projectEditor" class="modal-backdrop project-modal-backdrop" @click.self="cancelProjectAction">
<section class="modal-card project-modal" role="dialog" aria-modal="true" :aria-label="projectEditor.create ? '创建项目' : '编辑项目'">
<div class="modal-heading">
<div>
<p class="eyebrow">项目管理</p>
<h2>{{ projectEditor.create ? "创建项目" : "编辑项目" }}</h2>
</div>
<button class="close-button" type="button" aria-label="关闭" :disabled="savingProject" @click="cancelProjectAction">×</button>
</div>
<form class="project-editor" aria-label="项目资料" @submit.prevent="saveProject">
<label class="field">
<span>项目名称</span>
<input v-model="projectEditor.name" required maxlength="128" autocomplete="off" :disabled="savingProject" />
</label>
<label class="field">
<span>项目说明</span>
<textarea v-model="projectEditor.description" maxlength="4096" rows="3" :disabled="savingProject"></textarea>
</label>
<div class="modal-actions project-actions">
<button class="secondary-button" type="button" :disabled="savingProject" @click="cancelProjectAction">取消</button>
<button class="project-primary primary-button" type="submit" :disabled="savingProject || loadingProjects || savingMember">{{ savingProject ? "正在保存……" : "保存项目" }}</button>
</div>
</form>
</section>
</div>
<div v-if="pendingDeleteProject" class="project-confirm" role="alert">
<span>确认删除项目“{{ pendingDeleteProject.name }}”({{ pendingDeleteProject.id }})?</span>
<span class="project-help" tabindex="0" title="默认项目不能删除;存在域名、服务器、绑定或成员时会拒绝删除,不会自动删除关联资源。">ⓘ</span>