Explorar o código

Merge branch 'dev' of http://1.116.113.26:8088/zhuliu/RMS-FrontEnd into dev

zhuhao %!s(int64=2) %!d(string=hai) anos
pai
achega
a2267f9f44

+ 1 - 1
RMS-FrontEnd/public/index.html

@@ -4,7 +4,7 @@
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+    <link rel="icon" href="favicon.ico">
     <title><%= htmlWebpackPlugin.options.title %></title>
 </head>
 <body>

+ 2 - 0
RMS-FrontEnd/src/main.js

@@ -40,6 +40,8 @@ Vue.use(VueQuillEditor);
 import {reportPermission} from '@/utils/reportPermission'
 // import Directives from './directives/index'
 // Vue.use(Directives)
+import Cookies from "js-cookie";
+Vue.prototype.$cookie = Cookies
 
 Vue.config.productionTip = false
 Vue.prototype.$constants = constants

+ 19 - 2
RMS-FrontEnd/src/router/index.js

@@ -2,6 +2,7 @@ import Vue from 'vue'
 import VueRouter from 'vue-router'
 import Cookies from "js-cookie";
 import Store from '@/store'
+import config from '@/config';
 Vue.use(VueRouter)
 
 const originalPush = VueRouter.prototype.push
@@ -557,9 +558,18 @@ const router = new VueRouter({
 })
 
 router.beforeEach((to, from, next) => {
-
-  if (to.path === '/admin/login'||to.path==='/'){next()} 
+// 获取网页的来源地址
+var refull = document.referrer;
+  if (to.path === '/admin/login'||to.path==='/'){
+    if (to.meta.title) {
+      document.title = to.meta.title;
+    }
+    next()
+  } 
   else if(to.meta.allowPath){
+    if (to.meta.title) {
+      document.title = to.meta.title;
+    }
     next()
   }
   else{
@@ -567,13 +577,20 @@ router.beforeEach((to, from, next) => {
 
     switch(tokenStr){
       case undefined:
+        if (to.meta.title) {
+          document.title = to.meta.title;
+        }
         next({name:'Login',params:{ redirect:to.fullPath}})
         break
       default:
+        if (to.meta.title) {
+          document.title = to.meta.title;
+        }
         next()
         break;
     }
   }
+
   
   // 增加判断条件
   // if (tokenStr)

+ 1 - 0
RMS-FrontEnd/src/views/layout/components/UserBar.vue

@@ -156,6 +156,7 @@ export default {
       switch (command) {
         case 'doLogout':
           this.$api.adminLogout().then(response => {
+            this.$cookie.remove("token")
             this.$router.push({ path: '/admin/login' })
           })
           break;

+ 25 - 23
RMS-FrontEnd/src/views/login/index.vue

@@ -194,32 +194,34 @@ export default {
     }else{
       this.show = true
     }
-    if(!this.canShow){
-      var url=location.href;
-      var params=url.split("?");
-        if(params[1]){
-          var a = params[1]
-            var b= a.split("=")
-            // console.log(b[1])
-            if(b){
-              var token=b[1]
-              this.$api.IsadminLogin({token:token}).then(response=>{
-                // console.log(response)
-                if (response.data == true) {
-                  Cookies.set("token", token);
-                  this.$router.push({
-                      path: '/admin/rManage'
-                    })
-                }else{
-                  this.$message.error('您未登录,请重新登录!')
-                }
+
+    // if(!this.canShow){
+    //   var url=location.href;
+    //   var params=url.split("?");
+    //     if(params[1]){
+    //       var a = params[1]
+    //         var b= a.split("=")
+    //         // console.log(b[1])
+    //         if(b){
+    //           var token=b[1]
+    //           this.$api.IsadminLogin({token:token}).then(response=>{
+    //             // console.log(response)
+    //             if(response.data==true){
+    //               Cookies.set("token", token);
+    //               this.$router.push({
+    //                   path: '/admin/rManage'
+    //                 })
+    //             }else{
+    //               this.$message.error('您未登录,请重新登录!')
+    //             }
+
                 
-              })
+    //           })
               
-            }
+    //         }
   
-        }
-      }
+    //     }
+    //   }
     this.initTime();
    
   },