新增网络延迟,优化下注以及优化中奖ui展示

This commit is contained in:
Dragon
2022-12-15 16:00:23 +08:00
parent 5c530716a5
commit b4b77f43d3
3 changed files with 72 additions and 47 deletions

View File

@@ -293,7 +293,7 @@ body {
background: url("../images/tip.png") no-repeat 0 0/100% 100%;
text-align: center;
font-size: 0.2933333333rem;
color: rgba(255, 240, 199, 0.6);
color: #FFF0C799;
font-weight: bold;
}
.wrap .game-area .draw-time {
@@ -555,7 +555,7 @@ body {
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 3.6rem;
top: 3.8rem;
display: flex;
}
.wrap .game-area .draw-time .put-wrap .put {

View File

@@ -689,7 +689,7 @@ body {
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 3.6rem;
top: 3.8rem;
display: flex;
.put {

View File

@@ -119,6 +119,7 @@ const getNewestAct = () => {
networkRequest({
type: 'GET',
url: urlPrefix + '/act/luckySea/getNewestAct',
timeout: 8000,
success (res) {
if (res.code === 200) {
if ($.isEmptyObject(res.data) || res.data.status === 4) {
@@ -168,6 +169,12 @@ const getNewestAct = () => {
},
error (err) {
toastMsg('網絡錯誤,請退出重進')
},
complete: function (XMLHttpRequest, status) {
if (status == 'timeout') {
XMLHttpRequest.abort()// 超时后中断请求
toastMsg('网络开小差,请退出重进,开奖结果可通过【游戏记录】/【往轮结果】查看~')
}
}
})
}
@@ -609,7 +616,8 @@ const renderPreviousResults = () => {
}
// 發送用戶抽獎數量
const sendUserDrawInfo = (itemId, num) => {
const sendUserDrawInfo = (itemId, num, tais) => {
showLoading();
networkRequest({
type: 'POST',
url: urlPrefix + '/act/luckySea/draw',
@@ -621,16 +629,33 @@ const sendUserDrawInfo = (itemId, num) => {
data: { itemId, num },
success (res) {
if (res.code === 200) {
} else if (31005) (
tais.data('total-num').number = parseInt(tais.data('total-num').number) + fragmentNum
tais
.stop(true, true)
.animate({ scale: 1.1 }, 200)
.animate({ scale: 1 }, 200, function () {
if (lock) {
tais.find('.select-num').html('+' + tais.data('total-num').number).hide().fadeIn(200)
}
setTimeout(() => {
// getUserInfo()
getUserPieceNum()
// getListItem(roundId)
}, 100)
})
hideLoading(layerIndex)
} else if (31005) {
toastMsg(res.message)
)
hideLoading(layerIndex)
}
else {
toastMsg(res.message)
hideLoading(layerIndex)
}
},
error (err) {
toastMsg('網絡錯誤,請退出重進')
hideLoading(layerIndex)
}
})
}
@@ -1154,24 +1179,24 @@ $(function () {
if (!lock) {
lock = !lock
console.log($(this).data('total-num'));
console.log($(this).data('total-num').number);
console.log(fragmentNum);
$(this).data('total-num').number = parseInt($(this).data('total-num').number) + fragmentNum
$(this)
.stop(true, true)
.animate({ scale: 1.1 }, 200)
.animate({ scale: 1 }, 200, function () {
if (lock) {
$(this).find('.select-num').html('+' + $(this).data('total-num').number).hide().fadeIn(200)
}
setTimeout(() => {
// getUserInfo()
getUserPieceNum()
// getListItem(roundId)
}, 100)
})
sendUserDrawInfo($(this).data('total-num').id, fragmentNum)
// console.log($(this).data('total-num'));
// console.log($(this).data('total-num').number);
// console.log(fragmentNum);
// $(this).data('total-num').number = parseInt($(this).data('total-num').number) + fragmentNum
// $(this)
// .stop(true, true)
// .animate({ scale: 1.1 }, 200)
// .animate({ scale: 1 }, 200, function () {
// if (lock) {
// $(this).find('.select-num').html('+' + $(this).data('total-num').number).hide().fadeIn(200)
// }
// setTimeout(() => {
// // getUserInfo()
// getUserPieceNum()
// // getListItem(roundId)
// }, 100)
// })
sendUserDrawInfo($(this).data('total-num').id, fragmentNum, $(this))
}
})