修复bug

This commit is contained in:
Dragon
2024-02-22 16:09:23 +08:00
parent bb0acd6a57
commit 9f468451fe
5 changed files with 94 additions and 76 deletions

View File

@@ -23,7 +23,7 @@ if (env == 'test') {
console.log($(window).width());
console.log($(window).height());
var lock = true;
// 封裝layer消息提醒框
let layerIndex
@@ -606,14 +606,16 @@ const sendUserDrawInfo = (itemId, num) => {
if (currentWeaponIndex_top != undefined) {
restrainArr[currentWeaponIndex_top]['num_top'] = 0
}
}else if(res.code === 31005){
} else if (res.code === 31005) {
$('.shade-mask-no-money').show();
} else {
toastMsg(res.message)
}
lock = true;
},
error (err) {
toastMsg('網絡錯誤,請退出重進')
lock = true;
}
})
}
@@ -1326,22 +1328,25 @@ $(function () {
// return
// }
// 每個標誌位上的數量
restrainArr[currentWeaponIndex].costPieceNum += parseInt($('.select-num input').val())
$('.sign-wrap div').eq(currentWeaponIndex).find('img')
.stop(true, true)
.animate({ scale: 1.2 }, 200)
.animate({ scale: 1 }, 200, function () {
$('.sign-wrap div').eq(currentWeaponIndex).find('p').html('+' + restrainArr[currentWeaponIndex].costPieceNum).hide().fadeIn(200)
setTimeout(() => {
getUserInfo()
}, 100)
})
if (lock) {
lock = false;
// 每個標誌位上的數量
restrainArr[currentWeaponIndex].costPieceNum += parseInt($('.select-num input').val())
$('.sign-wrap div').eq(currentWeaponIndex).find('img')
.stop(true, true)
.animate({ scale: 1.2 }, 200)
.animate({ scale: 1 }, 200, function () {
$('.sign-wrap div').eq(currentWeaponIndex).find('p').html('+' + restrainArr[currentWeaponIndex].costPieceNum).hide().fadeIn(200)
setTimeout(() => {
getUserInfo()
}, 100)
})
console.log('costPieceNum---', restrainArr[currentWeaponIndex].costPieceNum);
console.log('id----', restrainArr[currentWeaponIndex].id);
sendUserDrawInfo(restrainArr[currentWeaponIndex].id, $('.select-num input').val())
console.log('costPieceNum---', restrainArr[currentWeaponIndex].costPieceNum);
console.log('id----', restrainArr[currentWeaponIndex].id);
sendUserDrawInfo(restrainArr[currentWeaponIndex].id, $('.select-num input').val())
}
})
// let isSelectTopWeapon
@@ -1451,63 +1456,66 @@ $(function () {
if ($('.popup-select-num input').val() == 0) {
return toastMsg('數量不能少於0')
}
if (parseInt(myFragment) < $('.popup-select-num input').val()) {
console.log(1);
let distance = $('.popup-select-num input').val() - myFragment
// let listArr = JSON.parse( window.sessionStorage.getItem('listMap'))
// console.log(JSON.parse( window.sessionStorage.getItem('listMap') ));
let packItem = {}
let giveNum = ''
if (distance == 1) {
packItem = listMap[0]
giveNum = 1
} else if (distance <= 10) {
console.log(2);
packItem = listMap[1]
giveNum = '7~10'
} else if (distance <= 100) {
packItem = listMap[2]
giveNum = '70~100'
} else {
packItem = listMap[3]
giveNum = '700~1000'
}
console.log(packItem);
$('.popup-not-enough .headwear-pic').attr('src', packItem.imgUrl)
$('.popup-not-enough .headwear-name').html(packItem.name + '/天')
$('.popup-not-enough .headwear-award').html(`獲贈魔法石${giveNum}`)
$('.popup-not-enough .headwear-price span').html(packItem.sellingPrice)
$('.popup-not-enough .diamond-num span').html(userDiamonds)
// if (parseInt(myFragment) < $('.popup-select-num input').val()) {
// console.log(1);
// let distance = $('.popup-select-num input').val() - myFragment
// // let listArr = JSON.parse( window.sessionStorage.getItem('listMap'))
// // console.log(JSON.parse( window.sessionStorage.getItem('listMap') ));
// let packItem = {}
// let giveNum = ''
// if (distance == 1) {
// packItem = listMap[0]
// giveNum = 1
// } else if (distance <= 10) {
// console.log(2);
// packItem = listMap[1]
// giveNum = '7~10'
// } else if (distance <= 100) {
// packItem = listMap[2]
// giveNum = '70~100'
// } else {
// packItem = listMap[3]
// giveNum = '700~1000'
// }
// console.log(packItem);
// $('.popup-not-enough .headwear-pic').attr('src', packItem.imgUrl)
// $('.popup-not-enough .headwear-name').html(packItem.name + '/天')
// $('.popup-not-enough .headwear-award').html(`獲贈魔法石${giveNum}個`)
// $('.popup-not-enough .headwear-price span').html(packItem.sellingPrice)
// $('.popup-not-enough .diamond-num span').html(userDiamonds)
$('.popup-not-enough .buy-btn').data('id', packItem.id)
// $('.popup-not-enough .buy-btn').data('id', packItem.id)
// 召喚神器彈窗關閉
$('.popup-summon').hide()
$('.popup-summon input').val(0)
$('.popup-select-num .ipt-wrap main i').html(0)
$('.popup-select-num .ipt-wrap p i').html(0)
restrainArr[currentWeaponIndex_top]['num_top'] = 0
// // 召喚神器彈窗關閉
// $('.popup-summon').hide()
// $('.popup-summon input').val(0)
// $('.popup-select-num .ipt-wrap main i').html(0)
// $('.popup-select-num .ipt-wrap p i').html(0)
// restrainArr[currentWeaponIndex_top]['num_top'] = 0
$('.popup-not-enough').show()
return
// $('.popup-not-enough').show()
// return
// }
if (lock) {
lock = false;
// 每個標誌位上的數量
restrainArr[currentWeaponIndex_top].costPieceNum += parseInt($('.popup-select-num input').val())
$('.sign-wrap div').eq(currentWeaponIndex_top).find('img')
.stop(true, true)
.animate({ scale: 1.2 }, 200)
.animate({ scale: 1 }, 200, function () {
$('.sign-wrap div').eq(currentWeaponIndex_top).find('p').html('+' + restrainArr[currentWeaponIndex_top].costPieceNum).hide().fadeIn(200)
setTimeout(() => {
getUserInfo()
}, 100)
})
console.log('costPieceNum---', restrainArr[currentWeaponIndex_top].costPieceNum);
console.log('id----', restrainArr[currentWeaponIndex_top].id);
sendUserDrawInfo(restrainArr[currentWeaponIndex_top].id, $('.popup-select-num input').val())
}
// 每個標誌位上的數量
restrainArr[currentWeaponIndex_top].costPieceNum += parseInt($('.popup-select-num input').val())
$('.sign-wrap div').eq(currentWeaponIndex_top).find('img')
.stop(true, true)
.animate({ scale: 1.2 }, 200)
.animate({ scale: 1 }, 200, function () {
$('.sign-wrap div').eq(currentWeaponIndex_top).find('p').html('+' + restrainArr[currentWeaponIndex_top].costPieceNum).hide().fadeIn(200)
setTimeout(() => {
getUserInfo()
}, 100)
})
console.log('costPieceNum---', restrainArr[currentWeaponIndex_top].costPieceNum);
console.log('id----', restrainArr[currentWeaponIndex_top].id);
sendUserDrawInfo(restrainArr[currentWeaponIndex_top].id, $('.popup-select-num input').val())
})
@@ -1571,6 +1579,9 @@ $(function () {
$('.popup-not-enough .close').click(() => {
$('.popup-not-enough').hide()
})
$('.wrap .popup-result .result-content .close').click(function () {
$('.popup-result').hide()
})
$('body').click(() => {
$('.shade-mask-no-money').hide()
})