config模板
---
```javascript
"use strict";
/***************************************************************************/
/* 项目配置项 */
/****************************************************************************/
// 全局配置项
phoenix.config.projectName = 'demo';// 项目名
phoenix.config.projectUrl = 'https://phoenix.jinyiyun.net/';// 项目首页路径
phoenix.config.projectType = ['app','weixin', 'miniprogram'];// 项目运行环境,app weixin
phoenix.config.apiUrl = 'https://phoenix.jinyiyun.net/api/';// 项目全局接口路径
phoenix.config.homeUrl = 'index.html';// 首页文件名
phoenix.config.homeName = 'index';// 首页路由名
phoenix.config.wxApiList = ['chooseImage'];// 微信环境下需要使用的接口列表
phoenix.config.isLogin = localStorage.getItem("currentUser_token") ? true : false;// 是否登录
phoenix.config.payment = ['alipay', 'wxpay', 'face', 'balance'];// 支付方式 (alipay支付宝)(wxpay微信)(face货到付款)(balance余额支付)
// 标签栏数据
phoenix.config.navData = [{
name: '界面',
url: 'a1',
refresh: false,
params: {
id: 1
},
icon0: '<svg class="icons color hide" aria-hidden="true"><use xlink:href="#icon-ui_fill"></use></svg>',
icon1: '<svg class="icons" aria-hidden="true"><use xlink:href="#icon-ui"></use></svg>'
}, {
name: '方法',
url: 'a2',
refresh: false,
icon0: '<div class="tip tipCart"></div><svg class="icons color hide" aria-hidden="true"><use xlink:href="#icon-fn_fill"></use></svg>',
icon1: '<svg class="icons" aria-hidden="true"><use xlink:href="#icon-fn"></use></svg>'
}, {
name: '组件',
url: 'a3',
refresh: true,
icon0: '<svg class="icons color hide" aria-hidden="true"><use xlink:href="#icon-cp_fill"></use></svg>',
icon1: '<svg class="icons" aria-hidden="true"><use xlink:href="#icon-cp"></use></svg>'
}, {
name: '扩展',
url: 'a4',
refresh: false,
icon0: '<svg class="icons color hide" aria-hidden="true"><use xlink:href="#icon-mb_fill"></use></svg>',
icon1: '<svg class="icons" aria-hidden="true"><use xlink:href="#icon-mb"></use></svg>'
},{
name: '微信',
url: 'a5',
refresh: false,
icon0: '<svg class="icons color hide" aria-hidden="true"><use xlink:href="#icon-wx_fill"></use></svg>',
icon1: '<svg class="icons" aria-hidden="true"><use xlink:href="#icon-wx"></use></svg>'
}];
// ajax请求全局配置
phoenix.ajaxConfig = {
// 默认请求超时时间,单位毫秒
timeout: 5000,
// 请求成功,验证result
verifyResult: function(result) {
if(result.code && result.code !== 0) {
// 请求成功,操作失败
return 'failed';
} else {
// 请求成功,操作成功
return 'success';
};
},
// 全局请求默认出错处理
error: function(status, opt) {
switch (status) {
case 0:
new phoenix.dialog({
title: '请求数据异常!'
});
break;
case 401:
phoenix.config.isLogin = false;
localStorage.removeItem("currentUser_token");
new phoenix.dialog({
title: '请求要求身份验证!'
});
break;
case 403:
new phoenix.dialog({
title: '服务器拒绝请求!'
});
break;
case 404:
new phoenix.dialog({
title: '服务器找不到请求的路径!'
});
break;
default:
new phoenix.dialog({
title: '请求异常,状态码:'+ status +''
});
};
}
};
// 全局页面回调
phoenix.pageTurn = function() {
// 暂停所有的video播放
var video = document.querySelectorAll('VIDEO');
if(video.length > 0) {
for (let i = 0; i < video.length; i++) {
video[i].pause();
};
};
};
```