//下拉刷新 上拉加载
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
callback: pulldownRefresh
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
//下拉
function pulldownRefresh() {
setTimeout(function() {
jobList();
}, 1000)
}
//上拉
function pullupRefresh() {
setTimeout(function() {
page++;
sendReq("/job", {
'uid': user_id, //用户id
'token': token, //用户令牌
'page': page, //每次下页面加一
'per_page': per_page
}, "GET", function(resp) {
for(var i = 0; i < resp.result.length; i++) {
var listHtml = '<div class="mui-card-content jobli">' +
'<div class="mui-card-content-inner">' +
'<div class="jobMessage">' +
'<span hidden class="job_id">' + resp.result[i].id + '</span>' +
'<p style="color: #333;" class="work_name">' + resp.result[i].work_name + '<span class="money">' + resp.result[i].money_min + '-' + resp.result[i].money_max + '</span></p>' +
'<div class="card-center">' +
'<p><img src="../img/job_gps.svg" /><span class="company_address">' + resp.result[i].working_address + '</span></p>' +
'<p><img src="../img/work_time.svg" /><span class="working_year">' + resp.result[i].working_year + '</span>年</p>' +
'<p><img src="../img/Education.svg" /><span class="education">' + resp.result[i].education + '</span></p>' +
'</div>' +
'</div>' +
'<div class="user">' +
'<ul class="userHead mui-pull-left">' +
'<img class="companyLOGO" src="' + resp.result[i].logo + '" alt="" style="border-radius: 100%;" />' +
'<ul class="joc_con_v"><span hidden>' + resp.result[i].is_authen + '</span></ul>' +
'</ul>' +
'<ul class="user_t">' +
'<li>' + resp.result[i].full_name + '</li>' +
'<li><span>' + resp.result[i].finacing_status + '</span> | <span>' + resp.result[i].company_scale + '</span> | <span>' + resp.result[i].company_main + '</span></li>' +
'</ul>' +
'<span class="data">' + resp.result[i].date + '</span>' +
'</div>' +
'</div>' +
'</div>';
$('.jodList').append(listHtml);
}
if(resp.result.length < 1) {
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
} else {
mui('#pullrefresh').pullRefresh().endPullupToRefresh(false);
}
for(var i = 0; i < $('.jodList .jobli').length; i++) {
var stat = $('.jodList .jobli').eq(i).find('.joc_con_v span').text();
if(stat == "0") {
$('.jodList .jobli').eq(i).find('.joc_con_v').hide();
} else {
$('.jodList .jobli').eq(i).find('.joc_con_v').show();
}
}
})
}, 1000);
}
//初始加载或者下拉调用
function jobList() {
page++;
sendReq("/job", {
'uid': user_id, //用户id
'token': token, //用户令牌
'page': page,
'per_page': per_page
}, "GET", function(resp) {
// $('.jodList').empty();
for(var i = 0; i < resp.result.length; i++) {
var listHtml = '<div class="mui-card-content jobli">' +
'<div class="mui-card-content-inner">' +
'<div class="jobMessage">' +
'<span hidden class="job_id">' + resp.result[i].id + '</span>' +
'<p style="color: #333;" class="work_name">' + resp.result[i].work_name + '<span class="money">' + resp.result[i].money_min + '-' + resp.result[i].money_max + '</span></p>' +
'<div class="card-center">' +
'<p><img src="../img/job_gps.svg" /><span class="company_address">' + resp.result[i].working_address + '</span></p>' +
'<p><img src="../img/work_time.svg" /><span class="working_year">' + resp.result[i].working_year + '</span>年</p>' +
'<p><img src="../img/Education.svg" /><span class="education">' + resp.result[i].education + '</span></p>' +
'</div>' +
'</div>' +
'<div class="user">' +
'<ul class="userHead mui-pull-left">' +
'<img class="companyLOGO" src="' + resp.result[i].logo + '" alt="" style="border-radius: 100%;" />' +
'<ul class="joc_con_v"><span hidden>' + resp.result[i].is_authen + '</span></ul>' +
'</ul>' +
'<ul class="user_t">' +
'<li>' + resp.result[i].full_name + '</li>' +
'<li><span>' + resp.result[i].finacing_status + '</span> | <span>' + resp.result[i].company_scale + '</span> | <span>' + resp.result[i].company_main + '</span></li>' +
'</ul>' +
'<span class="data">' + resp.result[i].date + '</span>' +
'</div>' +
'</div>' +
'</div>';
$('.jodList').prepend(listHtml);
}
if($('.jobli').length < 1) {
$('.jodList').append(moreData(Text));
}
mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
mui('#pullrefresh').pullRefresh().refresh(true);
for(var i = 0; i < $('.jodList .jobli').length; i++) {
var stat = $('.jodList .jobli').eq(i).find('.joc_con_v span').text();
if(stat == "0") {
$('.jodList .jobli').eq(i).find('.joc_con_v').hide();
} else {
$('.jodList .jobli').eq(i).find('.joc_con_v').show();
}
}
});
}
0 个回复