config.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //基本配置项
  2. const base = {
  3. //是否开启debug
  4. debug: true,
  5. //启动时初始化数据接口,初始化后可以直接使用$config获取,不填写则没有
  6. init:'main.home',
  7. //是否需要静默注册,如果需要这里填写静默注册的接口
  8. reg: 'main.reg',
  9. }
  10. //路径配置项
  11. const path = {
  12. //主页地址
  13. home: 'main',
  14. //个人主页
  15. user: 'user/index',
  16. //登录地址
  17. login: 'user/login',
  18. //绑定手机号地址
  19. bindMobile: 'user/bind/mobile',
  20. //绑定邮箱地址
  21. bindEmail: 'user/bind/email',
  22. //统一的webview地址
  23. webView: '/pages/tool/web_view',
  24. }
  25. //http request请求配置 基本的请求地址
  26. const request = {
  27. // 服务器接口地址
  28. host: "http://127.0.0.1/ydb/src/place/interface/?l=",
  29. // 请求的参数
  30. data: {},
  31. // 设置请求的 header,header 中不能设置 Referer。
  32. header: {'content-type': 'application/x-www-form-urlencoded'},
  33. // (需大写)有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  34. method: "POST",
  35. // json 如果设为json,会尝试对返回的数据做一次 JSON.parse
  36. dataType: "json",
  37. // text 设置响应的数据类型。合法值:text、arraybuffer 1.7.0
  38. responseType: "text",
  39. // 收到开发者服务成功返回的回调函数
  40. success() {},
  41. // 接口调用失败的回调函数
  42. fail() {},
  43. // 接口调用结束的回调函数(调用成功、失败都会执行)
  44. complete() {},
  45. }
  46. //自定义后端服务列表
  47. const server = {
  48. //用来获取平台版本
  49. version: 'http://127.0.0.1/ydb/src/sector/?l=data.version',
  50. //根据身份码获取入口码
  51. code: 'http://127.0.0.1/ydb/src/place/set/?l=tool.code',
  52. //聊天服务器
  53. im : 'ws://he.shemic.com:8282',
  54. //分享服务器
  55. share: 'https://he.shemic.com/package/share/?l=api.',
  56. //上传服务器
  57. upload: request.host + 'user.upload',
  58. }
  59. //定义switchtab,如果没有可以不定义
  60. const switchTab = {
  61. list: [],
  62. call: {
  63. 'index/index' : function(self, e) {
  64. var page = self.getPage();
  65. if (!page) return;
  66. if ('getInfo' in page) {
  67. page.getInfo();
  68. }
  69. }
  70. }
  71. }
  72. // 定义tabbar页面跳转
  73. const tabbar = {
  74. go : function(dever, item) {
  75. if (item.type == 1) {
  76. // 我的
  77. dever.location('user/index');
  78. } else if (item.type == 2) {
  79. // 已购
  80. } else if (item.type == 10 && item.type_id > 0) {
  81. // 频道
  82. dever.location('source/home?id=' + item.type_id);
  83. } else if (item.type == 11 && item.type_id > 0) {
  84. // 频道分类
  85. dever.location('source/channel?id=' + item.type_id);
  86. } else {
  87. }
  88. }
  89. }
  90. export default {
  91. base,
  92. path,
  93. request,
  94. server,
  95. switchTab,
  96. tabbar,
  97. }