problemInfo.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import service from '@/utils/request'
  2. import { ElMessage } from 'element-plus'
  3. // @Tags ProblemInfo
  4. // @Summary 创建ProblemInfo
  5. // @Security ApiKeyAuth
  6. // @accept application/json
  7. // @Produce application/json
  8. // @Param data body model.ProblemInfo true "创建ProblemInfo"
  9. // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
  10. // @Router /problemInfo/createProblemInfo [post]
  11. export const createProblemInfo = (data) => {
  12. return service({
  13. url: '/problemInfo/createProblemInfo',
  14. method: 'post',
  15. data
  16. })
  17. }
  18. export const sendUserProblemInfo = (data) => {
  19. return service({
  20. url: '/problemInfo/sendUser',
  21. method: 'post',
  22. data
  23. })
  24. }
  25. export const getReadCountList = (params) => {
  26. return service({
  27. url: '/readCount/getReadCountList',
  28. method: 'get',
  29. params
  30. })
  31. }
  32. export const exportExcel = (data) => {
  33. service({
  34. url: '/problemInfo/exportExcel',
  35. method: 'post',
  36. data,
  37. responseType: 'blob'
  38. }).then((res) => {
  39. handleFileError(res)
  40. })
  41. }
  42. const handleFileError = (res) => {
  43. if (typeof (res.data) !== 'undefined') {
  44. if (res.data.type === 'application/json') {
  45. const reader = new FileReader()
  46. reader.onload = function() {
  47. const message = JSON.parse(reader.result).msg
  48. ElMessage({
  49. showClose: true,
  50. message: message,
  51. type: 'error'
  52. })
  53. }
  54. reader.readAsText(new Blob([res.data]))
  55. }
  56. } else {
  57. var downloadUrl = window.URL.createObjectURL(new Blob([res]))
  58. var a = document.createElement('a')
  59. a.style.display = 'none'
  60. a.href = downloadUrl
  61. a.download = new Date().Format('yyyy-MM-dd hh:mm:ss') + '.xlsx'
  62. var event = new MouseEvent('click')
  63. a.dispatchEvent(event)
  64. }
  65. }
  66. // @Tags ProblemInfo
  67. // @Summary 删除ProblemInfo
  68. // @Security ApiKeyAuth
  69. // @accept application/json
  70. // @Produce application/json
  71. // @Param data body model.ProblemInfo true "删除ProblemInfo"
  72. // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
  73. // @Router /problemInfo/deleteProblemInfo [delete]
  74. export const deleteProblemInfo = (data) => {
  75. return service({
  76. url: '/problemInfo/deleteProblemInfo',
  77. method: 'delete',
  78. data
  79. })
  80. }
  81. // @Tags ProblemInfo
  82. // @Summary 删除ProblemInfo
  83. // @Security ApiKeyAuth
  84. // @accept application/json
  85. // @Produce application/json
  86. // @Param data body request.IdsReq true "批量删除ProblemInfo"
  87. // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
  88. // @Router /problemInfo/deleteProblemInfo [delete]
  89. export const deleteProblemInfoByIds = (data) => {
  90. return service({
  91. url: '/problemInfo/deleteProblemInfoByIds',
  92. method: 'delete',
  93. data
  94. })
  95. }
  96. // @Tags ProblemInfo
  97. // @Summary 更新ProblemInfo
  98. // @Security ApiKeyAuth
  99. // @accept application/json
  100. // @Produce application/json
  101. // @Param data body model.ProblemInfo true "更新ProblemInfo"
  102. // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
  103. // @Router /problemInfo/updateProblemInfo [put]
  104. export const updateProblemInfo = (data) => {
  105. return service({
  106. url: '/problemInfo/updateProblemInfo',
  107. method: 'put',
  108. data
  109. })
  110. }
  111. export const updateProblemInfoAudit = (data) => {
  112. return service({
  113. url: '/problemInfo/updateProblemInfoAudit',
  114. method: 'put',
  115. data
  116. })
  117. }
  118. // @Tags ProblemInfo
  119. // @Summary 用id查询ProblemInfo
  120. // @Security ApiKeyAuth
  121. // @accept application/json
  122. // @Produce application/json
  123. // @Param data query model.ProblemInfo true "用id查询ProblemInfo"
  124. // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
  125. // @Router /problemInfo/findProblemInfo [get]
  126. export const findProblemInfo = (params) => {
  127. return service({
  128. url: '/problemInfo/findProblemInfo',
  129. method: 'get',
  130. params
  131. })
  132. }
  133. // @Tags ProblemInfo
  134. // @Summary 分页获取ProblemInfo列表
  135. // @Security ApiKeyAuth
  136. // @accept application/json
  137. // @Produce application/json
  138. // @Param data query request.PageInfo true "分页获取ProblemInfo列表"
  139. // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
  140. // @Router /problemInfo/getProblemInfoList [get]
  141. export const getProblemInfoList = (params) => {
  142. return service({
  143. url: '/problemInfo/getProblemInfoList',
  144. method: 'get',
  145. params
  146. })
  147. }