Commit feb955a5c4ccd0c70710a0811bb1fa6c31c4b749

Authored by liuqimichale
1 parent 9ce9cfea

车流量section

src/assets/img/errortype1.png 0 → 100644

858 Bytes

src/assets/img/errortype5.png 0 → 100644

893 Bytes

src/assets/img/noticetype1.png 0 → 100644

853 Bytes

src/assets/img/noticetype2.png 0 → 100644

798 Bytes

src/components/lineChart.vue 0 → 100644
  1 +<template>
  2 + <div :class="className" :style="{height:height,width:width}"></div>
  3 +</template>
  4 +
  5 +<script>
  6 +import echarts from 'echarts'
  7 +
  8 +require('echarts/theme/macarons') // echarts theme
  9 +import {debounce} from '../utils/debounce'
  10 +
  11 +export default {
  12 + name: 'lineChart',
  13 + props: {
  14 + className: {
  15 + type: String,
  16 + default: 'chart'
  17 + },
  18 + width: {
  19 + type: String,
  20 + default: '100%'
  21 + },
  22 + height: {
  23 + type: String,
  24 + default: '205px'
  25 + },
  26 + autoResize: {
  27 + type: Boolean,
  28 + default: true
  29 + },
  30 + chartData: {
  31 + type: Object,
  32 + required: true
  33 + }
  34 + },
  35 + data() {
  36 + return {
  37 + chart: null,
  38 + sidebarElm: null
  39 + }
  40 + },
  41 + watch: {
  42 + chartData: {
  43 + deep: true,
  44 + }
  45 + },
  46 + mounted() {
  47 + this.initChart()
  48 + if (this.autoResize) {
  49 + this.__resizeHandler = debounce(() => {
  50 + if (this.chart) {
  51 + this.chart.resize()
  52 + }
  53 + }, 100)
  54 + window.addEventListener('resize', this.__resizeHandler)
  55 + }
  56 + },
  57 + beforeDestroy() {
  58 + if (!this.chart) {
  59 + return
  60 + }
  61 + if (this.autoResize) {
  62 + window.removeEventListener('resize', this.__resizeHandler)
  63 + }
  64 +
  65 + this.chart.dispose()
  66 + this.chart = null
  67 + },
  68 + methods: {
  69 + setOptions({xData, yData} = {}) {
  70 + this.chart.setOption({
  71 + tooltip: {
  72 + trigger: 'axis'
  73 + },
  74 + legend: {
  75 + data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
  76 + },
  77 + grid: {
  78 + left: '3%',
  79 + right: '4%',
  80 + bottom: '3%',
  81 + containLabel: true
  82 + },
  83 +
  84 + xAxis: {
  85 + type: 'category',
  86 + boundaryGap: false,
  87 + data: ['周一','周二','周三','周四','周五','周六','周日']
  88 + },
  89 + yAxis: {
  90 + type: 'value'
  91 + },
  92 + series: [
  93 + {
  94 + name:'邮件营销',
  95 + type:'line',
  96 + stack: '总量',
  97 + data:[120, 132, 101, 134, 90, 230, 210]
  98 + },
  99 + {
  100 + name:'联盟广告',
  101 + type:'line',
  102 + stack: '总量',
  103 + data:[220, 182, 191, 234, 290, 330, 310]
  104 + },
  105 + {
  106 + name:'视频广告',
  107 + type:'line',
  108 + stack: '总量',
  109 + data:[150, 232, 201, 154, 190, 330, 410]
  110 + },
  111 + {
  112 + name:'直接访问',
  113 + type:'line',
  114 + stack: '总量',
  115 + data:[320, 332, 301, 334, 390, 330, 320]
  116 + },
  117 + {
  118 + name:'搜索引擎',
  119 + type:'line',
  120 + stack: '总量',
  121 + data:[820, 932, 901, 934, 1290, 1330, 1320]
  122 + }
  123 + ]
  124 +
  125 + })
  126 + },
  127 + initChart() {
  128 + this.chart = echarts.init(this.$el, 'macarons')
  129 + this.setOptions(this.chartData)
  130 + }
  131 + }
  132 +}
  133 +</script>
... ...
src/views/mainContainer.vue
... ... @@ -10,7 +10,7 @@
10 10 <div class="heightper-top"></div>
11 11 <div class="heightper-bottom">
12 12 <outsection style="width: 50%;float: left"></outsection>
13   - <outsection style="width: 50%;float: left"></outsection>
  13 + <vehiclesection style="width: 50%;float: left"></vehiclesection>
