Selaa lähdekoodia

路由跳转效果优化

wenglk 6 vuotta sitten
vanhempi
commit
ad265b935c
4 muutettua tiedostoa jossa 25 lisäystä ja 10 poistoa
  1. 4 0
      src/main.js
  2. 18 8
      src/views/brokers/nBodytwo.vue
  3. 1 0
      src/views/brokers/nHeader.vue
  4. 2 2
      src/views/home/contTwo.vue

+ 4 - 0
src/main.js

@@ -22,3 +22,7 @@ new Vue({
   template: '<App/>',
   
 })
+
+router.afterEach((to,from,next) => {
+    window.scrollTo(0,0);
+});

+ 18 - 8
src/views/brokers/nBodytwo.vue

@@ -119,24 +119,34 @@
         		word:'5.经纪商可在后台查看直发客户及代理客户的交易统计表;'
         	}
         ],
-        applyform:[],
+        applyform:{
+          company:'',
+          contacts:'',
+          mobile_area:'',
+          other:'',
+          country:'',
+          area:''
+        },
       }; 
     },
 
     methods:{
       loadsession: function(){
         this.Authorization = sessionStorage.getItem('token_code')? sessionStorage.getItem('token_code'):'';
-        this.axios.get('https://dev407.33.cn/api/broker/applystatus',{headers:{Authorization: this.Authorization}}).then((res)=>{
-          console.log(res.data.data.info);
-          this.applyform = res.data.data.info;
-        }).catch((err)=>{
-          console.log(err);
-        })
+        if(this.Authorization != ''){
+          this.axios.get('https://dev407.33.cn/api/broker/applystatus',{headers:{Authorization: this.Authorization}}).then((res)=>{
+            this.applyform = res.data.data.info;
+          }).catch((err)=>{
+            console.log(err);
+          })
+        }
       }
     },
+    watch:{
+      '$route' : 'loadsession'
+    },
     mounted(){
       this.loadsession();
-      
     }
   }
 </script>

+ 1 - 0
src/views/brokers/nHeader.vue

@@ -65,6 +65,7 @@
 							sessionStorage.setItem('usertip',this.usertip);
 							sessionStorage.setItem('username',this.username);
 							sessionStorage.setItem('token_code',this.Authorization);
+							this.$router.push({path:'/home'});
 						}
 				})
 			},

+ 2 - 2
src/views/home/contTwo.vue

@@ -14,7 +14,7 @@
 						<h5>{{msg.tip1}}</h5>
 						<p>{{msg.detail1}}</p>
 						<img :src="msg.src1">
-						<router-link to='/brokers'>
+						<router-link to='/apply'>
 							<div class="apply-btn" v-show='msg.hover1==true'>立即申请经纪商<span>></span></div>
 						</router-link>
 					</div>
@@ -23,7 +23,7 @@
 						<h5>{{msg.tip2}}</h5>
 						<p>{{msg.detail2}}</p>
 						<img :src="msg.src2">
-						<router-link to='/brokers'>
+						<router-link to='/apply'>
 							<div class="apply-btn" v-show='msg.hover2==true'>立即申请经纪商<span>></span></div>
 						</router-link>
 					</div>