config.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /* eslint-disable spaced-comment */
  2. /********************* 1.项目常量定义 **********************/
  3. class Hotax {}
  4. // 设备类型
  5. Hotax.DEVICE_PC = 'COMPUTER';
  6. Hotax.DEVICE_MOBILE = 'MOBILE';
  7. // 资源类型 <视频|音频|直播|图片>
  8. Hotax.RESOURCE_VIDEO = 0;
  9. Hotax.RESOURCE_AUDIO = 1;
  10. Hotax.RESOURCE_LIVE = 2;
  11. Hotax.RESOURCE_IMAGE = 3;
  12. Hotax.RESOURCE_AUDIOBOOK = 4;
  13. // 清晰度类型 <流畅|标清|高清|超清>
  14. Hotax.QUALITY_FLUENT = 'fluent';
  15. Hotax.QUALITY_STANDARD = 'standard';
  16. Hotax.QUALITY_HIGH = 'high';
  17. Hotax.QUALITY_SUPERCLEAR = 'superclear';
  18. // 产品类型 <课|课程|配套|师训|课程包>
  19. Hotax.PRODUCT_LESSON = 'LESSON';
  20. Hotax.PRODUCT_COURSE = 'COURSE';
  21. Hotax.PRODUCT_SUPPORT = 'SUPPORT';
  22. Hotax.PRODUCT_TRAINING = 'TRAINING';
  23. Hotax.PRODUCT_PACKAGE = 'PACKAGE';
  24. // 删除状态 <正常|删除>
  25. Hotax.STATUS_NORMAL = 'NORMAL';
  26. Hotax.STATUS_DELETE = 'DEL';
  27. // 推荐位过滤标记值
  28. Hotax.FILTER_NO = 0;
  29. Hotax.FILTER_YES = 1;
  30. // 订单状态 <待支付|已作废|已支付|待发货|已发货|待收货|已收货|待退款|已完成>
  31. Hotax.ORDER_UNPAID = 'UNPAID';
  32. Hotax.ORDER_CANCEL = 'CANCEL';
  33. Hotax.ORDER_PAYOK = 'PAYOK';
  34. Hotax.ORDER_FORSEND = 'FORSEND';
  35. Hotax.ORDER_SENT = 'SENT';
  36. Hotax.ORDER_RECEIVED = 'RECEIVED';
  37. Hotax.ORDER_REFUND = 'REFUND';
  38. Hotax.ORDER_COMPLETE = 'COMPLETE';
  39. // 拆单状态 <已拆单|不需拆单|未拆单>
  40. Hotax.ORDER_SPLITED = 'YES';
  41. Hotax.ORDER_UNSPLIT = 'UN';
  42. Hotax.ORDER_NOSPLIT = 'NO';
  43. // 商品类型 <虚拟|实体>
  44. Hotax.GOODS_VIRTUAL = 'VIRTUAL';
  45. Hotax.GOODS_ENTITY = 'ENTITY';
  46. // 平台代号 <供应商|平台方|渠道方>
  47. Hotax.DOMAIN_CP = 1010;
  48. Hotax.DOMAIN_LJ = 2010;
  49. Hotax.DOMAIN_PJ = 3010;
  50. // 计价单位及时长
  51. Hotax.CHARGE_UNIT_SEASON = '季';
  52. Hotax.CHARGE_UNIT_HALF_YEAR = '半年';
  53. Hotax.CHARGE_UNIT_YEAR = '年';
  54. Hotax.CHARGE_UNIT_ITEM = '件';
  55. Hotax.CHARGE_UNIT_DAY = '天';
  56. Hotax.DURATION_SEASON = 90;
  57. Hotax.DURATION_HALF_YEAR = 180;
  58. Hotax.DURATION_YEAR = 365;
  59. Hotax.DURATION_DAY = 1;
  60. Hotax.DURATION_ITEM = 0;
  61. // 账号的绑定状态
  62. Hotax.ACCOUNT_BINDING = 1;
  63. Hotax.ACCOUNT_UNBOUND = 0;
  64. // 分页大小
  65. Hotax.PAGE_SIZE = 20;
  66. // 上传文件最大尺寸
  67. Hotax.FILE_MAX_SIZE = 5; // Index max size should below 5M
  68. // 项目名称
  69. Hotax.PROJECT_NAME = 'Taurus';
  70. // 版权声明
  71. Hotax.CopyRight = '2017-2020 领教信息科技有限公司';
  72. // 接口地址(测试)
  73. Hotax.API_HOST_DEV = 'http://tt-cms.api.ai160.com';
  74. // 接口地址(线上)
  75. Hotax.API_HOST_PRO = '/api';
  76. // oss存储地址
  77. Hotax.OSS_HOST = 'http://efunimgs.oss-cn-beijing.aliyuncs.com';
  78. /********************* 常量定义结束 **********************/
  79. /********************* 2.接口路径定义 **********************/
  80. const apiObj = {
  81. userLogin: '/login',
  82. userLogout: '/logout',
  83. resource: '/resource/list',
  84. resourceItem: '/resource',
  85. audiobookItem: '/resource/audioImg',
  86. signature: '/oss/signature',
  87. merchant: '/merchant/list',
  88. merchantItem: '/merchant',
  89. recommend: '/merchant/recommend',
  90. poster: '/merchant/poster',
  91. posterItem: '/poster',
  92. deposit: '/money/charge',
  93. campus: '/campus/list',
  94. campusItem: '/campus',
  95. terminal: '/user/list',
  96. terminalItem: '/user',
  97. terminalUnbound: '/device/unbind',
  98. terminalAuth: '/user/auth/list',
  99. terminalAuthEdit: '/user/auth',
  100. specialTerminal: '/white/user/list',
  101. specialTerminalItem: '/white/user',
  102. cmsUser: '/cms/user/list',
  103. cmsUserItem: '/cms/user',
  104. courseware: '/ware/list',
  105. coursewareItem: '/ware',
  106. lesson: '/lesson/list',
  107. lessonItem: '/lesson',
  108. tagGroup: '/group/list',
  109. tagGroupItem: '/group',
  110. tagType: '/tagType/list',
  111. tagTypeItem: '/tagType',
  112. tag: '/tag/list',
  113. tagItem: '/tag',
  114. product: '/product',
  115. items: '/merchant/product',
  116. itemDetail: '/merchant/product/detail',
  117. itemCreate: '/merchant/product/status',
  118. itemBindTags: '/merchant/product/tags',
  119. itemBindPrices: '/goods',
  120. shopCart: '/buymsg/list',
  121. order: '/order',
  122. subOrder: '/order/detail',
  123. orderPay: '/order/pay',
  124. orderSend: '/order/send',
  125. orderReceive: '/order/receive',
  126. snapshot: '/order/snapshot',
  127. userTags: '/user/userTag/uid',
  128. userTag: '/userTag',
  129. userTagCopy: '/userTag/copy',
  130. userRecommend: '/user/userRecommend/uid',
  131. userDevice: '/userDevice/list',
  132. };
  133. /**
  134. * 将api路径转化为绝对地址
  135. * @return {Object} 绝对地址
  136. */
  137. function apiFormatter() {
  138. // 根据环境变量选取接口地址
  139. let prefix = '';
  140. if (process.env.NODE_ENV === 'development') {
  141. prefix = Hotax.API_HOST_DEV;
  142. } else if (process.env.NODE_ENV === 'production') {
  143. prefix = Hotax.API_HOST_PRO;
  144. } else {
  145. prefix = Hotax.API_HOST_DEV;
  146. }
  147. // 生成接口绝对地址
  148. const newApiObj = {};
  149. Object.keys(apiObj).forEach((apiKey) => {
  150. newApiObj[apiKey] = prefix + apiObj[apiKey];
  151. });
  152. return newApiObj;
  153. }
  154. const api = apiFormatter();
  155. /********************* 接口定义结束 **********************/
  156. export { Hotax, api };