common.scss 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. // 页面主标题
  111. .page-title {
  112. @include font-styles($size: title, $weight: bold, $color: primary);
  113. }
  114. // 卡片标题
  115. .card-title {
  116. @include font-styles($size: title, $weight: bold, $color: primary);
  117. border-bottom: 1rpx solid map-get($colors, border);
  118. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  119. margin: 0;
  120. }
  121. // 地址标题
  122. .address-title {
  123. @include font-styles($size: title, $weight: bold, $color: primary);
  124. flex: 1;
  125. }
  126. // 主要内容文字
  127. .content-text {
  128. @include font-styles;
  129. }
  130. // 辅助文字
  131. .auxiliary-text {
  132. @include font-styles($size: small, $weight: regular, $color: tertiary, $line-height: small, $letter-spacing: small);
  133. }
  134. // 复选框/单选框文字
  135. .form-item-text {
  136. @include font-styles;
  137. vertical-align: middle;
  138. }
  139. // 空状态文字
  140. .empty-text {
  141. @include font-styles;
  142. text-align: center;
  143. }
  144. // 标签文字
  145. .label-text {
  146. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  147. }
  148. // 值文字
  149. .value-text {
  150. @include font-styles($size: small, $weight: regular, $color: secondary);
  151. }
  152. // 公共卡片样式
  153. .card_wrap {
  154. @include card;
  155. margin-bottom: 20rpx;
  156. &:hover {
  157. @include shadow(2);
  158. }
  159. }
  160. // 公共地址标题样式
  161. .address-header {
  162. display: flex;
  163. justify-content: space-between;
  164. align-items: center;
  165. margin-bottom: map-get($sizes, margin-sm);
  166. padding-bottom: map-get($sizes, margin-sm);
  167. border-bottom: 1rpx solid map-get($colors, border);
  168. .location-icon {
  169. margin-right: map-get($sizes, margin-xs);
  170. background-color: map-get($colors, primary-light);
  171. padding: map-get($sizes, icon-padding);
  172. border-radius: 50%;
  173. flex-shrink: 0;
  174. }
  175. .address-title {
  176. margin-left: 16rpx;
  177. }
  178. .add-image-btn {
  179. margin-top: -10rpx;
  180. }
  181. }