视频操作
$('video')[0].play();
let i = 1;
let timer = setInterval(function(){
if($('#layui-layer-shade1').get(0) || $('#layui-layer1').get(0) ){
$('#layui-layer-shade1,#layui-layer1').remove();
console.log("验证码被干掉了");
$('video')[0].play();
}else{
console.log("已经过去了" +(i++)*0.5 + "分钟");
}
let duration = $('video')[0].duration;
let currentTime = $('video')[0].currentTime;
if(currentTime==duration){
clearInterval(timer);
console.log("恭喜你,视频已学完!");
}else{
let remainder = (duration-currentTime)/60;
remainder = remainder.toFixed(1);
console.log("视频学习还剩" + remainder + "分钟");
}
}, 30000);
图文学习
function picContent(){
let box = $('#maincontent');
let p = $(box).children();
let num = 1;
let hold = $('#ware_time');
let timer = setInterval(()=>{
box.scrollTop(num*20)
console.log("滚动条位置:" + box.scrollTop());
if(hold.css('display')=="none"){
clearInterval(timer);
console.log("学习完成");
}
if($('#layui-layer-shade1').get(0) || $('#layui-layer1').get(0) ){
$('#layui-layer-shade1,#layui-layer1').remove();
console.log("验证码被干掉了");
}
num += 10;
}, 2000);
}
内容读取
let mulu = $('#mululist').children();
let arr_herf = [];
for (let i=0;i<mulu.length;i++){
var title = mulu[i];
var a_href = $(title).children().attr('href');
arr_herf.push(a_href);
}
for(let item of arr_herf){
eval(item);
if($('.layui-layer-btn1')){
$('.layui-layer-btn1').click();
}
picContent();
}