新增网络延迟,优化下注以及优化中奖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

@@ -16,7 +16,7 @@ const showLoading = (content = '加載中...') => {
type: 2,
shadeClose: false,
content,
success(e) {
success (e) {
layerIndex = $(e).attr('index')
}
})
@@ -45,7 +45,7 @@ const getUserInfo = (param) => {
networkRequest({
type: 'GET',
url: urlPrefix + '/act/luckySea/getUserActInfo',
success(res) {
success (res) {
if (res.code === 200) {
$('.info-bottom .info-wrap .fragment-num span').text(res.data.todayReward);
@@ -63,7 +63,7 @@ const getUserInfo = (param) => {
return toastMsg(res.message)
}
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -73,7 +73,7 @@ const getUserPieceNum = () => {
networkRequest({
type: 'GET',
url: urlPrefix + '/act/luckySea/getUserActInfo',
success(res) {
success (res) {
if (res.code === 200) {
$('.info-bottom').find('.fragment span').html(res.data.diamonds)
myFragment = res.data.diamonds;
@@ -82,7 +82,7 @@ const getUserPieceNum = () => {
}
lock = !lock
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -94,7 +94,7 @@ const getGameMode = () => {
networkRequest({
type: 'GET',
url: urlPrefix + '/act/luckySea/getTimeConfig',
success(res) {
success (res) {
if (res.code === 200) {
modelType = res.data.modelType
getNewestAct()
@@ -102,7 +102,7 @@ const getGameMode = () => {
return toastMsg(res.message)
}
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -119,7 +119,8 @@ const getNewestAct = () => {
networkRequest({
type: 'GET',
url: urlPrefix + '/act/luckySea/getNewestAct',
success(res) {
timeout: 8000,
success (res) {
if (res.code === 200) {
if ($.isEmptyObject(res.data) || res.data.status === 4) {
return showLoading('服務器正在維護中...')
@@ -166,8 +167,14 @@ const getNewestAct = () => {
return toastMsg(res.message)
}
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進')
},
complete: function (XMLHttpRequest, status) {
if (status == 'timeout') {
XMLHttpRequest.abort()// 超时后中断请求
toastMsg('网络开小差,请退出重进,开奖结果可通过【游戏记录】/【往轮结果】查看~')
}
}
})
}
@@ -373,7 +380,7 @@ const judgeStatus = () => {
networkRequest({
type: 'GET',
url: urlPrefix + '/act/luckySea/getNewestAct',
success(res) {
success (res) {
if (res.code === 200) {
console.log('res.data的值------------', res.data);
if ($.isEmptyObject(res.data) || res.data.status === 4) {
@@ -404,7 +411,7 @@ const judgeStatus = () => {
toastMsg(res.message)
}
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -490,7 +497,7 @@ const getListItem = (roundId, type) => {
roundId,
type
},
success(res) {
success (res) {
if (res.code === 200) {
listItem = res.data
renderListItem()
@@ -498,7 +505,7 @@ const getListItem = (roundId, type) => {
toastMsg(res.message)
}
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -569,13 +576,13 @@ const getPreviousResults = (count, roundId) => {
count,
roundId
},
success(res) {
success (res) {
if (res.code === 200) {
previousResults = res.data
renderPreviousResults()
}
},
error(err) {
error (err) {
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',
@@ -619,18 +627,35 @@ const sendUserDrawInfo = (itemId, num) => {
// "num":${num}
// }]`,
data: { itemId, num },
success(res) {
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) {
error (err) {
toastMsg('網絡錯誤,請退出重進')
hideLoading(layerIndex)
}
})
}
@@ -669,7 +694,7 @@ const getListRank = (type, page) => {
page,
pageSize
},
success(res) {
success (res) {
if (res.code === 200) {
if (type === 1) {
// 鉆石榜單
@@ -703,7 +728,7 @@ const getListRank = (type, page) => {
toastMsg(res.message)
}
},
error(err) {
error (err) {
toastMsg('網絡錯誤')
}
})
@@ -825,7 +850,7 @@ const renderRankList = () => {
`
})
$('.other-rank').html(others)
$('.other-rank li').click(function(){
$('.other-rank li').click(function () {
let uid = $(this).attr('uid')
openPerson(uid)
})
@@ -885,7 +910,7 @@ const renderRankList = () => {
`
})
$('.other-rank').html(others)
$('.other-rank li').click(function(){
$('.other-rank li').click(function () {
let uid = $(this).attr('uid')
openPerson(uid)
})
@@ -894,7 +919,7 @@ const renderRankList = () => {
}
//跳转个人主页
function openPerson(uid) {
function openPerson (uid) {
console.log('跳转个人主页方法');
if (!browser.app) return
if (browser.ios) {
@@ -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))
}
})