sunny 2 anni fa
parent
commit
cefb4288ed

+ 2 - 1
package.json

@@ -21,7 +21,8 @@
     "@vue/cli-service": "~5.0.0",
     "eslint": "^7.32.0",
     "eslint-plugin-vue": "^8.0.3",
-    "vue-template-compiler": "^2.6.14"
+    "vue-template-compiler": "^2.6.14",
+    "element-ui": "^2.15.12"
   },
   "eslintConfig": {
     "root": true,

+ 57 - 17
src/App.vue

@@ -1,32 +1,72 @@
 <template>
   <div id="app">
-    <nav>
-      <router-link to="/">Home</router-link> |
-      <router-link to="/about">About</router-link>
-    </nav>
-    <router-view/>
+    <div class="view-container">
+      <AppHeader></AppHeader>
+      <router-view />
+    </div>
+    
   </div>
 </template>
-
+<script lang="ts">
+import AppHeader from '@/components/AppHeader.vue';
+export default {
+  name: 'app',
+  components: {
+    AppHeader,
+  },
+  data() {
+    return {
+      isGray: false,
+    };
+  },
+  created() {
+    
+  },
+}
+</script>
 <style>
-#app {
-  font-family: Avenir, Helvetica, Arial, sans-serif;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-  text-align: center;
-  color: #2c3e50;
+.view-container{
+  position: relative;
+  margin: 0 auto;
+  width: 100%;
+  max-width: 1200px;
+}
+
+.header-box {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  position: fixed;
+  top: 0;
+  left: 0;
+  right: 0;
+  background: #fff;
+  border-bottom: 1px solid #f1f1f1;
+  color: #909090;
+  height: 5rem;
+  z-index: 250;
 }
 
-nav {
-  padding: 30px;
+.header-item {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+  padding: 0 80px;
 }
 
 nav a {
   font-weight: bold;
-  color: #2c3e50;
+  color: #515767;
 }
 
-nav a.router-link-exact-active {
-  color: #42b983;
+nav a.router-link-active {
+  color: #1e80ff;
+}
+
+
+.header-item i {
+  font-size: 30px;
+  margin-bottom: 5px;
 }
 </style>

+ 22 - 0
src/assets/css/global.css

@@ -0,0 +1,22 @@
+html {
+    word-break: break-word;
+    text-rendering: optimizeLegibility;
+    color: #333;
+    background-color: #f2f3f5;
+}
+body{
+    margin: 0;
+    line-height: normal;
+}
+
+ul {
+    padding: 0;
+    margin: 0;
+}
+li {
+    list-style: none;
+}
+a {
+    text-decoration: none;
+    background-color: transparent;
+  }

+ 24 - 0
src/components/AppHeader.vue

@@ -0,0 +1,24 @@
+<template>
+    <div style="position: relative;height: 5rem;">
+        <nav class="header-box">
+            <router-link to="/home">
+                <div class="header-item">
+                    <i class="el-icon-s-home"></i>首页
+                </div>
+            </router-link>
+            <router-link to="/noticeCenter">
+                <div class="header-item">
+                    <el-badge :value="2" class="item">
+                        <i class="el-icon-message-solid"></i>
+                    </el-badge>
+                    通知中心
+                </div>
+            </router-link>
+            <router-link to="/pointsRank">
+                <div class="header-item">
+                    <i class="el-icon-trophy"></i>积分排行
+                </div>
+            </router-link>
+        </nav>
+    </div>
+</template>

+ 36 - 0
src/components/AppSidebar.vue

@@ -0,0 +1,36 @@
+<template>
+    <nav class="side-navigator-wrap">
+        <div class="nav-item-wrap">
+            <div class="nav-item-content">
+                <router-link to="/home/employeeDynamics">
+                    <i class="el-icon-s-home"></i>员工动态
+                </router-link>
+            </div>
+        </div>
+
+        <div class="nav-item-wrap">
+            <div class="nav-item-content">
+                <router-link to="/home/pointsMall">
+                        <i class="el-icon-s-home"></i>积分商城
+                    </router-link>
+            </div>
+        </div>
+        <div class="nav-item-wrap">
+            <div class="nav-item-content">
+                <router-link to="/home/festiveEvents">
+                        <i class="el-icon-s-home"></i>节日活动
+                    </router-link>
+            </div>
+        </div>
+    </nav>
+</template>
+<style scoped>
+li a {
+    font-weight: bold;
+    color: #515767;
+}
+
+li a.router-link-active {
+    color: #1e80ff;
+}
+</style>

+ 0 - 59
src/components/HelloWorld.vue

@@ -1,59 +0,0 @@
-<template>
-  <div class="hello">
-    <h1>{{ msg }}</h1>
-    <p>
-      For a guide and recipes on how to configure / customize this project,<br>
-      check out the
-      <a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
-    </p>
-    <h3>Installed CLI Plugins</h3>
-    <ul>
-      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
-      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
-      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
-    </ul>
-    <h3>Essential Links</h3>
-    <ul>
-      <li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
-      <li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
-      <li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
-      <li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
-      <li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
-    </ul>
-    <h3>Ecosystem</h3>
-    <ul>
-      <li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
-      <li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
-      <li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
-      <li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
-      <li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
-    </ul>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'HelloWorld',
-  props: {
-    msg: String
-  }
-}
-</script>
-
-<!-- Add "scoped" attribute to limit CSS to this component only -->
-<style scoped>
-h3 {
-  margin: 40px 0 0;
-}
-ul {
-  list-style-type: none;
-  padding: 0;
-}
-li {
-  display: inline-block;
-  margin: 0 10px;
-}
-a {
-  color: #42b983;
-}
-</style>

+ 4 - 1
src/main.js

@@ -1,9 +1,12 @@
 import Vue from 'vue'
 import App from './App.vue'
 import router from './router'
-
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+import './assets/css/global.css';
 Vue.config.productionTip = false
 
+Vue.use(ElementUI);
 new Vue({
   router,
   render: h => h(App)

+ 28 - 10
src/router/index.js

@@ -6,22 +6,40 @@ Vue.use(VueRouter)
 
 const routes = [
   {
-    path: '/',
-    name: 'home',
-    component: HomeView
+    path:'/',
+    redirect:'/home',
   },
   {
-    path: '/about',
-    name: 'about',
-    // route level code-splitting
-    // this generates a separate chunk (about.[hash].js) for this route
-    // which is lazy-loaded when the route is visited.
-    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
+    path: '/home',
+    component: HomeView,
+    redirect:'/home/employeeDynamics',
+    children: [
+      {
+        path: '/home/employeeDynamics',
+        component: () => import('@/views/HomeView/EmployeeDynamics.vue')
+      },
+      {
+        path: '/home/pointsMall',
+        component: () => import('@/views/HomeView/PointsMall.vue')
+      },
+      {
+        path: '/home/festiveEvents',
+        component: () => import('@/views/HomeView/FestiveEvents.vue')
+      }
+    ]
+  },
+  {
+    path: '/noticeCenter',
+    component: () => import('../views/NoticeCenter.vue')
+  },
+  {
+    path: '/pointsRank',
+    component: () => import('../views/PointsRank.vue')
   }
 ]
 
 const router = new VueRouter({
-  routes
+  routes,
 })
 
 export default router

+ 0 - 5
src/views/AboutView.vue

@@ -1,5 +0,0 @@
-<template>
-  <div class="about">
-    <h1>This is an about page</h1>
-  </div>
-</template>

+ 31 - 6
src/views/HomeView.vue

@@ -1,18 +1,43 @@
 <template>
-  <div class="home">
-    <img alt="Vue logo" src="../assets/logo.png">
-    <HelloWorld msg="Welcome to Your Vue.js App"/>
+  <div class="main-container">
+    <div class="index-nav">
+      <AppSidebar></AppSidebar>
+    </div>
+    <router-view />
   </div>
 </template>
 
 <script>
-// @ is an alias to /src
-import HelloWorld from '@/components/HelloWorld.vue'
+import AppSidebar from '@/components/AppSidebar.vue'
 
 export default {
   name: 'HomeView',
   components: {
-    HelloWorld
+    AppSidebar
   }
 }
 </script>
+<style scoped>
+.main-container{
+  position: relative;
+    margin: 0 auto;
+    width: 100%;
+  max-width: 1200px;
+  margin-top: 1.66rem;
+  display: flex;
+}
+.index-nav{
+  width: 180px;
+    position: -webkit-sticky;
+    position: sticky;
+    top: 80px;
+    margin-right: 20px;
+    height: -webkit-fit-content;
+    height: -moz-fit-content;
+    height: fit-content;
+    border-radius: 4px;
+    background-color: var(--juejin-font-white);
+    max-height: calc(100vh - 101px);
+    overflow-x: hidden;
+}
+</style>

+ 5 - 0
src/views/HomeView/EmployeeDynamics copy 2.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="EmployeeDynamics">
+        员工动态
+    </div>
+</template>

+ 5 - 0
src/views/HomeView/EmployeeDynamics copy 3.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="EmployeeDynamics">
+        员工动态
+    </div>
+</template>

+ 5 - 0
src/views/HomeView/EmployeeDynamics copy 4.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="EmployeeDynamics">
+        员工动态
+    </div>
+</template>

+ 5 - 0
src/views/HomeView/EmployeeDynamics copy 5.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="EmployeeDynamics">
+        员工动态
+    </div>
+</template>

+ 5 - 0
src/views/HomeView/EmployeeDynamics.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="EmployeeDynamics">
+        员工动态
+    </div>
+</template>

+ 5 - 0
src/views/HomeView/FestiveEvents.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="FestiveEvents">
+        节日活动
+    </div>
+</template>

+ 5 - 0
src/views/HomeView/PointsMall.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="PointsMall">
+        积分商城
+    </div>
+</template>

+ 5 - 0
src/views/NoticeCenter.vue

@@ -0,0 +1,5 @@
+<template>
+  <div class="noticeCenter">
+    <h1>通知中心</h1>
+  </div>
+</template>

+ 5 - 0
src/views/PointsRank.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="pointsRank">
+      <h1>积分排行</h1>
+    </div>
+  </template>