config.js 5.2 KB

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