浏览代码

溧水app-404页面修改、OA登录修改

sunyadv 5 年之前
父节点
当前提交
ac17c8d1bf
共有 4 个文件被更改,包括 54 次插入7 次删除
  1. 1 1
      lss_vue/src/App.vue
  2. 二进制
      lss_vue/src/assets/image/404.png
  3. 47 2
      lss_vue/src/main.js
  4. 6 4
      lss_vue/src/views/404.vue

+ 1 - 1
lss_vue/src/App.vue

@@ -23,7 +23,7 @@
                 this.isRouterAlive = false;
                 this.$nextTick(function(){
                     this.isRouterAlive = true;
-                })
+                });
             }
         },
     }

二进制
lss_vue/src/assets/image/404.png


+ 47 - 2
lss_vue/src/main.js

@@ -43,16 +43,61 @@ const router = new VueRouter({
     routes
 })
 
-
 router.beforeEach((to, from, next) => {
     if (to.path == '/login') {
         sessionStorage.clear();
     }
 
     let user = JSON.parse(sessionStorage.getItem('user'));
-    if (!user && to.path != '/login') {
+    if (!user && to.path != '/login' && to.path != '/404') {
+        console.log(11123)
         next({ path: '/login' })
     } else {
+        if(to.path == '/login'){
+            var url = location.hash;
+            var theRequest = new Object();
+            if (url.indexOf("?") != -1) {
+                var str = url.split("?")[1].substr(1);
+                var strs = str.split("&");
+                for(var i = 0; i < strs.length; i ++) {
+                    theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
+                }
+                Vue.prototype.$indicator.open();
+                Vue.prototype.http.post(Vue.prototype.port.manage.login, {
+                    "loginName": theRequest.sername,
+                    "password": theRequest.password,
+                } , res => {
+                    Vue.prototype.$indicator.close();
+                    if (res.code == "ok") {
+                        sessionStorage.setItem('user', JSON.stringify(res.data));
+                        var str = '';
+                        for(var i in res.data.functions) {
+                            str += res.data.functions[i].code + ",";
+                        }
+                        sessionStorage.setItem('power',str);
+                        sessionStorage.setItem('assetsTab',-1);
+                        next({ path: '/assets' });
+                    } else {
+                        Vue.prototype.$toast({
+                            message: res.msg,
+                            duration: 2000
+                        });
+                        next({ path: '/404' });
+                    }
+                }, error => {
+                    Vue.prototype.$indicator.close();
+                    Vue.prototype.$toast({
+                        message: error,
+                        duration: 2000
+                    });
+                    next({ path: '/404' });
+                })
+            } else {
+                next();
+            }
+            return false;
+        }
+
         if(to.path == '/assets' || to.path == '/data' || to.path == '/my') {
             $(".tabber").show();
         } else {

+ 6 - 4
lss_vue/src/views/404.vue

@@ -3,9 +3,10 @@
         <div class="page-img">
             <img src="../assets/image/404.png" />
         </div>
-        <p class="page-container"><b>Error</b>  非常抱歉你访问的页面不存在!!!</p>
+        <p class="page-container"><b>Error</b>  页面加载失败!!!</p>
         <div class="page-button">
-            <el-button type="primary" round @click="back" icon="el-icon-s-promotion">返回首页</el-button>
+            <!-- <el-button type="primary" @click="back" icon="el-icon-s-promotion" style="color:#93ADFA">点击重新加载</el-button> -->
+            <a @click="back" style="color:#93ADFA">点击重新加载</a>
         </div>
     </div>
 </template>
@@ -19,7 +20,8 @@
 		},
 		methods: {
             back() {
-                this.$router.push('/map');
+                // this.$router.go(-1);
+                window.history.back()
             }
         },
         created() {
@@ -36,7 +38,7 @@
         padding: 100px 0 0 0 ;
 
         img {
-            width: 600px;
+            width: 2rem;
         }
     }