123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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 += '<section class="swiper-slide" style="background-color: ' + color + ';"><div class="swiper-scale show"><div class="bar-wrap" ><div class="bar"><span class="span1">长按识别二维码</span> <span class="span2"><span class="span3"><em class="c-red">' + ( item.word || "") + '</em></span></span></div></div>' +
- '<img class="swiper-img" data-id="' + item.id + '" src="' + item.qrcode + '" /></div></section>', colorIndex++
- }
- if (0 == colorIndex) {
- html += '<section class="swiper-slide"><div class="swiper-tips-offline iconfont icon-huanying common-color"></div></section>',
- 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();
|