微信

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import Ajax from '../../util/ajax'
  2. import api from '../../util/api'
  3. const http = new Object
  4. http.getCaptcha = (data) => { // 获取验证码
  5. console.log(data)
  6. return new Promise((resolve, reject) => {
  7. Ajax(api.user.captcha.url, {
  8. method: api.user.captcha.method,
  9. queryData: {
  10. phone: data
  11. }
  12. }).then(res => {
  13. resolve(res)
  14. }).catch((err) => {
  15. reject(err)
  16. })
  17. })
  18. }
  19. http.submitData = (data) => { // 登陆
  20. console.log(data)
  21. return new Promise((resolve, reject) => {
  22. Ajax(api.login.login.url, {
  23. method: api.login.login.method,
  24. data: data
  25. }).then(res => {
  26. resolve(res)
  27. }).catch((err) => {
  28. reject(err)
  29. })
  30. })
  31. }
  32. export default {
  33. namespaced: true,
  34. state: {},
  35. mutations: {},
  36. actions: {
  37. getCaptcha (data) {
  38. return new Promise((resolve) => {
  39. http.getCaptcha(data).then((res) => {
  40. resolve(res)
  41. })
  42. })
  43. },
  44. submitData(data) {
  45. return new Promise((resolve) => {
  46. http.submitData(data).then((res) => {
  47. resolve(res)
  48. })
  49. })
  50. }
  51. }
  52. }