MenuCard.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <!-- 外边框 -->
  3. <div
  4. class="menuMainBox"
  5. :style="{
  6. width: boxWidth ? boxWidth + 'px' : '410px',
  7. height: boxHeight + 'px',
  8. border: type !== 'chart' ? '' : '1px solid #2FB8FF',
  9. background: boxBackground ? boxBackground : ''
  10. }"
  11. >
  12. <!-- 头部 -->
  13. <div class="menuMainBox_top" v-if="type !== 'chart'">
  14. <!-- 头部左侧 -->
  15. <div class="menuMainBox_top_left" :style="{ width: titleWidth ? titleWidth + '%' : '50%' }">
  16. <!-- 左侧箭头图标 -->
  17. <div class="menuMainBox_top_left_iconS"></div>
  18. <!-- 标题 -->
  19. <div class="menuMainBox_top_left_title">{{ title }}</div>
  20. <!-- 右侧倾斜图标1 -->
  21. <div class="menuMainBox_top_left_iconE menuMainBox_top_left_iconE1"></div>
  22. <!-- 右侧倾斜图标2 -->
  23. <div class="menuMainBox_top_left_iconE menuMainBox_top_left_iconE2"></div>
  24. </div>
  25. <!-- 头部右侧 -->
  26. <div class="menuMainBox_top_right" :style="{ width: titleWidth ? 110 - titleWidth + '%' : '60%' }">
  27. <!-- 方块1 -->
  28. <div class="menuMainBox_top_right_d1"></div>
  29. <!-- 方块2 -->
  30. <div class="menuMainBox_top_right_d2"></div>
  31. </div>
  32. <!-- 右上角三个点 -->
  33. <div class="menuMainBox_top_topRight">
  34. <div></div>
  35. <div></div>
  36. <div></div>
  37. </div>
  38. </div>
  39. <!-- 折线 -->
  40. <div class="menuMainBox_topBottom" v-if="type !== 'chart'" :style="{ left: titleWidth ? titleWidth - 40 + '%' : '10%' }">
  41. <!-- 圆球 -->
  42. <div></div>
  43. </div>
  44. <div class="menuMainBox_topChart" v-if="type === 'chart'">
  45. <div class="menuMainBox_topChart_title">
  46. {{ title }}
  47. </div>
  48. </div>
  49. <!-- 主题 -->
  50. <div class="menuMainBox_main" v-if="type !== 'chart'">
  51. <!-- 上部 -->
  52. <div class="menuMainBox_main_top">
  53. <slot name="top"></slot>
  54. </div>
  55. <!-- 下部 -->
  56. <div class="menuMainBox_main_bottom">
  57. <slot name="bottom"></slot>
  58. </div>
  59. </div>
  60. <div class="menuMainBox_main" v-if="type === 'chart'">
  61. <!-- 上部 -->
  62. <div class="menuMainBox_main_all">
  63. <slot></slot>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. export default {
  70. name: "menuCard",
  71. components: {},
  72. data() {
  73. return {};
  74. },
  75. mounted() {},
  76. /**
  77. * type: 类型【card:卡片;chart:echart组件】,默认为card(非必填)
  78. * title: 标题(必填)
  79. * boxWidth: 宽,默认为410px(非必填)
  80. * boxHeight: 高,默认为auto(非必填)
  81. * boxBackground: 背景色,默认为渐变蓝色(非必填)
  82. * titleWidth: 标题宽度,默认为50(非必填)
  83. */
  84. props: ["type", "title", "boxWidth", "boxHeight", "boxBackground", "titleWidth"],
  85. methods: {},
  86. watch: {}
  87. };
  88. </script>
  89. <style lang="less" scoped>
  90. @borderColor: #00aaff;
  91. @borderColor32: #00aaff32;
  92. @borderColor64: #00aaff64;
  93. @topTitleBgLeft: #00244d;
  94. @topTitleMinLeft: #002f56;
  95. @lightColor: #74ffff;
  96. .menuMainBox {
  97. position: relative;
  98. margin: 5px 0;
  99. min-height: 60px;
  100. border: 2px solid transparent;
  101. border-image: --webkit-linear-gradient(to top, @borderColor, transparent) 1;
  102. border-image: --moz-linear-gradient(to top, @borderColor, transparent) 1;
  103. border-image: linear-gradient(to top, @borderColor, transparent) 1;
  104. opacity: 0.9;
  105. // type !== chart
  106. &_top {
  107. position: relative;
  108. width: 100%;
  109. height: 36px;
  110. display: flex;
  111. align-items: center;
  112. flex-wrap: nowrap;
  113. align-content: center;
  114. overflow: hidden;
  115. background-color: @topTitleMinLeft;
  116. &_left {
  117. position: relative;
  118. display: flex;
  119. align-items: center;
  120. flex-wrap: nowrap;
  121. align-content: center;
  122. height: 100%;
  123. background-image: --webkit-linear-gradient(to left, @topTitleMinLeft, @borderColor, @topTitleMinLeft);
  124. background-image: --moz-linear-gradient(to left, @topTitleMinLeft, @borderColor, @topTitleMinLeft);
  125. background-image: linear-gradient(to left, @topTitleMinLeft, @borderColor, @topTitleMinLeft);
  126. border-bottom: 2px solid @borderColor;
  127. &_iconS {
  128. margin: 10px;
  129. width: 20px;
  130. height: 20px;
  131. background-image: linear-gradient(to top, #0071b2, #1deef5);
  132. clip-path: polygon(0 0, 100% 50%, 0 100%, 30% 50%, 0 0);
  133. }
  134. &_title {
  135. font-size: 28px;
  136. font-family: YouSheBiaoTiHei;
  137. font-weight: 400;
  138. color: #ffffff;
  139. }
  140. &_iconE {
  141. position: absolute;
  142. margin-left: 10px;
  143. width: 15px;
  144. height: 30px;
  145. background-image: linear-gradient(to bottom, transparent, transparent, #00a6c0);
  146. transform: skew(-45deg);
  147. }
  148. &_iconE1 {
  149. right: 27px;
  150. }
  151. &_iconE2 {
  152. right: 7px;
  153. }
  154. }
  155. &_right {
  156. position: absolute;
  157. right: -10%;
  158. height: 100%;
  159. border-top: 2px solid @borderColor;
  160. border-left: 2px solid @borderColor;
  161. transform: skew(-45deg);
  162. background-color: @topTitleBgLeft;
  163. border-image: --webkit-linear-gradient(to right, @borderColor, transparent) 1;
  164. border-image: --moz-linear-gradient(to right, @borderColor, transparent) 1;
  165. border-image: linear-gradient(to right, @borderColor, transparent) 1;
  166. &_d1 {
  167. position: absolute;
  168. left: 10px;
  169. width: 50px;
  170. height: 20px;
  171. background-color: @borderColor64;
  172. }
  173. &_d2 {
  174. position: absolute;
  175. left: 70px;
  176. width: 80px;
  177. height: 10px;
  178. background-color: @borderColor32;
  179. }
  180. }
  181. &_topRight {
  182. position: absolute;
  183. top: 0;
  184. right: 0;
  185. display: flex;
  186. div:nth-child(1) {
  187. width: 5px;
  188. height: 2px;
  189. background-color: @borderColor;
  190. }
  191. div:nth-child(2) {
  192. margin: 0 1px;
  193. width: 5px;
  194. height: 2px;
  195. background-color: #f19b56;
  196. }
  197. div:nth-child(3) {
  198. width: 5px;
  199. height: 2px;
  200. background-color: @borderColor;
  201. }
  202. }
  203. }
  204. &_topBottom {
  205. position: absolute;
  206. top: 20px;
  207. width: 38%;
  208. height: 20px;
  209. border-bottom: 2px solid @borderColor;
  210. border-right: 2px solid @borderColor;
  211. transform: skew(-45deg);
  212. border-image: --webkit-linear-gradient(to left, @borderColor, transparent) 1;
  213. border-image: --moz-linear-gradient(to left, @borderColor, transparent) 1;
  214. border-image: linear-gradient(to left, @borderColor, transparent) 1;
  215. z-index: 9999;
  216. div {
  217. position: absolute;
  218. top: -2px;
  219. right: -2px;
  220. width: 4px;
  221. height: 4px;
  222. border-radius: 4px;
  223. background-color: @borderColor;
  224. transform: skew(45deg);
  225. }
  226. }
  227. // type === chart
  228. &_topChart {
  229. width: 100%;
  230. height: 30px;
  231. position: relative;
  232. display: flex;
  233. align-items: center;
  234. flex-wrap: nowrap;
  235. justify-content: center;
  236. align-content: center;
  237. background-image: --webkit-linear-gradient(to left, @topTitleMinLeft, @borderColor, @topTitleMinLeft);
  238. background-image: --moz-linear-gradient(to left, @topTitleMinLeft, @borderColor, @topTitleMinLeft);
  239. background-image: linear-gradient(to left, @topTitleMinLeft, @borderColor, @topTitleMinLeft);
  240. &_title {
  241. font-size: 18px;
  242. font-family: PingFang SC;
  243. font-weight: 300;
  244. color: #e6e6e6;
  245. line-height: 60px;
  246. }
  247. }
  248. // 卡片主题
  249. &_main {
  250. position: relative;
  251. padding-top: 10px;
  252. width: 100%;
  253. height: calc(100% - 40px);
  254. background-image: --webkit-linear-gradient(to top, @topTitleMinLeft, @topTitleBgLeft);
  255. background-image: --moz-linear-gradient(to top, @topTitleMinLeft, @topTitleBgLeft);
  256. background-image: linear-gradient(to top, @topTitleMinLeft, @topTitleBgLeft);
  257. &_top {
  258. margin:0 10px;
  259. width: calc(100% - 20px);
  260. }
  261. &_bottom {
  262. margin:0 10px;
  263. width: calc(100% - 20px);
  264. }
  265. &_all {
  266. margin:0 10px;
  267. width: calc(100% - 20px);
  268. height: calc(100% - 10px);
  269. }
  270. }
  271. }
  272. </style>