config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // 判断当前环境
  2. const isDev = process.env.NODE_ENV === 'development'
  3. // API基础URL配置
  4. export const API_BASE_URL = isDev
  5. ? 'https://mylive91.com/api'
  6. : 'https://mylive91.com/api' // 生产环境
  7. // App名称配置请求头
  8. export const APP_NAME = 'MewLive'
  9. // 支付方式切换参数 ('wechat' | 'alipay')
  10. export const PAYMENT_TYPE = 'wechat'
  11. // 支付宝支付自定义金额模块开关
  12. export const ALI_CUSTOM = false
  13. // 支付方式ID
  14. export const PAY_WAY_ID = {
  15. ANDROID: 10,
  16. IOS: 21,
  17. }
  18. // 检测设备类型
  19. export function getDevicePayWayId() {
  20. const ua = navigator.userAgent.toLowerCase()
  21. if (/iphone|ipad|ipod|ios/.test(ua)) {
  22. return PAY_WAY_ID.IOS
  23. }
  24. // 默认返回安卓支付方式
  25. return PAY_WAY_ID.ANDROID
  26. }
  27. // 获取平台类型
  28. export function getPlatformType() {
  29. const ua = navigator.userAgent.toLowerCase()
  30. if (/iphone|ipad|ipod|ios/.test(ua)) {
  31. return 'ios'
  32. } else if (/android/.test(ua)) {
  33. return 'android'
  34. }
  35. // 默认返回web平台
  36. return 'web'
  37. }
  38. // 其他全局配置可以在这里添加
  39. export default {
  40. API_BASE_URL,
  41. isDev,
  42. PAY_WAY_ID,
  43. getDevicePayWayId,
  44. getPlatformType,
  45. }