refactor(ui): 优化 ProductCard 组件视觉样式
- 升级为高端专业风格(白色背景 + 细腻阴影 + 装饰光晕) - 移除 nut-button 依赖,改用原生 view 实现精确样式控制 - 增加点击微缩放交互效果 (active:scale-[0.99]) - 优化标签样式和标题排版对比度 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Showing
2 changed files
with
69 additions
and
34 deletions
| ... | @@ -5,6 +5,26 @@ | ... | @@ -5,6 +5,26 @@ |
| 5 | 5 | ||
| 6 | --- | 6 | --- |
| 7 | 7 | ||
| 8 | +## [2026-02-10] - 优化 ProductCard 组件视觉质感 | ||
| 9 | + | ||
| 10 | +### 优化 | ||
| 11 | +- **UI 升级**:将产品卡片从基础样式升级为“高端专业”风格 | ||
| 12 | + - 背景:从 `bg-gray-50` 升级为 `bg-white` 配合细腻阴影 `box-shadow`,增加悬浮感 | ||
| 13 | + - 装饰:右上角增加淡蓝色光晕装饰,提升视觉层次 | ||
| 14 | + - 交互:增加点击时的微缩放效果 (`active:scale-[0.99]`) | ||
| 15 | +- **组件重构**: | ||
| 16 | + - 移除 `nut-button` 依赖,改用原生 `view` + Flexbox 实现按钮,便于精确控制样式 | ||
| 17 | + - 优化标签 (`tags`) 样式,增加动态边框逻辑 | ||
| 18 | + - 优化排版,增强标题对比度 (`font-bold`, `tracking-tight`) | ||
| 19 | + | ||
| 20 | +**详细信息**: | ||
| 21 | +- **影响文件**: src/components/cards/ProductCard.vue | ||
| 22 | +- **技术栈**: Vue 3, Tailwind CSS | ||
| 23 | +- **测试状态**: 待验证 | ||
| 24 | +- **备注**: 保持了品牌色 (#2563EB) 一致性,提升了整体精致度 | ||
| 25 | + | ||
| 26 | +--- | ||
| 27 | + | ||
| 8 | ## [2026-02-10] - 移除 Apifox MCP 集成 | 28 | ## [2026-02-10] - 移除 Apifox MCP 集成 |
| 9 | 29 | ||
| 10 | ### 删除 | 30 | ### 删除 | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | - <view class="bg-gray-50 rounded-[24rpx] p-[28rpx] product-card"> | 2 | + <view |
| 3 | - <!-- 产品名称 --> | 3 | + class="relative bg-white rounded-[24rpx] p-[32rpx] border border-gray-100 product-card overflow-hidden transition-all duration-300 active:scale-[0.99]" |
| 4 | - <text class="block text-gray-800 text-[32rpx] font-medium mb-[20rpx]">{{ productName }}</text> | 4 | + style="box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.04);" |
| 5 | + > | ||
| 6 | + <!-- 装饰背景: 右上角淡蓝色光晕 --> | ||
| 7 | + <view class="absolute -right-[40rpx] -top-[40rpx] w-[160rpx] h-[160rpx] bg-blue-50 rounded-full opacity-60 blur-[30rpx] pointer-events-none"></view> | ||
| 5 | 8 | ||
| 6 | - <!-- 产品标签 --> | 9 | + <!-- 内容区域 --> |
| 7 | - <view v-if="tags && tags.length" class="flex flex-wrap gap-[12rpx] mb-[24rpx]"> | 10 | + <view class="relative z-10"> |
| 8 | - <view | 11 | + <!-- 头部:标题与标签 --> |
| 9 | - v-for="tag in tags" | 12 | + <view class="mb-[36rpx]"> |
| 10 | - :key="tag.id" | 13 | + <!-- 产品名称 --> |
| 11 | - class="text-[20rpx] px-[12rpx] py-[4rpx] rounded-full" | 14 | + <text class="block text-gray-900 text-[34rpx] font-bold leading-[1.4] mb-[20rpx] tracking-tight"> |
| 12 | - :style="{ | 15 | + {{ productName }} |
| 13 | - backgroundColor: tag.bg_color, | 16 | + </text> |
| 14 | - color: tag.text_color | 17 | + |
| 15 | - }" | 18 | + <!-- 产品标签 --> |
| 16 | - > | 19 | + <view v-if="tags && tags.length" class="flex flex-wrap gap-[12rpx]"> |
| 17 | - <text class="text-[22rpx]">{{ tag.name }}</text> | 20 | + <view |
| 21 | + v-for="tag in tags" | ||
| 22 | + :key="tag.id" | ||
| 23 | + class="text-[22rpx] px-[16rpx] py-[6rpx] rounded-[8rpx] font-medium flex items-center justify-center transition-opacity" | ||
| 24 | + :style="{ | ||
| 25 | + backgroundColor: tag.bg_color || '#F3F4F6', | ||
| 26 | + color: tag.text_color || '#4B5563', | ||
| 27 | + border: `1px solid ${tag.bg_color ? 'transparent' : '#E5E7EB'}` | ||
| 28 | + }" | ||
| 29 | + > | ||
| 30 | + {{ tag.name }} | ||
| 31 | + </view> | ||
| 32 | + </view> | ||
| 18 | </view> | 33 | </view> |
| 19 | - </view> | ||
| 20 | 34 | ||
| 21 | - <!-- 操作按钮 --> | 35 | + <!-- 操作按钮组 --> |
| 22 | - <view class="flex justify-between gap-[24rpx]"> | 36 | + <view class="flex justify-between gap-[24rpx]"> |
| 23 | - <nut-button | 37 | + <!-- 详情按钮: 次级样式 --> |
| 24 | - plain | 38 | + <view |
| 25 | - color="#2563EB" | 39 | + class="flex-1 h-[80rpx] flex items-center justify-center rounded-[16rpx] bg-gray-50 active:bg-gray-100 transition-colors border border-gray-100" |
| 26 | - class="flex-1 !h-[64rpx] !rounded-[16rpx] !text-[26rpx] !m-0 !border-blue-600" | 40 | + @tap.stop="handleDetail" |
| 27 | - @tap="handleDetail" | 41 | + > |
| 28 | - > | 42 | + <text class="text-[28rpx] text-gray-600 font-medium">产品详情</text> |
| 29 | - 产品详情 | 43 | + </view> |
| 30 | - </nut-button> | 44 | + |
| 31 | - <nut-button | 45 | + <!-- 计划书按钮: 主要样式 --> |
| 32 | - color="#2563EB" | 46 | + <view |
| 33 | - class="flex-1 !h-[64rpx] !rounded-[16rpx] !text-[26rpx] !m-0" | 47 | + class="flex-1 h-[80rpx] flex items-center justify-center rounded-[16rpx] bg-blue-600 active:bg-blue-700 transition-all shadow-md shadow-blue-100" |
| 34 | - @tap="handlePlan" | 48 | + @tap.stop="handlePlan" |
| 35 | - > | 49 | + > |
| 36 | - 计划书 | 50 | + <text class="text-[28rpx] text-white font-medium">制作计划书</text> |
| 37 | - </nut-button> | 51 | + </view> |
| 52 | + </view> | ||
| 38 | </view> | 53 | </view> |
| 39 | </view> | 54 | </view> |
| 40 | </template> | 55 | </template> |
| ... | @@ -101,6 +116,6 @@ const handlePlan = () => { | ... | @@ -101,6 +116,6 @@ const handlePlan = () => { |
| 101 | 116 | ||
| 102 | <style lang="less" scoped> | 117 | <style lang="less" scoped> |
| 103 | .product-card { | 118 | .product-card { |
| 104 | - // 可以添加卡片特定的样式 | 119 | + // 保持 scoped 样式块,方便未来扩展 |
| 105 | } | 120 | } |
| 106 | </style> | 121 | </style> | ... | ... |
-
Please register or login to post a comment