main
kgdxpr 2 years ago
parent 0717c53206
commit b903f61436

@ -129,7 +129,7 @@
<input id="wSearch" type="search" class="mui-input-clear" placeholder="请输入任务名称1">
</div>
<div class="mui-scroll-wrapper" style="margin-top: 45px;">
<div class="mui-scroll">
<div class="mui-scroll1">
<ul class="mui-table-view" id="wTab">
</ul>
@ -141,7 +141,7 @@
<input id="ySearch" type="search" class="mui-input-clear" placeholder="请输入任务名称2">
</div>
<div class="mui-scroll-wrapper" style="margin-top: 45px;">
<div class="mui-scroll">
<div class="mui-scroll2">
<ul class="mui-table-view" id="yTab">
</ul>
@ -170,11 +170,16 @@
}
var loadWList = function (page, keyword) {
var _limit = 20;
var flag = true;
$.ajax({
url: "/QingLong/collect/viewJobListPerson?page=" + page + "&limit=20&keyword=" + keyword + "&is_finish=0",
url: "/QingLong/collect/viewJobListPerson?page=" + page + "&limit=" + _limit + "&keyword=" + keyword + "&is_finish=0",
async: false,
type: 'GET',
success: function (res) {
if (page * _limit < res.count) {
flag = false;
}
res.data.forEach(function (item) {
var _html = "<li class='mui-table-view-cell' onclick='report(" + item.job_id + "," + item.jiezhi + "," + item.status_code + ",\"" + item.target_id + "\")'>" +
"<div class='mui-table'>" +
@ -190,18 +195,23 @@
$("#wTab").append(_html);
});
_wPage += 1;
}
});
return flag;
}
var loadYList = function (page, keyword) {
var _limit = 20;
var flag = true;
$.ajax({
url: "/QingLong/collect/viewJobListPerson?page=" + page + "&limit=20&keyword=" + keyword + "&is_finish=1",
url: "/QingLong/collect/viewJobListPerson?page=" + page + "&limit=" + _limit + "&keyword=" + keyword + "&is_finish=1",
async: false,
type: 'GET',
success: function (res) {
if (page * _limit < res.count) {
flag = false;
}
res.data.forEach(function (item) {
var _html = "";
@ -238,9 +248,13 @@
_yPage += 1;
}
});
return flag;
}
$(function () {
var pullToRefreshW;
var pullToRefreshY;
var tabFlag = window.localStorage.getItem('tabFlag');
if (tabFlag == 1) {
@ -248,55 +262,71 @@
$("#item1").addClass("mui-active");
$("#tab2").removeClass("mui-active");
$("#item2").removeClass("mui-active");
$("#wTab").empty();
loadWList(1, "");
} else {
_wPage = 1;
wList();
} else {
$("#tab2").addClass("mui-active");
$("#item2").addClass("mui-active");
$("#tab1").removeClass("mui-active");
$("#item1").removeClass("mui-active");
$(".mui-slider-group").css({
"transform": "translate3d(-"+$(window).width()+"px, 0px, 0px) translateZ(0px)",
"transform": "translate3d(-" + $(window).width() + "px, 0px, 0px) translateZ(0px)",
"transition-duration": "0ms"
});
$("#yTab").empty();
loadYList(1, "");
_yPage = 1;
yList();
}
$("#wSearch").keypress(function (event) {
if (event.which == 13) {
pullToRefreshW.refresh(true);
$("#wTab").empty();
loadWList(1, $("#wSearch").val());
_wPage = 1;
wList();
}
});
$("#ySearch").keypress(function (event) {
if (event.which == 13) {
pullToRefreshY.refresh(true);
$("#yTab").empty();
loadYList(1, $("#ySearch").val());
_yPage = 1;
yList();
}
});
mui(".mui-icon-clear")[0].addEventListener('tap', function () {
pullToRefreshW.refresh(true);
$("#wTab").empty();
loadWList(1, "");
_wPage = 1;
wList();
});
mui(".mui-icon-clear")[1].addEventListener('tap', function () {
pullToRefreshY.refresh(true);
$("#yTab").empty();
loadYList(1, "");
_yPage = 1;
yList();
});
mui(".mui-control-item")[0].addEventListener('tap', function () {
if (typeof pullToRefreshW != 'undefined') {
pullToRefreshW.refresh(true);
}
window.localStorage.setItem('tabFlag', 1);
$("#wTab").empty();
loadWList(1, "");
_wPage = 1;
wList();
});
mui(".mui-control-item")[1].addEventListener('tap', function () {
if (typeof pullToRefreshY != 'undefined') {
pullToRefreshY.refresh(true);
}
window.localStorage.setItem('tabFlag', 2);
$("#yTab").empty();
loadYList(1, "");
_yPage = 1;
yList();
});
//阻尼系数
@ -306,28 +336,39 @@
indicators: true, //是否显示滚动条
deceleration: deceleration
});
mui.ready(function () {
//循环初始化所有下拉刷新,上拉加载。
mui.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function (index, pullRefreshEl) {
mui(pullRefreshEl).pullToRefresh({
up: {
// auto: true,
callback: function () {
var self = this;
setTimeout(function () {
if (index == 0) {
loadWList(_wPage, "");
} else {
loadYList(_yPage, "");
}
self.endPullUpToRefresh();
}, 500);
}
function wList() {
pullToRefreshW = mui('.mui-scroll1').pullToRefresh({
up: {
auto: true,
callback: function () {
var self = this;
setTimeout(function () {
var flag = loadWList(_wPage, $("#wSearch").val());
self.endPullUpToRefresh(flag);
}, 200);
}
});
}
});
}
function yList() {
pullToRefreshY = mui('.mui-scroll2').pullToRefresh({
up: {
auto: true,
callback: function () {
var self = this;
console.log("wList2");
setTimeout(function () {
var flag = loadYList(_yPage, $("#ySearch").val());
self.endPullUpToRefresh(flag);
}, 200);
}
}
});
}
});
});
</script>
</body>

Loading…
Cancel
Save