• Vue2+ElementUI 静态首页案例


     源码

    1. <template>
    2. <div class="app-container home">
    3. <el-row type="flex" justify="space-around" class="row-bg">
    4. <el-card class="box-card cardDiv1">
    5. <el-col :span="5">
    6. <div class="box-div card1">
    7. <div class="webBox">
    8. <div class="webO">今日交易额:</div>
    9. <div class="webT">645334.45</div>
    10. </div>
    11. </div>
    12. </el-col>
    13. <el-col :span="5">
    14. <div class="box-div card2">
    15. <div class="webBox">
    16. <div class="webO">今日订单数量:</div>
    17. <div class="webT">7512</div>
    18. </div>
    19. </div>
    20. </el-col>
    21. <el-col :span="5">
    22. <div class="box-div card3">
    23. <div class="webBox">
    24. <div class="webO">今日访问人数:</div>
    25. <div class="webT">53101</div>
    26. </div>
    27. </div>
    28. </el-col>
    29. <el-col :span="5">
    30. <div class="box-div card4">
    31. <div class="webBox">
    32. <div class="webO">今日新增用户:</div>
    33. <div class="webT">8868</div>
    34. </div>
    35. </div>
    36. </el-col>
    37. <el-col :span="5">
    38. <div class="box-div card5">
    39. <div class="webBox">
    40. <div class="webO">累计用户量:</div>
    41. <div class="webT">895421</div>
    42. </div>
    43. </div>
    44. </el-col>
    45. </el-card>
    46. </el-row>
    47. <!-- <el-divider />-->
    48. <el-row type="flex" justify="space-around" class="row-bg" style="margin-bottom:10px">
    49. <el-col :span="10">
    50. <el-card class="box-card" style="height: 320px;margin-right: 10px">
    51. <div id="main1" style="height: 300px;width:700px">
    52. </div>
    53. </el-card>
    54. </el-col>
    55. <el-col :span="7">
    56. <el-card class="box-card" style="height: 320px;margin-right: 10px">
    57. <div id="main2" style="height: 270px;width:400px">
    58. </div>
    59. </el-card>
    60. </el-col>
    61. <el-col :span="7">
    62. <el-card class="box-card" style="height: 320px;">
    63. <div id="main3" style="height: 270px;width:400px">
    64. </div>
    65. </el-card>
    66. </el-col>
    67. </el-row>
    68. <!-- <el-divider />-->
    69. <el-row type="flex" justify="space-around" class="row-bg" >
    70. <el-col :span="14" style="margin-right: 10px">
    71. <el-card class="box-card cardDiv2">
    72. <div slot="header" class="clearfix">
    73. <span style="margin-right: 30px">订单信息</span>
    74. <el-badge :value="99" class="item">
    75. <el-button type="text" size="small">待处理订单</el-button>
    76. </el-badge>
    77. <el-button style="float: right; padding: 3px 0" type="text">更多</el-button>
    78. </div>
    79. <el-table
    80. :data="tableData2"
    81. height="300"
    82. style="width: 100%">
    83. <el-table-column
    84. prop="code"
    85. label="订单编号">
    86. </el-table-column>
    87. <el-table-column
    88. prop="date"
    89. label="下单日期">
    90. </el-table-column>
    91. <el-table-column
    92. prop="money"
    93. label="交易金额">
    94. </el-table-column>
    95. <el-table-column
    96. prop="name"
    97. label="客户名称">
    98. </el-table-column>
    99. <el-table-column
    100. prop="status"
    101. label="订单状态">
    102. <template slot-scope="scope">
    103. <span v-if="scope.row.status==='1'" style="color: #FF9933">待发货</span>
    104. <span v-if="scope.row.status==='2'" style="color: #FF5722">已退货</span>
    105. <span v-if="scope.row.status==='3'" style="color: #1890ff">已取消</span>
    106. </template>
    107. </el-table-column>
    108. <el-table-column
    109. label="操作">
    110. <template slot-scope="scope">
    111. <el-button type="text" icon="el-icon-view" size="small">查看</el-button>
    112. <el-button type="text" icon="el-icon-edit" size="small">编辑</el-button>
    113. </template>
    114. </el-table-column>
    115. </el-table>
    116. </el-card>
    117. </el-col>
    118. <el-col :span="10">
    119. <el-card class="box-card cardDiv2">
    120. <div slot="header" class="clearfix">
    121. <span>客户信息</span>
    122. <el-badge :value="99" class="item" style="visibility: hidden">
    123. <el-button type="text" size="small">待处理订单</el-button>
    124. </el-badge>
    125. <el-button style="float: right; padding: 3px 0" type="text">更多</el-button>
    126. </div>
    127. <el-table
    128. :data="tableData"
    129. height="300"
    130. style="width: 100%">
    131. <el-table-column
    132. prop="name"
    133. label="客户名称">
    134. </el-table-column>
    135. <el-table-column
    136. prop="phone"
    137. label="联系电话">
    138. </el-table-column>
    139. <el-table-column
    140. prop="money"
    141. label="消费金额">
    142. </el-table-column>
    143. <el-table-column
    144. prop="level"
    145. label="会员级别">
    146. <template slot-scope="scope">
    147. <span v-if="scope.row.level==='1'"><el-tag type="danger">至尊</el-tag></span>
    148. <span v-if="scope.row.level==='2'"><el-tag type="success">钻石</el-tag></span>
    149. <span v-if="scope.row.level==='3'"><el-tag type="warning">黄金</el-tag></span>
    150. <span v-if="scope.row.level==='4'"><el-tag type="info">普通</el-tag></span>
    151. </template>
    152. </el-table-column>
    153. <el-table-column
    154. label="操作">
    155. <template slot-scope="scope">
    156. <el-button type="text" icon="el-icon-view" size="small">查看</el-button>
    157. </template>
    158. </el-table-column>
    159. </el-table>
    160. </el-card>
    161. </el-col>
    162. </el-row>
    163. </div>
    164. </template>
    165. <script>
    166. import * as echarts from 'echarts'
    167. export default {
    168. name: "Index",
    169. data() {
    170. return {
    171. // 版本号
    172. version: "3.8.6",
    173. tableData: [{
    174. money: '8856.56',
    175. name: '张三',
    176. phone: '18888888888',
    177. level:'1'
    178. }, {
    179. money: '2384.50',
    180. name: '李四',
    181. phone: '18888888888',
    182. level:'2'
    183. }, {
    184. money: '6000.20',
    185. name: '王五',
    186. phone: '13688888888',
    187. level:'3'
    188. }, {
    189. money: '5558.34',
    190. name: '赵六',
    191. phone: '13688888888',
    192. level:'4'
    193. },
    194. {
    195. money: '1234.25',
    196. name: '钱七',
    197. phone: '13688888888',
    198. level:'3'
    199. },
    200. {
    201. money: '1234.25',
    202. name: '钱七',
    203. phone: '13688888888',
    204. level:'3'
    205. },
    206. {
    207. money: '1234.25',
    208. name: '钱七',
    209. phone: '13688888888',
    210. level:'2'
    211. }
    212. ],
    213. tableData2: [
    214. {
    215. date: '2016-05-02',
    216. name: '张三',
    217. code: '454545454234455',
    218. money: '2422',
    219. status: '1',
    220. },
    221. {
    222. date: '2016-05-02',
    223. name: '李四',
    224. code: '234234234324234',
    225. money: '7870.00',
    226. status: '1',
    227. },
    228. {
    229. date: '2016-05-02',
    230. name: '王五',
    231. code: '23523523544644',
    232. money: '34545.2',
    233. status: '1',
    234. },
    235. {
    236. date: '2016-05-02',
    237. name: '赵六',
    238. code: '25235235235325',
    239. money: '3430',
    240. status: '2',
    241. },
    242. {
    243. date: '2016-05-02',
    244. name: '钱七',
    245. code: '25235235235325',
    246. money: '3430',
    247. status: '3',
    248. },
    249. ]
    250. };
    251. },
    252. created() {
    253. },
    254. mounted() {
    255. this.setLineData()
    256. this.setbData()
    257. this.setBireData()
    258. },
    259. methods: {
    260. goTarget(href) {
    261. window.open(href, "_blank");
    262. },
    263. setLineData(){
    264. var chartDom = document.getElementById('main1');
    265. var myChart = echarts.init(chartDom);
    266. var option;
    267. option = {
    268. title: [{
    269. text: '一周交易额',
    270. textStyle: {
    271. fontSize: 15
    272. },
    273. },
    274. {
    275. text: '单位:万元',
    276. left:'80%',
    277. textStyle:{
    278. fontSize:13,
    279. fontWeight:100
    280. }
    281. }],
    282. xAxis: {
    283. type: 'category',
    284. data: ['3-16', '3-17', '3-18', '3-19', '3-20', '3-21', '3-22']
    285. },
    286. yAxis: {
    287. type: 'value',
    288. splitLine:{
    289. show:true,
    290. lineStyle:{
    291. type:'dashed'
    292. }
    293. }
    294. },
    295. series: [
    296. {
    297. data: [150, 230, 224, 218, 135, 147, 260],
    298. type: 'line',
    299. itemStyle: {
    300. normal: {
    301. color: "#2ec7c9",
    302. lineStyle: {
    303. color: "rgb(30 198 149)"
    304. }
    305. }
    306. },
    307. }
    308. ]
    309. };
    310. option && myChart.setOption(option);
    311. },
    312. setbData(){
    313. var chartDom = document.getElementById('main2');
    314. var myChart = echarts.init(chartDom);
    315. var option;
    316. option = {
    317. color: ['#49bafc', '#e9898f', '#f7b230', '#bd92e1', '#26c8aa'],
    318. title: {
    319. text: '商品销售额占比',
    320. left: 'left',
    321. textStyle: {
    322. fontSize: 15
    323. },
    324. },
    325. tooltip: {
    326. trigger: 'item',
    327. formatter: '{a}
      {b} : {c} ({d}%)'
    328. },
    329. legend: {
    330. bottom: 1,
    331. left: 'center',
    332. data: ['食品', '服装', '家电', '日用品', '原材料']
    333. },
    334. series: [
    335. {
    336. type: 'pie',
    337. radius: '65%',
    338. center: ['50%', '45%'],
    339. selectedMode: 'single',
    340. data: [
    341. { value: 1548,name: '原材料'},
    342. { value: 735, name: '日用品'},
    343. { value: 510, name: '家电' },
    344. { value: 434, name: '服装' },
    345. { value: 335, name: '食品' }
    346. ],
    347. emphasis: {
    348. itemStyle: {
    349. shadowBlur: 10,
    350. shadowOffsetX: 0,
    351. shadowColor: 'rgba(0, 0, 0, 0.5)'
    352. }
    353. }
    354. }
    355. ]
    356. };
    357. option && myChart.setOption(option);
    358. },
    359. setBireData(){
    360. var chartDom = document.getElementById('main3');
    361. var myChart = echarts.init(chartDom);
    362. var option;
    363. option = {
    364. title: {
    365. text: '订单状态',
    366. textStyle: {
    367. fontSize: 15
    368. },
    369. },
    370. tooltip: {
    371. trigger: 'axis',
    372. axisPointer: {
    373. type: 'shadow'
    374. }
    375. },
    376. legend: {},
    377. grid: {
    378. left: '3%',
    379. right: '4%',
    380. bottom: '3%',
    381. containLabel: true,//设置自适应画布大小状态为开,也可通过设置left左移实现相同效果
    382. },
    383. xAxis: {
    384. type: 'value',
    385. boundaryGap: [0, 0.01],
    386. splitLine:{
    387. show:false
    388. },
    389. "axisLine":{ //x轴坐标轴
    390. "show":false
    391. },
    392. axisLabel:{
    393. show: false
    394. },
    395. axisTick: { //x轴刻度线
    396. show:false
    397. },
    398. },
    399. yAxis: {
    400. type: 'category', //纵向改成横向柱状图
    401. data: ['今日取消订单', '今日评价订单','今日退货订单','今日发货订单', ], //y轴显示文字
    402. axisTick: {
    403. show: false
    404. },
    405. axisLine: {
    406. show: false,
    407. },
    408. },
    409. series: [
    410. {
    411. name: '',
    412. type: 'bar',
    413. barWidth: 20,
    414. showSymbol: false,
    415. label:{ //柱状图显示数值
    416. show:true,
    417. position: 'insideTop', //内部顶部显示
    418. textStyle: {
    419. color: '#FFF', //字体颜色
    420. fontSize: 14 //字体大小
    421. }
    422. },
    423. data: [{
    424. value:1546,
    425. itemStyle: {
    426. normal: {
    427. barBorderRadius: [0, 6, 6, 0],
    428. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{ //1000纵向柱状图渐变色 0100横向柱状图渐变色
    429. offset: 0,
    430. color: "rgba(30, 198, 149, 1)" // 0% 处的颜色
    431. }, {
    432. offset: 0.6,
    433. color: "rgba(30, 198, 149, 1)" // 60% 处的颜色
    434. }, {
    435. offset: 1,
    436. color: "rgba(51, 204, 204, 1)" // 100% 处的颜色
    437. }], false)
    438. }
    439. },
    440. },
    441. {
    442. value:860,
    443. itemStyle: {
    444. normal: {
    445. barBorderRadius: [0, 6, 6, 0],//顺时针左上,右上,右下,左下)
    446. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
    447. offset: 0,
    448. color: "rgba(170, 137, 254, 1)" // 0% 处的颜色
    449. }, {
    450. offset: 0.6,
    451. color: "rgba(170, 137, 254, 1)" // 60% 处的颜色
    452. }, {
    453. offset: 1,
    454. color: "rgba(204, 153, 204, 1)" // 100% 处的颜色
    455. }], false)
    456. }
    457. },
    458. },
    459. {
    460. value:1022,
    461. itemStyle: {
    462. normal: {
    463. barBorderRadius: [0, 6, 6, 0],
    464. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
    465. offset: 0,
    466. color: "rgba(226, 113, 140, 1)" // 0% 处的颜色
    467. }, {
    468. offset: 0.6,
    469. color: "rgba(244, 174, 149, 1)" // 60% 处的颜色
    470. }, {
    471. offset: 1,
    472. color: "rgba(244, 174, 149, 1)" // 100% 处的颜色
    473. }], false)
    474. }
    475. },
    476. },
    477. {
    478. value:1600,
    479. itemStyle: {
    480. normal: {
    481. barBorderRadius: [0, 6, 6, 0],
    482. color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
    483. offset: 0,
    484. color: "rgba(255, 153, 51, 1)" // 0% 处的颜色
    485. }, {
    486. offset: 0.6,
    487. color: "rgba(255, 153, 51, 1)" // 60% 处的颜色
    488. }, {
    489. offset: 1,
    490. color: "rgba(239, 203, 45, 1)" // 100% 处的颜色
    491. }], false)
    492. }
    493. },
    494. },
    495. ]
    496. },
    497. ]
    498. };
    499. option && myChart.setOption(option);
    500. }
    501. }
    502. };
    503. </script>
    504. <style scoped lang="scss">
    505. ::v-deep .el-card__body {
    506. padding: 15px 20px 20px 20px;
    507. display: flex;
    508. justify-content: center;
    509. }
    510. .box-div{
    511. height: 120px;
    512. padding: 35px;
    513. margin: 20px;
    514. }
    515. .cardDiv1{
    516. width: 100%;
    517. margin-bottom: 10px;
    518. }
    519. .cardDiv2{
    520. width: 100%;
    521. margin-bottom: 20px;
    522. }
    523. .app-container {
    524. padding: 20px;
    525. background: #eeeeee50;
    526. }
    527. .home {
    528. blockquote {
    529. padding: 10px 20px;
    530. margin: 0 0 20px;
    531. font-size: 17.5px;
    532. border-left: 5px solid #eee;
    533. }
    534. hr {
    535. margin-top: 20px;
    536. margin-bottom: 20px;
    537. border: 0;
    538. border-top: 1px solid #eee;
    539. }
    540. .col-item {
    541. margin-bottom: 20px;
    542. }
    543. ul {
    544. padding: 0;
    545. margin: 0;
    546. }
    547. font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    548. font-size: 13px;
    549. color: #676a6c;
    550. overflow-x: hidden;
    551. ul {
    552. list-style-type: none;
    553. }
    554. h4 {
    555. margin-top: 0px;
    556. }
    557. h2 {
    558. margin-top: 10px;
    559. font-size: 26px;
    560. font-weight: 100;
    561. }
    562. p {
    563. margin-top: 10px;
    564. b {
    565. font-weight: 700;
    566. }
    567. }
    568. .update-log {
    569. ol {
    570. display: block;
    571. list-style-type: decimal;
    572. margin-block-start: 1em;
    573. margin-block-end: 1em;
    574. margin-inline-start: 0;
    575. margin-inline-end: 0;
    576. padding-inline-start: 40px;
    577. }
    578. }
    579. .webBox{
    580. display: -webkit-box;
    581. -webkit-box-orient: vertical;
    582. }
    583. .webO{
    584. display: -webkit-box;
    585. -webkit-box-pack: start;
    586. -webkit-box-align: center;
    587. font-size: 14px;
    588. font-weight: 700;
    589. color: #fff;
    590. }
    591. .webT{
    592. display: -webkit-box;
    593. -webkit-box-pack: end;
    594. -webkit-box-align: center;
    595. font-size: 20px;
    596. font-weight: 700;
    597. padding-right: 50px;
    598. padding-top: 10px;
    599. color: #fff;
    600. }
    601. .card1{
    602. background: linear-gradient(180deg, rgba(30, 198, 149, 1) 0%, rgba(30, 198, 149, 1) 0%, rgba(51, 204, 204, 1) 100%, rgba(51, 204, 204, 1) 100%);
    603. border: none;
    604. border-radius: 4px;
    605. box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.349019607843137);
    606. font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
    607. }
    608. .card2{
    609. background: linear-gradient(90deg, rgba(244, 174, 149, 1) 0%, rgba(244, 174, 149, 1) 0%, rgba(226, 113, 140, 1) 100%, rgba(226, 113, 140, 1) 100%);
    610. border: none;
    611. border-radius: 4px;
    612. box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.349019607843137);
    613. font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
    614. }
    615. .card3{
    616. background: linear-gradient(180deg, rgba(255, 153, 51, 1) 0%, rgba(255, 153, 51, 1) 0%, rgba(239, 203, 45, 1) 100%, rgba(239, 203, 45, 1) 100%);
    617. border: none;
    618. border-radius: 4px;
    619. box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.349019607843137);
    620. font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
    621. }
    622. .card4{
    623. background: linear-gradient(180deg, rgba(45, 169, 250, 1) 0%, rgba(45, 169, 250, 1) 0%, rgba(102, 204, 255, 1) 100%, rgba(102, 204, 255, 1) 100%);
    624. border: none;
    625. border-radius: 4px;
    626. box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.349019607843137);
    627. font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
    628. }
    629. .card5{
    630. background: linear-gradient(180deg, rgba(170, 137, 254, 1) 0%, rgba(170, 137, 254, 1) 0%, rgba(204, 153, 204, 1) 100%, rgba(204, 153, 204, 1) 100%);
    631. border: none;
    632. border-radius: 4px;
    633. box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.349019607843137);
    634. font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
    635. }
    636. }
    637. </style>

  • 相关阅读:
    Kubernetes数据卷Volume和数据卷分类(emptyDir、nfs、hostPath、ConfigMap)详解
    常用损失函数详解:广泛使用的优化约束方法
    【数据库——MySQL(实战项目1)】(2)图书借阅系统
    【ELFK】之消息队列kafka
    web大作业 静态网页(地下城与勇士 10页 带视频)
    带你掌握Java各种日志框架
    GitOps 介绍
    JVM之【执行引擎】
    HTML整站规划与规范
    rust所有权
  • 原文地址:https://blog.csdn.net/huichao199175/article/details/133138639