matchExt.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import { defineStore } from 'pinia'
  2. import { AxiosWrapper } from '@/utils/axios-wrapper'
  3. import { get } from 'lodash-es'
  4. const url = '/matchExt'
  5. const axios = new AxiosWrapper()
  6. export const MatchExtStore = defineStore('matchExt', () => {
  7. const query = async ({ skip = 0, limit = undefined, ...info } = {}) => {
  8. let cond = {}
  9. if (skip) cond.skip = skip
  10. if (limit) cond.limit = limit
  11. cond = { ...cond, ...info }
  12. const res = await axios.$get(`${url}`, cond)
  13. return res
  14. }
  15. const fetch = async (payload) => {
  16. const res = await axios.$get(`${url}/${payload}`)
  17. return res
  18. }
  19. const create = async (payload) => {
  20. const res = await axios.$post(`${url}`, payload)
  21. return res
  22. }
  23. const update = async (payload) => {
  24. const id = get(payload, 'id', get(payload, '_id'))
  25. const res = await axios.$post(`${url}/${id}`, payload)
  26. return res
  27. }
  28. const del = async (payload) => {
  29. const res = await axios.$delete(`${url}/${payload}`)
  30. return res
  31. }
  32. const firstStep = async (payload) => {
  33. const id = get(payload, 'id', get(payload, '_id'))
  34. const res = await axios.$post(`${url}/firstStep/${id}`, payload)
  35. return res
  36. }
  37. const step1 = async (payload) => {
  38. const res = await axios.$post(`${url}/step1`, payload)
  39. return res
  40. }
  41. const step2 = async (payload) => {
  42. const res = await axios.$post(`${url}/step2`, payload)
  43. return res
  44. }
  45. const stepFill = async (payload) => {
  46. const res = await axios.$post(`${url}/step2/fill`, payload)
  47. return res
  48. }
  49. const step3 = async (payload) => {
  50. const res = await axios.$post(`${url}/step3`, payload)
  51. return res
  52. }
  53. const step4 = async (payload) => {
  54. const res = await axios.$post(`${url}/step4`, payload)
  55. return res
  56. }
  57. const step4Score = async (payload) => {
  58. const id = get(payload, 'id', get(payload, '_id'))
  59. const res = await axios.$post(`${url}/step4/score/${id}`, payload)
  60. return res
  61. }
  62. const step4To5 = async (payload) => {
  63. const id = get(payload, 'id', get(payload, '_id'))
  64. const res = await axios.$post(`${url}/step4/to5/${id}`, payload)
  65. return res
  66. }
  67. const step5 = async (payload) => {
  68. const res = await axios.$post(`${url}/step5`, payload)
  69. return res
  70. }
  71. const step5Time = async (payload) => {
  72. const id = get(payload, 'id', get(payload, '_id'))
  73. const res = await axios.$post(`${url}/step5/time/${id}`, payload)
  74. return res
  75. }
  76. const step5Sms = async (payload) => {
  77. const res = await axios.$get(`${url}/step5/sms/${payload}`)
  78. return res
  79. }
  80. const step5Sup = async (payload) => {
  81. const id = get(payload, 'id', get(payload, '_id'))
  82. const res = await axios.$post(`${url}/step5/supplement/${id}`, payload)
  83. return res
  84. }
  85. const step5Order = async (payload) => {
  86. const id = get(payload, 'match_id', get(payload, 'match_id'))
  87. const res = await axios.$post(`${url}/step5/order/${id}`, payload)
  88. return res
  89. }
  90. const step6 = async (payload) => {
  91. const res = await axios.$post(`${url}/step6`, payload)
  92. return res
  93. }
  94. const step7 = async (payload) => {
  95. const res = await axios.$post(`${url}/step7`, payload)
  96. return res
  97. }
  98. const step8 = async (payload) => {
  99. const res = await axios.$post(`${url}/step8`, payload)
  100. return res
  101. }
  102. return {
  103. query,
  104. fetch,
  105. create,
  106. update,
  107. firstStep,
  108. step1,
  109. step2,
  110. stepFill,
  111. step3,
  112. step4,
  113. step4Score,
  114. step4To5,
  115. step5,
  116. step5Time,
  117. step5Sms,
  118. step5Sup,
  119. step5Order,
  120. step6,
  121. step7,
  122. step8,
  123. del
  124. }
  125. })