厨房:完成所有接口联调,提测

This commit is contained in:
Dragon
2023-03-06 17:15:23 +08:00
parent 0a4ff7e83c
commit c12b08e3f8
22 changed files with 656 additions and 218 deletions

View File

@@ -37,8 +37,11 @@ if (false) { //!browser.app
} else {
$('.wrap').removeClass('no-in-app')
}
console.log(document.body.clientWidth);
console.log(document.body.clientHeight);
if (document.body.clientHeight <= 700 || document.body.clientWidth >= 360) {
$('body,html').css({ "height": '19.2rem' });
}
// 獲取用戶相關信息
let myFragment
const getUserInfo = (param) => {
@@ -135,8 +138,8 @@ const getNewestAct = () => {
} else {
clearTimeout(timer2)
hideLoading(layerIndex)
roundId = res.data.roundId
getPreviousResults(20, roundId)
$('.game-area .roundId').html(roundId)
getListItem(roundId, modelType)
@@ -217,11 +220,8 @@ const showView = () => {
$('.award-wrap').html('').show()
// $('.award-info .desc').html('')
getPreviousResults(10, roundId)
showCountDown(userComeinTime, startTime, drawStageStartTime)
getUserInfo()
} else if (drawStageStartTime <= userComeinTime && userComeinTime < showResultStageStartTime) {
// 第二階段
console.log('進入第二階段');
@@ -239,16 +239,13 @@ const showView = () => {
console.log('isStatus2的值------------', isStatus2);
// $('.btn-wrap').find('div').removeClass('active')
getPreviousResults(10, roundId)
showCountDown(userComeinTime, drawStageStartTime, showResultStageStartTime)
judgeStatus()
getUserInfo()
// 播放5s動畫
let player = new SVGA.Player('.wait-time');
let parser = new SVGA.Parser('.wait-time');
parser.load('./images/wait.svga', function (videoItem) {
parser.load('./images/wait1.svga', function (videoItem) {
// player.loops = 2;
player.clearsAfterStop = false;
player.setVideoItem(videoItem);
@@ -268,7 +265,6 @@ const showView = () => {
showCountDown(userComeinTime, showResultStageStartTime, endTime)
judgeStatus()
getUserInfo()
// getPreviousResults(10, roundId)
}
}
@@ -401,7 +397,7 @@ const judgeStatus = () => {
drawInfo = res.data
img = res.data.drawImageUrl
if (isStatus3) {
getPreviousResults(10, roundId)
getPreviousResults(20, roundId)
}
renderDrawInfo()
} else {
@@ -425,8 +421,40 @@ const judgeStatus = () => {
let topThreeArr = []
const renderDrawInfo = () => {
$('.draw-time .current-tip .current-result').html(drawInfo.drawName)
$('.draw-pic img').attr('src', drawInfo.drawImageUrl)
// $('.draw-pic img').attr('src', drawInfo.drawImageUrl)
$('.wrap .game-area .draw-time .draw-pic').remove();
var lenght = drawInfo.drawItemList.length;
var drawStr = '';
drawInfo.drawItemList.forEach(res => {
drawStr += `
<div class="draw-pic">
<img src="${res.drawImageUrl}" alt="">
</div>
`
})
$('.wrap .game-area .draw-time').append(drawStr);
if (lenght == 1) {
$('.wrap .game-area .draw-time').css({ "width": "55%", })
$('.wrap .game-area .draw-time .draw-pic').css({ "width": "50%", "height": "100%", });
$('.wrap .game-area .draw-time .draw-pic img').css({ "width": "45%" });
} else if (lenght == 2) {
$('.wrap .game-area .draw-time').css({ "width": "55%", })
$('.wrap .game-area .draw-time .draw-pic').css({ "width": "50%", "height": "100%", });
$('.wrap .game-area .draw-time .draw-pic img').css({ "width": "45%" });
} else if (lenght == 3) {
$('.wrap .game-area .draw-time').css({ "width": "70%", })
$('.wrap .game-area .draw-time .draw-pic').css({ "width": "33.3333%", "height": "75%", });
$('.wrap .game-area .draw-time .draw-pic img').css({ "width": "40%" });
} else if (lenght == 4) {
$('.wrap .game-area .draw-time').css({ "width": "80%", })
$('.wrap .game-area .draw-time .draw-pic').css({ "width": "25%", "height": "65%", });
$('.wrap .game-area .draw-time .draw-pic img').css({ "width": "38%" });
} else if (lenght > 4) {
$('.wrap .game-area .draw-time').css({ "width": "55%", })
$('.wrap .game-area .draw-time .draw-pic').css({ "width": "1.3466666667rem", "height": "1.3466666667rem", });
$('.wrap .game-area .draw-time .draw-pic img').css({ "width": "0.8rem" });
}
// if()
// if (isStatus3) {
// if (drawInfo.userDrawResult.drawStatus === 1) {
// $('.award-info .desc').html('恭喜你,猜中了!')
@@ -570,8 +598,7 @@ const renderListItem = () => {
setTimeout2s()
}
// 獲取往輪遊戲結果
let previousResults = []
// 獲取往輪遊戲結果
const getPreviousResults = (count, roundId) => {
networkRequest({
type: 'GET',
@@ -582,8 +609,8 @@ const getPreviousResults = (count, roundId) => {
},
success (res) {
if (res.code === 200) {
previousResults = res.data
renderPreviousResults()
// previousResults = res.data
renderPreviousResults(res.data)
}
},
error (err) {
@@ -593,40 +620,51 @@ const getPreviousResults = (count, roundId) => {
}
// 渲染往輪遊戲結果
const renderPreviousResults = () => {
const renderPreviousResults = (val) => {
let str = ''
if (previousResults.length < 5) {
let len = 5 - previousResults.length
if (val.length < 5) {
let len = 5 - val.length
let arr = new Array(len).fill(1)
previousResults.push(...arr)
val.push(...arr)
}
if (isStatus3) {
if (img) {
previousResults.pop()
previousResults.unshift({
val.pop()
val.unshift({
drawImageUrl: img
})
console.log(previousResults);
}
}
previousResults.map((item) => {
val.forEach(res => {
str += `
<p><img src="${item.drawImageUrl}" alt=""></p>
<li>
${res.drawItemList.map(item => {
if (res.drawItemList.length == 1) {
return `<p style="width:0.8rem;height:0.8rem"><img src="${item.drawImageUrl}" alt=""></p>`;
} else if (res.drawItemList.length == 2) {
return `<p style="width:0.6rem;height:0.6rem"><img src="${item.drawImageUrl}" alt=""></p>`;
} else if (res.drawItemList.length == 3) {
return `<p style="width:0.45rem;height:0.45rem"><img src="${item.drawImageUrl}" alt=""></p>`;
} else {
return `<p><img style="width:0.3333333333rem;height:0.3333333333rem" src="${item.drawImageUrl}" alt=""></p>`;
}
}).join('')
}
</li>
`
})
$('.result-list').html(str)
$('.wrap .previous_Round_Result .box ul').html(str)
}
// 發送用戶抽獎數量
const sendUserDrawInfo = (itemId, num, tais) => {
showLoading();
// showLoading();
networkRequest({
type: 'POST',
url: urlPrefix + '/act/luckySea/draw',
// contentType: 'application/json',
// data: `[ {
// data: `[{
// "itemId":${itemId},
// "num":${num}
// }]`,
@@ -787,7 +825,7 @@ const renderMyInfo = () => {
myInfoN.nick = '未知'
}
$('.mine-info').find('.mine-nick').html(myInfoN.nick)
$('.mine-diamond-num').html('猜中' + myInfoN.num + '次')
$('.mine-diamond-num').html('猜中<b> ' + myInfoN.num + ' </b>次')
}
}
@@ -903,7 +941,7 @@ const renderRankList = () => {
othersArr.map((item, index) => {
let num
if (item.erbanNo) {
num = '猜中' + item.num + '次'
num = '猜中<b> ' + item.num + ' </b>次'
}
others += `
<li uid="${item.uid}">
@@ -971,6 +1009,7 @@ $(function () {
}
}
})
// getPreviousResults(20, roundId)
}, 50)
// 監聽按鈕點擊事件