feat: P2 Mobile CSS 变量对齐

- 新建 mobile/src/styles/variables.css — Design Token 变量定义
- App.vue — 使用 var(--muted) / var(--foreground) 替代硬编码
- sandbox/index.vue — 完整迁移参考页(品牌色/边框/文字/背景)
- docs/design-tokens.md — 更新 Mobile 迁移对照表
This commit is contained in:
yuzhiran-dev
2026-05-18 11:18:02 +08:00
parent fb092cb5d9
commit 8665032da4
5 changed files with 57 additions and 18 deletions
+19 -5
View File
@@ -118,10 +118,24 @@ page {
## Mobile (Vue) 迁移清单
| 文件 | 问题 | 修复 |
| 文件 | 状态 | 备注 |
|------|------|------|
| `App.vue` | `background-color: #f5f5f5` | 使用 CSS 变量 |
| 所有页面 | 硬编码 `#333`/`#666`/`#999`/`#f5f5f5` | 替换为 `var(--foreground)` |
| 所有页面 | `#4f8cff` 品牌色 | 替换为 `var(--brand)` |
| `mobile/src/styles/variables.css` | ✅ 新建 | 完整 Design Token CSS 变量定义 |
| `mobile/src/App.vue` | ✅ 已修复 | 使用 `var(--muted)` / `var(--foreground)` |
| `mobile/src/pages/sandbox/index.vue` | ✅ 已修复 | 参考页面,全部替换为 CSS 变量 |
| 其余 16 个页面 | ⏳ | 按 sandbox 模式全局替换硬编码颜色 |
> 此文档在 UI 变更时同步更新。Mobile 迁移见 P0b 跟踪。
### Mobile 迁移对照表
| 旧值 | 新值 |
|------|------|
| `#fff` / `white` | `var(--card)` |
| `#f5f5f5` | `var(--muted)` |
| `#333` | `var(--foreground)` |
| `#666` / `#999` | `var(--muted-foreground)` |
| `#4f8cff` | `var(--brand)` |
| `#e0effe` | `var(--brand-light)` |
| `#f0f0f0` / `#e5e5e5` | `var(--border)` |
| `12rpx` border-radius | `var(--radius)` |
> 此文档在 UI 变更时同步更新。
+7 -1
View File
@@ -15,7 +15,13 @@
| **P0f** | 会话分享链接 — HMAC 签名 + 分享查看页 | ✅ |
| **全栈验证** | 后端 13 suites / 92 tests / 前端 61 pages | ✅ |
### P1 — 待定义
### P1 — 学习技能包(全部完成 ✅)
| 子项 | 说明 | 状态 |
|------|------|------|
| **后端** | SkillsModule + 8 技能定义 + 过滤/详情 API | ✅ |
| **前端** | /skills 市场 + /skills/[id] 详情 + header 入口 | ✅ |
| **沙盒集成** | 替代硬编码 SCENES,从 API 动态加载,?skill=xxx 支持 | ✅ |
| **全栈验证** | 后端 92 tests / 前端 70 pages | ✅ |
### 参考来源
- opencode 源码克隆到 `/tmp/opencode-source/`21 packages, 147MB
+5 -1
View File
@@ -18,8 +18,12 @@ const showTabBar = computed(() => {
</script>
<style>
@import './styles/variables.css';
page {
background-color: #f5f5f5;
background-color: var(--muted);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
color: var(--foreground);
font-size: 28rpx;
}
</style>
+11 -11
View File
@@ -83,28 +83,28 @@ function onModelChange(e: any) {
<style scoped>
.sandbox { display: flex; flex-direction: column; height: 100vh; }
.model-selector {
display: flex; align-items: center; padding: 16rpx 30rpx; background: #fff;
border-bottom: 1rpx solid #f0f0f0;
display: flex; align-items: center; padding: 16rpx 30rpx; background: var(--card);
border-bottom: 1rpx solid var(--border);
}
.label { font-size: 26rpx; color: #666; }
.picker-value { font-size: 26rpx; color: #4f8cff; margin-left: 8rpx; }
.label { font-size: 26rpx; color: var(--muted-foreground); }
.picker-value { font-size: 26rpx; color: var(--brand); margin-left: 8rpx; }
.chat-area { flex: 1; padding: 20rpx 30rpx; overflow-y: auto; }
.message { margin-bottom: 20rpx; max-width: 80%; }
.message.user { align-self: flex-end; margin-left: auto; }
.message.ai { align-self: flex-start; }
.role { font-size: 22rpx; color: #999; display: block; margin-bottom: 6rpx; }
.role { font-size: 22rpx; color: var(--muted-foreground); display: block; margin-bottom: 6rpx; }
.content {
display: inline-block; padding: 16rpx 20rpx; border-radius: 12rpx; font-size: 28rpx; line-height: 1.6;
}
.message.user .content { background: #4f8cff; color: #fff; border-radius: 12rpx 0 12rpx 12rpx; }
.message.ai .content { background: #fff; color: #333; border-radius: 0 12rpx 12rpx 12rpx; }
.message.user .content { background: var(--brand); color: #fff; border-radius: 12rpx 0 12rpx 12rpx; }
.message.ai .content { background: var(--card); color: var(--foreground); border-radius: 0 12rpx 12rpx 12rpx; }
.input-area {
display: flex; align-items: center; padding: 16rpx 30rpx; background: #fff;
border-top: 1rpx solid #f0f0f0;
display: flex; align-items: center; padding: 16rpx 30rpx; background: var(--card);
border-top: 1rpx solid var(--border);
}
.input { flex: 1; background: #f5f5f5; border-radius: 12rpx; padding: 16rpx 24rpx; font-size: 28rpx; }
.input { flex: 1; background: var(--muted); border-radius: 12rpx; padding: 16rpx 24rpx; font-size: 28rpx; }
.btn-send {
background: #4f8cff; color: #fff; border-radius: 10rpx; padding: 14rpx 28rpx;
background: var(--brand); color: #fff; border-radius: 10rpx; padding: 14rpx 28rpx;
font-size: 26rpx; margin-left: 16rpx; border: none;
}
</style>
+15
View File
@@ -0,0 +1,15 @@
/* 宇之然 Design Token — Mobile 版 */
/* 与 Web 端 CSS 变量保持一致 */
page {
--background: #ffffff;
--foreground: #0a0a0a;
--card: #ffffff;
--card-foreground: #0a0a0a;
--muted: #f5f5f5;
--muted-foreground: #666666;
--border: #e5e5e5;
--brand: #0070c4;
--brand-light: #e0effe;
--radius: 12rpx;
}