猫妈狗爸伴宠师小程序前端代码
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.

115 lines
2.1 KiB

  1. import request from '@/utils/request'
  2. export const getLicenseList = () => {
  3. return request({
  4. url: '/applet/examination/licenseList',
  5. method: "get"
  6. }).then(res => {
  7. return res.data
  8. })
  9. }
  10. export const getPetTypeList = () => {
  11. return request({
  12. url: '/applet/examination/petTypeList',
  13. method: "get"
  14. }).then(res => {
  15. return res.data
  16. })
  17. }
  18. export const getServiceList = (params) => {
  19. return request({
  20. url: '/applet/config/serviceList',
  21. method: "get",
  22. params
  23. }).then(res => {
  24. return res.data?.map?.(item => {
  25. const { id, title, video } = item
  26. return { id, title, video }
  27. }) || []
  28. })
  29. }
  30. export const getTrainList = (params) => {
  31. return request({
  32. url: '/applet/config/trainList',
  33. method: "get",
  34. params
  35. }).then(res => {
  36. return res.data?.map?.(item => {
  37. const { id, title, content } = item
  38. return { id, title, content }
  39. }) || []
  40. })
  41. }
  42. export const getQuestionList = (params) => {
  43. return request({
  44. url: '/applet/examination/questionList',
  45. method: "get",
  46. params
  47. }).then(res => {
  48. return res.data
  49. })
  50. }
  51. export const getQuestionOptions = (params) => {
  52. return request({
  53. url: '/applet/examination/insertUser',
  54. method: "get",
  55. params
  56. }).then(res => {
  57. return res.data
  58. })
  59. }
  60. export const addBaseAnswer = (data) => {
  61. return request({
  62. url: '/applet/examination/addBaseAnswer',
  63. headers: {
  64. isToken: true
  65. },
  66. method: 'post',
  67. data
  68. })
  69. }
  70. export const answeBaseByQuestionId = (params) => {
  71. return request({
  72. url: '/applet/examination/answeBaseByQuestionId',
  73. headers: {
  74. isToken: true
  75. },
  76. method: "get",
  77. params
  78. }).then(res => {
  79. return res.data?.[0] || {}
  80. })
  81. }
  82. export const addTrainAnswer = (data) => {
  83. return request({
  84. url: '/applet/examination/addTrainAnswer',
  85. headers: {
  86. isToken: true
  87. },
  88. method: 'post',
  89. data
  90. })
  91. }
  92. export const answeTrainByQuestionId = (params) => {
  93. return request({
  94. url: '/applet/examination/answeTrainByQuestionId',
  95. headers: {
  96. isToken: true
  97. },
  98. method: "get",
  99. params
  100. }).then(res => {
  101. return res.data?.[0] || {}
  102. })
  103. }