care.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /**
  2. * 调理方案模块 API
  3. */
  4. import http from '@/utils/http'
  5. /**
  6. * 获取调理方案列表(分页)
  7. * @param {Object} params - { modeType, page, size }
  8. * @param {string} params.modeType - 模式标识: PROFESSIONAL / CUSTOM / EXPERT
  9. * @param {number} [params.page=0] - 页码
  10. * @param {number} [params.size=100] - 每页数量
  11. * @returns {Promise<{records, total}>}
  12. */
  13. export function getCareList(params = {}) {
  14. return http.post('/userCare/careList', {
  15. page: params.page || 0,
  16. size: params.size || 100,
  17. modeType: params.modeType || ''
  18. })
  19. }
  20. /**
  21. * 获取当前用户的自定义方案列表
  22. * 通过 Token 获取当前 APP 账号下创作人属于自己的自定义模式方案
  23. * @returns {Promise<Array<{id, planCode, name, modeType, symptoms, applicableGender, ageMin, ageMax, description, authorId, authorName, authorType, useCount, avgRating, lastUseTime, status, createTime, updateTime}>>}
  24. */
  25. export function getCustomPlanList() {
  26. return http.get('/app/custom-plan/list')
  27. }
  28. /**
  29. * 获取用户自定义方案详情
  30. * @param {string|number} id - 方案ID
  31. * @returns {Promise<Object>} 方案详情含steps
  32. */
  33. export function getCustomPlanDetail(id) {
  34. return http.get(`/app/custom-plan/${id}`)
  35. }
  36. /**
  37. * 获取调理方案详情
  38. * @param {string|number} id - 方案ID
  39. * @returns {Promise<{steps: Array}>}
  40. */
  41. export function getCareDetail(id) {
  42. return http.get('/userCare/careDetail', { data: { id } })
  43. }
  44. /**
  45. * 获取专业模式方案列表
  46. * 所有 APP 用户共享同一份方案,仅返回已发布方案
  47. * @returns {Promise<Array>}
  48. */
  49. export function getProfessionalPlanList() {
  50. return http.get('/app/professional-plan/list')
  51. }
  52. /**
  53. * 获取专业模式方案详情(含穴位步骤列表)
  54. * @param {string|number} id - 方案ID
  55. * @returns {Promise<Object>}
  56. */
  57. export function getProfessionalPlanDetail(id) {
  58. return http.get(`/app/professional-plan/${id}`)
  59. }
  60. /**
  61. * 获取延年圣手模式方案列表
  62. * 所有 APP 用户共享同一份方案,仅返回已发布方案
  63. * @returns {Promise<Array>}
  64. */
  65. export function getMasterPlanList() {
  66. return http.get('/app/master-plan/list')
  67. }
  68. /**
  69. * 获取延年圣手模式方案详情(含穴位步骤列表)
  70. * @param {string|number} id - 方案ID
  71. * @returns {Promise<Object>}
  72. */
  73. export function getMasterPlanDetail(id) {
  74. return http.get(`/app/master-plan/${id}`)
  75. }
  76. /**
  77. * 新增用户自定义方案
  78. * @param {Object} data - 方案数据 { name, symptoms, applicableGender, ageMin, ageMax, description, status, steps }
  79. * @returns {Promise<number>} 新方案ID
  80. */
  81. export function createCustomPlan(data) {
  82. return http.post('/app/custom-plan', data)
  83. }
  84. /**
  85. * 修改用户自定义方案
  86. * @param {Object} data - 方案数据 { id, name, symptoms, applicableGender, ageMin, ageMax, description, status, steps }
  87. * @returns {Promise}
  88. */
  89. export function updateCustomPlan(data) {
  90. return http.put('/app/custom-plan', data)
  91. }
  92. /**
  93. * 删除用户自定义方案
  94. * @param {string|number} id - 方案ID
  95. * @returns {Promise}
  96. */
  97. export function deleteCustomPlan(id) {
  98. return http.delete(`/app/custom-plan/${id}`)
  99. }