MenuCard.vue 8.2 KB

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