问题遇到的现象和发生背景
浏览器页面关闭了内存没有释放,随着脚本运行,浏览器提示内存不足,但是刷新页面又可以重新跑
问题相关代码,请勿粘贴截图
if(href.indexOf('servicehall/business-activity-detail')!=-1){
let timer=setInterval(()=>{
if($('tbody.auxo-table-tbody').eq(0).length>0){
clearInterval(timer)
let rateLow=$('.activity-detail__word-special span').eq(1).text()
rateLow=rateLow.split('最低佣金:')
rateLow=rateLow[1]
rateLow=rateLow.split('%')
rateLow=parseInt(rateLow[0])
// console.log('最低佣金:')
// console.log(rateLow)
if(rateLow==0){
window.location.href=href
}
else{
pageFn()
function pageFn(){
let len=$('tbody.auxo-table-tbody').eq(0).find('tr.auxo-table-row.auxo-table-row-level-0').length
clickFn(0)
function clickFn(index){
let $tr=$('tbody.auxo-table-tbody').eq(0).find('tr.auxo-table-row.auxo-table-row-level-0').eq(index)
let rate=$tr.find('td').eq(5).text()
rate=rate.split('%')
rate=rate[0]
let price=$tr.find('td').eq(4).text()
price=price.split(' ')
price=price[1]
if(parseInt(rate)>=rateLow){
$('.unregistered-operation.role-item__btn').eq(index).click()
setTimeout(()=>{
if($('#price').length==0){
nextFn()
}
else{
var myinputEvent = document.createEvent("HTMLEvents");
myinputEvent.initEvent("input", true, true);
$('#price').val(price)
document.querySelector('#price').dispatchEvent(myinputEvent);
setTimeout(()=>{
$('#rate').val(rate)
document.querySelector('#rate').dispatchEvent(myinputEvent);
setTimeout(()=>{
$('#stock').val(100)
document.querySelector('#stock').dispatchEvent(myinputEvent);
setTimeout(()=>{
$('#phone_num').val(15980186430)
document.querySelector('#phone_num').dispatchEvent(myinputEvent);
setTimeout(()=>{
$('#wechat_id').val('imjinwen')
document.querySelector('#wechat_id').dispatchEvent(myinputEvent);
setTimeout(()=>{
$('.auxo-input.cooperate-selling-point__textarea').val('京东销量过万,价格超级丝滑,品质直入人心')
document.querySelector('.auxo-input.cooperate-selling-point__textarea').dispatchEvent(myinputEvent);
setTimeout(()=>{
$('.auxo-btn.auxo-btn-primary.cooperate-selling-point__submit').click()
setTimeout(()=>{
nextFn()
},2000)
},1000)
},1000)
},1000)
},1000)
},1000)
},1000)
}
},1000)
}
else{
nextFn()
}
function nextFn() {
index++
if (index<len){
clickFn(index)
}
else{
if($('.auxo-pagination-next.auxo-pagination-disabled').length==0){
$('.auxo-pagination-next').click()
setTimeout(()=>{
pageFn()
},3000)
}
else{
layer.msg('此达人报名成功')
// console.log('此达人报名成功')
let listIndex=localStorage.getItem('listIndex')
let list=JSON.parse(localStorage.getItem('list'))
listIndex++
localStorage.setItem('listIndex',listIndex)
if(listIndex<list.length){
let url=`https://buyin.jinritemai.com/dashboard/servicehall/business-activity-detail?event_id=${list[listIndex]}&tab_num=1&isSigned=1&isInstitution=0`
window.open(url)
window.close()
}
else{
layer.msg('all报名成功')
console.log('all报名成功')
}
}
}
}
}
}
}
}
},6000)
}
运行结果及报错内容
随着脚本运行,浏览器提示内存不足,但是刷新页面又可以重新跑
各位帮忙看看是什么原因以及解决方法