common.scss 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. max-width: 100%;
  81. margin: 0;
  82. background-color: map-get($colors, card);
  83. border-radius: map-get($sizes, radius);
  84. box-sizing: border-box;
  85. @include shadow;
  86. }
  87. // 字体样式混合宏
  88. @mixin font-styles(
  89. $size: content,
  90. $weight: regular,
  91. $color: primary,
  92. $line-height: medium,
  93. $letter-spacing: medium
  94. ) {
  95. font-size: map-get($font-sizes, $size);
  96. font-weight: map-get($font-weights, $weight);
  97. color: map-get($text-colors, $color);
  98. line-height: map-get($line-heights, $line-height);
  99. letter-spacing: map-get($letter-spacings, $letter-spacing);
  100. font-family: map-get($font, family);
  101. }
  102. // 公共页面容器样式
  103. .page-container {
  104. box-sizing: border-box;
  105. padding: 0;
  106. background-color: map-get($colors, bg);
  107. font-family: map-get($font, family);
  108. -webkit-font-smoothing: map-get($font, smoothing);
  109. font-smoothing: map-get($font, smoothing);
  110. }
  111. // 公共卡片样式
  112. .card-wrap {
  113. @include card;
  114. margin-bottom: 20rpx;
  115. box-sizing: border-box;
  116. max-width: 100%;
  117. overflow: hidden;
  118. &:hover {
  119. @include shadow(2);
  120. }
  121. }
  122. // 公共地址标题样式
  123. .address-header {
  124. display: flex;
  125. align-items: center;
  126. margin-bottom: map-get($sizes, margin-sm);
  127. padding-bottom: map-get($sizes, margin-sm);
  128. border-bottom: 1rpx solid map-get($colors, border);
  129. .location-icon {
  130. margin-right: map-get($sizes, margin-xs);
  131. background-color: map-get($colors, primary-light);
  132. padding: map-get($sizes, icon-padding);
  133. border-radius: 50%;
  134. flex-shrink: 0;
  135. }
  136. .address-title {
  137. margin-left: 16rpx;
  138. @include font-styles($size: title, $weight: bold, $color: primary);
  139. }
  140. .add-button {
  141. display: flex;
  142. align-items: center;
  143. justify-content: center;
  144. padding: 8rpx 24rpx;
  145. border: 1rpx solid #108cff;
  146. border-radius: 40rpx;
  147. background-color: transparent;
  148. color: #108cff;
  149. font-size: 24rpx;
  150. cursor: pointer;
  151. text {
  152. margin-left: 8rpx;
  153. }
  154. }
  155. }