• iViewadmin数据请求跨域处理


    main.js中的要改成这样

    import axios from 'axios';
    var instance = axios.create({
    baseURL: 'http://192.168.10.67/api',
    timeout: 5000,
    });
    Vue.prototype.$axios = instance;

    在logo.vue页面

    var  params = {
    userName:__this.form.userName,
    userPwd:__this.form.password
    };
    if (__this.form.userName !== '' && __this.form.password !== '') {
    __this.$axios.post('/login/checkLogin',JSON.stringify(params), {
    headers: {
    "Content-Type":'application/json'
    }})
    .then(response=>{
    if(response.status == "200"){
    Cookies.set("token",response.data.data);
    if(response.data.msg =="success"){
    let admin_info = eval("("+response.config.data+")");
    console.log(admin_info);
    let ___this = __this;
    ___this.show = false;
    if (valid) {
    Cookies.set('user', ___this.form.userName);
    Cookies.set('password', ___this.form.password);
    ___this.$store.commit('setAvator', 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3448484253,3685836170&fm=27&gp=0.jpg');
    if (___this.form.userName === admin_info.userName && ___this.form.password === admin_info.userPwd) {
    Cookies.set('access', 0);
    } else {

    Cookies.set('access', 1);
    }
    ___this.$router.push({
    name: 'home_index'
    });
    }
    }else{
    console.log("登录失败");
    }
    }else {
    throw new Error("sss");
    }
    }).then(data=>{
    })
  • 相关阅读:
    洛谷
    洛谷
    洛谷
    洛谷
    模板
    .
    洛谷
    洛谷
    洛谷
    poj 2955"Brackets"(区间DP)
  • 原文地址:https://www.cnblogs.com/boonook/p/8949361.html
Copyright © 2020-2023  润新知