李志伟 3 anni fa
parent
commit
465f8050a1

+ 2
- 2
src/components/Breadcrumb/index.vue Vedi File

@@ -33,7 +33,7 @@ export default {
33 33
       const first = matched[0]
34 34
 
35 35
       if (!this.isDashboard(first)) {
36
-        matched = [{ path: '/dashboard', meta: { title: '首页' }}].concat(matched)
36
+        matched = [{ path: '/Person', meta: { title: '中奖人员管理' }}].concat(matched)
37 37
       }
38 38
 
39 39
       this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
@@ -43,7 +43,7 @@ export default {
43 43
       if (!name) {
44 44
         return false
45 45
       }
46
-      return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase()
46
+      return name.trim().toLocaleLowerCase() === 'Person'.toLocaleLowerCase()
47 47
     },
48 48
     pathCompile(path) {
49 49
       // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561

+ 4
- 11
src/layout/components/Navbar.vue Vedi File

@@ -11,17 +11,6 @@
11 11
           <i class="el-icon-caret-bottom" />
12 12
         </div>
13 13
         <el-dropdown-menu slot="dropdown" class="user-dropdown">
14
-          <router-link to="/">
15
-            <el-dropdown-item>
16
-              首页
17
-            </el-dropdown-item>
18
-          </router-link>
19
-          <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">
20
-            <el-dropdown-item>Github</el-dropdown-item>
21
-          </a>
22
-          <a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
23
-            <el-dropdown-item>框架文档</el-dropdown-item>
24
-          </a>
25 14
           <el-dropdown-item divided @click.native="logout">
26 15
             <span style="display:block;">安全退出</span>
27 16
           </el-dropdown-item>
@@ -135,5 +124,9 @@ export default {
135 124
       }
136 125
     }
137 126
   }
127
+  .el-dropdown-menu__item--divided {
128
+    margin: 0;
129
+    border: 0;
130
+  }
138 131
 }
139 132
 </style>

+ 1
- 22
src/router/index.js Vedi File

@@ -31,17 +31,6 @@ import Layout from '@/layout'
31 31
  * all roles can be accessed
32 32
  */
