* Add dark/light theme toggle feature * update: refine dark/light theme and related components * 调整语义化主题变量,优化暗/亮模式切换效果 * Revert "调整语义化主题变量,优化暗/亮模式切换效果" This reverts commit 85d9373297686fdbacb252a880b2847d20a39641. * 深色模式适配:减少 !important,迁移 CSS 变量,优化布局 * style: 替换硬编码颜色值为CSS变量以支持主题切换 将多处硬编码的颜色值(如#fff、#f0f0f0等)替换为CSS变量(如--gray-0、--gray-150等),统一管理颜色样式,便于主题切换和样式维护。主要修改包括背景色、边框色、文字色等视觉元素,同时移除不再需要的深色模式适配代码。 * style: 使用CSS变量替换硬编码颜色值 * refactor(theme): 重构主题系统,统一使用CSS变量并优化暗色模式实现 - 移除冗余的theme.js配置文件,将主题配置集中到theme store - 使用ant-design-vue的darkAlgorithm实现暗色模式 - 在多个组件中替换硬编码颜色值为CSS变量 - 优化用户信息组件,整合文档中心和主题切换功能 - 更新基础CSS样式,完善颜色系统和滚动条样式 * reset: 恢复被覆盖的修改(96d257a7ace38c94e2b113d56472d211d1141087) * feat(theme): 实现深色主题支持并重构样式系统 重构颜色变量系统,添加深色主题支持 移除硬编码颜色值,统一使用CSS变量 优化图表组件以响应主题切换 清理无用样式代码,提升可维护性 * docs: 更新开发规范文档 * style: 调整边框和背景颜色样式 --------- Co-authored-by: Wenjie Zhang <xerrors@163.com>
239 lines
4.2 KiB
Vue
239 lines
4.2 KiB
Vue
<template>
|
|
<transition name="slide-up">
|
|
<div v-if="visible" class="approval-modal">
|
|
<div class="approval-content">
|
|
<div class="approval-header">
|
|
<h4>{{ question }}</h4>
|
|
</div>
|
|
|
|
<div class="approval-operation">
|
|
<span class="label">操作:</span>
|
|
<span class="operation-text">{{ operation }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="approval-actions">
|
|
<button class="btn btn-reject" @click="handleReject" :disabled="isProcessing">
|
|
✕ 拒绝
|
|
</button>
|
|
<button class="btn btn-approve" @click="handleApprove" :disabled="isProcessing">
|
|
✓ 批准
|
|
</button>
|
|
</div>
|
|
|
|
<div v-if="isProcessing" class="approval-processing">
|
|
<span class="processing-spinner"></span>
|
|
处理中...
|
|
</div>
|
|
</div>
|
|
</transition>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, watch } from 'vue';
|
|
|
|
const props = defineProps({
|
|
visible: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
question: {
|
|
type: String,
|
|
default: '是否批准此操作?'
|
|
},
|
|
operation: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
});
|
|
|
|
const emit = defineEmits(['approve', 'reject']);
|
|
|
|
const isProcessing = ref(false);
|
|
|
|
// 监听弹窗关闭,重置处理状态
|
|
watch(() => props.visible, (newVal) => {
|
|
if (!newVal) {
|
|
isProcessing.value = false;
|
|
}
|
|
});
|
|
|
|
const handleApprove = () => {
|
|
if (isProcessing.value) return;
|
|
isProcessing.value = true;
|
|
emit('approve');
|
|
};
|
|
|
|
const handleReject = () => {
|
|
if (isProcessing.value) return;
|
|
isProcessing.value = true;
|
|
emit('reject');
|
|
};
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
.approval-modal {
|
|
background: var(--gray-0);
|
|
border-radius: 12px 12px;
|
|
box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
|
|
margin: 0 auto 8px;
|
|
max-width: 800px;
|
|
width: 100%;
|
|
border: 1px solid var(--gray-200);
|
|
}
|
|
|
|
.approval-content {
|
|
padding: 16px 20px;
|
|
}
|
|
|
|
.approval-header {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.approval-header h4 {
|
|
margin: 0;
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
color: var(--gray-800);
|
|
text-align: center;
|
|
}
|
|
|
|
.approval-operation {
|
|
background: var(--gray-50);
|
|
padding: 10px 12px;
|
|
border-radius: 6px;
|
|
font-size: 13px;
|
|
line-height: 1.5;
|
|
display: flex;
|
|
gap: 6px;
|
|
}
|
|
|
|
.approval-operation .label {
|
|
color: var(--gray-600);
|
|
font-weight: 500;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.approval-operation .operation-text {
|
|
color: var(--gray-800);
|
|
word-break: break-word;
|
|
}
|
|
|
|
.approval-actions {
|
|
display: flex;
|
|
gap: 10px;
|
|
padding: 12px 20px 16px;
|
|
}
|
|
|
|
.btn {
|
|
flex: 1;
|
|
padding: 10px 20px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 6px;
|
|
}
|
|
|
|
.btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.btn-reject {
|
|
background: var(--gray-100);
|
|
color: var(--gray-700);
|
|
}
|
|
|
|
.btn-reject:hover:not(:disabled) {
|
|
background: var(--gray-200);
|
|
}
|
|
|
|
.btn-approve {
|
|
background: var(--main-color);
|
|
color: var(--gray-0);
|
|
}
|
|
|
|
.btn-approve:hover:not(:disabled) {
|
|
background: var(--main-700);
|
|
box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
|
|
}
|
|
|
|
.approval-processing {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
padding: 10px;
|
|
color: var(--gray-600);
|
|
font-size: 13px;
|
|
background: var(--gray-25);
|
|
border-top: 1px solid var(--gray-100);
|
|
}
|
|
|
|
.processing-spinner {
|
|
width: 14px;
|
|
height: 14px;
|
|
border: 2px solid var(--gray-300);
|
|
border-top-color: var(--main-color);
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
/* 滑入滑出动画 */
|
|
.slide-up-enter-active,
|
|
.slide-up-leave-active {
|
|
transition: all 0.25s ease;
|
|
}
|
|
|
|
.slide-up-enter-from {
|
|
opacity: 0;
|
|
transform: translateY(20px);
|
|
}
|
|
|
|
.slide-up-leave-to {
|
|
opacity: 0;
|
|
transform: translateY(20px);
|
|
}
|
|
|
|
@media (max-width: 520px) {
|
|
.approval-content {
|
|
padding: 12px 16px;
|
|
}
|
|
|
|
.approval-header h4 {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.approval-operation {
|
|
font-size: 12px;
|
|
padding: 8px 10px;
|
|
}
|
|
|
|
.approval-actions {
|
|
padding: 10px 16px 12px;
|
|
gap: 8px;
|
|
}
|
|
|
|
.btn {
|
|
padding: 8px 16px;
|
|
font-size: 13px;
|
|
}
|
|
}
|
|
</style>
|