import axios from "axios"; export function loginUser(data) { console.log("用户登录service!", data); let baseUrl = "/api/user/login/"; let res = null; axios .post(baseUrl, data) .then((o) => { res = o; console.log("成功认证", res); // 只返回username localStorage.setItem( "yma16siteUserInfo", JSON.stringify({ username: data.name, //保存一个用户名 password: data.password, }) ); }) .catch((r) => { console.log("登录失败!", r); }); return res; }