You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 년 전
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const http = require("../api/index");
  2. export const POSTMODEL = function (url) {
  3. return function (params) {
  4. return new Promise((resolve, reject) => {
  5. http.post(url, params, function (response) {
  6. if (response.code == 200) {
  7. resolve(response.data)
  8. } else {
  9. wx.showModal({
  10. title: '错误信息',
  11. content: response.msg,
  12. confirmText: '知道了',
  13. showCancel: false,
  14. success(res1) {
  15. if (res1.confirm) {
  16. reject(response)
  17. }
  18. }
  19. })
  20. }
  21. })
  22. })
  23. }
  24. }
  25. export const GETMODEL = function (url) {
  26. return function (params) {
  27. return new Promise((resolve, reject) => {
  28. http.get(url, params, function (response) {
  29. if (response.code == 200) {
  30. resolve(response.data)
  31. } else if (response.code == 404) {
  32. let code = 404;
  33. reject(code)
  34. } else {
  35. wx.showModal({
  36. title: '错误信息',
  37. content: response.msg,
  38. confirmText: '知道了',
  39. showCancel: false,
  40. success(res1) {
  41. if (res1.confirm) {
  42. reject(response)
  43. }
  44. }
  45. })
  46. }
  47. })
  48. })
  49. }
  50. }