瀏覽代碼

工作台路由建立

LIPENGTAO1313 6 年之前
父節點
當前提交
7582311cac

+ 61 - 0
src/components/bench-views/WorkCommon.vue

@ -0,0 +1,61 @@
1
<template>
2
  <div class="main Site">
3
    <TheHeader></TheHeader>
4
    <div class="Site-content">
5
      <div class="contain-wrapper">
6
        <transition name="router-fade" mode="out-in">
7
          <keep-alive>
8
            <router-view :plat="plat"></router-view>
9
          </keep-alive>
10
        </transition>
11
      </div>
12
    </div>
13
    <TheFooter :plat="plat"></TheFooter>
14
  </div>
15
</template>
16

17
<script>
18
  import TheHeader from './WorkHead.vue';
19
  import TheFooter from '../main-views/TheFooter.vue';
20

21
  const ERR_OK = 0;
22

23
  export default {
24
    data() {
25
      return {
26
        plat: {}
27
      };
28
    },
29
    created() {
30
      this.$axios.get('./api/plat').then((res) => {
31
        // console.log(res);
32
        res = res.data;
33
        if (res.errno === ERR_OK) {
34
          this.plat = res.data;
35
        };
36
      });
37
    },
38
    components: {
39
      TheHeader,
40
      TheFooter
41
    }
42
  };
43
</script>
44

45
<style lang="stylus" rel="stylesheet/stylus">
46

47
  .Site
48
    display: flex
49
    min-height: 100vh
50
    flex-direction: column
51
    .Site-content
52
      flex: 1
53
      padding-top:20px
54
      .router-fade-enter-active,
55
      .router-fade-leave-active
56
        transition: opacity 0.2s
57

58
      .router-fade-enter,
59
      .router-fade-leave-active
60
        opacity: 0
61
</style>

+ 77 - 0
src/components/bench-views/WorkHead.vue

@ -0,0 +1,77 @@
1
<template>
2
	<div class="workHeader">
3
		<div class="workHeaderWrapper">
4
				<ul class="workHeaderMain">
5
					<li>
6
						<a href="http://www.ekexiu.com" target="_blank" >
7
							<h1 class="kexiuLogo"></h1>
8
						</a>
9
					</li>
10
					<li>
11
						<div class="loginLogo">
12
							<img src="./img/home_icon_logo_orange.png"/>
13
						</div>
14
					</li>
15
				</ul>
16
		</div>
17
	</div>
18
</template>
19

20
<script>
21
	export default {
22
		
23
	}
24
</script>
25

26
<style lang="stylus" rel="stylesheet/stylus">
27
  @import '../../common/stylus/mixin'
28

29
	.workHeader
30
	  .workHeaderWrapper
31
	    width:100%
32
	    height:60px
33
	    background:#fff
34
	    border-bottom:2px solid #e5e5e5
35
	    box-sizing:border-box
36
	    position:fixed
37
	    top:0
38
	    left:0
39
	    right:0
40
	    z-index:1000
41
	    font-size:16px
42
	    line-height:32px
43
	    display:flex
44
	    display:-webkit-flex
45
	    justify-content:center
46
	  .workHeaderMain
47
	    width:1100px
48
	    padding:0 10px
49
	    display:flex
50
	    display:-webkit-flex
51
	    justify-content:space-between
52
	    li
53
	      display:flex
54
	      display:-webkit-flex
55
	      align-items:center
56
		    .kexiuLogo
57
		      width:60px
58
		      height:30px
59
		      bg-image('./img/home_icon_logo_orange.png')
60
		      background-size:contain
61
		      overflow:hidden
62
		    .loginLogo
63
		      overflow:hidden
64
		      border:1px solid #e5e5e5
65
		      vertical-align:middle
66
		      text-align:center
67
		      cursor:pointer
68
		      border-radius:4px
69
		      display:table-cell
70
		      width:42px
71
		      height:42px
72
		      img
73
		        max-width:40px
74
		        max-height:100%
75
		        overflow-y:hidden
