@use 'sass:color'; @use '@/styles/variables.scss' as *; // 导入全局样式变量 // ===== AppCard 应用卡片样式 ===== // 使用全局变量,符合设计规范 v3.0 .app-card { background: $bg-secondary; border: 1px solid $border-base; border-radius: $radius-xl; padding: $spacing-4; cursor: pointer; transition: $transition-base; position: relative; overflow: hidden; min-height: 280px; display: flex; flex-direction: column; &:hover { transform: translateY(-$spacing-1); box-shadow: $shadow-lg; border-color: rgba(0, 93, 128, 0.3); .card-actions { opacity: 1; transform: translateY(0); } .card-hover-actions { opacity: 1; transform: translateY(0); } .card-title { color: $primary-color; } } } // 热门标识 - 缩小尺寸,被操作按钮遮盖 .card-hot-badge { position: absolute; top: $spacing-3; right: $spacing-3; padding: $spacing-1 $spacing-2; background: linear-gradient(135deg, $warning-color 0%, color.adjust($warning-color, $lightness: -10%) 100%); color: $bg-secondary; border-radius: $radius-full; font-size: $font-xs; font-weight: $font-weight-bold; text-transform: uppercase; letter-spacing: 0.05em; box-shadow: 0 2px 8px rgba($warning-color, 0.3); z-index: 5; } // 状态标签 .card-status-badge { position: absolute; top: $spacing-4; left: $spacing-4; padding: 2px 6px; color: $bg-secondary; border-radius: $radius-full; font-size: 9px; font-weight: $font-weight-semibold; z-index: 10; } // 卡片头部:图标 + 创建者 .card-header { display: flex; justify-content: flex-start; align-items: flex-start; margin-bottom: $spacing-3; gap: $spacing-3; } // 创建者信息区域 - 三行文字与图标高度一致(56px) // 计算:$font-xs + $font-base + $font-sm = 9px + 13px + 12px = 34px 文字 // + $spacing-1 × 2 = 8px 间距 + 行高余量 ≈ 56px .card-creator { display: flex; align-items: center; flex: 1; min-width: 0; .card-creator-info { display: flex; flex-direction: column; gap: $spacing-1; // 行间距 4px line-height: $line-height-tight; .card-creator-label { font-size: $font-xs; // 9px color: $text-hint; text-transform: uppercase; letter-spacing: 0.05em; font-weight: $font-weight-medium; line-height: $line-height-tight; } .card-creator-name { font-size: $font-base; // 13px color: $text-secondary; font-weight: $font-weight-semibold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: $line-height-tight; } // 项目名称 - 单行省略 .card-pro-name { font-size: $font-sm; // 12px color: $text-hint; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; line-height: $line-height-tight; } } } // 图标容器 .card-icon-wrapper { width: $card-icon-size; height: $card-icon-size; border-radius: $radius-xl; display: flex; align-items: center; justify-content: center; padding: 2px; flex-shrink: 0; &.bg-blue { background: $icon-bg-blue; } &.bg-indigo { background: $icon-bg-indigo; } &.bg-teal { background: $icon-bg-teal; } &.bg-purple { background: $icon-bg-purple; } &.bg-rose { background: $icon-bg-rose; } &.bg-cyan { background: $icon-bg-cyan; } &.bg-amber { background: $icon-bg-amber; } &.bg-green { background: $tag-bg-teal; } &.bg-orange { background: $tag-bg-amber; } .card-icon, svg { width: 100%; height: 100%; object-fit: contain; // fill 风格图标 - 移除描边 &[fill="none"] { fill: currentColor; stroke: none; } } } // 操作按钮 - 悬停显示(在 Hot Tag 上层,完全遮盖) .card-actions { position: absolute; top: $spacing-2; right: $spacing-2; display: flex; gap: $spacing-1; opacity: 0; transform: translateY(0); transition: $transition-base; z-index: 15; .card-action-btn { width: $card-btn-size; height: $card-btn-size; border-radius: $radius-lg; background: $bg-tertiary; border: none; display: flex; align-items: center; justify-content: center; color: $text-secondary; cursor: pointer; transition: $transition-base; &:hover { background: $border-base; color: $primary-color; transform: scale(1.05); } svg { width: 16px; height: 16px; } } } // 应用名称 .card-title { font-size: $font-lg; font-weight: $font-weight-semibold; color: $text-primary; margin: 0; padding: 0; margin-bottom: $spacing-2; transition: $transition-fast; line-height: $line-height-tight; .app-card:hover & { color: $primary-color; } } // 应用描述 .card-description { font-size: $font-sm; color: $text-secondary; line-height: $line-height-base; margin-bottom: $spacing-2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; } // 标签 .card-tags { display: flex; flex-wrap: wrap; gap: $spacing-1; margin-bottom: $spacing-2; } .card-tag { padding: 3px 10px; border-radius: $radius-md; font-size: $font-xs; font-weight: $font-weight-bold; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; &.tag-slate { background: $tag-bg-slate; color: $tag-text-slate; } &.tag-blue { background: $tag-bg-blue; color: $tag-text-blue; } &.tag-indigo { background: $tag-bg-indigo; color: $tag-text-indigo; } &.tag-teal { background: $tag-bg-teal; color: $tag-text-teal; } &.tag-purple { background: $tag-bg-purple; color: $tag-text-purple; } &.tag-rose { background: $tag-bg-rose; color: $tag-text-rose; } &.tag-cyan { background: $tag-bg-cyan; color: $tag-text-cyan; } &.tag-amber { background: $tag-bg-amber; color: $tag-text-amber; } } // 统计信息 .card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0; .card-meta-left { display: flex; gap: $spacing-3; } .card-meta-right { margin-left: auto; } .card-meta-item { display: flex; align-items: center; gap: $spacing-1; font-size: $font-sm; color: $text-hint; svg { width: 14px; height: 14px; } } } // 底部信息 .card-footer-info { display: flex; align-items: center; gap: $spacing-2; flex-wrap: wrap; padding-top: $spacing-2; margin-top: auto; } .card-certification { display: flex; align-items: center; gap: $spacing-1; font-size: $font-xs; color: $text-hint; svg { width: 14px; height: 14px; color: $success-color; } } .card-department { display: flex; align-items: center; gap: $spacing-1; font-size: $font-xs; color: $text-secondary; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; svg { width: 14px; height: 14px; } } .card-visible-tag { font-size: $font-xs; font-weight: $font-weight-semibold; padding: 2px 8px; border-radius: $radius-sm; background: $bg-tertiary; } // 悬停操作按钮层 .card-hover-actions { position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; // 两端对齐 align-items: center; padding: $spacing-4; background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%); border-top: 1px solid $border-light; opacity: 0; transform: translateY($spacing-2); transition: $transition-base; pointer-events: none; .app-card:hover & { opacity: 1; transform: translateY(0); pointer-events: auto; } .card-operation-btn { flex: 0 0 auto; // 不伸缩 width: auto; min-width: 100px; height: 40px; background: $bg-tertiary; border: 1px solid $border-base; border-radius: $radius-lg; font-size: $font-md; font-weight: $font-weight-medium; color: $text-primary; transition: $transition-base; margin-right: $spacing-2; // 与立即使用按钮的间距 display: inline-flex; align-items: center; justify-content: center; &:hover { background: $border-base; border-color: $border-dark; color: $text-primary; } svg { width: 18px; height: 18px; } } .card-use-btn { flex: 0 0 auto; // 不伸缩 width: auto; min-width: 120px; height: 40px; background: linear-gradient(135deg, $primary-color 0%, $primary-light 100%); border: none; border-radius: $radius-lg; font-size: $font-md; font-weight: $font-weight-semibold; color: $bg-secondary; box-shadow: 0 4px 12px rgba(0, 93, 128, 0.3); transition: $transition-base; display: inline-flex; align-items: center; justify-content: center; &:hover { background: linear-gradient(135deg, $primary-dark 0%, $primary-color 100%); box-shadow: 0 6px 16px rgba(0, 93, 128, 0.4); transform: translateY(-$spacing-1); } &:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(0, 93, 128, 0.2); } svg { width: 18px; height: 18px; } } } // 注意:.app-card-grid 已在全局 global.scss 中定义,此处不需要重复 // ===== H5 移动端极简样式(v3.7 新增)===== // 仅在移动端(≤768px)生效,用于应用广场 2 列布局 @media (max-width: 768px) { .mobile-app-card { min-height: auto; padding: 0; border-radius: var(--h5-radius-lg, $radius-xl); overflow: hidden; background: var(--h5-bg-secondary, $bg-secondary); border: 1px solid var(--h5-border, $border-base); // 隐藏所有复杂元素 .card-creator, .card-pro-name, .card-description, .card-tags, .card-certification, .card-department, .card-meta, .card-actions, .card-hover-actions, .card-hot-badge, .card-status-badge { display: none; } // 图片区域(全宽) .card-icon-wrapper { width: 100%; height: auto; aspect-ratio: 1; // 正方形 border-radius: $radius-xl; padding: 0; margin: 0; .card-icon, .iconify { width: 100%; height: 100%; object-fit: cover; } } // 头部区域 .card-header { padding: var(--h5-spacing-md, $spacing-3); margin: 0; gap: var(--h5-spacing-sm, $spacing-2); } // 卡片标题 .card-title { padding: 0 var(--h5-spacing-md, $spacing-3) var(--h5-spacing-md, $spacing-3); font-size: var(--h5-font-base, $font-lg); font-weight: var(--h5-font-weight-medium, $font-weight-medium); color: var(--h5-text-primary, $text-primary); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } // 悬停效果禁用(移动端无悬停) &:hover { transform: none; box-shadow: none; border-color: var(--h5-border, $border-base); } // 点击反馈 &:active { background: var(--h5-bg-tertiary, $bg-tertiary); } } }