camera.api.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import HTTP from '@/request/alova';
  2. import { processMethod2 } from '@/request/api/flow.api';
  3. import { useVisitor } from '@/stores';
  4. import { Dialog } from '@/platform';
  5. export function uploadFileMethod(file: File) {
  6. const formData = new FormData();
  7. formData.append('file', file);
  8. return HTTP.Post<{ name: string; url: string }>(`/file/upload`, formData, {});
  9. }
  10. export function saveFileMethod(params: Record<string, string>) {
  11. const Visitor = useVisitor();
  12. params.patientId = Visitor.patientId!;
  13. return HTTP.Get(`/fdhb-tablet/patientInfoManage/saveTonguefaceImg`, {
  14. params,
  15. async transform(data: string, headers) {
  16. Visitor.resultId = data;
  17. const flow = await processMethod2();
  18. let path = flow.optional
  19. ? await Dialog.show({
  20. title: flow.title || '获取健康调理方案',
  21. confirmButtonText: '好的',
  22. showCancelButton: true,
  23. cancelButtonText: '返回首页',
  24. width: 350,
  25. }).then(
  26. () => flow.route,
  27. () => '/screen'
  28. )
  29. : flow.route;
  30. return {
  31. resultId: data,
  32. route: { path },
  33. };
  34. },
  35. });
  36. }