entryAdv.style.display = 'none';
document.body.style.overflow = 'auto';
document.body.ontouchmove = function(ev) {
ev.stopPropagation();
};
}
let time = (res.data.SPJG || 5000) / 1000;
// let time = res.data.SPJG;
let ADV_list = [];
let BCcontextPathSrc = store.state.common.BCcontextPathSrc;
switch (res.data.ADV_TYPE) {
// 开屏直接跳过
case '1':
{
let ImgList = [];
for (let i = 0; i < list.length; i++) {
ImgList.push(BCcontextPathSrc + res.data.retList[i].ADV_IMG_URL);
ADV_list.push(res.data.retList[i].ADV_URL);
}
let count_down = time / list.length;
let ImgNum = 0;
let timer = setInterval(() => {
switch (ImgList.length) {
case 1:
break;
case 2:
{
if (time % 3 == 0) {
ImgNum++;
}
}
break;
case 3:
{
if (time % 2 == 0) {
ImgNum++;
}
}
break;
case 4:
{
if (time % 1 == 0) {
if (ImgNum > ImgList.length - 2) break;
ImgNum++;
}
}
break;
default:
{
if (time % 1 == 0) {
if (ImgNum > ImgList.length - 2) break;
ImgNum++;
}
}
break;
}
if (time <= 0) {
clearInterval(timer);
entryAdv.style.display = 'none';
document.body.style.overflowY = 'auto';
document.body.ontouchmove = function(ev) {
ev.stopPropagation();
};
}
entry.src = ImgList[ImgNum];
entryTim.innerHTML = '跳过 ' + time + 's';
entry.addEventListener('click', function() {
window.location.href = ADV_list[ImgNum];
}, false);
time--;
}, 1000);
entryTim.addEventListener('click', function(ev) {
ev.preventDefault();
clearInterval(timer);
entryAdv.style.display = 'none';
document.body.style.overflowY = 'auto';
document.body.ontouchmove = function(ev) {
ev.stopPropagation();
};
}, false);
}
break;
// 闪屏广告
case '2':
同上开屏广告,可根据贵公司要求来更改
}
};
setTimeout(() => {
require('./main.js');
}, 300)
这样就完成了。










