//基本配置项 const base = { //是否开启debug debug: true, //启动时初始化数据接口,初始化后可以直接使用$config获取,不填写则没有 init:'main.home', //是否需要静默注册,如果需要这里填写静默注册的接口 reg: 'main.reg', } //路径配置项 const path = { //主页地址 home: 'main', //个人主页 user: 'user/index', //登录地址 login: 'user/login', //绑定手机号地址 bindMobile: 'user/bind/mobile', //绑定邮箱地址 bindEmail: 'user/bind/email', //统一的webview地址 webView: '/pages/tool/web_view', } //http request请求配置 基本的请求地址 const request = { // 服务器接口地址 host: "http://127.0.0.1/ydb/src/place/interface/?l=", // 请求的参数 data: {}, // 设置请求的 header,header 中不能设置 Referer。 header: {'content-type': 'application/x-www-form-urlencoded'}, // (需大写)有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT method: "POST", // json 如果设为json,会尝试对返回的数据做一次 JSON.parse dataType: "json", // text 设置响应的数据类型。合法值:text、arraybuffer 1.7.0 responseType: "text", // 收到开发者服务成功返回的回调函数 success() {}, // 接口调用失败的回调函数 fail() {}, // 接口调用结束的回调函数(调用成功、失败都会执行) complete() {}, } //自定义后端服务列表 const server = { //用来获取平台版本 version: 'http://127.0.0.1/ydb/src/sector/?l=data.version', //根据身份码获取入口码 code: 'http://127.0.0.1/ydb/src/place/set/?l=tool.code', //聊天服务器 im : 'ws://he.shemic.com:8282', //分享服务器 share: 'https://he.shemic.com/package/share/?l=api.', //上传服务器 upload: request.host + 'user.upload', } //定义switchtab,如果没有可以不定义 const switchTab = { list: [], call: { 'index/index' : function(self, e) { var page = self.getPage(); if (!page) return; if ('getInfo' in page) { page.getInfo(); } } } } // 定义tabbar页面跳转 const tabbar = { go : function(dever, item) { if (item.type == 1) { // 我的 dever.location('user/index'); } else if (item.type == 2) { // 已购 } else if (item.type == 10 && item.type_id > 0) { // 频道 dever.location('source/home?id=' + item.type_id); } else if (item.type == 11 && item.type_id > 0) { // 频道分类 dever.location('source/channel?id=' + item.type_id); } else { } } } export default { base, path, request, server, switchTab, tabbar, }