Browse Source

登录 5-24

zhaomiao 3 years ago
parent
commit
bb837455e3
5 changed files with 26 additions and 17 deletions
  1. BIN
      public/static/images/login.jpg
  2. 8 8
      src/assets/css/base.scss
  3. 12 4
      src/assets/css/login.scss
  4. 4 5
      src/router/index.js
  5. 2 0
      src/views/login.vue

BIN
public/static/images/login.jpg


+ 8 - 8
src/assets/css/base.scss

@@ -337,14 +337,14 @@ img {
 }
 
 /***框架样式 - 开始***/
-// html,
-// body,
-// #app {
-//   height: 100%;
-//   overflow: hidden;
-//   position: relative;
-//   z-index: 1;
-// }
+html,
+body,
+#app {
+  height: 100%;
+  overflow: hidden;
+  position: relative;
+  z-index: 1;
+}
 
 .comReport{
   width: 100%;

+ 12 - 4
src/assets/css/login.scss

@@ -1,12 +1,20 @@
-$bg:#2d3a4b;
+$bg:#fff;
 $dark_gray:#889aa4;
 $light_gray:#eee;
-.login-container{
+.bg{
   background:url("/static/img/login.jpg") center center no-repeat;
   background-size:100% 100%;
-  width: 100%;
+  height: 100%;
+  display:flex;
+  align-items:center;
+  justify-content:center;
+}
+.login-container{
+  background: $bg;
+  box-shadow: 0 15px 30px 0 rgba(0,0,0,0.3);
+  border-radius: 9px;
+  width: 50%;
   height: 330px;
-  margin-top: 9%;
   display: flex;
   justify-content: center;
   flex-direction: row ;

+ 4 - 5
src/router/index.js

@@ -73,11 +73,10 @@ const router = new VueRouter({
  * 路由的钩子函数,处理是否登录的判断
  * **/
  router.beforeEach((to, from, next) => {
-    // 登录后登录页面处理办法
-  // if(to.path === '/login' && store.getters.authToken){
-  //   next({path: '/'})
-  // }else
-   if (to.matched.some(m => m.meta.requireAuth)) {    // 需要登录
+    // 登录后登录处理办法
+  if(to.path === '/login' && store.getters.authToken){
+    next({path: '/'})
+  }else if (to.matched.some(m => m.meta.requireAuth)) {    // 需要登录
     if(window.localStorage.authToken){
       next()
     } else if (to.path !== '/login') {

+ 2 - 0
src/views/login.vue

@@ -1,4 +1,5 @@
 <template>
+<div class="bg">
   <div class="login-container">
     <div class="pic">
       <img src="@/assets/images/log3.png">
@@ -15,6 +16,7 @@
       </el-form-item>
     </el-form>
   </div>
+  </div>
 </template>
 
 <script>