import Ajax from '../../util/ajax' import api from '../../util/api' const http = new Object http.getCaptcha = (data) => { // 获取验证码 console.log(data) return new Promise((resolve, reject) => { Ajax(api.user.captcha.url, { method: api.user.captcha.method, queryData: { phone: data } }).then(res => { resolve(res) }).catch((err) => { reject(err) }) }) } http.submitData = (data) => { // 登陆 console.log(data) return new Promise((resolve, reject) => { Ajax(api.login.login.url, { method: api.login.login.method, data: data }).then(res => { resolve(res) }).catch((err) => { reject(err) }) }) } export default { namespaced: true, state: {}, mutations: {}, actions: { getCaptcha (data) { return new Promise((resolve) => { http.getCaptcha(data).then((res) => { resolve(res) }) }) }, submitData(data) { return new Promise((resolve) => { http.submitData(data).then((res) => { resolve(res) }) }) } } }