system.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import flyio from "../flyio";
  2. import { ApiCaptchaResponse, ApiResponse, DictItem, ConfigItem } from "@/types";
  3. import { SmsRequestDTO } from "@/types/user";
  4. /**
  5. * 获取配置属性
  6. * @returns
  7. */
  8. export function getConfig() {
  9. return flyio.get('/front/comm/config') as Promise<ApiResponse<ConfigItem[]>>;
  10. }
  11. /**
  12. * 获取字典数据
  13. * @param dictTypes 字典类型列表,逗号分隔
  14. * @returns
  15. */
  16. export function getDictData(dictTypes: string) {
  17. return flyio.get(`/front/comm/dict/${dictTypes}`) as Promise<ApiResponse<Record<string, DictItem[]>>>;
  18. }
  19. /**
  20. * 发送短信验证码, 发送验证码(不验重,验证码,不登陆), 适用于账号登录
  21. * @param params 包含手机号等参数的对象
  22. * @returns
  23. */
  24. export function sendSmsNoValidationNoToken(params: SmsRequestDTO) {
  25. // 使用POST方法,参数通过URL查询字符串传递
  26. return flyio.post('/front/comm/sendSmsNoValidationNoToken', null, { params }) as Promise<ApiResponse<any>>;
  27. }
  28. /**
  29. * 发送短信验证码, 发送验证码(验重,验证码,不登陆), 适用于账号注册
  30. * @param params 包含手机号等参数的对象
  31. * @returns
  32. */
  33. export function sendSmsNoToken(params: SmsRequestDTO) {
  34. return flyio.post('/front/comm/sendSmsNoToken', null, { params }) as Promise<ApiResponse<any>>;
  35. }
  36. /**
  37. * 发送短信验证码, 发送验证码(不验重,无验证码,需登陆), 适用于登录后的校验
  38. * @param params 包含手机号等参数的对象
  39. * @returns
  40. */
  41. export function sendSms(params: SmsRequestDTO) {
  42. return flyio.post('/front/comm/sendSms', null, { params }) as Promise<ApiResponse<any>>;
  43. }
  44. /**
  45. * 获取省份列表
  46. * @returns
  47. */
  48. export function getProvinces() {
  49. return flyio.get('/front/user/provinces') as Promise<ApiResponse<DictItem[]>>;
  50. }
  51. /**
  52. * 获取考生类别
  53. * @returns
  54. */
  55. export function getExamTypes(location: string) {
  56. return flyio.get('/front/user/examTypes', { location }) as Promise<ApiResponse<DictItem[]>>;
  57. }
  58. /**
  59. * 获取专业列表
  60. * @returns
  61. */
  62. export function getExamMajors(location: string, examType: string) {
  63. return flyio.get('/front/user/examMajors', { location, examType }) as Promise<ApiResponse<DictItem[]>>;
  64. }
  65. /**
  66. * 获取毕业年份列表
  67. * @returns
  68. */
  69. export function getGraduateYears(location: string, examType: string) {
  70. return flyio.get('/front/user/graduateYears', { location, examType }) as Promise<ApiResponse<DictItem[]>>;
  71. }
  72. /**
  73. * 获取验证码图片
  74. * @returns
  75. */
  76. export function getCaptchaImage() {
  77. return flyio.get('/captchaImage') as Promise<ApiCaptchaResponse>;
  78. }