33 33
 export const constantRoutes = [
34
-  {
35
-    path: '/',
36
-    component: Layout,
37
-    redirect: '/dashboard',
38
-    children: [{
39
-      path: 'dashboard',
40
-      name: 'Dashboard',
41
-      component: () => import('@/views/dashboard/index'),
42
-      meta: { title: '首页', icon: 'dashboard' }
43
-    }]
44
-  },
45 34
 
46 35
   // 奖品管理
47 36
 
@@ -62,6 +51,7 @@ export const constantRoutes = [
62 51
     path: '/Person',
63 52
     component: Layout,
64 53
     meta: { title: '中奖人员管理', icon: 'form' },
54
+    name: 'Person',
65 55
     children: [
66 56
       {
67 57
         path: 'Person',
@@ -98,17 +88,6 @@ export const constantRoutes = [
98 88
     hidden: true
99 89
   },
100 90
 
101
-  {
102
-    path: 'external-link',
103
-    component: Layout,
104
-    children: [
105
-      {
106
-        path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
107
-        meta: { title: 'External Link', icon: 'link' }
108
-      }
109
-    ]
110
-  },
111
-
112 91
   // 404 page must be placed at the end !!!
113 92
   { path: '*', redirect: '/404', hidden: true }
114 93
 ]

+ 2
- 1
src/store/modules/user.js Vedi File

@@ -1,6 +1,7 @@
1 1
 import { login } from '@/api/user'
2 2
 import { getToken, setToken, removeToken, setUserId } from '@/utils/auth'
3 3
 import { resetRouter } from '@/router'
4
+import md5 from 'js-md5'
4 5
 
5 6
 const getDefaultState = () => {
6 7
   return {
@@ -26,7 +27,7 @@ const actions = {
26 27
   login({ commit }, userInfo) {
27 28
     const { userName, password } = userInfo
28 29
     return new Promise((resolve, reject) => {
29
-      login({ userName: userName.trim(), password: password }).then(response => {
30
+      login({ userName: userName.trim(), password:md5(password) }).then(response => {
30 31
         const { data } = response
31 32
         commit('SET_TOKEN', data.token)
32 33
         setToken(data.token)

+ 0
- 28
src/views/dashboard/index.vue Vedi File

@@ -1,28 +0,0 @@
1
-<template>
2
-  <div class="dashboard-container">
3
-    <div class="dashboard-text">欢迎使用{{ name }}</div>
4
-  </div>
5
-</template>
6
-
7
-<script>
8
-import { mapGetters } from 'vuex'
9
-
10
-export default {
11
-  name: 'Dashboard',
12
-  computed: {
13
-    ...mapGetters(['name'])
14
-  }
15
-}
16
-</script>
17
-
18
-<style lang="scss" scoped>
19
-.dashboard {
20
-  &-container {
21
-    margin: 30px;
22
-  }
23
-  &-text {
24
-    font-size: 30px;
25
-    line-height: 46px;
26
-  }
27
-}
28
-</style>

+ 1
- 3
src/views/login/index.vue Vedi File

@@ -69,7 +69,6 @@
69 69
   </div>
70 70
 </template>
71 71
 <script>
72
-import md5 from 'js-md5'
73 72
 export default {
74 73
   name: 'Login',
75 74
   data() {
@@ -114,11 +113,10 @@ export default {
114 113
       this.$refs.loginForm.validate((valid) => {
115 114
         if (valid) {
116 115
           this.loading = true
117
-          this.loginForm.password = md5(this.loginForm.password)
118 116
           this.$store
119 117
             .dispatch('user/login', this.loginForm)
120 118
             .then(() => {
121
-              this.$router.push({ path: '/' })
119
+              this.$router.push({ path: '/Person/Person' })
122 120
               this.loading = false
123 121
             })
124 122
             .catch(() => {

+ 14
- 23
tests/unit/components/Breadcrumb.spec.js Vedi File

@@ -9,13 +9,18 @@ localVue.use(ElementUI)
9 9
 
10 10
 const routes = [
11 11
   {
12
-    path: '/',
13
-    name: 'home',
14
-    children: [{
15
-      path: 'dashboard',
16
-      name: 'dashboard'
17
-    }]
18
-  },  
12
+    path: '/Person',
13
+    meta: { title: '中奖人员管理', icon: 'form' },
14
+    name: 'Person',
15
+    children: [
16
+      {
17
+        path: 'Person',
18
+        name: '',
19
+        component: () => import('@/views/person/index'),
20
+        meta: { title: '中奖人员列表', icon: 'gamePerson' }
21
+      }
22
+    ]
23
+  },
19 24
 ]
20 25
 
21 26
 const router = new VueRouter({
@@ -27,8 +32,8 @@ describe('Breadcrumb.vue', () => {
27 32
     localVue,
28 33
     router
29 34
   })
30
-  it('dashboard', () => {
31
-    router.push('/dashboard')
35
+  it('Person', () => {
36
+    router.push('/Person')
32 37
     const len = wrapper.findAll('.el-breadcrumb__inner').length
33 38
     expect(len).toBe(1)
34 39
   })
@@ -47,20 +52,6 @@ describe('Breadcrumb.vue', () => {
47 52
     const len = wrapper.findAll('.el-breadcrumb__inner').length
48 53
     expect(len).toBe(3)
49 54
   })
50
-  // it('click link', () => {
51
-  //   router.push('/menu/menu1/menu1-2/menu1-2-2')
52
-  //   const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner')
53
-  //   const second = breadcrumbArray.at(1)
54
-  //   console.log(breadcrumbArray)
55
-  //   const href = second.find('a').attributes().href
56
-  //   expect(href).toBe('#/menu/menu1')
57
-  // })
58
-  // it('noRedirect', () => {
59
-  //   router.push('/menu/menu1/menu1-2/menu1-2-1')
60
-  //   const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner')
61
-  //   const redirectBreadcrumb = breadcrumbArray.at(2)
62
-  //   expect(redirectBreadcrumb.contains('a')).toBe(false)
63
-  // })
64 55
   it('last breadcrumb', () => {
65 56
     router.push('/menu/menu1/menu1-2/menu1-2-1')
66 57
     const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner')

+ 3
- 3
tests/unit/utils/validate.spec.js Vedi File

@@ -10,8 +10,8 @@ describe('Utils:validate', () => {
10 10
     expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true)
11 11
     expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true)
12 12
     expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false)
13
-    expect(isExternal('/dashboard')).toBe(false)
14
-    expect(isExternal('./dashboard')).toBe(false)
15
-    expect(isExternal('dashboard')).toBe(false)
13
+    expect(isExternal('/Person')).toBe(false)
14
+    expect(isExternal('./Person')).toBe(false)
15
+    expect(isExternal('Person')).toBe(false)
16 16
   })
17 17
 })