config.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * API配置
  3. */
  4. // 判断是否为开发环境
  5. // @ts-ignore
  6. const isDevelopment = import.meta.env.DEV || false;
  7. /** 客服电话 */
  8. export const CUSTOMER_SERVICE_PHONE = '400-0755-315';
  9. /** 应用版本号(与 package.json 同步) */
  10. export const APP_VERSION = 'v1.62.11';
  11. export const API_CONFIG = {
  12. // 后端API基础URL
  13. // 注意:上线生产环境时需替换为正式域名
  14. baseUrl: 'https://dev-haha.kuaiyuman.cn/api',
  15. // baseUrl: 'http://192.168.10.100:7077/api', // 本地开发
  16. // baseUrl: 'http://localhost:7077/api', // 本地开发
  17. // 请求超时时间(毫秒)
  18. timeout: 10000,
  19. // 是否显示请求日志
  20. enableLog: isDevelopment
  21. };
  22. /**
  23. * API接口路径
  24. * 各 API 文件从此处引用路径常量,避免硬编码
  25. */
  26. export const API_PATHS = {
  27. // 用户相关
  28. loginMiniappPhone: '/login/miniapp-phone',
  29. getUserInfo: '/login/user-info',
  30. logout: '/login/logout',
  31. // 设备相关
  32. scanDoor: '/device/scan-open',
  33. checkDeviceStatus: '/device/status',
  34. getDeviceProducts: (deviceId: string) => `/device/products/${deviceId}`,
  35. // 订单相关
  36. getOrders: '/order/list',
  37. getOrderDetail: '/order/detail',
  38. cancelOrder: '/order/cancel',
  39. // 支付分相关
  40. createPayscoreOrder: '/payscore/create',
  41. // 优惠券相关
  42. getMyCoupons: '/coupon/my',
  43. getCouponDetail: (id: string) => `/coupon/${id}`,
  44. receiveCoupon: (templateId: string) => `/coupon/receive/${templateId}`,
  45. getCouponCount: '/coupon/count',
  46. getAvailableCoupons: '/coupon/available',
  47. getUsableCoupons: '/coupon/usable',
  48. // 状态轮询相关
  49. pollDeviceStatus: '/status/device',
  50. pollRecognizeResult: '/status/recognize',
  51. pollOrderInfo: '/status/order',
  52. pollAllStatus: '/status/all',
  53. // 公告相关
  54. getAnnouncementList: '/announcement/list',
  55. getAnnouncementDetail: '/announcement/detail',
  56. // 补货员相关
  57. replenisherWechatLogin: '/replenisher/login/wechat',
  58. replenisherBind: '/replenisher/login/bind',
  59. replenisherMyInfo: '/replenisher/my-info'
  60. };