uni.scss 14 KB

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