husilu hace 6 años
padre
commit
714599cbd6

+ 4 - 0
build/webpack.base.conf.js

@@ -47,6 +47,10 @@ module.exports = {
47 47
         options: vueLoaderConfig
48 48
       },
49 49
       {
50
+        test: /\.scss/,
51
+        loaders: ['style','css','sass']
52
+      },
53
+      {
50 54
         test: /\.js$/,
51 55
         loader: 'babel-loader',
52 56
         include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]

+ 1 - 1
mock/index.js

@@ -6,7 +6,7 @@ const Mock = require('mockjs')
6 6
  * 每个mock模块只需暴露一个默认的接口
7 7
  * 暴露的模块中的元素,必须每个带有url,methods,callback
8 8
  */
9
-const apiModules = ['list', 'test']
9
+const apiModules = ['list']
10 10
 
11 11
 let API = {}
12 12
 

+ 0 - 49
mock/modules/test/test.js

@@ -1,49 +0,0 @@
1
-import Mock from 'mockjs'
2
-import API from '../../../src/api'
3
-
4
-let listData1 = Mock.mock({
5
-  'dataList': [
6
-    {
7
-      'data': [
8
-        {'NAME':'李子','PRICE': '128'},
9
-        {'NAME':'苹果','PRICE': '130'},
10
-        {'NAME':'香蕉','PRICE': '110'},
11
-        {'NAME':'西瓜','PRICE': '100'}
12
-      ]
13
-    }
14
-  ],
15
-  'carList': [
16
-    {
17
-      'data': [
18
-        {'NAME':'1李子','PRICE': '128'},
19
-        {'NAME':'1苹果','PRICE': '130'},
20
-        {'NAME':'1香蕉','PRICE': '110'},
21
-        {'NAME':'1西瓜','PRICE': '100'}
22
-      ]
23
-    }
24
-  ]
25
-})
26
-
27
-export const getList1 = {
28
-  url: new RegExp(API.getList1),
29
-  type: /get/,
30
-  callback: function (req) {
31
-    // console.log(req.body)
32
-    return {
33
-      status: 'ok',
34
-      data: listData1.dataList
35
-    }
36
-  }
37
-}
38
-
39
-export const getCar1 = {
40
-  url: new RegExp(API.getcarList1),
41
-  type: /get/,
42
-  callback: function (req) {
43
-    // console.log(req.body)
44
-    return {
45
-      status: 'ok',
46
-      data: listData1.carList
47
-    }
48
-  }
49
-}

+ 19 - 25
src/App.vue

@@ -1,12 +1,17 @@
1 1
 <template>
2
-  <div id="app">
2
+  <el-row id='app'>
3
+    <el-col :span="24" class='main-container'>
4
+    <router-view></router-view>
5
+    </el-col>
6
+  </el-row>
7
+  <!-- <div id="app" class='el-row'> -->
8
+    <!-- <my-chart></my-chart> -->
3 9
      <!-- <hello-world></hello-world> -->
4
-     <my-table></my-table>
5
-    <!-- <chao-ge v-if='opt == 1'></chao-ge> -->
10
+     <!-- <my-table></my-table> -->
11
+    <!-- <chao-ge></chao-ge> -->
6 12
     <!-- <test-com></test-com> -->
7 13
     <!-- <chaoge-brush></chaoge-brush> -->
8 14
     <!-- <keep-alive> -->
9
-    <!-- <router-view></router-view> -->
10 15
     <!-- </keep-alive> -->
11 16
    <!-- <ant></ant> -->
12 17
    <!-- <my-list></my-list> -->
@@ -21,7 +26,7 @@
21 26
       :value="item.value">
22 27
     </el-option>
23 28
   </el-select> -->
24
-  </div>
29
+  <!-- </div> -->
25 30
 </template>
26 31
 
27 32
 <script>
@@ -35,6 +40,7 @@ import myTable from './components/mytable'
35 40
 import myList from './components/myList'
36 41
 import myCar from './components/mycar'
37 42
 // import myCan from './components/mycan'
