function initPage() { initTaskList() } function getTaskList(t) { sendRequest(Server_Url.Task_List, "GET", {devNo: devNo, token: token}, t) } function initTaskList() { getTaskList(function (result) { var colorList = ["#fff", "#fff", "#fff", "#fff", "#fff"]; resultStatus(result); for (var html = "", length = result.data.taskList.length, colorIndex = 0, index = 0; length > index; index++) { var color = ""; var item = result.data.taskList[index]; color = 5 > colorIndex ? colorList[colorIndex] : colorList[colorIndex % 5]; html += '长按识别二维码 ' + ( item.word || "") + '' + '', colorIndex++ } if (0 == colorIndex) { html += '', colorIndex++ } 1 == colorIndex && $("#pagination").addClass("hidden"), $("#taskList").html(html); var outW = $(".bar").width(); //动态修改动画的时间 $("#taskList .span3").each(function () { var that = $(this); var text = that.text(); var time = text.length * 0.5;//一个文字0.5秒 var inW = that.width(); if (inW < outW) { that.css("animation", "none"); } else { that.css("animation-duration", time + "s"); } }); { var d, c, p = colorIndex > 1; new Swiper(".swiper-container", { speed: 600, loop: p, slidesPerView: "auto", centeredSlides: !0, spaceBetween: 10, pagination: { el: '.swiper-pagination' }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, touchRatio: .5 }) } }) } function resultStatus(t) { if (1 != t.result) { toast(t.description); } } var devNo = getQueryString("devNo"), token = getQueryString("token"); initPage();