uni.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. /**
  2. * ============================================================
  3. * 知心益家 (ZXYJ) Design System — UniApp SCSS Variables
  4. * ============================================================
  5. *
  6. * 色彩体系: 暖橙 + 天蓝 (儿童友好 + 专业信任)
  7. * 风格: Claymorphism (孩子端) / 扁平卡片 (家长端) / 专业工具 (规划师端)
  8. * 角色色彩: 家长=暖橙 / 孩子=暖橙+天蓝 / 规划师=蓝色调
  9. *
  10. * v2.0 — 2026-06-05
  11. * ============================================================
  12. */
  13. // ============================================================
  14. // 1. 品牌色彩 (Brand Colors)
  15. // ============================================================
  16. /* 主色调 - 暖橙 (Primary) */
  17. $uni-primary: #F97316;
  18. $uni-primary-light: #FB923C;
  19. $uni-primary-dark: #EA580C;
  20. /* 强调色 - 天蓝 (Accent) */
  21. $uni-accent: #0EA5E9;
  22. $uni-accent-light: #38BDF8;
  23. $uni-accent-dark: #0284C7;
  24. /* 语义色 (Semantic) */
  25. $uni-success: #22C55E;
  26. $uni-success-light: #4ADE80;
  27. $uni-warning: #F59E0B;
  28. $uni-warning-light: #FBBF24;
  29. $uni-error: #EF4444;
  30. $uni-error-light: #F87171;
  31. /* 中性色 (Neutral) */
  32. $uni-bg-color: #FFF7ED; // 暖白背景
  33. $uni-bg-color-grey: #FFF2E4; // 浅暖灰
  34. $uni-bg-color-dark: #F5E6D3; // 暖灰
  35. $uni-surface: #FFFFFF; // 卡片/表面
  36. $uni-border-color: #FED7AA; // 浅橙边框
  37. $uni-border-color-light: #FFEDD5; // 更浅边框
  38. $uni-text-color: #3D2E1E; // 暖深棕 (正文)
  39. $uni-text-color-secondary: #6B5A4A; // 次要文字
  40. $uni-text-color-grey: #94A3B8; // 灰蓝 (禁用/占位)
  41. $uni-text-color-placeholder: #A8A29E; // 占位文字
  42. $uni-text-color-inverse: #FFFFFF;
  43. // ============================================================
  44. // 2. 字体系统 (Typography)
  45. // ============================================================
  46. /* 字体栈 - 微信小程序不支持自定义字体,使用系统回退 */
  47. $uni-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
  48. 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
  49. 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  50. $uni-font-family-display: $uni-font-family;
  51. $uni-font-family-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code',
  52. 'Cascadia Code', monospace;
  53. /* 字号 */
  54. $uni-font-size-xs: 20rpx;
  55. $uni-font-size-sm: 24rpx;
  56. $uni-font-size-base: 28rpx;
  57. $uni-font-size-lg: 32rpx;
  58. $uni-font-size-xl: 36rpx;
  59. $uni-font-size-2xl: 44rpx;
  60. $uni-font-size-3xl: 52rpx;
  61. /* 字重 */
  62. $uni-font-weight-normal: 400;
  63. $uni-font-weight-medium: 500;
  64. $uni-font-weight-bold: 600;
  65. $uni-font-weight-black: 700;
  66. // ============================================================
  67. // 3. 间距系统 (Spacing)
  68. // ============================================================
  69. $uni-spacing-xs: 8rpx;
  70. $uni-spacing-sm: 16rpx;
  71. $uni-spacing-md: 24rpx;
  72. $uni-spacing-lg: 32rpx;
  73. $uni-spacing-xl: 48rpx;
  74. $uni-spacing-2xl: 64rpx;
  75. $uni-page-padding: 32rpx; // 页面左右边距
  76. // ============================================================
  77. // 4. 圆角 (Border Radius)
  78. // ============================================================
  79. $uni-radius-sm: 12rpx;
  80. $uni-radius-md: 20rpx;
  81. $uni-radius-lg: 32rpx;
  82. $uni-radius-xl: 40rpx;
  83. $uni-radius-full: 50%;
  84. $uni-radius-round: 9999rpx;
  85. // ============================================================
  86. // 5. 阴影 (Shadows)
  87. // ============================================================
  88. $uni-shadow-sm: 0 4rpx 12rpx rgba(249, 115, 22, 0.06);
  89. $uni-shadow-md: 0 8rpx 24rpx rgba(249, 115, 22, 0.10);
  90. $uni-shadow-lg: 0 16rpx 48rpx rgba(249, 115, 22, 0.14);
  91. $uni-shadow-inner: inset 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
  92. /* Claymorphism 双重阴影(孩子端风格) */
  93. $uni-shadow-clay: inset -4rpx -4rpx 12rpx rgba(249, 115, 22, 0.05),
  94. 6rpx 6rpx 18rpx rgba(249, 115, 22, 0.10);
  95. /* 规划师端阴影(蓝色调) */
  96. $uni-shadow-blue-sm: 0 4rpx 12rpx rgba(59, 130, 246, 0.06);
  97. $uni-shadow-blue-md: 0 8rpx 24rpx rgba(59, 130, 246, 0.10);
  98. // ============================================================
  99. // 6. 动画 (Animations)
  100. // ============================================================
  101. $uni-transition-fast: 0.15s ease;
  102. $uni-transition-base: 0.25s ease;
  103. $uni-transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  104. $uni-transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  105. // ============================================================
  106. // 7. CSS 自定义属性 (CSS Custom Properties)
  107. // 用于运行时动态覆盖和组件级使用
  108. // ============================================================
  109. :root {
  110. // 品牌色
  111. --color-primary: #F97316;
  112. --color-primary-light: #FB923C;
  113. --color-primary-dark: #EA580C;
  114. --color-accent: #0EA5E9;
  115. --color-accent-light: #38BDF8;
  116. // 语义色
  117. --color-success: #22C55E;
  118. --color-warning: #F59E0B;
  119. --color-error: #EF4444;
  120. // 中性色
  121. --bg: #FFF7ED;
  122. --bg-grey: #FFF2E4;
  123. --surface: #FFFFFF;
  124. --text: #3D2E1E;
  125. --text-secondary: #6B5A4A;
  126. --muted: #94A3B8;
  127. --border: #FED7AA;
  128. --border-light: #FFEDD5;
  129. // 间距(转换为 px 近似值,rpx 在组件内使用)
  130. --space-xs: 4px;
  131. --space-sm: 8px;
  132. --space-md: 12px;
  133. --space-lg: 16px;
  134. --space-xl: 24px;
  135. --space-page: 16px;
  136. // 圆角
  137. --radius-sm: 6px;
  138. --radius-md: 10px;
  139. --radius-lg: 16px;
  140. --radius-xl: 20px;
  141. // 阴影
  142. --shadow-sm: 0 2px 6px rgba(249, 115, 22, 0.06);
  143. --shadow-md: 0 4px 12px rgba(249, 115, 22, 0.10);
  144. --shadow-lg: 0 8px 24px rgba(249, 115, 22, 0.14);
  145. --shadow-clay: inset -2px -2px 6px rgba(249, 115, 22, 0.05),
  146. 3px 3px 10px rgba(249, 115, 22, 0.10);
  147. // 字体
  148. --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI',
  149. 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  150. --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI',
  151. 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  152. --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  153. // 角色专属色(规划师端用蓝色系)
  154. --color-teacher-primary: #3B82F6;
  155. --color-teacher-bg: #EFF6FF;
  156. }
  157. // ============================================================
  158. // 8. 实用工具类 (Utility Classes)
  159. // ============================================================
  160. // --- 文字 ---
  161. .text-primary { color: $uni-primary; }
  162. .text-accent { color: $uni-accent; }
  163. .text-success { color: $uni-success; }
  164. .text-warning { color: $uni-warning; }
  165. .text-error { color: $uni-error; }
  166. .text-muted { color: $uni-text-color-grey; }
  167. .text-secondary { color: $uni-text-color-secondary; }
  168. .text-bold { font-weight: $uni-font-weight-bold; }
  169. .text-black { font-weight: $uni-font-weight-black; }
  170. .text-center { text-align: center; }
  171. .text-sm { font-size: $uni-font-size-sm; }
  172. .text-base { font-size: $uni-font-size-base; }
  173. .text-lg { font-size: $uni-font-size-lg; }
  174. .text-xl { font-size: $uni-font-size-xl; }
  175. .text-2xl { font-size: $uni-font-size-2xl; }
  176. .text-3xl { font-size: $uni-font-size-3xl; }
  177. // --- 背景 ---
  178. .bg-primary { background-color: $uni-primary; }
  179. .bg-accent { background-color: $uni-accent; }
  180. .bg-surface { background-color: $uni-surface; }
  181. .bg-page { background-color: $uni-bg-color; }
  182. // --- 圆角 ---
  183. .radius-sm { border-radius: $uni-radius-sm; }
  184. .radius-md { border-radius: $uni-radius-md; }
  185. .radius-lg { border-radius: $uni-radius-lg; }
  186. .radius-xl { border-radius: $uni-radius-xl; }
  187. // --- 弹性布局 ---
  188. .flex { display: flex; }
  189. .flex-col { flex-direction: column; }
  190. .flex-row { flex-direction: row; }
  191. .flex-wrap { flex-wrap: wrap; }
  192. .flex-1 { flex: 1; }
  193. .items-center { align-items: center; }
  194. .justify-center { justify-content: center; }
  195. .justify-between { justify-content: space-between; }
  196. .justify-around { justify-content: space-around; }
  197. .gap-xs { gap: $uni-spacing-xs; }
  198. .gap-sm { gap: $uni-spacing-sm; }
  199. .gap-md { gap: $uni-spacing-md; }
  200. .gap-lg { gap: $uni-spacing-lg; }
  201. // --- 间距 ---
  202. .m-0 { margin: 0; }
  203. .p-0 { padding: 0; }
  204. .p-sm { padding: $uni-spacing-sm; }
  205. .p-md { padding: $uni-spacing-md; }
  206. .p-lg { padding: $uni-spacing-lg; }
  207. .mt-sm { margin-top: $uni-spacing-sm; }
  208. .mt-md { margin-top: $uni-spacing-md; }
  209. .mt-lg { margin-top: $uni-spacing-lg; }
  210. .mb-sm { margin-bottom: $uni-spacing-sm; }
  211. .mb-md { margin-bottom: $uni-spacing-md; }
  212. .mb-lg { margin-bottom: $uni-spacing-lg; }
  213. // --- 其他 ---
  214. .w-full { width: 100%; }
  215. .h-full { height: 100%; }
  216. .relative { position: relative; }
  217. .overflow-hidden { overflow: hidden; }
  218. .truncate {
  219. overflow: hidden;
  220. text-overflow: ellipsis;
  221. white-space: nowrap;
  222. }
  223. // ============================================================
  224. // 9. Claymorphism 风格 (孩子端视觉)
  225. // ============================================================
  226. @mixin clay-card($border-color: $uni-border-color) {
  227. border-radius: $uni-radius-md;
  228. border: 4rpx solid $border-color;
  229. background: linear-gradient(145deg, #FFFFFF, $uni-bg-color);
  230. box-shadow: $uni-shadow-clay;
  231. }
  232. @mixin clay-button($bg-color: $uni-primary) {
  233. border-radius: $uni-radius-lg;
  234. border: 3px solid $uni-border-color;
  235. background: linear-gradient(145deg, lighten($bg-color, 8%), $bg-color);
  236. box-shadow:
  237. inset -3rpx -3rpx 10rpx rgba(255, 255, 255, 0.3),
  238. 4rpx 4rpx 12rpx rgba($bg-color, 0.3);
  239. transition: transform $uni-transition-fast;
  240. &:active {
  241. transform: scale(0.96);
  242. }
  243. }
  244. .clay-card {
  245. @include clay-card;
  246. }
  247. // ============================================================
  248. // 10. 关键帧动画
  249. // ============================================================
  250. @keyframes fadeIn {
  251. from { opacity: 0; }
  252. to { opacity: 1; }
  253. }
  254. @keyframes slideUp {
  255. from {
  256. opacity: 0;
  257. transform: translateY(30rpx);
  258. }
  259. to {
  260. opacity: 1;
  261. transform: translateY(0);
  262. }
  263. }
  264. @keyframes slideDown {
  265. from {
  266. opacity: 0;
  267. transform: translateY(-20rpx);
  268. }
  269. to {
  270. opacity: 1;
  271. transform: translateY(0);
  272. }
  273. }
  274. @keyframes scaleIn {
  275. from {
  276. opacity: 0;
  277. transform: scale(0.9);
  278. }
  279. to {
  280. opacity: 1;
  281. transform: scale(1);
  282. }
  283. }
  284. @keyframes bounceIn {
  285. 0% {
  286. opacity: 0;
  287. transform: scale(0.3);
  288. }
  289. 50% {
  290. transform: scale(1.05);
  291. }
  292. 70% {
  293. transform: scale(0.95);
  294. }
  295. 100% {
  296. opacity: 1;
  297. transform: scale(1);
  298. }
  299. }
  300. @keyframes pulseGlow {
  301. 0%, 100% {
  302. box-shadow: 0 0 0 0 rgba($uni-primary, 0.4);
  303. }
  304. 50% {
  305. box-shadow: 0 0 0 12rpx rgba($uni-primary, 0);
  306. }
  307. }
  308. @keyframes float {
  309. 0%, 100% {
  310. transform: translateY(0);
  311. }
  312. 50% {
  313. transform: translateY(-8rpx);
  314. }
  315. }
  316. @keyframes shimmer {
  317. 0% {
  318. background-position: -200% 0;
  319. }
  320. 100% {
  321. background-position: 200% 0;
  322. }
  323. }
  324. @keyframes confettiFall {
  325. 0% {
  326. transform: translateY(-100%) rotate(0deg);
  327. opacity: 1;
  328. }
  329. 100% {
  330. transform: translateY(100vh) rotate(720deg);
  331. opacity: 0;
  332. }
  333. }
  334. @keyframes pointsFly {
  335. 0% {
  336. opacity: 1;
  337. transform: translateY(0) scale(1);
  338. }
  339. 100% {
  340. opacity: 0;
  341. transform: translateY(-100rpx) scale(1.5);
  342. }
  343. }
  344. // 动画实用类
  345. .animate-fade-in { animation: fadeIn $uni-transition-base both; }
  346. .animate-slide-up { animation: slideUp $uni-transition-slow both; }
  347. .animate-slide-down { animation: slideDown $uni-transition-base both; }
  348. .animate-scale-in { animation: scaleIn $uni-transition-slow both; }
  349. .animate-bounce-in { animation: bounceIn $uni-transition-bounce both; }
  350. .animate-pulse-glow { animation: pulseGlow 2s ease-in-out infinite; }
  351. .animate-float { animation: float 3s ease-in-out infinite; }
  352. // 交错入场(用于列表)
  353. @for $i from 1 through 20 {
  354. .animate-stagger-#{$i} {
  355. animation-delay: #{$i * 60}ms;
  356. }
  357. }
  358. // ============================================================
  359. // 11. 骨架屏 (Skeleton)
  360. // ============================================================
  361. @mixin skeleton {
  362. background: linear-gradient(
  363. 90deg,
  364. $uni-border-color-light 25%,
  365. #FFF7ED 50%,
  366. $uni-border-color-light 75%
  367. );
  368. background-size: 200% 100%;
  369. animation: shimmer 1.5s ease-in-out infinite;
  370. border-radius: $uni-radius-sm;
  371. }
  372. .skeleton {
  373. @include skeleton;
  374. }
  375. .skeleton-text {
  376. @include skeleton;
  377. height: 28rpx;
  378. margin-bottom: 12rpx;
  379. }
  380. .skeleton-block {
  381. @include skeleton;
  382. height: 160rpx;
  383. }