43
+import myChart from './components/brushchart'
38 44
 export default {
39 45
   name: 'App',
40 46
   components: {
@@ -46,7 +52,8 @@ export default {
46 52
     chaogeBrush,
47 53
     myTable,
48 54
     myList,
49
-    myCar
55
+    myCar,
56
+    myChart
50 57
     // myCan
51 58
   },
52 59
   data () {
@@ -73,25 +80,12 @@ export default {
73 80
 }
74 81
 </script>
75 82
 
76
-<style>
83
+<style lang ='scss'>
84
+@import './assets/scss/public.scss';
77 85
 #app {
78
-  font-family: 'Avenir', Helvetica, Arial, sans-serif;
79
-  -webkit-font-smoothing: antialiased;
80
-  -moz-osx-font-smoothing: grayscale;
81
-  text-align: center;
82
-  color: #2c3e50;
83
-  margin-top: 60px;
86
+  height: 100%;
87
+}
88
+.main-container {
89
+  height: 100%;
84 90
 }
85
- .demo-table-expand {
86
-    font-size: 0;
87
-  }
88
-  .demo-table-expand label {
89
-    width: 90px;
90
-    color: #99a9bf;
91
-  }
92
-  .demo-table-expand .el-form-item {
93
-    margin-right: 0;
94
-    margin-bottom: 0;
95
-    width: 50%;
96
-  }
97 91
 </style>

BIN
src/assets/logo.png


+ 32 - 0
src/assets/scss/public.scss

@@ -0,0 +1,32 @@
1
+// 字体大小
2
+$fontSize: 14px;
3
+
4
+html,
5
+body {
6
+  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
7
+  padding: 0;
8
+  margin: 0;
9
+  height: 100%;
10
+  width: 100%; // background-color: $backgroundColor;
11
+}
12
+
13
+p,
14
+ul {
15
+  margin: 0;
16
+  padding: 0;
17
+}
18
+
19
+.el-menu-vertical-demo {
20
+  padding: 16px 0px;
21
+  .el-submenu__title {
22
+    text-align: left;
23
+  }
24
+}
25
+.el-submenu .el-menu-item {
26
+  padding-left: 48px;
27
+  text-align: left;
28
+}
29
+.publicStyle {
30
+  font-size: $fontSize;
31
+  
32
+}

+ 105 - 0
src/components/brushchart.vue

@@ -0,0 +1,105 @@
1
+<template>
2
+  <div>
3
+    <div id='myChart' :style="{width: '900px', height: '500px'}"></div>
4
+  </div>
5
+</template>
6
+<script>
7
+import Mock from 'mockjs'
8
+import moment from 'moment'
9
+// import chartConfig from '@/utils/chart/baseConf.js'
10
+let startTimes = (new Date()).getTime() - 60 * 60 * 1000
11
+
12
+let MockData = Mock.mock({
13
+  'defaultData|60': [
14
+    [function () {
15
+      startTimes += 60000
16
+      return moment(new Date(startTimes)).format('YYYY-MM-DD HH:mm')
17
+    }, '@integer(0, 9999)']
18
+  ]
19
+})
20
+export default {
21
+  name: 'brushchart',
22
+  data () {
23
+    return {
24
+      startValue: 55,
25
+      endValue: 59,
26
+      options: {
27
+        toolbox: {
28
+          feature: {
29
+            dataZoom: {
30
+              yAxisIndex: false
31
+            }
32
+          }
33
+        },
34
+        dataZoom: [
35
+          {
36
+            show: true,
37
+            type: 'slider',
38
+            top: '90%',
39
+            realtime: false,
40
+            zoomLock: true
41
+          }
42
+        ],
43
+        xAxis: {
44
+          type: 'category'
45
+        },
46
+        yAxis: {
47
+          type: 'value'
48
+        },
49
+        series: [{
50
+          data: [],
51
+          type: 'line'
52
+        }]
53
+      },
54
+      myChart: {}
55
+    }
56
+  },
57
+  methods: {
58
+    doChart () {
59
+      let chartData = MockData.defaultData
60
+      this.options.series[0].data = chartData
61
+      this.myChart = this.$echarts.init(document.getElementById('myChart'))
62
+      this.myChart.setOption(this.options)
63
+      let renderBrushed = (params) => {
64
+        this.startValue = this.myChart.getModel().option.dataZoom[0].startValue
65
+        // console.log(this.startValue)
66
+        this.endValue = this.myChart.getModel().option.dataZoom[0].endValue
67
+        // console.log(this.endValue)
68
+        // console.log(chartData[this.startValue][0])
69
+        console.log(chartData[this.endValue])
70
+        // console.log(startValue)
71
+        // console.log(params)
72
+      }
73
+      this.myChart.dispatchAction({
74
+        type: 'dataZoom',
75
+        // 开始位置的数值
76
+        startValue: 55,
77
+        // 结束位置的数值
78
+        endValue: 60
79
+      })
80
+      this.myChart.on('datazoom', renderBrushed)
81
+      // setTimeout(() => {
82
+      setInterval(() => {
83
+        // let start = this.startValue--
84
+        // let end = this.endValue--
85
+        this.startValue--
86
+        this.endValue--
87
+        this.myChart.dispatchAction({
88
+          type: 'dataZoom',
89
+          // 开始位置的数值
90
+          startValue: this.startValue,
91
+          // 结束位置的数值
92
+          endValue: this.endValue
93
+        })
94
+      }, 3000)
95
+      // }, 1000)
96
+    }
97
+  },
98
+  mounted () {
99
+    this.doChart()
100
+  }
101
+}
102
+</script>
103
+<style>
104
+
105
+</style>

+ 3 - 2
src/components/chaoge.vue

@@ -2,7 +2,7 @@
2 2
   <div>
3 3
     <h1>测试组件</h1>
4 4
     <p>选择的时间轴: {{timeRang}}</p>
5
-    <div id="myChart" style="width: 800px;height:400px;"></div>
5
+    <div id="myChart1" style="width: 800px;height:400px;"></div>
6 6
   </div>
7 7
 </template>
8 8
 <script>
@@ -31,8 +31,9 @@ export default {
31 31
     drawChart (flag) {
32 32
     //   console.log(flag)
33 33
       console.log('hautu ')
34
-      this.myChart = echarts.init(document.getElementById('myChart'))
34
+      this.myChart = echarts.init(document.getElementById('myChart1'))
35 35
       let chartData = MockData.defaultData
36
+      console.log(chartData)
36 37
       // 指定图表的配置项和数据
37 38
       let option = {
38 39
         title: {

+ 4 - 4
src/components/chaogebrush.vue

@@ -1,16 +1,16 @@
1 1
 <template>
2 2
   <div>
3
-    <p>选择的时间轴: {{time}}</p>
3
+    <!-- <p>选择的时间轴: {{time}}</p>
4 4
     时间框大小 <select name="" id=""><option value="">1</option></select>
5
-    最近几小时 <select name="" id=""><option value="">1</option></select>
5
+    最近几小时 <select name="" id=""><option value="">1</option></select> -->
6 6
     <div id="myChart" style="width: 800px;height:400px;"></div>
7
-    <button @click='toPage'>跳转1</button>
7
+    <!-- <button @click='toPage'>跳转1</button>
8 8
     <button @click='toPage2'>跳转2</button>
9 9
     <p>TOP SQL</p>
10 10
     <table border="1px">
11 11
       <tr><td>1</td><td>2</td><td>3</td></tr>
12 12
       <tr><td>1</td><td>2</td><td>3</td></tr>
13
-    </table>
13
+    </table> -->
14 14
   </div>
15 15
 </template>
16 16
 <script>

+ 132 - 18
src/views/homepage/index.vue

@@ -1,45 +1,103 @@
1 1
 <template>
2 2
 <div>
3
-     <el-menu
4
-      default-active="2"
3
+  <el-container class='home-container'>
4
+      <el-aside :width="isCollapse ? '65px' : '200px'">
5
+      <div class='index-logo' :class='{"tosmall":isCollapse}'><h1>Ant Design Pro</h1></div>
6
+      <el-menu
7
+      default-active="1"
5 8
       class="el-menu-vertical-demo"
6 9
       @open="handleOpen"
7
-      @close="handleClose">
10
+      @close="handleClose"
11
+      :collapse="isCollapse">
8 12
       <el-submenu index="1">
9 13
         <template slot="title">
10
-          <i class="el-icon-location"></i>
11
-          <span>导航一</span>
14
+          <i class="el-icon-mobile-phone"></i>
15
+          <span>Dashboard</span>
12 16
         </template>
13 17
         <el-menu-item-group>
14 18
           <!-- <template slot="title">分组一</template> -->
15
-          <el-menu-item index="1-1">选项1</el-menu-item>
16
-          <el-menu-item index="1-2">选项2</el-menu-item>
19
+          <el-menu-item index="/panel">分析页</el-menu-item>
20
+          <el-menu-item index="1-2">监控页</el-menu-item>
21
+          <el-menu-item index="1-2">工作台</el-menu-item>
17 22
         </el-menu-item-group>
18 23
       </el-submenu>
19 24
       <el-submenu index="2">
20 25
         <template slot="title">
21
-          <i class="el-icon-location"></i>
22
-          <span>导航一</span>
26
+          <i class="el-icon-tickets"></i>
27
+          <span>表单页</span>
23 28
         </template>
24 29
         <el-menu-item-group>
25 30
           <!-- <template slot="title">分组一</template> -->
26
-          <el-menu-item index="2-1">选项1</el-menu-item>
27
-          <el-menu-item index="2-2">选项2</el-menu-item>
31
+          <el-menu-item index="2-1">基础表单</el-menu-item>
32
+          <el-menu-item index="2-2">分步表单</el-menu-item>
33
+          <el-menu-item index="2-3">高级表单</el-menu-item>
28 34
         </el-menu-item-group>
29 35
       </el-submenu>
30 36
       <el-submenu index="3">
31 37
         <template slot="title">
32
-          <i class="el-icon-location"></i>
33
-          <span>导航一</span>
38
+          <i class="el-icon-document"></i>
39
+          <span>列表页</span>
34 40
         </template>
35 41
         <el-menu-item-group>
36 42
           <!-- <template slot="title">分组一</template> -->
37
-          <el-menu-item index="3-1">选项1</el-menu-item>
38
-          <el-menu-item index="3-2">选项2</el-menu-item>
43
+          <el-menu-item index="3-1">查询表格</el-menu-item>
44
+          <el-menu-item index="3-2">标准表格</el-menu-item>
45
+          <el-menu-item index="3-3">查询表格</el-menu-item>
46
+          <el-menu-item index="3-4">标准表格</el-menu-item>
47
+        </el-menu-item-group>
48
+      </el-submenu>
49
+        <el-submenu index="4">
50
+        <template slot="title">
51
+          <i class="el-icon-printer"></i>
52
+          <span>详情页</span>
53
+        </template>
54
+        <el-menu-item-group>
55
+          <!-- <template slot="title">分组一</template> -->
56
+          <el-menu-item index="4-1">基础详情页</el-menu-item>
57
+          <el-menu-item index="4-2">高级详情页</el-menu-item>
58
+        </el-menu-item-group>
59
+      </el-submenu>
60
+      <el-submenu index="5">
61
+        <template slot="title">
62
+          <i class="el-icon-success"></i>
63
+          <span>结果页</span>
64
+        </template>
65
+        <el-menu-item-group>
66
+          <!-- <template slot="title">分组一</template> -->
67
+          <el-menu-item index="5-1">成功页</el-menu-item>
68
+          <el-menu-item index="5-2">失败页</el-menu-item>
69
+        </el-menu-item-group>
70
+      </el-submenu>
71
+        <el-submenu index="6">
72
+        <template slot="title">
73
+          <i class="el-icon-warning"></i>
74
+          <span>异常页</span>
75
+        </template>
76
+        <el-menu-item-group>
77
+          <!-- <template slot="title">分组一</template> -->
78
+          <el-menu-item index="6-1">403</el-menu-item>
79
+          <el-menu-item index="6-2">404</el-menu-item>
80
+          <el-menu-item index="6-3">500</el-menu-item>
81
+        </el-menu-item-group>
82
+      </el-submenu>
83
+        <el-submenu index="7">
84
+        <template slot="title">
85
+          <i class="el-icon-service"></i>
86
+          <span>个人页</span>
87
+        </template>
88
+        <el-menu-item-group>
89
+          <!-- <template slot="title">分组一</template> -->
90
+          <el-menu-item index="7-1">个人中心</el-menu-item>
91
+          <el-menu-item index="7-2">个人设置</el-menu-item>
39 92
         </el-menu-item-group>
40 93
       </el-submenu>
41 94
      </el-menu>
42
-     <input type="text" maxlength='20' style='width:500px;'>
95
+  </el-aside>
96
+  <el-container>
97
+   <el-header><div class='menu-icon' @click='changeMenu'><i class='el-icon-arrow-right' v-if='isCollapse'></i><i class='el-icon-arrow-left' v-else></i></div></el-header>
98
+    <el-main class='right-container'>Main</el-main>
99
+  </el-container>
100
+  </el-container>
43 101
   </div>
44 102
 </template>
45 103
 <script>
@@ -47,6 +105,7 @@ export default {
47 105
   name: 'homepage',
48 106
   data () {
49 107
     return {
108
+      isCollapse: false
50 109
     }
51 110
   },
52 111
   methods: {
@@ -55,10 +114,65 @@ export default {
55 114
     },
56 115
     handleOpen () {
57 116
       console.log('handleOpen')
117
+    },
118
+    changeMenu () {
119
+      this.isCollapse = !this.isCollapse
58 120
     }
59 121
   }
60 122
 }
61 123
 </script>
62
-<style>
63
-
124
+<style lang='scss'>
125
+  .el-aside {
126
+    // background-color: #D3DCE6;
127
+    color: #333;
128
+    text-align: center;
129
+    /* line-height: 200px; */
130
+  }
131
+  .el-menu-item-group__title {
132
+    padding-top: 0px;
133
+  }
134
+  .el-main {
135
+    background-color: #E9EEF3;
136
+    color: #333;
137
+    text-align: center;
138
+    /* line-height: 160px; */
139
+  }
140
+  .home-container {
141
+    height: 100%;
142
+    min-width: 1366px;
143
+  }
144
+  .index-logo {
145
+    transition:  0.3s;
146
+    cursor: pointer;
147
+    h1{
148
+      color:#1890ff;
149
+      font-size: 20px;
150
+      font-weight: 600;
151
+      margin: 0px;
152
+      overflow: hidden;
153
+    }
154
+    height: 64px;
155
+    position: relative;
156
+    line-height: 64px;
157
+    background-color: white;
158
+    box-shadow:1px 1px 0 0 #e8e8e8;
159
+  }
160
+  .el-header {
161
+    display: flex;
162
+    align-content: center;
163
+    justify-content: space-between;
164
+    height: 64px !important;
165
+    padding: 0px;
166
+    padding-right: 20px;
167
+    .menu-icon {
168
+      height: 64px;
169
+      line-height: 64px;
170
+      text-align: center;
171
+      width:64px;
172
+      cursor: pointer;
173
+    }
174
+  }
175
+  .tosmall {
176
+    width: 64px;
177
+  }
64 178
 </style>

+ 16 - 0
src/views/trace/index.vue

@@ -0,0 +1,16 @@
1
+<template>
2
+   <div>trace</div> 
3
+</template>
4
+<script>
5
+export default {
6
+  name: 'trace',
7
+  data() {
8
+    return {
9
+      
10
+    }
11
+  } 
12
+}
13
+</script>
14
+<style lang='scss'>
15
+
16
+</style>