common.js 746 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * 公共API
  3. */
  4. import storage from "@/utils/storage.js"
  5. import {http, Method} from '@/utils/request.js';
  6. import api from '@/config/api.js';
  7. /**
  8. * 获取图片验证码URL
  9. * @param type
  10. * @param uuid
  11. * @returns {string}
  12. */
  13. export function getValidateCodeUrl(type, uuid) {
  14. if (!type) {
  15. return '';
  16. }
  17. if (!uuid) {
  18. uuid = storage.getUuid()
  19. }
  20. return `${api.base}/captchas/${uuid}/${type}?r=${new Date().getTime()}`;
  21. }
  22. /**
  23. * 获取地区数据
  24. * @param id
  25. */
  26. export function getRegionsById(id = 0) {
  27. return http.request({
  28. url: `${api.common}/region/item/${id}`,
  29. method: Method.GET,
  30. message: false,
  31. });
  32. }
  33. /**
  34. * 文件上传地址
  35. * @type {string}
  36. */
  37. export const upload =api.common+'/upload/file';