Commit 1ec54148453dac8785305f3c1126e7f59dd55ed6
1 parent
35fdd297
删除无效代码
Showing
4 changed files
with
5 additions
and
59 deletions
webintroduce/src/main.js
| @@ -3,35 +3,12 @@ | @@ -3,35 +3,12 @@ | ||
| 3 | import Vue from 'vue' | 3 | import Vue from 'vue' |
| 4 | import App from './App' | 4 | import App from './App' |
| 5 | import router from './router' | 5 | import router from './router' |
| 6 | -import Cookies from 'js-cookie' | ||
| 7 | require ('./assets/css/reset.css') | 6 | require ('./assets/css/reset.css') |
| 8 | Vue.config.productionTip = false | 7 | Vue.config.productionTip = false |
| 9 | 8 | ||
| 10 | router.beforeEach((to, from, next) =>{ | 9 | router.beforeEach((to, from, next) =>{ |
| 11 | - | ||
| 12 | - // if(to.matched.some(record => record.meta.requiresAuth)){ | ||
| 13 | - // if(Cookies.get('username')){ | ||
| 14 | - // document.title = to.meta.title | ||
| 15 | - // next() | ||
| 16 | - // }else{ | ||
| 17 | - // alert() | ||
| 18 | - // next({ | ||
| 19 | - // path:'/login', | ||
| 20 | - // query: { redirect: to.fullPath } | ||
| 21 | - // }) | ||
| 22 | - // document.title = '登录' | ||
| 23 | - // } | ||
| 24 | - // | ||
| 25 | - // | ||
| 26 | - // }else { | ||
| 27 | - // document.title = to.meta.title | ||
| 28 | - // next() | ||
| 29 | - // } | ||
| 30 | document.title = to.meta.title | 10 | document.title = to.meta.title |
| 31 | next() | 11 | next() |
| 32 | - // console.log(to) | ||
| 33 | - // | ||
| 34 | - // next() | ||
| 35 | }) | 12 | }) |
| 36 | router.afterEach((to,from,next) => { | 13 | router.afterEach((to,from,next) => { |
| 37 | window.scrollTo(0,0) | 14 | window.scrollTo(0,0) |
webintroduce/src/router/index.js
| @@ -3,7 +3,6 @@ import Router from 'vue-router' | @@ -3,7 +3,6 @@ import Router from 'vue-router' | ||
| 3 | import home from '../views/home' | 3 | import home from '../views/home' |
| 4 | const solution = () => import('../views/solution') | 4 | const solution = () => import('../views/solution') |
| 5 | const enterprise = () => import('../views/enterprise') | 5 | const enterprise = () => import('../views/enterprise') |
| 6 | -const login = () => import('../views/login') | ||
| 7 | 6 | ||
| 8 | Vue.use(Router) | 7 | Vue.use(Router) |
| 9 | 8 | ||
| @@ -20,7 +19,6 @@ export default new Router({ | @@ -20,7 +19,6 @@ export default new Router({ | ||
| 20 | component: home, | 19 | component: home, |
| 21 | meta: { | 20 | meta: { |
| 22 | title: '首页', | 21 | title: '首页', |
| 23 | - requiresAuth: false | ||
| 24 | } | 22 | } |
| 25 | }, | 23 | }, |
| 26 | { | 24 | { |
| @@ -29,7 +27,6 @@ export default new Router({ | @@ -29,7 +27,6 @@ export default new Router({ | ||
| 29 | component: solution, | 27 | component: solution, |
| 30 | meta: { | 28 | meta: { |
| 31 | title: '解决方案', | 29 | title: '解决方案', |
| 32 | - requiresAuth: false | ||
| 33 | } | 30 | } |
| 34 | }, | 31 | }, |
| 35 | { | 32 | { |
| @@ -38,7 +35,6 @@ export default new Router({ | @@ -38,7 +35,6 @@ export default new Router({ | ||
| 38 | component: enterprise, | 35 | component: enterprise, |
| 39 | meta: { | 36 | meta: { |
| 40 | title: '企业', | 37 | title: '企业', |
| 41 | - requiresAuth: true | ||
| 42 | }, | 38 | }, |
| 43 | child:[ | 39 | child:[ |
| 44 | { | 40 | { |
| @@ -47,19 +43,10 @@ export default new Router({ | @@ -47,19 +43,10 @@ export default new Router({ | ||
| 47 | component: enterprise, | 43 | component: enterprise, |
| 48 | meta: { | 44 | meta: { |
| 49 | title: '企业', | 45 | title: '企业', |
| 50 | - requiresAuth: true | ||
| 51 | }, | 46 | }, |
| 52 | } | 47 | } |
| 53 | ] | 48 | ] |
| 54 | }, | 49 | }, |
| 55 | - { | ||
| 56 | - path: '/login', | ||
| 57 | - name: 'login', | ||
| 58 | - component: login, | ||
| 59 | - meta: { | ||
| 60 | - title: '登录', | ||
| 61 | - requiresAuth: false | ||
| 62 | - } | ||
| 63 | - } | 50 | + |
| 64 | ] | 51 | ] |
| 65 | }) | 52 | }) |
webintroduce/src/views/enterprise.vue
webintroduce/src/views/home.vue
| 1 | <template> | 1 | <template> |
| 2 | - <ul> | ||
| 3 | - <li v-for="(enterprise,index) in enterprises" | ||
| 4 | - :key="index" @click="toEnterprise(enterprise.id)"> | ||
| 5 | - {{enterprise.name}} | ||
| 6 | - </li> | ||
| 7 | - <div style="height: 800px;background-color: #00f">shouye</div> | ||
| 8 | - <div style="height: 800px;background-color: #ccc">shouye</div> | ||
| 9 | - </ul> | 2 | + <div> 首页</div> |
| 10 | </template> | 3 | </template> |
| 11 | 4 | ||
| 12 | <script> | 5 | <script> |
| @@ -14,17 +7,6 @@ export default { | @@ -14,17 +7,6 @@ export default { | ||
| 14 | name: 'VHome', | 7 | name: 'VHome', |
| 15 | data(){ | 8 | data(){ |
| 16 | return { | 9 | return { |
| 17 | - enterprises:[ | ||
| 18 | - {name:'企业1',id:1}, | ||
| 19 | - {name:'企业2',id:2}, | ||
| 20 | - {name:'企业3',id:3}, | ||
| 21 | - ] | ||
| 22 | - } | ||
| 23 | - }, | ||
| 24 | - methods: { | ||
| 25 | - toEnterprise(id){ | ||
| 26 | - console.log(id) | ||
| 27 | - this.$router.push({name:'enterprise',params:{id:id}}) | ||
| 28 | } | 10 | } |
| 29 | } | 11 | } |
| 30 | } | 12 | } |