question.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import { CRequest } from "./request"
  2. import Global from "@/common/global"
  3. const proxyApi = Global.getIsDev ? '/api' : '/question-api'
  4. /** /gamecontest/admin/bank */
  5. export async function getQuestionBank (options?: any) {
  6. return CRequest<API.ResponseFormat>(`/gamecontest/admin/bank`, {
  7. method: "GET",
  8. ...options
  9. })
  10. }
  11. /** gamecontest/admin/card */
  12. export async function getQuestionCard (params: any, options?: any) {
  13. return CRequest<API.ResponseFormat>(`/gamecontest/admin/card`, {
  14. method: "GET",
  15. params: params,
  16. ...options
  17. })
  18. }
  19. /** /gamecontest/admin/bank/add */
  20. export async function addQuestionBank (
  21. params: {
  22. bankName: string
  23. },
  24. options?: any
  25. ) {
  26. return CRequest<API.ResponseFormat>(`/gamecontest/admin/bank/add`, {
  27. method: "POST",
  28. params: params,
  29. ...options
  30. })
  31. }
  32. /** /gamecontest/admin/bank/add */
  33. export async function delQuestionBank (id: number | string) {
  34. return CRequest<API.ResponseFormat>(`/gamecontest/admin/bank/${id}`, {
  35. method: "DELETE"
  36. })
  37. }
  38. /** gamecontest/admin/bank */
  39. export async function putQuestionBank (data: any) {
  40. return CRequest<API.ResponseFormat>(`/gamecontest/admin/bank`, {
  41. data,
  42. method: "PUT"
  43. })
  44. }
  45. /** /gamecontest/admin/textbook */
  46. export async function getQuestionBook (
  47. params: { bankId: string | number}
  48. ) {
  49. return CRequest<API.ResponseFormat>(`/gamecontest/admin/textbook`, {
  50. params,
  51. method: "GET"
  52. })
  53. }
  54. /** /gamecontest/admin/textbook/addTextBook */
  55. export async function postQuestionBook (
  56. data: any
  57. ) {
  58. return CRequest<API.ResponseFormat>(`/gamecontest/admin/textbook/addTextBook`, {
  59. data,
  60. method: "POST"
  61. })
  62. }
  63. export async function putQuestionBook (
  64. id: string,
  65. params: {label: string}
  66. ) {
  67. return CRequest<API.ResponseFormat>(`/gamecontest/admin/textbook/${id}`, {
  68. params,
  69. method: "PUT"
  70. })
  71. }
  72. /**
  73. *
  74. * @description 启用或者停用题卡
  75. * @api /gamecontest/admin/card/{id}
  76. *
  77. */
  78. export async function useQuestionCard (
  79. id: string,
  80. params: {
  81. state: number
  82. }
  83. ) {
  84. return CRequest<API.ResponseFormat>(`/gamecontest/admin/card/${id}`, {
  85. params,
  86. method: "PUT"
  87. })
  88. }
  89. /**
  90. *
  91. * @description 删除题卡
  92. * @api /gamecontest/admin/card/{id}
  93. *
  94. */
  95. export async function delQuestionCard (
  96. id: string,
  97. ) {
  98. return CRequest<API.ResponseFormat>(`/gamecontest/admin/card/${id}`, {
  99. method: "DELETE"
  100. })
  101. }
  102. /**
  103. *
  104. * @description 新增题卡
  105. * @api /gamecontest/admin/card/{state}
  106. *
  107. */
  108. // {
  109. // "ableVar": "",
  110. // "bookId": "",
  111. // "content": [
  112. // {
  113. // "bg": "",
  114. // "cardId": "",
  115. // "color": "",
  116. // "createTime": "",
  117. // "h": 0,
  118. // "id": "",
  119. // "ih": 0,
  120. // "imgUrl": "",
  121. // "iw": 0,
  122. // "ix": 0,
  123. // "iy": 0,
  124. // "label": "",
  125. // "ph": 0,
  126. // "pw": 0,
  127. // "px": 0,
  128. // "py": 0,
  129. // "rotate": 0,
  130. // "roundOrArrow": "",
  131. // "updateTime": "",
  132. // "voiceUrl": "",
  133. // "w": 0,
  134. // "x": 0,
  135. // "y": 0
  136. // }
  137. // ],
  138. // "createTime": "",
  139. // "id": "",
  140. // "label": "",
  141. // "options": [
  142. // {
  143. // "cardId": "",
  144. // "color": "",
  145. // "createTime": "",
  146. // "id": "",
  147. // "ifTrue": true,
  148. // "imgUrl": "",
  149. // "label": "",
  150. // "myAnswer": "",
  151. // "updateTime": ""
  152. // }
  153. // ],
  154. // "rightOptionCount": 0,
  155. // "state": 0,
  156. // "takeTime": 0,
  157. // "title": "",
  158. // "totalOptionCount": 0,
  159. // "updateTime": "",
  160. // "voiceUrl": ""
  161. // }
  162. export async function addQuestionCard (
  163. state: 0 | 1,
  164. data: any
  165. ) {
  166. return CRequest<API.ResponseFormat>(`/gamecontest/admin/card/${state}`, {
  167. data,
  168. method: "POST"
  169. })
  170. }
  171. /**
  172. * 编辑题卡
  173. */
  174. export async function putQuestionCard (
  175. state: 0 | 1,
  176. data: any
  177. ) {
  178. return CRequest<API.ResponseFormat>(`/gamecontest/admin/card/questionCard/${state}`, {
  179. data,
  180. method: "PUT"
  181. })
  182. }
  183. /**
  184. * @description 根据id 获取 题卡数据
  185. *
  186. */
  187. export async function getQuestionCardByid (cardId: string | number) {
  188. return CRequest<API.ResponseFormat>(`/gamecontest/admin/card/${cardId}`, {
  189. method: "GET"
  190. })
  191. }