Box.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div
  3. class="l-flex--col c-box"
  4. :class="{ fullscreen }"
  5. >
  6. <div class="c-box__border--left" />
  7. <div class="c-box__border--right" />
  8. <div class="l-flex__fill l-flex--col c-box__main has-bg">
  9. <div
  10. v-if="title"
  11. class="l-flex__none c-box__header l-flex--row"
  12. >
  13. <div class="u-bold l-flex__fill">{{ title }}</div>
  14. <div class="header__decoration">
  15. <div class="decoration__bg" />
  16. <div class="decoration__bg--under" />
  17. </div>
  18. <i
  19. v-if="canFullScreen"
  20. class="c-box__button has-bg u-pointer"
  21. @click.stop="onToggle"
  22. />
  23. <div
  24. v-else
  25. class="header__rects l-flex--row"
  26. >
  27. <div class="header__rect l-flex__fill" />
  28. <div class="header__rect l-flex__fill" />
  29. <div class="header__rect l-flex__fill" />
  30. </div>
  31. </div>
  32. <div class="l-flex__fill l-flex--col has-content-padding">
  33. <slot />
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. name: 'Box',
  41. props: {
  42. title: {
  43. type: String,
  44. default: ''
  45. },
  46. fullscreen: {
  47. type: [Boolean, String],
  48. default: false
  49. },
  50. canFullScreen: {
  51. type: [Boolean, String],
  52. default: false
  53. }
  54. },
  55. methods: {
  56. onToggle () {
  57. this.$emit('fullscreenChange', !this.fullscreen)
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .c-box {
  64. position: relative;
  65. height: 100%;
  66. width: 100%;
  67. color: #fff;
  68. border: 1px solid rgba(#fff, 0.3);
  69. &__border {
  70. &--left {
  71. left: 0;
  72. position: absolute;
  73. height: 100%;
  74. width: 2px;
  75. background-image: linear-gradient(
  76. to bottom,
  77. #fff 0,
  78. #fff 8px,
  79. transparent 8px,
  80. transparent 12px,
  81. #2956f0 16px,
  82. #2956f0 24px,
  83. #2956f0 32px,
  84. transparent 36px,
  85. transparent 42px,
  86. #fff 42px,
  87. #fff 50px,
  88. transparent 50px,
  89. transparent calc(100% - 8px),
  90. #fff calc(100% - 8px),
  91. #fff 100%
  92. );
  93. }
  94. &--right {
  95. right: 0;
  96. position: absolute;
  97. height: 100%;
  98. width: 2px;
  99. background-image: linear-gradient(
  100. to bottom,
  101. #fff 0,
  102. #fff 8px,
  103. transparent 8px,
  104. transparent calc(100% - 8px),
  105. #fff calc(100% - 8px),
  106. #fff 100%
  107. );
  108. }
  109. }
  110. &.fullscreen {
  111. position: absolute;
  112. width: 1592px;
  113. height: 964px;
  114. top: 50%;
  115. left: 50%;
  116. border-bottom: none;
  117. transform: translate(-50%, -50%);
  118. overflow: visible;
  119. z-index: 999;
  120. &::before {
  121. content: "";
  122. position: absolute;
  123. top: -58px;
  124. left: -164px;
  125. width: 1920px;
  126. height: 1080px;
  127. background-color: rgba(#000, 0.85);
  128. z-index: -1;
  129. }
  130. .c-box__border--left {
  131. background-image: linear-gradient(
  132. to bottom,
  133. #fff 0,
  134. #fff 8px,
  135. transparent 8px,
  136. transparent 12px,
  137. #2956f0 16px,
  138. #2956f0 30px,
  139. #2956f0 44px,
  140. transparent 48px,
  141. transparent 54px,
  142. #fff 54px,
  143. #fff 62px,
  144. transparent 62px,
  145. transparent calc(100% - 8px),
  146. #fff calc(100% - 8px),
  147. #fff 100%
  148. );
  149. }
  150. .header__decoration {
  151. margin-right: 20px;
  152. }
  153. .c-box {
  154. &__main {
  155. background-color: rgba(#1d274b, 0.85);
  156. overflow: hidden;
  157. font-size: 28px;
  158. }
  159. &__header {
  160. padding: 0 16px;
  161. position: relative;
  162. height: 52px;
  163. line-height: 70px;
  164. font-size: 28px;
  165. }
  166. &__button {
  167. top: 6px;
  168. right: 10px;
  169. width: 20px;
  170. height: 20px;
  171. background-image: url("~@/assets/icon_narrow.png");
  172. }
  173. }
  174. }
  175. &__main {
  176. background-color: rgba(#1d274b, 0.85);
  177. overflow: hidden;
  178. }
  179. &__header {
  180. margin: 0 16px 10px;
  181. position: relative;
  182. height: 40px;
  183. line-height: 40px;
  184. font-size: 18px;
  185. border-bottom: 1px solid rgba(#fff, 0.1);
  186. }
  187. .header__decoration {
  188. position: relative;
  189. width: 160px;
  190. height: 8px;
  191. .decoration__bg {
  192. width: 100%;
  193. height: 100%;
  194. background: linear-gradient(
  195. 270deg,
  196. rgba(34, 51, 108, 0) 0%,
  197. #22336c 100%
  198. );
  199. }
  200. .decoration__bg--under {
  201. position: absolute;
  202. width: 100%;
  203. height: 100%;
  204. top: 0;
  205. background: repeating-linear-gradient(
  206. 120deg,
  207. rgba(#1d274b, 0.85),
  208. rgba(#1d274b, 0.85) 4px,
  209. transparent 4px,
  210. transparent 8px
  211. );
  212. }
  213. }
  214. .header__rect {
  215. width: 16px;
  216. height: 8px;
  217. &:nth-child(1) {
  218. background-color: #8ca6ff;
  219. }
  220. &:nth-child(2) {
  221. margin-left: 4px;
  222. }
  223. background-color: #5279ff;
  224. &:nth-child(3) {
  225. margin-left: 4px;
  226. background-color: #2556ff;
  227. }
  228. }
  229. &__button {
  230. width: 12px;
  231. height: 12px;
  232. background-image: url("~@/assets/icon_enlarge.png");
  233. }
  234. }
  235. .has-content-padding {
  236. padding: 0 16px 16px;
  237. }
  238. </style>