76
		        color:transparent  
77
</style>

+ 3 - 0
src/components/bench-views/WorkHome.vue

@ -0,0 +1,3 @@
1
<template>
2
	<div>我是工作台主页</div>
3
</template>

二進制
src/components/bench-views/img/home_icon_logo_orange.png


+ 40 - 35
src/components/form-views/loginPlat.vue

@ -1,35 +1,40 @@
1
<template>
2
  <div class="login">
3
    <div class="logo-wrapper"></div>
4
    <div class="form-wrapper">
5
      <form class="form-contain">
6
        <p class="form-title">登录平台工作台</p>
7
        <ul class="form-ul">
8
          <li>
9
            <input type="email" class="frmtype" hidden autocomplete="off"/>
10
            <input type="email" class="frmtype companyEmail" placeholder="请输入邮箱账号" autocomplete="off"/>
11
            <div class="frmmsg">333</div>
12
          </li>
13
          <li>
14
            <input type="password" class="frmtype" placeholder="请输入登录密码"/>
15
            <div class="frmmsg msgLog2"><span></span></div>
16
          </li>
17
          <li>
18
            <button type="button" disabled class="frmtype btnModel">登录</button>
19
            <router-link to="workBench">wwww</router-link>
20
            <router-link class="fontLink" to="">忘记密码?</router-link>
21
          </li>
22
        </ul>
23
      </form>
24
    </div>
25
  </div>
26
</template>
27
28
<script>
29
  export default {
30
  };
31
</script>
32
33
<style lang="stylus" rel="stylesheet/stylus">
34
  @import './style';
35
</style>
1
<template>
2
  <div class="login">
3
    <div class="logo-wrapper"></div>
4
    <div class="form-wrapper">
5
      <form class="form-contain">
6
        <p class="form-title">登录平台工作台</p>
7
        <ul class="form-ul">
8
          <li>
9
            <input type="email" class="frmtype" hidden autocomplete="off"/>
10
            <input type="email" class="frmtype companyEmail" placeholder="请输入邮箱账号" autocomplete="off"/>
11
            <div class="frmmsg">333</div>
12
          </li>
13
          <li>
14
            <input type="password" class="frmtype" placeholder="请输入登录密码"/>
15
            <div class="frmmsg msgLog2"><span></span></div>
16
          </li>
17
          <li>
18
            <button type="button" disabled class="frmtype btnModel" @click="login">登录</button>
19
            <router-link to="workBench">wwww</router-link>
20
            <router-link class="fontLink" to="">忘记密码?</router-link>
21
          </li>
22
        </ul>
23
      </form>
24
    </div>
25
  </div>
26
</template>
27

28
<script>
29
  export default {
30
    methods: {
31
      login() {
32
          this.$router.push({path:'/WorkHome'});
33
      }
34
    }
35
  };
36
</script>
37

38
<style lang="stylus" rel="stylesheet/stylus">
39
  @import './style';
40
</style>

+ 78 - 74
src/router/router.js

