common.scss 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // 公共SCSS变量定义
  2. $colors: (
  3. primary: #108cff,
  4. primary-light: rgba(16, 140, 255, 0.08),
  5. bg: #f9fafb,
  6. card: #ffffff,
  7. border: #f5f5f5,
  8. text-primary: #1f2937,
  9. text-secondary: #374151,
  10. shadow: rgba(0, 0, 0, 0.05)
  11. );
  12. $sizes: (
  13. radius: 16rpx,
  14. padding: 32rpx,
  15. padding-sm: 28rpx,
  16. margin-sm: 18rpx,
  17. margin-xs: 16rpx,
  18. icon-padding: 14rpx,
  19. font-title: 34rpx,
  20. font-content: 32rpx,
  21. line-height: 56rpx,
  22. checkbox-size: 32rpx
  23. );
  24. // 字体优化
  25. $font: (
  26. family: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif',
  27. smoothing: antialiased
  28. );
  29. // 字体大小变量
  30. $font-sizes: (
  31. title: 38rpx,
  32. content: 34rpx,
  33. sub-content: 30rpx,
  34. small: 26rpx,
  35. tiny: 24rpx
  36. );
  37. // 字体权重变量
  38. $font-weights: (
  39. bold: 700,
  40. semi-bold: 600,
  41. medium: 500,
  42. regular: 450,
  43. light: 400
  44. );
  45. // 行高变量
  46. $line-heights: (
  47. large: 56rpx,
  48. medium: 48rpx,
  49. small: 40rpx
  50. );
  51. // 字间距变量
  52. $letter-spacings: (
  53. large: 1rpx,
  54. medium: 0.8rpx,
  55. small: 0.5rpx
  56. );
  57. // 文本颜色变量
  58. $text-colors: (
  59. primary: map-get($colors, text-primary),
  60. secondary: map-get($colors, text-secondary),
  61. tertiary: #666666,
  62. placeholder: #999999
  63. );
  64. // 公共混合宏
  65. @mixin flex-center {
  66. display: flex;
  67. align-items: center;
  68. }
  69. @mixin shadow($level: 1) {
  70. $shadow-levels: (
  71. 1: 0 2rpx 12rpx map-get($colors, shadow),
  72. 2: 0 4rpx 20rpx map-get($colors, shadow),
  73. 3: 0 8rpx 30rpx map-get($colors, shadow)
  74. );
  75. box-shadow: map-get($shadow-levels, $level);
  76. transition: box-shadow 0.3s ease;
  77. }
  78. @mixin card {
  79. width: 100%;
  80. margin: 0;
  81. background-color: map-get($colors, card);
  82. border-radius: map-get($sizes, radius);
  83. @include shadow;
  84. }
  85. // 字体样式混合宏
  86. @mixin font-styles(
  87. $size: content,
  88. $weight: regular,
  89. $color: primary,
  90. $line-height: medium,
  91. $letter-spacing: medium
  92. ) {
  93. font-size: map-get($font-sizes, $size);
  94. font-weight: map-get($font-weights, $weight);
  95. color: map-get($text-colors, $color);
  96. line-height: map-get($line-heights, $line-height);
  97. letter-spacing: map-get($letter-spacings, $letter-spacing);
  98. font-family: map-get($font, family);
  99. }
  100. // 公共页面容器样式
  101. .page-container {
  102. box-sizing: border-box;
  103. padding: 0;
  104. background-color: map-get($colors, bg);
  105. font-family: map-get($font, family);
  106. -webkit-font-smoothing: map-get($font, smoothing);
  107. font-smoothing: map-get($font, smoothing);
  108. }
  109. // 公共卡片样式
  110. .card-wrap {
  111. @include card;
  112. margin-bottom: 20rpx;
  113. &:hover {
  114. @include shadow(2);
  115. }
  116. }
  117. // 公共地址标题样式
  118. .address-header {
  119. display: flex;
  120. align-items: center;
  121. margin-bottom: map-get($sizes, margin-sm);
  122. padding-bottom: map-get($sizes, margin-sm);
  123. border-bottom: 1rpx solid map-get($colors, border);
  124. .location-icon {
  125. margin-right: map-get($sizes, margin-xs);
  126. background-color: map-get($colors, primary-light);
  127. padding: map-get($sizes, icon-padding);
  128. border-radius: 50%;
  129. flex-shrink: 0;
  130. }
  131. .address-title {
  132. margin-left: 16rpx;
  133. @include font-styles($size: title, $weight: bold, $color: primary);
  134. }
  135. }