upload.scss 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. @import "mixins/mixins";
  2. @import "progress";
  3. @import "common/var";
  4. @include b(upload) {
  5. display: inline-block;
  6. text-align: center;
  7. cursor: pointer;
  8. outline: none;
  9. @include e(input) {
  10. display: none;
  11. }
  12. @include e(tip) {
  13. font-size: 12px;
  14. color: $--color-text-regular;
  15. margin-top: 7px;
  16. }
  17. iframe {
  18. position: absolute;
  19. z-index: -1;
  20. top: 0;
  21. left: 0;
  22. opacity: 0;
  23. filter: alpha(opacity=0);
  24. }
  25. /* 照片墙模式 */
  26. @include m(picture-card) {
  27. background-color: #fbfdff;
  28. border: 1px dashed #c0ccda;
  29. border-radius: 6px;
  30. box-sizing: border-box;
  31. width: 148px;
  32. height: 148px;
  33. cursor: pointer;
  34. line-height: 146px;
  35. vertical-align: top;
  36. i {
  37. font-size: 28px;
  38. color: #8c939d;
  39. }
  40. &:hover {
  41. border-color: $--color-primary;
  42. color: $--color-primary;
  43. }
  44. }
  45. &:focus {
  46. border-color: $--color-primary;
  47. color: $--color-primary;
  48. .el-upload-dragger {
  49. border-color: $--color-primary;
  50. }
  51. }
  52. }
  53. @include b(upload-dragger) {
  54. background-color: #fff;
  55. border: 1px dashed #d9d9d9;
  56. border-radius: 6px;
  57. box-sizing: border-box;
  58. width: 360px;
  59. height: 180px;
  60. text-align: center;
  61. cursor: pointer;
  62. position: relative;
  63. overflow: hidden;
  64. .el-icon-upload {
  65. font-size: 67px;
  66. color: $--color-text-placeholder;
  67. margin: 40px 0 16px;
  68. line-height: 50px;
  69. }
  70. + .el-upload__tip {
  71. text-align: center;
  72. }
  73. ~ .el-upload__files {
  74. border-top: $--border-base;
  75. margin-top: 7px;
  76. padding-top: 5px;
  77. }
  78. .el-upload__text {
  79. color: $--color-text-regular;
  80. font-size: 14px;
  81. text-align: center;
  82. em {
  83. color: $--color-primary;
  84. font-style: normal;
  85. }
  86. }
  87. &:hover {
  88. border-color: $--color-primary;
  89. }
  90. @include when(dragover) {
  91. background-color: rgba(32, 159, 255, .06);
  92. border: 2px dashed $--color-primary;
  93. }
  94. }
  95. @include b(upload-list) {
  96. margin: 0;
  97. padding: 0;
  98. list-style: none;
  99. @include e(item) {
  100. transition: all .5s cubic-bezier(.55,0,.1,1);
  101. font-size: 14px;
  102. color: $--color-text-regular;
  103. line-height: 1.8;
  104. margin-top: 5px;
  105. position: relative;
  106. box-sizing: border-box;
  107. border-radius: 4px;
  108. width: 100%;
  109. .el-progress {
  110. position: absolute;
  111. top: 20px;
  112. width: 100%;
  113. }
  114. .el-progress__text {
  115. position: absolute;
  116. right: 0;
  117. top: -13px;
  118. }
  119. .el-progress-bar {
  120. margin-right: 0;
  121. padding-right: 0;
  122. }
  123. &:first-child {
  124. margin-top: 10px;
  125. }
  126. & .el-icon-upload-success {
  127. color: $--color-success;
  128. }
  129. .el-icon-close {
  130. display: none;
  131. position: absolute;
  132. top: 5px;
  133. right: 5px;
  134. cursor: pointer;
  135. opacity: .75;
  136. color: $--color-text-regular;
  137. //transform: scale(.7);
  138. &:hover {
  139. opacity: 1;
  140. }
  141. }
  142. & .el-icon-close-tip {
  143. display: none;
  144. position: absolute;
  145. top: 5px;
  146. right: 5px;
  147. font-size: 12px;
  148. cursor: pointer;
  149. opacity: 1;
  150. color: $--color-primary;
  151. }
  152. &:hover {
  153. background-color: $--background-color-base;
  154. .el-icon-close {
  155. display: inline-block;
  156. }
  157. .el-progress__text {
  158. display: none;
  159. }
  160. }
  161. @include when(success) {
  162. .el-upload-list__item-status-label {
  163. display: block;
  164. }
  165. .el-upload-list__item-name:hover, .el-upload-list__item-name:focus {
  166. color: $--link-hover-color;
  167. cursor: pointer;
  168. }
  169. &:focus:not(:hover) { /* 键盘focus */
  170. .el-icon-close-tip {
  171. display: inline-block;
  172. }
  173. }
  174. &:not(.focusing):focus, &:active { /* click时 */
  175. outline-width: 0;
  176. .el-icon-close-tip {
  177. display: none;
  178. }
  179. }
  180. &:hover, &:focus {
  181. .el-upload-list__item-status-label {
  182. display: none;
  183. }
  184. }
  185. }
  186. }
  187. @include when(disabled) {
  188. .el-upload-list__item:hover .el-upload-list__item-status-label {
  189. display: block;
  190. }
  191. }
  192. @include e(item-name) {
  193. color: $--color-text-regular;
  194. display: block;
  195. margin-right: 40px;
  196. overflow: hidden;
  197. padding-left: 4px;
  198. text-overflow: ellipsis;
  199. transition: color .3s;
  200. white-space: nowrap;
  201. [class^="el-icon"] {
  202. height: 100%;
  203. margin-right: 7px;
  204. color: $--color-text-secondary;
  205. line-height: inherit;
  206. }
  207. }
  208. @include e(item-status-label) {
  209. position: absolute;
  210. right: 5px;
  211. top: 0;
  212. line-height: inherit;
  213. display: none;
  214. }
  215. @include e(item-delete) {
  216. position: absolute;
  217. right: 10px;
  218. top: 0;
  219. font-size: 12px;
  220. color: $--color-text-regular;
  221. display: none;
  222. &:hover {
  223. color: $--color-primary;
  224. }
  225. }
  226. @include m(picture-card) {
  227. margin: 0;
  228. display: inline;
  229. vertical-align: top;
  230. .el-upload-list__item {
  231. overflow: hidden;
  232. background-color: #fff;
  233. border: 1px solid #c0ccda;
  234. border-radius: 6px;
  235. box-sizing: border-box;
  236. width: 148px;
  237. height: 148px;
  238. margin: 0 8px 8px 0;
  239. display: inline-block;
  240. .el-icon-check,
  241. .el-icon-circle-check {
  242. color: $--color-white;
  243. }
  244. .el-icon-close {
  245. display: none;
  246. }
  247. &:hover {
  248. .el-upload-list__item-status-label {
  249. display: none;
  250. }
  251. .el-progress__text {
  252. display: block;
  253. }
  254. }
  255. }
  256. .el-upload-list__item-name {
  257. display: none;
  258. }
  259. .el-upload-list__item-thumbnail {
  260. width: 100%;
  261. height: 100%;
  262. }
  263. .el-upload-list__item-status-label {
  264. position: absolute;
  265. right: -15px;
  266. top: -6px;
  267. width: 40px;
  268. height: 24px;
  269. background: #13ce66;
  270. text-align: center;
  271. transform: rotate(45deg);
  272. box-shadow: 0 0 1pc 1px rgba(0,0,0,0.2);
  273. i {
  274. font-size: 12px;
  275. margin-top: 11px;
  276. transform: rotate(-45deg);
  277. }
  278. }
  279. .el-upload-list__item-actions {
  280. position: absolute;
  281. width: 100%;
  282. height: 100%;
  283. left: 0;
  284. top: 0;
  285. cursor: default;
  286. text-align: center;
  287. color: #fff;
  288. opacity: 0;
  289. font-size: 20px;
  290. background-color: rgba(0, 0, 0, .5);
  291. transition: opacity .3s;
  292. &::after {
  293. display: inline-block;
  294. content: "";
  295. height: 100%;
  296. vertical-align: middle
  297. }
  298. span {
  299. display: none;
  300. cursor: pointer;
  301. }
  302. span + span {
  303. margin-left: 15px;
  304. }
  305. .el-upload-list__item-delete {
  306. position: static;
  307. font-size: inherit;
  308. color: inherit;
  309. }
  310. &:hover {
  311. opacity: 1;
  312. span {
  313. display: inline-block;
  314. }
  315. }
  316. }
  317. .el-progress {
  318. top: 50%;
  319. left: 50%;
  320. transform: translate(-50%, -50%);
  321. bottom: auto;
  322. width: 126px;
  323. .el-progress__text {
  324. top: 50%;
  325. }
  326. }
  327. }
  328. @include m(picture) {
  329. .el-upload-list__item {
  330. overflow: hidden;
  331. z-index: 0;
  332. background-color: #fff;
  333. border: 1px solid #c0ccda;
  334. border-radius: 6px;
  335. box-sizing: border-box;
  336. margin-top: 10px;
  337. padding: 10px 10px 10px 90px;
  338. height: 92px;
  339. .el-icon-check,
  340. .el-icon-circle-check {
  341. color: $--color-white;
  342. }
  343. &:hover {
  344. .el-upload-list__item-status-label {
  345. background: transparent;
  346. box-shadow: none;
  347. top: -2px;
  348. right: -12px;
  349. }
  350. .el-progress__text {
  351. display: block;
  352. }
  353. }
  354. &.is-success {
  355. .el-upload-list__item-name {
  356. line-height: 70px;
  357. margin-top: 0;
  358. i {
  359. display: none;
  360. }
  361. }
  362. }
  363. }
  364. .el-upload-list__item-thumbnail {
  365. vertical-align: middle;
  366. display: inline-block;
  367. width: 70px;
  368. height: 70px;
  369. float: left;
  370. position: relative;
  371. z-index: 1;
  372. margin-left: -80px;
  373. background-color: $--color-white
  374. }
  375. .el-upload-list__item-name {
  376. display: block;
  377. margin-top: 20px;
  378. i {
  379. font-size: 70px;
  380. line-height: 1;
  381. position: absolute;
  382. left: 9px;
  383. top: 10px;
  384. }
  385. }
  386. .el-upload-list__item-status-label {
  387. position: absolute;
  388. right: -17px;
  389. top: -7px;
  390. width: 46px;
  391. height: 26px;
  392. background: #13ce66;
  393. text-align: center;
  394. transform: rotate(45deg);
  395. box-shadow: 0 1px 1px #ccc;
  396. i {
  397. font-size: 12px;
  398. margin-top: 12px;
  399. transform: rotate(-45deg);
  400. }
  401. }
  402. .el-progress {
  403. position: relative;
  404. top: -7px;
  405. }
  406. }
  407. }
  408. @include b(upload-cover) {
  409. position: absolute;
  410. left: 0;
  411. top: 0;
  412. width: 100%;
  413. height: 100%;
  414. overflow: hidden;
  415. z-index: 10;
  416. cursor: default;
  417. @include utils-vertical-center;
  418. img {
  419. display: block;
  420. width: 100%;
  421. height: 100%;
  422. }
  423. @include e(label) {
  424. position: absolute;
  425. right: -15px;
  426. top: -6px;
  427. width: 40px;
  428. height: 24px;
  429. background: #13ce66;
  430. text-align: center;
  431. transform: rotate(45deg);
  432. box-shadow: 0 0 1pc 1px rgba(0,0,0,0.2);
  433. i {
  434. font-size: 12px;
  435. margin-top: 11px;
  436. transform: rotate(-45deg);
  437. color: #fff;
  438. }
  439. }
  440. @include e(progress) {
  441. display: inline-block;
  442. vertical-align: middle;
  443. position: static;
  444. width: 243px;
  445. + .el-upload__inner {
  446. opacity: 0;
  447. }
  448. }
  449. @include e(content) {
  450. position: absolute;
  451. top: 0;
  452. left: 0;
  453. width: 100%;
  454. height: 100%;
  455. }
  456. @include e(interact) {
  457. position: absolute;
  458. bottom: 0;
  459. left: 0;
  460. width: 100%;
  461. height: 100%;
  462. background-color: rgba(#000, .72);
  463. text-align: center;
  464. .btn {
  465. display: inline-block;
  466. color: $--color-white;
  467. font-size: 14px;
  468. cursor: pointer;
  469. vertical-align: middle;
  470. transition: $--md-fade-transition;
  471. margin-top: 60px;
  472. i {
  473. margin-top: 0;
  474. }
  475. span {
  476. opacity: 0;
  477. transition: opacity .15s linear;
  478. }
  479. &:not(:first-child) {
  480. margin-left: 35px;
  481. }
  482. &:hover {
  483. transform: translateY(-13px);
  484. span {
  485. opacity: 1;
  486. }
  487. }
  488. i {
  489. color: $--color-white;
  490. display: block;
  491. font-size: 24px;
  492. line-height: inherit;
  493. margin: 0 auto 5px;
  494. }
  495. }
  496. }
  497. @include e(title) {
  498. position: absolute;
  499. bottom: 0;
  500. left: 0;
  501. background-color: $--color-white;
  502. height: 36px;
  503. width: 100%;
  504. overflow: hidden;
  505. text-overflow: ellipsis;
  506. white-space: nowrap;
  507. font-weight: normal;
  508. text-align: left;
  509. padding: 0 10px;
  510. margin: 0;
  511. line-height: 36px;
  512. font-size: 14px;
  513. color: $--color-text-primary;
  514. }
  515. + .el-upload__inner {
  516. opacity: 0;
  517. position: relative;
  518. z-index: 1;
  519. }
  520. }