14 14 </div>
15 15 </li>
16 16 <li>
... ... @@ -32,7 +32,7 @@ import sfysection from &#39;../views/sfysection&#39;
32 32 import berthsection from '../views/berthsection'
33 33 import newssection from '../views/newssection'
34 34 import outsection from '../views/outsection'
35   -
  35 +import vehiclesection from '../views/vehiclesection'
36 36  
37 37 export default {
38 38 name: 'mainContainer',
... ... @@ -44,7 +44,8 @@ export default {
44 44 sfysection,
45 45 berthsection,
46 46 newssection,
47   - outsection
  47 + outsection,
  48 + vehiclesection
48 49 },
49 50 data() {
50 51 return {
... ...
src/views/newssection.vue
... ... @@ -4,9 +4,12 @@
4 4 <div class="nwwest-roll flexfm news-wrap" id="nwwest-roll">
5 5 <ul id="roll-ul">  
6 6 <li v-for="item in list" ref="rollul" :class="{anim:animate==true}">
7   -              <span class="noticetype"></span>
8   -              <span class="text" :title="item.site">{{item.site}}</span>
9   -              <span class="time">{{item.gsmc}}</span>
  7 +              <div class="noticetype1" v-if="item.type===1"></div>
  8 + <div class="noticetype2" v-else-if="item.type===2"></div>
  9 + <div class="errortype1" v-else-if="item.type===3"></div>
  10 + <div class="errortype2" v-else></div>
  11 +              <div class="text" :title="item.site">{{item.site}}</div>
  12 +              <div class="time">{{item.gsmc}}</div>
10 13 </li>
11 14 </ul>
12 15 </div>
... ... @@ -25,17 +28,17 @@ export default {
25 28 return {
26 29 animate: true,
27 30 list: [
28   - { "name": "于先生1", "site": "北京门头沟区1北京门头沟区1北京门头沟区1", "gsmc": "10-02" },
29   - { "name": "于先生2", "site": "北京门头沟区2", "gsmc": "10-02" },
30   - { "name": "于先生3", "site": "北京门头沟区3北京门头沟区3北京门头沟区3北京门头沟区3北京门头沟区3北京门头沟区3", "gsmc": "10-02" },
31   - { "name": "于先生4", "site": "北京门头沟区4", "gsmc": "10-02" },
32   - { "name": "于先生5", "site": "北京门头沟区5", "gsmc": "10-02" },
33   - { "name": "于先生6", "site": "北京门头北京门头沟区6北京门头沟区6北京门头沟区6北京门头沟区6沟区6", "gsmc": "10-02" },
34   - { "name": "于先生7", "site": "北京门头沟区7", "gsmc": "10-02" },
35   - { "name": "于先生8", "site": "北京门头沟区8", "gsmc": "10-02" },
36   - { "name": "于先生9", "site": "北京门头北京门头沟区9北京门头沟区9北京门头沟区9沟区9", "gsmc": "10-02" },
37   - { "name": "于先生10", "site": "北京门头沟区10", "gsmc": "10-02" },
38   - { "name": "于先生11", "site": "北京门北京门头沟区11北京门头沟区11北京门头沟区11头沟区11", "gsmc": "10-02" }
  31 + {"type":1, "name": "于先生1", "site": "北京门头沟区1北京门头沟区1北京门头沟区1", "gsmc": "10-02" },
  32 + {"type":2, "name": "于先生2", "site": "北京门头沟区2", "gsmc": "10-02" },
  33 + {"type":3, "name": "于先生3", "site": "北京门头沟区3北京门头沟区3北京门头沟区3北京门头沟区3北京门头沟区3北京门头沟区3", "gsmc": "10-02" },
  34 + {"type":4, "name": "于先生4", "site": "北京门头沟区4", "gsmc": "10-02" },
  35 + {"type":1, "name": "于先生5", "site": "北京门头沟区5", "gsmc": "10-02" },
  36 + {"type":2, "name": "于先生6", "site": "北京门头北京门头沟区6北京门头沟区6北京门头沟区6北京门头沟区6沟区6", "gsmc": "10-02" },
  37 + {"type":3, "name": "于先生7", "site": "北京门头沟区7", "gsmc": "10-02" },
  38 + {"type":4, "name": "于先生8", "site": "北京门头沟区8", "gsmc": "10-02" },
  39 + {"type":1, "name": "于先生9", "site": "北京门头北京门头沟区9北京门头沟区9北京门头沟区9沟区9", "gsmc": "10-02" },
  40 + {"type":2, "name": "于先生10", "site": "北京门头沟区10", "gsmc": "10-02" },
  41 + {"type":3, "name": "于先生11", "site": "北京门北京门头沟区11北京门头沟区11北京门头沟区11头沟区11", "gsmc": "10-02" }
39 42 ]
40 43 }
41 44 },
... ... @@ -60,6 +63,14 @@ export default {
60 63 </script>
61 64  
62 65 <style lang="scss" scoped>
  66 + @mixin newsType($img){
  67 + margin-left: 23px;
  68 + margin-right: 23px;
  69 + width: 26px;
  70 + height: 26px;
  71 + background-image: url($img);
  72 + background-repeat:no-repeat ;
  73 + }
63 74 .nwwest-roll {
64 75 width: 100%;
65 76 height: 210px;
... ... @@ -73,19 +84,17 @@ export default {
73 84 display: flex;
74 85 background:rgba(255,255,255,.1);
75 86 margin-bottom: 10px;
76   - .noticetype{
77   - margin-left: 23px;
78   - margin-right: 23px;
79   - width: 26px;
80   - height: 26px;
81   - background: url("../assets/img/noticetype.png") no-repeat;
  87 + .noticetype1{
  88 + @include newsType("../assets/img/noticetype1.png");
  89 + }
  90 + .noticetype2{
  91 + @include newsType("../assets/img/noticetype2.png");
  92 + }
  93 + .errortype1{
  94 + @include newsType("../assets/img/errortype1.png");
82 95 }
83   - .errortype{
84   - margin-left: 23px;
85   - margin-right: 23px;
86   - width: 26px;
87   - height: 26px;
88   - background: #f00;
  96 + .errortype2{
  97 + @include newsType("../assets/img/errortype1.png");
89 98 }
90 99 .text{
91 100 width:calc(100% - 100px);
... ...
src/views/outsection.vue
1 1 <template>
2 2 <div>
3 3 <titlesection title="周出场统计"></titlesection>
4   - <ul class="flexfm ydp-dz-wrap">
5   -
6   - </ul>
  4 + <lineChart class="flexfm inout-wrap">
  5 + </lineChart>
7 6 </div>
8 7 </template>
9 8  
10 9 <script>
11 10 import titlesection from '../components/titlesection'
12 11 import {fetchList} from '../api/api'
  12 +import lineChart from '../components/lineChart'
13 13  
14 14 const lineChartData = {
15 15 newVisitis: {
... ... @@ -22,7 +22,8 @@ const lineChartData = {
22 22 export default {
23 23 name: 'outsection',
24 24 components: {
25   - titlesection
  25 + titlesection,
  26 + lineChart
26 27 },
27 28 data() {
28 29 return {
... ... @@ -46,7 +47,7 @@ export default {
46 47 </script>
47 48  
48 49 <style lang="scss" scoped>
49   - .ydp-dz-wrap{
  50 + .inout-wrap{
50 51 display: flex;
51 52  
52 53 }
... ...
src/views/vehiclesection.vue 0 → 100644
  1 +<template>
  2 + <div>
  3 + <titlesection title="今日车流量"></titlesection>
  4 + <lineChart class="flexfm inout-wrap">
  5 + </lineChart>
  6 + </div>
  7 +</template>
  8 +
  9 +<script>
  10 +import titlesection from '../components/titlesection'
  11 +import {fetchList} from '../api/api'
  12 +import lineChart from '../components/lineChart'
  13 +
  14 +const lineChartData = {
  15 + newVisitis: {
  16 + yData: [100, 120, 161],
  17 + xData: ['正常', '异常', '故障']
  18 + }
  19 +}
  20 +
  21 +
  22 +export default {
  23 + name: 'vehiclesection',
  24 + components: {
  25 + titlesection,
  26 + lineChart
  27 + },
  28 + data() {
  29 + return {
  30 + lineChartData: lineChartData.newVisitis,
  31 + dzNum: '23454',
  32 + ydpNum: '4454'
  33 + }
  34 + },
  35 + created() {
  36 + },
  37 + methods: {
  38 + getList() {
  39 + fetchList()
  40 + .then(res => {
  41 + console.log(res);
  42 +
  43 + });
  44 + },
  45 + }
  46 +}
  47 +</script>
  48 +
  49 +<style lang="scss" scoped>
  50 + .inout-wrap{
  51 + display: flex;
  52 +
  53 + }
  54 +</style>
... ...