export async function loginUser (data) { return new Promise(resolve => { try { console.log('用户登录service!', data) let baseUrl = '/api/user/login/' const res = window.$echarts_w .post(baseUrl, data) console.log('成功认证', res) // 只返回username localStorage.setItem( 'yma16siteUserInfo', JSON.stringify({ username: data.name, // 保存一个用户名 password: data.password }) ) resolve(true) } catch (r) { console.log('登录失败!', r) resolve(false) } }) }