12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- 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)
- })
- })
- }
- }
- }
|