许成详 6 年 前
コミット
dbb2b81d47

+ 3
- 1
src/components/siderBar/index.vue ファイルの表示

@@ -13,7 +13,9 @@
13 13
                 <span>{{item.title}}</span>
14 14
               </template>
15 15
               <el-menu-item-group>
16
-                <el-menu-item v-for="(subItem,subIndex) in item.children" :key="subIndex" :index="String(index)+'-'+String(subIndex)">{{subItem.title}}</el-menu-item>
16
+                <el-menu-item v-for="(subItem,subIndex) in item.children" :key="subIndex" :index="String(index)+'-'+String(subIndex)">
17
+                  <router-link :to="{name:subItem.pathName,query:{}}">{{subItem.title}}</router-link>
18
+                </el-menu-item>
17 19
               </el-menu-item-group>
18 20
             </el-submenu>
19 21
             <el-menu-item v-else :index="String(index)" :key="index">

+ 40
- 0
src/components/siderBar/page.scss ファイルの表示

@@ -0,0 +1,40 @@
1
+
2
+a{
3
+  width: 100%;
4
+  display: inline-block;
5
+  color: #666;
6
+}
7
+
8
+.el-menu-item.is-active{
9
+  background: rgba(64, 158, 255, .1);
10
+}
11
+
12
+.el-menu-item.is-active{
13
+  a{
14
+    color: #409EFF;
15
+  }
16
+}
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+

+ 41
- 0
src/components/tableSearch/index.vue ファイルの表示

@@ -0,0 +1,41 @@
1
+<template>
2
+  <div class="tableSearch flex-h">
3
+    <div class="flex-item">
4
+      <el-input
5
+        placeholder="请输入内容"
6
+        v-model="key"
7
+        clearable>
8
+      </el-input>
9
+    </div>
10
+    <el-button
11
+        size="mini"
12
+        type="primary" @click="search">搜索</el-button>
13
+  </div>
14
+</template>
15
+
16
+<script>
17
+export default {
18
+  name: '',
19
+  props: [''],
20
+  data () {
21
+    return {
22
+      key: ''
23
+    }
24
+  },
25
+  mounted () {
26
+    this.$nextTick(function () {
27
+      // console.log(this.menu)
28
+    })
29
+  },
30
+  methods: {
31
+    search () { // 搜索
32
+      this.$emit('exportSearchKey', this.key)
33
+    },
34
+  }
35
+}
36
+</script>
37
+
38
+<!-- Add "scoped" attribute to limit CSS to this component only -->
39
+<style lang="scss" scoped>
40
+@import "page.scss";
41
+</style>

+ 35
- 0
src/components/tableSearch/page.scss ファイルの表示

@@ -0,0 +1,35 @@
1
+
2
+
3
+.tableSearch{
4
+  width: 300px;
5
+  &>*{
6
+    margin-right: 10px;
7
+  }
8
+  &>*:last-child{
9
+    margin-right: 0;
10
+  }
11
+}
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+

+ 4
- 3
src/main.js ファイルの表示

@@ -3,17 +3,18 @@
3 3
 import Vue from 'vue'
4 4
 import App from './App'
5 5
 import ElementUI from 'element-ui'
6
+import 'element-ui/lib/theme-chalk/index.css'
6 7
 import Cookies from 'vue-cookie'
7 8
 import './style/main.css'
8 9
 import router from './router'
9
-import Ajax from './util/ajax'
10
+// import Ajax from './util/ajax'
10 11
 
11 12
 Vue.use(ElementUI)
12 13
 Vue.use(Cookies)
13 14
 
14 15
 Vue.config.productionTip = false
15
-const http = new Ajax()
16
-Vue.prototype.$ajax = http
16
+// const http = new Ajax()
17
+// Vue.prototype.$ajax = http
17 18
 /* eslint-disable no-new */
