Kaynağa Gözat

修改用户信息

tenggouwa 6 yıl önce
ebeveyn
işleme
0a1c5a07e5
2 değiştirilmiş dosya ile 23 ekleme ve 11 silme
  1. 2 1
      src/assets/js/common.js
  2. 21 10
      src/views/home/login.vue

+ 2 - 1
src/assets/js/common.js

@@ -159,7 +159,7 @@ var ajax = function(that, url, params, success, method) {
         });
       } 
     }).catch(function(response){
-      console.log(response);
+      // console.log(response);
     })
   }else{
     params=that.querystring.stringify(params);
@@ -303,6 +303,7 @@ var sublogion=function(_this,pageindex,params,success){
       setcookie('id', data.userid);
       ajax(_this, _this.extendApi.getUserInfo, '', function(data) {
         if(data.code==200){
+          _this.username = data.data.base.username;
           savecookie(data.data);
           setcookie('quite', '4'); //登录状态为4.未登录为0
           bus.$emit("login","h1");

+ 21 - 10
src/views/home/login.vue

@@ -191,7 +191,7 @@
     <!-- 登录成功页面 -->
     <div class="login-block" v-if="loginTab===3">
       <div class="contain">
-        <p class="user-msg">欢迎您,{{userInfo.username}} !</p>
+        <p class="user-msg">欢迎您,{{username}} !</p>
         <div class="whole-line">
           <button v-if="hahashenqingnimabi == 0" class="whole-btn cursor" @click="golink('/apply')">申请经纪商</button>
           <button v-if="hahashenqingnimabi == 1" class="whole-btn cursor" @click="golink('/apply')">您的申请正在审核中</button>
@@ -256,10 +256,10 @@ export default{
         "password2":"",
         "resettoken":"",
       },
-      userInfo:{
+      // userInfo:{
         //base:{}
         username:'',
-      },
+      // },
       operateType:"mobile",
       areaOptions:{},
       area:"86",
@@ -341,7 +341,7 @@ export default{
       if(token){
         this.getUserInfo();
         this.loginTab=3;
-        this.userInfo.username = localStorage.getItem('block_fxeesusername');
+        this.username = localStorage.getItem('block_fxeesusername');
       }
       else{
         this.loginTab=1;
@@ -351,6 +351,7 @@ export default{
       });
       this.country();
       this.getStatus();
+      this.getUserInfo()
     })   
   },
   methods:{
@@ -796,25 +797,35 @@ export default{
       this.buttonLoad=true;      
       sublogion(this,'index',param,(data)=>{
         this.buttonLoad=false;
-        if(data.code==200){         
-          this.getUserInfo()
+        if(data.code==200){    
+            
+          
           this.$notify({
             title: '成功',
             message: '登录成功',
             type: 'success',
             duration:'1500'
           })
+          // console.log(localStorage.getItem('block_fxeesusername'))
+          if(localStorage.getItem('block_fxeesusername') == null){
+            setTimeout(()=>{
+              this.getUserInfo();
+              this.getStatus();
+            },100)
+          }else{
+            
+            
+          }
+          this.getUserInfo();
           this.getStatus();
+          
           // this.userInfo.username = localStorage.getItem('block_fxeesusername');
         }  
       });
     },
     getUserInfo(){
       getUserData(this,(data)=>{
-        //console.log(data);
-        this.userInfo.username = data.data.base.username;
-        //sessionStorage.setItem("username",data.data.base.username);
-        //bus.$emit("login","h1");
+        this.username = data.data.base.username;
       });
     },
   }