uni.scss 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. /**
  2. * ============================================================
  3. * 浠艾福 (XAF) Design System — UniApp SCSS Variables
  4. * ============================================================
  5. *
  6. * 色彩体系: 品牌橙 + 珊瑚暖色 (活力关怀 + 家庭温暖)
  7. * 风格: 极简扁平圆角 (全角色统一)
  8. * Logo配色参考: #6BB9F0 (中蓝) / #D6EAF8 (浅蓝) / ❤白色心形
  9. *
  10. * 设计原则:
  11. * - 扁平圆角:全端统一,无Claymorphism
  12. * - 品牌橙 #F97316 为主色:与 pages.json tabBar.selectedColor 一致(线上真值)
  13. * - 珊瑚暖色为点缀:保留"家庭温暖"和"关怀"
  14. * - 心形符号:品牌识别元素
  15. * - 减少装饰动效,聚焦内容可读性
  16. *
  17. * v3.1 — 2026-10-18 品牌令牌收敛:$uni-primary 系由旧蓝 #5B9BD5 翻转为品牌橙
  18. * (旧蓝与 tabBar.selectedColor / 线上实际主色不一致,详见 §12 背景说明)
  19. * ============================================================
  20. */
  21. // ============================================================
  22. // 1. 品牌色彩 (Brand Colors)
  23. // ============================================================
  24. // 主色调 - 品牌橙(2026-10 令牌收敛:原 #5B9BD5 旧蓝与线上实际主色不一致,已翻转;
  25. // 现值与 $brand-primary / tabBar.selectedColor 三方一致,见 §12)
  26. $uni-primary: #F97316; // 品牌主色
  27. $uni-primary-light: #FB923C; // 浅橙
  28. $uni-primary-dark: #EA580C; // 深橙
  29. $uni-primary-pale: #FFF7ED; // 极浅橙 (品牌淡底)
  30. // 辅助暖色 - 珊瑚粉 (家庭温暖)
  31. $uni-warm: #F08A7A; // 心形暖色 - 保留"关爱"感
  32. $uni-warm-light: #F4B0A5;
  33. $uni-warm-dark: #E06A58;
  34. // 语义色 (Semantic)
  35. $uni-success: #4CAF50;
  36. $uni-success-light: #81C784;
  37. $uni-warning: #FFB74D;
  38. $uni-warning-light: #FFD54F;
  39. $uni-error: #EF5350;
  40. $uni-error-light: #E57373;
  41. $uni-info: #0EA5E9; // 信息蓝(2026-10 起独立于品牌色,不再复用主色)
  42. // 中性色 (Neutral) — 冷调中性,匹配蓝色系
  43. $uni-bg-color: #F5F9FC; // 极浅蓝灰背景
  44. $uni-bg-color-grey: #EDF2F7; // 浅灰蓝
  45. $uni-bg-color-dark: #E2E8F0; // 灰蓝
  46. $uni-surface: #FFFFFF; // 卡片/表面
  47. $uni-border-color: #CBD5E1; // 冷灰边框
  48. $uni-border-color-light: #E2E8F0;
  49. $uni-text-color: #1E293B; // 深蓝灰 (正文)
  50. $uni-text-color-secondary: #64748B; // 次要文字
  51. $uni-text-color-grey: #94A3B8; // 灰色文字
  52. $uni-text-color-placeholder: #94A3B8;
  53. $uni-text-color-inverse: #FFFFFF;
  54. // ============================================================
  55. // 2. 字体系统 (Typography)
  56. // ============================================================
  57. // 字体栈 - 小程序不支持自定义字体
  58. $uni-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
  59. 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
  60. 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  61. $uni-font-family-display: $uni-font-family;
  62. $uni-font-family-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  63. // 字号
  64. $uni-font-size-xs: 20rpx;
  65. $uni-font-size-sm: 24rpx;
  66. $uni-font-size-base: 28rpx;
  67. $uni-font-size-lg: 32rpx;
  68. $uni-font-size-xl: 36rpx;
  69. $uni-font-size-2xl: 44rpx;
  70. $uni-font-size-3xl: 52rpx;
  71. // 字重
  72. $uni-font-weight-normal: 400;
  73. $uni-font-weight-medium: 500;
  74. $uni-font-weight-bold: 600;
  75. $uni-font-weight-black: 700;
  76. // ============================================================
  77. // 3. 间距系统 (Spacing)
  78. // ============================================================
  79. $uni-spacing-xs: 8rpx;
  80. $uni-spacing-sm: 16rpx;
  81. $uni-spacing-md: 24rpx;
  82. $uni-spacing-lg: 32rpx;
  83. $uni-spacing-xl: 48rpx;
  84. $uni-spacing-2xl: 64rpx;
  85. $uni-page-padding: 32rpx;
  86. // ============================================================
  87. // 4. 圆角 (Border Radius)
  88. // ============================================================
  89. $uni-radius-sm: 10rpx;
  90. $uni-radius-md: 16rpx;
  91. $uni-radius-lg: 24rpx;
  92. $uni-radius-xl: 32rpx;
  93. $uni-radius-full: 50%;
  94. $uni-radius-round: 9999rpx;
  95. // ============================================================
  96. // 5. 阴影 (Shadows) — 极简风格,轻微阴影
  97. // ============================================================
  98. $uni-shadow-sm: 0 2rpx 8rpx rgba(249, 115, 22, 0.06);
  99. $uni-shadow-md: 0 4rpx 16rpx rgba(249, 115, 22, 0.08);
  100. $uni-shadow-lg: 0 8rpx 32rpx rgba(249, 115, 22, 0.10);
  101. $uni-shadow-inner: inset 0 1rpx 4rpx rgba(0, 0, 0, 0.04);
  102. // ============================================================
  103. // 6. 动画 (Animations) — 节制使用
  104. // ============================================================
  105. $uni-transition-fast: 0.15s ease;
  106. $uni-transition-base: 0.25s ease;
  107. $uni-transition-slow: 0.3s ease;
  108. // ============================================================
  109. // 7. CSS 自定义属性
  110. // ============================================================
  111. :root {
  112. // 品牌色(2026-10 由旧蓝 #5B9BD5 系翻转为品牌橙,与 §1 SCSS 变量同值;
  113. // 注意 mp-weixin 对 :root 支持不稳,页面实际渲染以各处 var() 兜底值为准)
  114. --color-primary: #F97316;
  115. --color-primary-light: #FB923C;
  116. --color-primary-dark: #EA580C;
  117. --color-primary-pale: #FFF7ED;
  118. --color-warm: #F08A7A;
  119. --color-warm-light: #F4B0A5;
  120. // 语义色
  121. --color-success: #4CAF50;
  122. --color-warning: #FFB74D;
  123. --color-error: #EF5350;
  124. // 中性色
  125. --bg: #F5F9FC;
  126. --bg-grey: #EDF2F7;
  127. --surface: #FFFFFF;
  128. --text: #1E293B;
  129. --text-secondary: #64748B;
  130. --muted: #94A3B8;
  131. --border: #CBD5E1;
  132. --border-light: #E2E8F0;
  133. // 间距
  134. --space-xs: 4px;
  135. --space-sm: 8px;
  136. --space-md: 12px;
  137. --space-lg: 16px;
  138. --space-xl: 24px;
  139. --space-page: 16px;
  140. // 圆角
  141. --radius-sm: 5px;
  142. --radius-md: 8px;
  143. --radius-lg: 12px;
  144. --radius-xl: 16px;
  145. // 阴影 — 极简风格(色调随品牌色翻转为橙,2026-10)
  146. --shadow-sm: 0 1px 4px rgba(249, 115, 22, 0.06);
  147. --shadow-md: 0 2px 8px rgba(249, 115, 22, 0.08);
  148. --shadow-lg: 0 4px 16px rgba(249, 115, 22, 0.10);
  149. }
  150. // ============================================================
  151. // 8. 实用工具类
  152. // ============================================================
  153. // --- 文字色彩 ---
  154. .text-primary { color: $uni-primary; }
  155. .text-warm { color: $uni-warm; }
  156. .text-success { color: $uni-success; }
  157. .text-warning { color: $uni-warning; }
  158. .text-error { color: $uni-error; }
  159. .text-muted { color: $uni-text-color-grey; }
  160. .text-secondary { color: $uni-text-color-secondary; }
  161. .text-bold { font-weight: $uni-font-weight-bold; }
  162. .text-black { font-weight: $uni-font-weight-black; }
  163. .text-center { text-align: center; }
  164. // 正文工具类跟随用户字号系数(--font-scale);使用方式:在根节点 :style="{ '--font-scale': fontScale }"
  165. .text-sm { font-size: calc($uni-font-size-sm * var(--font-scale, 1)); }
  166. .text-base { font-size: calc($uni-font-size-base * var(--font-scale, 1)); }
  167. .text-lg { font-size: calc($uni-font-size-lg * var(--font-scale, 1)); }
  168. .text-xl { font-size: calc($uni-font-size-xl * var(--font-scale, 1)); }
  169. .text-2xl { font-size: calc($uni-font-size-2xl * var(--font-scale, 1)); }
  170. .text-3xl { font-size: calc($uni-font-size-3xl * var(--font-scale, 1)); }
  171. // --- 背景 ---
  172. .bg-primary { background-color: $uni-primary; }
  173. .bg-warm { background-color: $uni-warm; }
  174. .bg-surface { background-color: $uni-surface; }
  175. .bg-page { background-color: $uni-bg-color; }
  176. // --- 圆角 ---
  177. .radius-sm { border-radius: $uni-radius-sm; }
  178. .radius-md { border-radius: $uni-radius-md; }
  179. .radius-lg { border-radius: $uni-radius-lg; }
  180. .radius-xl { border-radius: $uni-radius-xl; }
  181. // --- 弹性布局 ---
  182. .flex { display: flex; }
  183. .flex-col { flex-direction: column; }
  184. .flex-row { flex-direction: row; }
  185. .flex-wrap { flex-wrap: wrap; }
  186. .flex-1 { flex: 1; }
  187. .items-center { align-items: center; }
  188. .justify-center { justify-content: center; }
  189. .justify-between { justify-content: space-between; }
  190. .justify-around { justify-content: space-around; }
  191. .gap-xs { gap: $uni-spacing-xs; }
  192. .gap-sm { gap: $uni-spacing-sm; }
  193. .gap-md { gap: $uni-spacing-md; }
  194. .gap-lg { gap: $uni-spacing-lg; }
  195. // --- 间距 ---
  196. .m-0 { margin: 0; }
  197. .p-0 { padding: 0; }
  198. .p-sm { padding: $uni-spacing-sm; }
  199. .p-md { padding: $uni-spacing-md; }
  200. .p-lg { padding: $uni-spacing-lg; }
  201. .mt-sm { margin-top: $uni-spacing-sm; }
  202. .mt-md { margin-top: $uni-spacing-md; }
  203. .mt-lg { margin-top: $uni-spacing-lg; }
  204. .mb-sm { margin-bottom: $uni-spacing-sm; }
  205. .mb-md { margin-bottom: $uni-spacing-md; }
  206. .mb-lg { margin-bottom: $uni-spacing-lg; }
  207. // --- 其他 ---
  208. .w-full { width: 100%; }
  209. .h-full { height: 100%; }
  210. .relative { position: relative; }
  211. .overflow-hidden { overflow: hidden; }
  212. .truncate {
  213. overflow: hidden;
  214. text-overflow: ellipsis;
  215. white-space: nowrap;
  216. }
  217. // ============================================================
  218. // 9. 扁平圆角卡片 (Flat Rounded Card) — 全端统一风格
  219. // ============================================================
  220. @mixin flat-card($border-color: $uni-border-color-light) {
  221. border-radius: $uni-radius-md;
  222. background: $uni-surface;
  223. border: 1rpx solid $border-color;
  224. box-shadow: $uni-shadow-sm;
  225. }
  226. @mixin flat-button($bg-color: $uni-primary) {
  227. border-radius: $uni-radius-lg;
  228. background: $bg-color;
  229. color: #FFFFFF;
  230. border: none;
  231. transition: opacity $uni-transition-fast;
  232. &:active {
  233. opacity: 0.85;
  234. }
  235. }
  236. .flat-card {
  237. @include flat-card;
  238. }
  239. // ============================================================
  240. // 10. 关键帧动画(精简)
  241. // ============================================================
  242. @keyframes fadeIn {
  243. from { opacity: 0; }
  244. to { opacity: 1; }
  245. }
  246. @keyframes slideUp {
  247. from { opacity: 0; transform: translateY(20rpx); }
  248. to { opacity: 1; transform: translateY(0); }
  249. }
  250. @keyframes scaleIn {
  251. from { opacity: 0; transform: scale(0.95); }
  252. to { opacity: 1; transform: scale(1); }
  253. }
  254. @keyframes pulseSoft {
  255. 0%, 100% { opacity: 1; }
  256. 50% { opacity: 0.7; }
  257. }
  258. // 动画实用类
  259. .animate-fade-in { animation: fadeIn $uni-transition-base both; }
  260. .animate-slide-up { animation: slideUp $uni-transition-slow both; }
  261. .animate-scale-in { animation: scaleIn $uni-transition-slow both; }
  262. .animate-pulse-soft { animation: pulseSoft 3s ease-in-out infinite; }
  263. // 交错入场
  264. @for $i from 1 through 20 {
  265. .animate-stagger-#{$i} {
  266. animation-delay: #{$i * 60}ms;
  267. }
  268. }
  269. // ============================================================
  270. // 11. 骨架屏
  271. // ============================================================
  272. @mixin skeleton {
  273. background: linear-gradient(
  274. 90deg,
  275. $uni-border-color-light 25%,
  276. #F5F9FC 50%,
  277. $uni-border-color-light 75%
  278. );
  279. background-size: 200% 100%;
  280. animation: shimmer 1.5s ease-in-out infinite;
  281. border-radius: $uni-radius-sm;
  282. }
  283. @keyframes shimmer {
  284. 0% { background-position: -200% 0; }
  285. 100% { background-position: 200% 0; }
  286. }
  287. .skeleton { @include skeleton; }
  288. .skeleton-text {
  289. @include skeleton;
  290. height: 28rpx;
  291. margin-bottom: 12rpx;
  292. }
  293. .skeleton-block {
  294. @include skeleton;
  295. height: 160rpx;
  296. }
  297. // ============================================================
  298. // 12. 五维 + 品牌运行时令牌(对齐真实线上视觉)
  299. // ============================================================
  300. // 背景:原 $uni-primary(#5B9BD5 蓝) 与线上实际主色不一致,且五维色长期硬编码在页面里。
  301. // 本段补齐「真实在用」的语义令牌;页面改用这些名字,避免逐个硬编码。
  302. // 注意:mp-weixin 对 CSS var(--x) 运行时解析不稳定,故统一用 SCSS 变量(编译期内联,零运行时风险)。
  303. // 品牌主色 —— 与 pages.json tabBar.selectedColor 一致
  304. $brand-primary: #F97316;
  305. $brand-primary-dark: #EA580C;
  306. $brand-primary-soft: rgba(249, 115, 22, 0.12);
  307. // 五维身份色:页面 PageBanner / 分段左条 / CTA / 价值卡浅底统一取用
  308. $dim-body: #FF8C42;
  309. $dim-mind: #FF6B9D;
  310. $dim-wisdom: #6366F1;
  311. $dim-action: #10B981;
  312. $dim-wealth: #F59E0B;
  313. $dim-body-soft: rgba(255, 140, 66, 0.15);
  314. $dim-mind-soft: rgba(255, 107, 157, 0.15);
  315. $dim-wisdom-soft: rgba(99, 102, 241, 0.15);
  316. $dim-action-soft: rgba(16, 185, 129, 0.15);
  317. $dim-wealth-soft: rgba(245, 158, 11, 0.15);
  318. // 语义角色(与应用真实观感一致)
  319. $app-bg: #F5F7FA;
  320. $app-surface: #FFFFFF;
  321. $app-surface-subtle: #F7F8FA;
  322. $app-text: #17181C;
  323. $app-text-secondary: #606875;
  324. $app-text-muted: #8A94A3;
  325. $app-border-subtle: #E7EBF0;
  326. $app-border: #CBD5E1;
  327. // 状态:按压/禁用用透明度与语言表达,不新增多套颜色
  328. $press-opacity: 0.85;
  329. $disabled-opacity: 0.45;
  330. // 动效令牌:只声明稳定属性,禁止 transition: all
  331. $ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  332. $dur-press: 0.12s;
  333. $dur-state: 0.2s;
  334. $dur-structural: 0.26s;
  335. // 可复用 mixin
  336. @mixin dim-card($radius: $uni-radius-md) {
  337. background: $app-surface;
  338. border-radius: $radius;
  339. box-shadow: $uni-shadow-sm;
  340. }
  341. @mixin press-scale {
  342. transition: opacity $dur-press $ease-standard, transform $dur-press $ease-standard;
  343. &:active { opacity: $press-opacity; }
  344. }
  345. @mixin touch-target($size: 88rpx) {
  346. min-height: $size;
  347. min-width: $size;
  348. }
  349. // ============================================================
  350. // 13. 状态色阶 / 品牌亮阶 / 维度浅底
  351. // ============================================================
  352. // 状态色只用于传达状态,禁止当装饰使用;浅底为不透明 tint,用于卡片与分区背景。
  353. // 状态色阶
  354. $status-success: #10B981;
  355. $status-success-soft: #D1FAE5;
  356. $status-success-strong: #065F46;
  357. $status-warning: #FBBF24;
  358. $status-warning-soft: #FEF3C7;
  359. $status-warning-strong: #92400E;
  360. $status-danger: #EF4444;
  361. $status-danger-soft: #FEE2E2;
  362. $status-danger-strong: #B91C1C;
  363. // 品牌橙亮阶(渐变/高亮用)
  364. $brand-primary-light: #FB923C;
  365. // 维度浅底(不透明 tint)
  366. $dim-body-tint: #FFF8F0;
  367. $dim-mind-tint: #FFF0F5;
  368. $dim-wisdom-tint: #F0F0FF;
  369. $dim-action-tint: #F0FFF4;
  370. $dim-wealth-tint: #FFFBEB;
  371. // 边框与文字的次级阶
  372. $app-border-strong: #D1D5DB;
  373. $app-text-subtle: #94A3B8;
  374. // ============================================================
  375. // 14. 状态深阶 / 品牌深阶(收尾:跨页共性)
  376. // ============================================================
  377. // -deep 为色板 600 档,用于状态文字与强调;-tint 为极浅底。
  378. // 仅收录在 2 个及以上页面中复用的色值,单页专有色阶由页面级局部变量承载。
  379. // 状态深阶(文字 / 强调)
  380. $status-danger-deep: #DC2626; // 危险态文字:较差 / 已过期
  381. $status-danger-tint: #FEF2F2; // 危险态极浅底
  382. $status-warning-deep: #D97706; // 警示态文字
  383. $status-success-deep: #059669; // 成功态文字
  384. $status-success-text: #16A34A; // 成功态文字(green-600)
  385. // 品牌 / 身 深阶文字
  386. $brand-primary-deep: #C2410C;