zoukankan      html  css  js  c++  java
  • 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=>{
    })
  • 相关阅读:
    tar.gz 查看原文件大小
    ssh2 和 ssh 的公钥转换
    MySQL binlog 导入
    app自动测试-微信(android)-web-1
    crontab中执行java程序的脚本
    tomcat 启动慢解决(/dev/random)
    app自动测试-微信(iOS)-web-1
    git
    java.lang.OutOfMemoryError: unable to create new native thread
    docker (centOS 7) 使用笔记6
  • 原文地址:https://www.cnblogs.com/boonook/p/8949361.html
Copyright © 2011-2022 走看看