apiready = function(){
//头部不遮盖处理
$api.fixStatusBar($api.dom('header'));
//初始列表查询
initDisputeList();
//监听事件
initEvent();
}
var pageNo=1;//页码
var pageSize=10;//每页所展示的条数
//初始化监听事件
function initEvent() {
/**上拉加载 */
api.addEventListener({
name: 'scrolltobottom',
extra: {
threshold: 20
}
}, function(ret, err) {
//页码+1,继续请求数据
pageNo += 1;
//列表查询
disputeList();
});
/** 下拉刷新 */
api.setRefreshHeaderInfo({
bgColor: '#ccc',
textColor: '#fff',
textDown: '下拉刷新...',
textUp: '松开刷新...'
}, function(ret, err) {
//初始列表查询
initDisputeList();
});
};
//初始化纠纷列表
function initDisputeList(){
if($api.getStorage('infoCustObj')){
//加载中提示
api.showProgress({
style: 'default',
animationType: 'fade',
title: '努力加载中...',
text: '先喝杯茶...',
modal: false
});
api.ajax({
url: global.ip + global.prefix + "/app/disputeList",
method: 'post',
data: {
values: {
//参数
infoCustObj: $api.getStorage('infoCustObj').id,
pageNo: pageNo,
pageSize: pageSize
}
}
},function(ret, err){
// 取消下拉刷新效果
api.refreshHeaderLoadDone();
//取消loading
api.hideProgress();
if (ret.code == '200') {
var disputeListAll = "";
var disputeListIng = "";
var disputeListEd = "";
for(var i = 0;i < ret.data.length;i++){
//页面渲染及逻辑实现
}
}else if (ret.code == '400') {
api.toast({
msg: ret.msg,
duration: 2000,
location: 'bottom'
});
}else {
api.toast({
msg: '网络错误',
duration: 2000,
location: 'bottom'
});
}
});
}else {
api.toast({
msg: '请先登录',
duration: 2000,
location: 'bottom'
});
api.openWin({
name: '登录页面',
url: './frame4.html',
pageParam: {
name: 'test'
}
});
}
}