18 19
 new Vue({
19 20
   el: '#app',

+ 25
- 5
src/pages/login/index.vue ファイルの表示

@@ -6,15 +6,15 @@
6 6
         <span>城的空间 · 登录</span>
7 7
       </div>
8 8
       <div class="login">
9
-        <input type="text" placeholder="请输入账号">
10
-        <input type="password" placeholder="请输入密码">
9
+        <input type="text" v-model="account" placeholder="请输入账号">
10
+        <input type="password" v-model="password" placeholder="请输入密码">
11 11
         <div>
12 12
           <label :class="{'active':remberAccount}" @click="triggerRember">
13 13
             <i class="iconfont icon-gouxuan"></i>
14 14
             <span onselectstart="return false">记住账号密码</span>
15 15
           </label>
16 16
         </div>
17
-        <a class="btn">登 录</a>
17
+        <a class="btn" @click="toLogin">登 录</a>
18 18
       </div>
19 19
     </div>
20 20
   </div>
@@ -25,6 +25,8 @@ export default {
25 25
   name: '',
26 26
   data () {
27 27
     return {
28
+      account: '', // 账号
29
+      password: '', // 密码
28 30
       remberAccount: true, // 记住账号密码
29 31
     }
30 32
   },
@@ -34,10 +36,28 @@ export default {
34 36
     })
35 37
   },
36 38
   methods: {
39
+    // 登录
40
+    toLogin () {
41
+      if (this.remberAccount) {
42
+        var aData = { account: this.account, password: this.password, remberAccount: true }
43
+        this.$cookie.set('accountInfo', JSON.stringify(aData))
44
+      } else {
45
+        this.$cookie.delete('accountInfo')
46
+      }
47
+    },
48
+
37 49
     // 初始化登陆逻辑
38 50
     initLogin () {
39
-      if (this.$cookie.get('accountInfo') === undefined || this.$cookie.get('accountInfo') === '') {
40
-
51
+      var aData = {}
52
+      if (this.$cookie.get('accountInfo') === undefined || this.$cookie.get('accountInfo') === null) {
53
+        aData = { account: '', password: '', remberAccount: true }
54
+        this.$cookie.set('accountInfo', JSON.stringify(aData))
55
+      } else {
56
+        aData = this.$cookie.get('accountInfo')
57
+        aData = JSON.parse(aData)
58
+        for (var n in aData) {
59
+          this[n] = aData[n]
60
+        }
41 61
       }
42 62
     },
43 63
 

+ 117
- 0
src/pages/system/channelList/index.vue ファイルの表示

@@ -0,0 +1,117 @@
1
+<template>
2
+  <div class="subPage">
3
+    <div class="system-table-search">
4
+      <div class="flex-h">
5
+        <div class="flex-item flex-h">
6
+          <el-button size="mini" type="success">新增渠道</el-button>
7
+        </div>
8
+        <tableSearch @exportSearchKey="searchList"></tableSearch>
9
+      </div>
10
+      <div class="moreFilter"></div>
11
+    </div>
12
+    <div class="system-table-box">
13
+      <el-table
14
+        :data="tableData"
15
+        stripe
16
+        style="width: 100%">
17
+        <el-table-column
18
+          prop="channelName"
19
+          label="渠道名"
20
+          width="180">
21
+        </el-table-column>
22
+        <el-table-column
23
+          prop="channelCode"
24
+          label="渠道code">
25
+        </el-table-column>
26
+        <el-table-column label="操作">
27
+          <template slot-scope="scope">
28
+            <el-button
29
+              size="mini"
30
+              @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
31
+            <el-button
32
+              size="mini"
33
+              type="danger"
34
+              @click="handleDelete(scope.$index, scope.row)">删除</el-button>
35
+          </template>
36
+        </el-table-column>
37
+      </el-table>
38
+    </div>
39
+    <el-pagination
40
+      @size-change="handleSizeChange"
41
+      @current-change="handleCurrentChange"
42
+      :current-page.sync="currentPage"
43
+      :page-size="10"
44
+      layout="prev, pager, next, jumper"
45
+      :total="100">
46
+    </el-pagination>
47
+  </div>
48
+</template>
49
+
50
+<script>
51
+import tableSearch from '@/components/tableSearch/index'
52
+
53
+export default {
54
+  name: '',
55
+  data () {
56
+    return {
57
+      currentPage: 0, // 当前页码
58
+      tableSearch: { // 表格搜索条件
59
+        key: '111', // 搜索关键字
60
+      },
61
+      tableData: [{
62
+        channelName: 'xxx',
63
+        channelCode: 'xxx'
64
+      }, {
65
+        channelName: 'xxx',
66
+        channelCode: 'xxx'
67
+      }, {
68
+        channelName: 'xxx',
69
+        channelCode: 'xxx'
70
+      }, {
71
+        channelName: 'xxx',
72
+        channelCode: 'xxx'
73
+      }]
74
+    }
75
+  },
76
+  components: {
77
+    tableSearch,
78
+  },
79
+  methods: {
80
+    handleSizeChange (val) {
81
+      console.log(`每页 ${val} 条`)
82
+    },
83
+    handleCurrentChange (val) {
84
+      console.log(`当前页: ${val}`)
85
+    },
86
+    handleEdit (index, row) { // 编辑
87
+      console.log(index, row)
88
+    },
89
+    handleDelete (index, row) { // 删除
90
+      console.log(index, row)
91
+      this.$confirm('确认删除此渠道?', '提示', {
92
+        confirmButtonText: '确定',
93
+        cancelButtonText: '取消',
94
+        type: 'warning'
95
+      }).then(() => {
96
+        this.$message({
97
+          type: 'success',
98
+          message: '删除成功!'
99
+        })
100
+      }).catch(() => {
101
+        this.$message({
102
+          type: 'info',
103
+          message: '已取消删除'
104
+        })
105
+      })
106
+    },
107
+    searchList (key) { // 搜索列表
108
+      console.log(key)
109
+    }
110
+  }
111
+}
112
+</script>
113
+
114
+<!-- Add "scoped" attribute to limit CSS to this component only -->
115
+<style lang="scss" scoped>
116
+@import "page.scss";
117
+</style>

+ 36
- 0
src/pages/system/channelList/page.scss ファイルの表示

@@ -0,0 +1,36 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+

+ 5
- 13
src/pages/system/index.vue ファイルの表示

@@ -18,8 +18,8 @@
18 18
           <breadCrumb :list="breadCrumb"></breadCrumb>
19 19
         </div>
20 20
         <div class="flex-item">
21
-          <div>
22
-            业务页面
21
+          <div class="subPageBox">
22
+            <router-view></router-view>
23 23
           </div>
24 24
         </div>
25 25
       </div>
@@ -52,19 +52,11 @@ export default {
52 52
         pathName: ''
53 53
       }],
54 54
       pageMenu: [{
55
-        title: '一级菜单1',
55
+        title: '渠道管理',
56 56
         pathName: '',
57 57
         children: [{
58
-          title: '二级菜单1',
59
-          pathName: '',
60
-          children: [],
61
-        }, {
62
-          title: '二级菜单2',
63
-          pathName: '',
64
-          children: [],
65
-        }, {
66
-          title: '二级菜单3',
67
-          pathName: '',
58
+          title: '渠道列表',
59
+          pathName: 'channelList',
68 60
           children: [],
69 61
         }],
70 62
       }, {

+ 19
- 0
src/pages/system/page.js ファイルの表示

@@ -0,0 +1,19 @@
1
+
2
+import system from './index'
3
+import channelList from './channelList/index'
4
+
5
+export default {
6
+  router: [
7
+    {
8
+      path: '/system',
9
+      name: 'system',
10
+      component: system,
11
+      children: [{
12
+        path: 'channelList',
13
+        name: 'channelList',
14
+        component: channelList,
15
+        children: [],
16
+      }],
17
+    },
18
+  ],
19
+}

+ 7
- 0
src/pages/system/page.scss ファイルの表示

@@ -79,6 +79,13 @@
79 79
   border-bottom: 1px solid #eee;
80 80
 }
81 81
 
82
+.subPageBox{
83
+  width: 100%;
84
+  height: 100%;
85
+  position: relative;
86
+  overflow: hidden;
87
+}
88
+
82 89
 
83 90
 
84 91
 

+ 3
- 6
src/router/index.js ファイルの表示

@@ -1,7 +1,7 @@
1 1
 import Vue from 'vue'
2 2
 import Router from 'vue-router'
3 3
 import login from '@/pages/login/index'
4
-import system from '@/pages/system/index'
4
+import system from '@/pages/system/page'
5 5
 import test from '@/pages/test/test'
6 6
 
7 7
 Vue.use(Router)
@@ -13,11 +13,8 @@ export default new Router({
13 13
       name: 'login',
14 14
       component: login
15 15
     },
16
-    {
17
-      path: '/system',
18
-      name: 'system',
19
-      component: system
20
-    },
16
+    { path: '/', redirect: '/index' },
17
+    ...system.router,
21 18
     {
22 19
       path: '/test',
23 20
       name: 'test',

+ 29
- 0
src/style/main.css ファイルの表示

@@ -136,6 +136,13 @@ select:focus {
136 136
   overflow: hidden;
137 137
 }
138 138
 
139
+.subPage{
140
+  width: 100%;
141
+  height: 100%;
142
+  position: relative;
143
+  overflow-y: auto;
144
+}
145
+
139 146
 * > img.cover {
140 147
   width: 100%;
141 148
   height: 100%;
@@ -161,3 +168,25 @@ select:focus {
161 168
   border-radius: 5px;
162 169
   background: rgba(0, 0, 0, 0.3);
163 170
 }
171
+
172
+.system-table-box{
173
+  width: calc(100% - 40px);
174
+  margin: 20px auto 0;
175
+  box-sizing: border-box;
176
+  border: 1px solid #eee;
177
+  border-bottom: none;
178
+}
179
+
180
+.system-table-search{
181
+  width: calc(100% - 40px);
182
+  margin: 20px auto 0;
183
+}
184
+
185
+.el-pagination{
186
+  text-align: right;
187
+  margin: 20px auto 0;
188
+}
189
+
190
+.el-pagination>*:last-child{
191
+  margin-right: 20px
192
+}