utils.scss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /**
  2. * $fix 偏移量
  3. * $isLight true:light/false: heavy
  4. */
  5. @mixin setFontBase($fix, $isLight: false) {
  6. font-size: #{$base-font-size-normal - 1}px;
  7. [data-fontsize="nor-small"] & {
  8. font-size: #{$base-font-size-small - 1 + $fix}px;
  9. @if $isLight != true {
  10. font-family: #{$font-family-base};
  11. font-weight: bold;
  12. } @else {
  13. font-family: #{$font-family-base};
  14. font-weight: normal;
  15. }
  16. }
  17. [data-fontsize="nor-middle"] & {
  18. font-size: #{$base-font-size-normal - 1 + $fix}px;
  19. @if $isLight != true {
  20. font-family: #{$font-family-base};
  21. font-weight: bold;
  22. } @else {
  23. font-family: #{$font-family-base};
  24. font-weight: normal;
  25. }
  26. }
  27. [data-fontsize="nor-big"] & {
  28. font-size: #{$base-font-size-big - 1 + $fix}px;
  29. @if $isLight != true {
  30. font-family: #{$font-family-base};
  31. font-weight: bold;
  32. } @else {
  33. font-family: #{$font-family-base};
  34. font-weight: normal;
  35. }
  36. }
  37. }
  38. /**
  39. * $attr color backgroud-color
  40. * $fix 偏移量 0
  41. * $type light/dark
  42. */
  43. @mixin setThemeColorBase($attr, $fix: 0) {
  44. #{$attr}: map-get(map-get($colors, "blue"), 0);
  45. [data-theme="blue"] & {
  46. #{$attr}: map-get(map-get($colors, "blue"), $fix);
  47. }
  48. [data-theme="purple"] & {
  49. #{$attr}: map-get(map-get($colors, "purple"), $fix);
  50. }
  51. [data-theme="red"] & {
  52. #{$attr}: map-get(map-get($colors, "red"), $fix);
  53. }
  54. [data-theme="green"] & {
  55. #{$attr}: map-get(map-get($colors, "green"), $fix);
  56. }
  57. }
  58. @mixin setStyleAssist() {
  59. .fl {
  60. float: left;
  61. }
  62. .fr {
  63. float: right;
  64. }
  65. .w-60 {
  66. width: 60px;
  67. }
  68. .w-120 {
  69. width: 120px;
  70. }
  71. .w-150 {
  72. width: 150px;
  73. }
  74. .mt-15 {
  75. margin-top: 15px;
  76. }
  77. .mt-30 {
  78. margin-top: 30px;
  79. }
  80. .ml-30 {
  81. margin-left: 30px;
  82. }
  83. .text-r {
  84. text-align: right;
  85. }
  86. .pr-15{
  87. padding-right: 15px;
  88. }
  89. }
  90. /**
  91. * 设置 全局字体class类
  92. */
  93. @mixin setFontAssistClass() {
  94. .fsize-p {
  95. @include setFontBase(0)
  96. }
  97. .fsize-p-l {
  98. @include setFontBase(0, true)
  99. }
  100. @for $i from 1 through 13 {
  101. .fsize-p#{$i} {
  102. @include setFontBase($i)
  103. }
  104. .fsize-m#{$i} {
  105. @include setFontBase(-$i)
  106. }
  107. .fsize-p#{$i}-l {
  108. @include setFontBase($i, true)
  109. }
  110. .fsize-m#{$i}-l {
  111. @include setFontBase(-$i, true)
  112. }
  113. }
  114. }
  115. /**
  116. * 设置 全局字体class类
  117. */
  118. @mixin setColorAssistClass($attr, $prefix) {
  119. .#{$prefix}-p {
  120. @include setThemeColorBase($attr, 0)
  121. }
  122. @for $i from 1 through 13 {
  123. .#{$prefix}-p#{$i} {
  124. @include setThemeColorBase($attr, $i)
  125. }
  126. .#{$prefix}-m#{$i} {
  127. @include setThemeColorBase($attr, -$i)
  128. }
  129. }
  130. }
  131. /**
  132. * 设置 全局设置 图标
  133. */
  134. @mixin bgImg($link) {
  135. background: url("~@/assets/images/" + $link);
  136. }
  137. /* 网站字体样式 */
  138. $client-font-size:20;
  139. //传入改变数值及是否加粗
  140. @mixin setFontStyle($fix, $isBold: false) {
  141. font-size: #{$client-font-size + $fix}px;
  142. @if $isBold == true {
  143. font-weight: bold;
  144. }
  145. }