@ -1,74 +1,78 @@
1
import Main from '@/components/Main.vue';
2
3
// 全屏展示页面
4
export const loginRouter = {
5
    path: '/loginPlat',
6
    name: 'loginPlat',
7
    meta: {
8
        title: 'Login - 登录'
9
    },
10
    component: () => import('@/components/form-views/loginPlat.vue')
11
};
12
13
// 作为Main组件的子页面展示
14
export const otherRouter = {
15
  path: '/',
16
  name: 'otherRouter',
17
  redirect: '/home',
18
  component: Main,
19
  children: [
20
    { path: 'home',
21
      title: '首页',
22
      name: 'home_index',
23
      component: () => import('@/components/main-views/ViewHome.vue')
24
    },
25
    { path: 'platTrends',
26
      title: '平台动态',
27
      name: 'platTrends',
28
      component: () => import('@/components/main-views/ViewPlatTrend.vue')
29
    },
30
    { path: 'findServe',
31
      title: '找服务',
32
      name: 'findServe',
33
      component: () => import('@/components/main-views/ViewFindServe.vue')
34
    },
35
    { path: 'findResource',
36
      title: '找资源',
37
      name: 'findResource',
38
      component: () => import('@/components/main-views/ViewFindResource.vue')
39
    },
40
    { path: 'expertPool',
41
      title: '专家顾问',
42
      name: 'expertPool',
43
      component: () => import('@/components/main-views/ViewExpertPool.vue')
44
    },
45
    { path: 'cooperationAgency',
46
      title: '合作机构',
47
      name: 'cooperationAgency',
48
      component: () => import('@/components/main-views/ViewCooperationAgency.vue')
49
    },
50
    { path: 'aboutUs',
51
      title: '关于我们',
52
      name: 'aboutUs',
53
      component: () => import('@/components/main-views/ViewAboutUs.vue')
54
      // component: resolve => { require(['../components/ViewAboutUs.vue'], resolve); }
55
    },
56
    { path: 'workBench',
57
      title: '平台工作台',
58
      name: 'workBench',
59
      component: () => import('@/components/bench-views/ViewWorkBench.vue')
60
    }
61
  ]
62
};
63
64
// 作为工作台bench子页面展示
65
export const appRouter = [
66
67
];
68
69
// 所有上面定义的路由都要写在下面的routers里
70
export const routers = [
71
    loginRouter,
72
    otherRouter,
73
    ...appRouter
74
];
1
import Main from '@/components/Main.vue';
2
import WorkMain from '@/components/bench-views/WorkCommon.vue';
3
// 全屏展示页面
4
export const loginRouter = {
5
    path: '/loginPlat',
6
    name: 'loginPlat',
7
    meta: {
8
        title: 'Login - 登录'
9
    },
10
    component: () => import('@/components/form-views/loginPlat.vue')
11
};
12

13
// 作为Main组件的子页面展示
14
export const otherRouter = {
15
  path: '/',
16
  name: 'otherRouter',
17
  redirect: '/home',
18
  component: Main,
19
  children: [
20
    { path: 'home',
21
      title: '首页',
22
      name: 'home_index',
23
      component: () => import('@/components/main-views/ViewHome.vue')
24
    },
25
    { path: 'platTrends',
26
      title: '平台动态',
27
      name: 'platTrends',
28
      component: () => import('@/components/main-views/ViewPlatTrend.vue')
29
    },
30
    { path: 'findServe',
31
      title: '找服务',
32
      name: 'findServe',
33
      component: () => import('@/components/main-views/ViewFindServe.vue')
34
    },
35
    { path: 'findResource',
36
      title: '找资源',
37
      name: 'findResource',
38
      component: () => import('@/components/main-views/ViewFindResource.vue')
39
    },
40
    { path: 'expertPool',
41
      title: '专家顾问',
42
      name: 'expertPool',
43
      component: () => import('@/components/main-views/ViewExpertPool.vue')
44
    },
45
    { path: 'cooperationAgency',
46
      title: '合作机构',
47
      name: 'cooperationAgency',
48
      component: () => import('@/components/main-views/ViewCooperationAgency.vue')
49
    },
50
    { path: 'aboutUs',
51
      title: '关于我们',
52
      name: 'aboutUs',
53
      component: () => import('@/components/main-views/ViewAboutUs.vue')
54
      // component: resolve => { require(['../components/ViewAboutUs.vue'], resolve); }
55
    }
56
  ]
57
};
58

59
// 作为工作台bench子页面展示
60
export const appRouter ={
61
  path: '/',
62
  name: 'appRouter',
63
  component: WorkMain,
64
  children: [
65
    {
66
      path:  "WorkHome",
67
      titile:  '平台主页',
68
      component: () => import('@/components/bench-views/WorkHome.vue')
69
    }
70
  ]
71
}
72

73
// 所有上面定义的路由都要写在下面的routers里
74
export const routers = [
75
    loginRouter,
76
    otherRouter,
77
    appRouter
78
];