config.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. // eslint-disable-next-line no-unused-vars
  2. window.apidocFeConfig = {
  3. // 标题
  4. TITLE: 'Apidoc',
  5. // 缓存配置
  6. CACHE: {
  7. // 缓存前缀
  8. PREFIX: 'APIDOC_',
  9. },
  10. HTTP: {
  11. // 接口请求地址
  12. HOSTS: [],
  13. // 请求前缀地址
  14. // API_PREFIX:"/apidoc",
  15. // 接口响应超时时间
  16. TIMEOUT: 30000,
  17. // 跨域请求时是否使用凭证
  18. WITHCREDENTIALS: false,
  19. // 启用转码
  20. ENCODEURICOMPONENT: false,
  21. },
  22. // 授权访问
  23. AUTH: {
  24. // 异常状态码
  25. ERROR_STATUS: 401,
  26. // 异常code字段
  27. ERROR_CODE_FIELD: 'code',
  28. },
  29. // 菜单配置
  30. MENU: {
  31. SHOWURL: false,
  32. WIDTH: 300,
  33. },
  34. // 请求类型的颜色
  35. METHOD_COLOR: {
  36. GET: '#87d068',
  37. POST: '#2db7f5',
  38. PUT: '#ff9800',
  39. DELETE: '#ff4d4f',
  40. PATCH: '#802feb',
  41. },
  42. // 接口详情页的tab顺序
  43. API_DETAIL_TABS: ['table', 'json', 'ts', 'debug'],
  44. // 接口详情表格属性
  45. API_TABLE_PROPS: {
  46. // 是否默认展开所有行
  47. defaultExpandAllRows: true,
  48. },
  49. // 加载外部js文件
  50. LOAD_SCRIPTS: ['./utils/md5.js'],
  51. // (选配)调试时事件,处理参数值的方法
  52. DEBUG_EVENTS: {
  53. md5(param) {
  54. return new Promise((resolve, reject) => {
  55. const { config, event } = param
  56. if (event.key) {
  57. let value = ''
  58. let paramKey = 'params'
  59. if (config.params[event.key]) {
  60. value = config.params[event.key]
  61. } else if (config.data[event.key]) {
  62. value = config.data[event.key]
  63. paramKey = 'data'
  64. }
  65. if (value) {
  66. const password = md5(value)
  67. param.config[paramKey][event.key] = password
  68. param.message = '->' + password
  69. }
  70. resolve(param)
  71. } else {
  72. reject('未指定字段')
  73. }
  74. })
  75. },
  76. },
  77. // (选配)自定义mock规则
  78. MOCK_EXTENDS: {},
  79. // (选配)自定义方法
  80. CUSTOM_METHODS: {},
  81. // 多语言
  82. LANG: [
  83. {
  84. title: '简体中文',
  85. lang: 'zh-cn',
  86. messages: {
  87. 'home.title': '首页',
  88. 'home.appCount': '应用数',
  89. 'home.apiCount': 'API数量',
  90. 'home.docsCount': '文档数量',
  91. 'home.methodCount': '类型统计',
  92. 'common.ok': '确认',
  93. 'common.cancel': '取消',
  94. 'common.clear': '清空',
  95. 'common.desc': '说明',
  96. 'common.action': '操作',
  97. 'common.field': '字段',
  98. 'common.method': '请求类型',
  99. 'common.require': '必填',
  100. 'common.notEmpty': '非空',
  101. 'common.defaultValue': '默认值',
  102. 'common.value': '值',
  103. 'common.docs': '文档',
  104. 'common.close': '关闭',
  105. 'common.view': '查看',
  106. 'common.copy': '复制',
  107. 'common.copySuccess': '复制成功',
  108. 'common.copyUrl': '复制链接',
  109. 'common.actionSuccess': '操作成功',
  110. 'common.page.404': '404-未知页面',
  111. 'common.notdata': '暂无数据',
  112. 'common.group': '分组',
  113. 'common.notGroup': '未分组',
  114. 'common.currentApp': '当前应用',
  115. 'common.please.input': '请输入',
  116. 'common.please.select': '请选择',
  117. 'common.file.name': '文件名',
  118. 'common.appOrVersion': '应用/版本',
  119. 'common.allAppOption': '全部应用',
  120. 'common.ms': '毫秒',
  121. 'common.name': '名称',
  122. 'common.controller': '控制器',
  123. 'common.api': '接口',
  124. 'common.author': '作者',
  125. 'common.tag': '标签',
  126. 'common.delete.confirm.title': '标签',
  127. 'side.search.placeholder': '名称 URL',
  128. 'lang.change.confirm.title': '您确认切换语言为 {langTitle} 吗?',
  129. 'lang.change.confirm.content': '确认后将刷新页面,并回到首页',
  130. 'host.change.confirm.title': '您确认切换Host为 {hostTitle} 吗?',
  131. 'auth.title': '授权访问',
  132. 'auth.password.label': '访问密码',
  133. 'auth.input.placeholder': '请输入访问密码',
  134. 'apiPage.reload.button': '刷新',
  135. 'apiPage.tabs.table': '文档',
  136. 'apiPage.tabs.json': 'Json',
  137. 'apiPage.tabs.ts': 'TypeScript',
  138. 'apiPage.tabs.debug': '调试',
  139. 'apiPage.header.title': '请求头Header',
  140. 'apiPage.query.title': '请求参数Query',
  141. 'apiPage.body.title': '请求参数Body',
  142. 'apiPage.routeParam.title': '路由参数Route',
  143. 'apiPage.title.responses': '响应结果',
  144. 'apiPage.responses': '响应结果',
  145. 'apiPage.responses.success': '成功响应',
  146. 'apiPage.responses.error': '错误响应',
  147. 'apiPage.mdDetail.title': '{name} 字段的说明',
  148. 'apiPage.debug.param.reload': '重置参数',
  149. 'apiPage.debug.header': 'Header',
  150. 'apiPage.debug.query': 'Query',
  151. 'apiPage.debug.body': 'Body',
  152. 'apiPage.debug.routeParam': 'Route',
  153. 'apiPage.debug.excute': '执行 Excute',
  154. 'apiPage.debug.notExcute': '未发起请求',
  155. 'apiPage.debug.reloadParamsAndExcute': '重置所有参数并执行',
  156. 'apiPage.debug.selectFile': 'Select File',
  157. 'apiPage.debug.selectFiles': 'Select Files',
  158. 'apiPage.common.field': '字段名',
  159. 'apiPage.common.value': '字段值',
  160. 'apiPage.common.method': '字段类型',
  161. 'apiPage.common.require': '必填',
  162. 'apiPage.common.desc': '描述',
  163. 'apiPage.common.defaultValue': '默认值',
  164. 'apiPage.common.action': '操作',
  165. 'apiPage.common.type': '类型',
  166. 'apiPage.json.formatError': 'json 参数格式化错误',
  167. 'cache.manage': '缓存管理',
  168. 'cache.cancelAll': '清除所有缓存',
  169. 'cache.cancelSuccess': '清除成功',
  170. 'cache.cancelAllConfirm': '您确认清除所有Api缓存吗?',
  171. 'cache.createAllApi': '生成所有Api缓存',
  172. 'cache.createAllConfirm': '您确认生成所有Api缓存吗?',
  173. 'cache.createSuccess': '生成成功',
  174. 'layout.menu.reload': '更新菜单',
  175. 'layout.menu.openAll': '展开全部',
  176. 'layout.menu.hideAll': '收起全部',
  177. 'layout.tabs.leftSide': '左侧',
  178. 'layout.tabs.rightSide': '右侧',
  179. 'layout.tabs.notTab': '没有标签',
  180. 'layout.tabs.closeCurrent': '关闭当前',
  181. 'layout.tabs.closeLeft': '关闭左侧',
  182. 'layout.tabs.closeRight': '关闭右侧',
  183. 'layout.tabs.closeAll': '关闭全部',
  184. 'globalParam.title': '全局参数',
  185. 'globalParam.header': 'Header',
  186. 'globalParam.header.message': '发送请求时,所有接口将自动携带以下Header参数。',
  187. 'globalParam.query': 'Query',
  188. 'globalParam.query.message': '发送请求时,所有接口将自动携带以下Query参数。',
  189. 'globalParam.body': 'Body',
  190. 'globalParam.body.message': '发送请求时,所有接口将自动携带以下Body参数。',
  191. 'globalParam.cancel.confirm': '确认清空所有参数吗?',
  192. 'globalParam.add': '添加参数',
  193. 'debug.event.before': '请求前事件',
  194. 'debug.event.after': '响应后事件',
  195. 'debug.event.setHeader': '设置请求Header参数',
  196. 'debug.event.setQuery': '设置请求Query参数',
  197. 'debug.event.setBody': '设置请求Body参数',
  198. 'debug.event.clearHeader': '清除请求Header参数',
  199. 'debug.event.clearQuery': '清除请求Query参数',
  200. 'debug.event.clearBody': '清除请求Body参数',
  201. 'debug.event.setGlobalHeader': '设置全局Header参数',
  202. 'debug.event.setGlobalQuery': '设置全局Query参数',
  203. 'debug.event.setGlobalBody': '设置全局Body参数',
  204. 'debug.event.clearGlobalHeader': '清除全局Header参数',
  205. 'debug.event.clearGlobalQuery': '清除全局Query参数',
  206. 'debug.event.clearGlobalBody': '清除全局Body参数',
  207. 'debug.event.ajax': '发送请求',
  208. 'debug.event.custom': '自定义事件',
  209. 'debug.request.header': '请求头',
  210. 'debug.responses.header': '响应头',
  211. 'generator.title': '接口生成',
  212. 'generator.apps.title': '应用/版本',
  213. 'generator.group.title': '分组',
  214. 'generator.table.field': '字段名',
  215. 'generator.table.desc': '注释',
  216. 'generator.table.type': '类型',
  217. 'generator.table.length': '长度',
  218. 'generator.table.default': '默认值',
  219. 'generator.table.notNull': '非Null',
  220. 'generator.table.autoAdd': '自增',
  221. 'generator.table.mainKey': '主键',
  222. 'generator.model.name': '模型名',
  223. 'generator.table.name': '表名',
  224. 'generator.table.comment': '表注释',
  225. 'generator.model.name.placeholder': '请输入模型文件名',
  226. 'generator.table.name.placeholder': '请输入表名',
  227. 'generator.table.row.error': '第{rows}行,字段名、类型必填',
  228. 'generator.submitSuccess': '生成成功',
  229. 'tools.title': '工具',
  230. 'codeTemplate.title': '代码模板',
  231. 'codeTemplate.reload': '重新生成',
  232. 'apiShare.title': '接口分享',
  233. 'apiShare.edit': '编辑接口分享',
  234. 'apiShare.add': '新增接口分享',
  235. 'apiShare.type.all': '全部',
  236. 'apiShare.type.app': '应用',
  237. 'apiShare.type.api': '接口',
  238. 'apiShare.button.create': '创建分享',
  239. 'apiShare.button.edit': '编辑',
  240. 'apiShare.button.delete': '删除',
  241. 'apiShare.type.label': '分享接口',
  242. 'apiShare.time.label': '分享时间',
  243. 'apiShare.all.text': '每次都解析或取缓存中所有接口数据',
  244. },
  245. },
  246. ],
  247. }