system-info.js 656 B

123456789101112131415161718192021
  1. import { httpApp } from "@/plugins/axiosIndex";
  2. import { object2QueryString } from "@/utils/utils";
  3. import { pickBy } from "lodash-es";
  4. export function uploadFile({ file, md5 }) {
  5. const form = new FormData();
  6. form.append("file", file);
  7. return httpApp.post(
  8. "/api/admin/sys/file/upload?" + object2QueryString({ type: "frontend" }),
  9. form,
  10. { headers: { "Content-Type": "multipart/form-data", md5: md5 } }
  11. );
  12. }
  13. export function downloadFile({ id = "", type = "" }) {
  14. const data = pickBy({ id, type }, (v) => v !== "");
  15. return httpApp.post(
  16. "/api/admin/sys/file/download?" +
  17. object2QueryString({ ...data, type: type })
  18. );
  19. }