zoukankan      html  css  js  c++  java
  • vue微博回调空页面

    1.vue微博回调空页面

      注:微博回调空页面为: http://127.0.0.1:8888/oauth/callback/

    1.1 页面路径components\oauth.vue

    <template>  
        <div>    
            <p>跳转中....</p>  
        </div> 
    </template> 
    <script> 
    import { oauth_callback_post } from './axios_api/api' 
    export default {  
        mounted() {    
            this.getCode()  
    }, 
         methods: { 
             getCode() {
                 let code = this.$route.query.code             
                 console.log(this.$route.query) 
    
                let params = { code: code }                      
                oauth_callback_post(params).then((resp) => {    
                    console.log(resp)
                    if (resp.data.type == '0') {
    
                    let res = resp.data
    
                   localStorage.setItem('username', res.username)         
                 // localStorage.setItem('img', res.img)                              
                    localStorage.setItem('token', res.token)           
                   localStorage.setItem('uid', res.id)           
                   this.login_username = res.username          
                    this.opened = false
                    // alert(res.message) 
             
    
                  this.$router.push('/')
                    }
    
               if (resp.data.type == '1') {          
                       this.visiable = true         
                     this.uid = resp.data.uid        
    }      })    },  } }
    
    </script>
    
    
    
    
                                            
    components\oauth.vue
  • 相关阅读:
    暑假日报-11
    暑假日报-10
    暑假日报-9
    暑假日报-8
    暑假日报-7
    暑假日报-6
    暑假日报-5
    暑假日报-4
    暑假日报-3
    第二次集训的每日感想
  • 原文地址:https://www.cnblogs.com/xiaoxiamiaichiyu/p/13797684.html
Copyright © 2011-2022 走看看