mixin.scss 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. @import "./var";
  2. $imageUrl:"../images/";
  3. $DefaultLinearGradient: linear-gradient(to top,#4e5358,#25282a);
  4. @mixin responsiveImageWithLinearGradient($filename,$ext:png, $bgPos: center, $linearGradient: $DefaultLinearGradient){
  5. background: url('#{$imageUrl}#{$filename}.#{$ext}') $bgPos no-repeat, $linearGradient no-repeat;;
  6. @media
  7. (-webkit-min-device-pixel-ratio: 1.5),
  8. (min-resolution: 144dpi){
  9. background: url('#{$imageUrl}#{$filename}X3.#{$ext}') $bgPos no-repeat, $linearGradient no-repeat;;
  10. }
  11. @media
  12. (-webkit-min-device-pixel-ratio: 2),
  13. (min-resolution: 192dpi){
  14. background: url('#{$imageUrl}#{$filename}X3.#{$ext}') $bgPos no-repeat, $linearGradient no-repeat;;
  15. }
  16. }
  17. @mixin responsiveImage($filename,$ext:png){
  18. background-size:cover;
  19. background-repeat: no-repeat;
  20. background-image:url('#{$imageUrl}#{$filename}.#{$ext}');
  21. @media
  22. (-webkit-min-device-pixel-ratio: 1.5),
  23. (min-resolution: 144dpi){
  24. background-image:url('#{$imageUrl}#{$filename}X3.#{$ext}');
  25. }
  26. @media
  27. (-webkit-min-device-pixel-ratio: 2),
  28. (min-resolution: 192dpi){
  29. background-image:url('#{$imageUrl}#{$filename}X3.#{$ext}');
  30. }
  31. }
  32. @mixin bluetryButton(){
  33. text-align: center;
  34. font-size:16px;
  35. cursor: pointer;
  36. border-radius:22.5px;
  37. width:160px;
  38. height:40px;
  39. line-height: 40px;
  40. transition: 0.3s;
  41. background: #338fe6 linear-gradient(to bottom, #107ee5, #336ae6);
  42. &:hover{
  43. background-image: linear-gradient(to top, #107ee5, #336ae6);
  44. }
  45. &:active{
  46. background-image: linear-gradient(to top, #107ee5, #336ae6);
  47. }
  48. }
  49. @mixin pbCenter(){
  50. position: absolute;
  51. top:0;
  52. bottom: 0;
  53. left:0;
  54. right:0;
  55. margin: auto;
  56. }
  57. @mixin no-select{
  58. -moz-user-select: none;
  59. -webkit-user-select: none;
  60. -o-user-select:none;
  61. }
  62. @mixin simpleBlueTryButton($concatClass){
  63. @include pbCenter;
  64. border-radius: 3px;
  65. background-color: $dark-blue;
  66. text-align: center;
  67. color: white;
  68. font-size: 14px;
  69. cursor: pointer;
  70. &.#{$concatClass}{
  71. border: 1px solid $dark-blue;
  72. background: white;
  73. color: $dark-blue;
  74. }
  75. &:hover {
  76. opacity: 0.8;
  77. }
  78. }
  79. @mixin beforeIcon($iconPath, $offset: 0, $iconSize: 22px, $margin: 8px) {
  80. &:before {
  81. content: '';
  82. display: inline-block;
  83. width: $iconSize;
  84. height: $iconSize;
  85. margin-right: $margin;
  86. position: relative;
  87. top: $offset;
  88. vertical-align: middle;
  89. @include responsiveImage($iconPath)
  90. }
  91. }
  92. @mixin absoluteBeforeIcon($iconPath, $offsetTop: 0, $offsetLeft: 0, $iconSize: 18px) {
  93. &:before {
  94. content: '';
  95. display: inline-block;
  96. width: $iconSize;
  97. height: $iconSize;
  98. position: absolute;
  99. top: $offsetTop;
  100. left: $offsetLeft;
  101. vertical-align: middle;
  102. @include responsiveImage($iconPath)
  103. }
  104. }
  105. // 验证手机号 输入框以及按钮样式
  106. @mixin inputAndBtnInPhoneVerificationForm {
  107. $input-width: 100%;
  108. .send-verification-code{
  109. @include no-select;
  110. width: 100px;
  111. height: 34px;
  112. line-height: 34px;
  113. border-radius: 2px;
  114. border: solid 1px $dark-blue;
  115. margin-top: 5px;
  116. margin-left: 3%;
  117. text-align: center;
  118. display: inline-block;
  119. vertical-align: top;
  120. cursor: pointer;
  121. color: $dark-blue;
  122. transition: 0.3s;
  123. font-size:14px;
  124. &:hover,&:active{
  125. color: $light-blue;
  126. border-color: $light-blue;
  127. }
  128. &.sended-verification-code{
  129. cursor: not-allowed;
  130. color: rgba(#25282a,0.3);
  131. border-color: rgba(#25282a, 0.3);
  132. &:hover,&:active{
  133. cursor: not-allowed;
  134. color: rgba(#25282a,0.3);
  135. border-color: rgba(#25282a, 0.3);
  136. }
  137. }
  138. }
  139. .normal-button{
  140. background: $dark-blue;
  141. color: white;
  142. width: 430px;
  143. height:38px;
  144. transition: background 0.3s;
  145. cursor: pointer;
  146. text-align: center;
  147. line-height: 38px;
  148. border-radius: 3px;
  149. margin-top: 20px;
  150. position: absolute;
  151. top: 283px;
  152. &:hover{
  153. background-color: $light-blue;
  154. }
  155. &.normal-button-disable{
  156. cursor: not-allowed;
  157. opacity: .5;
  158. }
  159. .normal_button_loading_icon_wrapper {
  160. width: 0;
  161. transition: width .5s;
  162. display: inline-block;
  163. overflow: hidden;
  164. vertical-align: top;
  165. margin-right: 5px;
  166. }
  167. &.normal-button-loading {
  168. .normal_button_loading_icon_wrapper {
  169. width: 20px;
  170. }
  171. .normal_button_loading_icon {
  172. width: 20px;
  173. height: 20px;
  174. display: inline-block !important;
  175. border: 2px solid transparent;
  176. border-radius: 50%;
  177. border-bottom-color: #fff;
  178. animation: spin .5s infinite linear;
  179. vertical-align: middle;
  180. margin-top: -4px;
  181. }
  182. }
  183. @keyframes spin {
  184. 0% {
  185. transform: rotate(0deg);
  186. }
  187. 100% {
  188. transform: rotate(360deg);
  189. }
  190. }
  191. }
  192. .normal-input-title{
  193. font-size: 14px;
  194. height: 20px;
  195. font-weight: 500;
  196. color: $title-black;
  197. }
  198. .normal-input-title.required:after {
  199. content: '*';
  200. color: $orange;
  201. margin-left: 2px;
  202. }
  203. .normal-input-component{
  204. margin-top: 5px;
  205. width: $input-width;
  206. margin-bottom: 10px;
  207. &.sign-up-verification-code{
  208. position: relative;
  209. .verification-code-success{
  210. position: absolute;
  211. right:10px;
  212. top:0;
  213. bottom:0;
  214. margin: auto;
  215. width: 16px;
  216. height: 16px;
  217. display: none;
  218. &.verification-code-success-show{
  219. display: block;
  220. }
  221. }
  222. }
  223. input {
  224. border-radius: 3px;
  225. background: white;
  226. padding: 0 10px;
  227. border: 1px solid #b4b9c2;
  228. font-size: 14px;
  229. width: 100%;
  230. transition: 0.2s;
  231. height: 34px;
  232. line-height: 34px;
  233. &:active,&:focus,&:hover{
  234. border-color: $dark-blue;
  235. }
  236. }
  237. .normal-input-error-area{
  238. color: $orange;
  239. font-size: 12px;
  240. height:0;
  241. overflow: hidden;
  242. }
  243. &.normal-input-error-area-show{
  244. margin-bottom: 0 !important;
  245. input{
  246. border: 1px solid $orange;
  247. }
  248. .normal-input-error-area{
  249. height:21px;
  250. margin-top: 5px;
  251. }
  252. }
  253. ::-webkit-input-placeholder {
  254. color: #ced4d9;
  255. font-weight: 400;
  256. }
  257. &.phone-number{
  258. width: 66%;
  259. display: inline-block;
  260. vertical-align: middle;
  261. }
  262. }
  263. }
  264. @mixin loading($size: 14px) {
  265. &:after {
  266. width: $size;
  267. height: $size;
  268. display: inline-block !important;
  269. border: 2px solid transparent;
  270. border-radius: 50%;
  271. border-bottom-color: #fff;
  272. animation: spin .5s infinite linear;
  273. vertical-align: middle;
  274. margin: 10px;
  275. content: "";
  276. }
  277. }
  278. @mixin arrow-icon($color) {
  279. position: relative;
  280. top: -2px;
  281. width: 9px;
  282. height: 7px;
  283. display: inline-block;
  284. margin: auto auto auto 6px;
  285. transition: transform .3s;
  286. cursor: pointer;
  287. .arrow-icon {
  288. right: 7px;
  289. top: 7px;
  290. width: 2px;
  291. height: 7px;
  292. background-color: $color;
  293. transform: rotate(47deg);
  294. position: absolute;
  295. &:before {
  296. content: '';
  297. width: 2px;
  298. height: 7px;
  299. background-color: $color;
  300. transform: rotate(-98deg);
  301. display: block;
  302. position: absolute;
  303. top: 3px;
  304. left: -3px;
  305. }
  306. }
  307. &.active{
  308. transform: rotate(180deg);
  309. transition: transform .3s;
  310. .arrow-icon:before,
  311. .arrow-icon {
  312. background-color: $color;
  313. }
  314. }
  315. }
  316. @mixin links-arrow($color:$title-black, $degree-right:-45deg, $degree-left: 90deg) {
  317. position: relative;
  318. top: -10px;
  319. width: 9px;
  320. height: 7px;
  321. display: inline-block;
  322. margin: auto auto auto 6px;
  323. transition: transform .3s;
  324. cursor: pointer;
  325. .arrow-icon {
  326. right: 2px;
  327. top: 7px;
  328. width: 2px;
  329. height: 7px;
  330. background-color: $color;
  331. transform: rotate($degree-right);
  332. position: absolute;
  333. border-radius: 2px;
  334. &:before {
  335. content: '';
  336. width: 2px;
  337. height: 7px;
  338. background-color: $color;
  339. transform: rotate($degree-left);
  340. display: block;
  341. position: absolute;
  342. top: 3px;
  343. left: -3px;
  344. border-radius: 2px;
  345. }
  346. }
  347. }
  348. @keyframes spin {
  349. 0% {
  350. transform: rotate(0deg);
  351. }
  352. 100% {
  353. transform: rotate(360deg);
  354. }
  355. }
  356. // keyframes兼容性,调用方法@include keyframes(animationName){}
  357. @mixin keyframes($animationName) {
  358. @keyframes #{$animationName} {
  359. @content;
  360. }
  361. // Firefox
  362. @-moz-keyframes #{$animationName} {
  363. @content;
  364. }
  365. // Safari 和 Chrome
  366. @-webkit-keyframes #{$animationName} {
  367. @content;
  368. }
  369. // Opera
  370. @-o-keyframes #{$animationName} {
  371. @content;
  372. }
  373. }