Browse Source

跳转企业列表条件调整

hy 7 years ago
parent
commit
a492a1ff21

+ 5 - 1
frontend/saas-portal-web/src/components/conenter/enterprise.vue

@@ -17,7 +17,7 @@
             </div>
             </div>
             <div class="collapse navbar-collapse navbar-right" role="navigation">
             <div class="collapse navbar-collapse navbar-right" role="navigation">
                 <ul id="nav" class="nav navbar-nav menu">
                 <ul id="nav" class="nav navbar-nav menu">
-                    <li><router-link to="/home"><a href="#"><span style="color: white">首页</span></a></router-link></li>
+                    <li><router-link to="/home"><a href="#" @click="setTurnHome"><span style="color: white">首页</span></a></router-link></li>
                     <li><a href="https://uas.usoftchina.com/about" target="_blank"><span>关于我们</span></a></li>
                     <li><a href="https://uas.usoftchina.com/about" target="_blank"><span>关于我们</span></a></li>
                     <li style="margin-left:30px;margin-top: 13px;cursor: pointer;">
                     <li style="margin-left:30px;margin-top: 13px;cursor: pointer;">
                         <span style="color:#fff;font-size: 16px;">
                         <span style="color:#fff;font-size: 16px;">
@@ -197,6 +197,10 @@ import { setTimeout } from 'timers';
             tabswitch(index){
             tabswitch(index){
                 this.nowindex = index;
                 this.nowindex = index;
             },
             },
+            setTurnHome(){
+                debugger
+                this.$parent.turnHome = true
+            },
             //退出
             //退出
             loginout(){
             loginout(){
                 const frame = window.frames[window.frames.length - 1]
                 const frame = window.frames[window.frames.length - 1]

+ 21 - 12
frontend/saas-portal-web/src/components/conenter/home.vue

@@ -17,7 +17,7 @@
             </div>
             </div>
         <div class="collapse navbar-collapse navbar-right" role="navigation">
         <div class="collapse navbar-collapse navbar-right" role="navigation">
           <ul @click="gohome" id="nav" class="nav navbar-nav menu">
           <ul @click="gohome" id="nav" class="nav navbar-nav menu">
-            <li><a href="#"><span>首页</span></a></li>
+            <li><a href="#" @click="setTurnHome"><span>首页</span></a></li>
             <li><a href="https://www.usoftchina.com/" target="_blank"><span>优软云</span></a></li>
             <li><a href="https://www.usoftchina.com/" target="_blank"><span>优软云</span></a></li>
             <li>
             <li>
               <a href="#feature"><span>特色</span></a>
               <a href="#feature"><span>特色</span></a>
@@ -262,11 +262,20 @@
       } else {
       } else {
         this.isproblem = this.$route.params.isporblem
         this.isproblem = this.$route.params.isporblem
       };
       };
+      let token;
+      if(localStorage.getItem('app-state-session')){
+        let mytoken = JSON.parse(localStorage.getItem('app-state-session'));
+        token = String(mytoken.token);
+      }
       this.$ajax({
       this.$ajax({
         url: this.$url.api+'/api/auth/info',
         url: this.$url.api+'/api/auth/info',
         method: 'get',
         method: 'get',
         async:false,
         async:false,
-        withCredentials:true
+        withCredentials:true,
+        headers: {
+            "Authorization":token,
+            "Content-Type":"application/x-www-form-urlencoded"
+        }
       })
       })
       .then(res=>{
       .then(res=>{
         const data=res.data.data;
         const data=res.data.data;
@@ -276,18 +285,15 @@
           session.account = account
           session.account = account
           Session.set(session);
           Session.set(session);
           this.account = Session.getAccount();
           this.account = Session.getAccount();
-          //有企业信息时 第一次访问页面 跳转企业列表
+          //有企业信息时 跳转企业列表
           if(account.companies.length>0){
           if(account.companies.length>0){
-            //监听访问首页的次数
-            if(!localStorage.VisitCount){
-              localStorage.VisitCount = '1'
-            }else{
-              localStorage.VisitCount = (Number(localStorage.VisitCount) + 1 ) + ''
-            }
-            if(localStorage.VisitCount=='1'){
               const me = this || _this;
               const me = this || _this;
-              me.$router.push({path: '/enterprise'})
-            }
+              //点击首页按钮时不跳转企业列表
+              if(!me.$parent.turnHome){
+                me.$router.push({path: '/enterprise'})
+              }else{
+                me.$parent.turnHome = false
+              }
           }
           }
         }
         }
       })
       })
@@ -344,6 +350,9 @@
           frame.postMessage(JSON.stringify(session), '*')
           frame.postMessage(JSON.stringify(session), '*')
         })
         })
       },
       },
+      setTurnHome(){
+        this.turnHome = true
+      },
       login() {
       login() {
         // 显示账户中心登录窗口
         // 显示账户中心登录窗口
         this.isLogin = true
         this.isLogin = true