config.js 2.8 KB

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