星级厨房:修改开奖页面

This commit is contained in:
qf
2022-12-09 19:35:35 +08:00
committed by Dragon
parent bc9bc487c1
commit 2db5fd90c7
8 changed files with 682 additions and 121 deletions

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,7 @@ const getNewestAct = () => {
networkRequest({
type: 'GET',
url: urlPrefix + '/act/luckySea/getNewestAct',
success (res) {
success(res) {
if (res.code === 200) {
if ($.isEmptyObject(res.data) || res.data.status === 4) {
return showLoading('服務器正在維護中...')
@@ -166,7 +166,7 @@ const getNewestAct = () => {
return toastMsg(res.message)
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -207,7 +207,7 @@ const showView = () => {
}
$('.award-wrap').html('').show()
$('.award-info .desc').html('')
// $('.award-info .desc').html('')
getPreviousResults(10, roundId)
showCountDown(userComeinTime, startTime, drawStageStartTime)
@@ -373,7 +373,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 +404,7 @@ const judgeStatus = () => {
toastMsg(res.message)
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -416,41 +416,74 @@ const renderDrawInfo = () => {
$('.draw-time .current-tip .current-result').html(drawInfo.drawName)
$('.draw-pic img').attr('src', drawInfo.drawImageUrl)
if (isStatus3) {
if (drawInfo.userDrawResult.drawStatus === 1) {
$('.award-info .desc').html('恭喜你,猜中了!')
// if (modelType === 1) {
// $('.award-wrap').html(`獲得 <span class="award-total">${drawInfo.userDrawResult.prizeDiamonds} </span>鉆石`)
// } else {
// $('.award-wrap').html(`獲得 <span class="award-name">${drawInfo.userDrawResult.prizeName} </span>(<span class="awrad-price">${drawInfo.userDrawResult.prizePrice}</span>鉆)*<span class="award-num">${drawInfo.userDrawResult.prizeCount}</span>個 累計<span class="award-total">${drawInfo.userDrawResult.prizeDiamonds}</span>鉆石`)
// }
} else if (drawInfo.userDrawResult.drawStatus === 2) {
$('.award-info .desc').html('很遺憾,本輪未猜中')
$('.award-wrap').hide()
} else if (drawInfo.userDrawResult.drawStatus === 3) {
$('.award-info .desc').html('本輪未參與')
$('.award-wrap').hide()
}
}
// if (isStatus3) {
// if (drawInfo.userDrawResult.drawStatus === 1) {
// $('.award-info .desc').html('恭喜你,猜中了!')
// // if (modelType === 1) {
// // $('.award-wrap').html(`獲得 <span class="award-total">${drawInfo.userDrawResult.prizeDiamonds} </span>鉆石`)
// // } else {
// // $('.award-wrap').html(`獲得 <span class="award-name">${drawInfo.userDrawResult.prizeName} </span>(<span class="awrad-price">${drawInfo.userDrawResult.prizePrice}</span>鉆)*<span class="award-num">${drawInfo.userDrawResult.prizeCount}</span>個 累計<span class="award-total">${drawInfo.userDrawResult.prizeDiamonds}</span>鉆石`)
// // }
// } else if (drawInfo.userDrawResult.drawStatus === 2) {
// $('.award-info .desc').html('很遺憾,本輪未猜中')
// $('.award-wrap').hide()
// } else if (drawInfo.userDrawResult.drawStatus === 3) {
// $('.award-info .desc').html('本輪未參與')
// $('.award-wrap').hide()
// }
// }
$('.put-wrap .list .item').remove()
// 渲染投入列表
let list = ''
drawInfo.userDrawResult.drawRecords.map(res => {
list += `
<div class="item">
<p><img src="${res.imgUrl}" class="gift" alt=""></p>
<div>
<img src="./images/diamond.png" class="diamond" alt="">
<span class="in">${res.costPieceNum}</span>
</div>
</div>
`
});
$('.put-wrap .list').append(list)
$('.award-info .award-wrap').html(drawInfo.userDrawResult.prizeDiamonds)
// 渲染前三名
topThreeArr = drawInfo.rankUserList
let str = ''
if (topThreeArr.length === 0) {
$('.topthree-desc').html('本輪無人猜中')
$('.top-three-list p img').attr('src', './images/default-hui.png')
$('.top-three-list').css('display', 'none')
$('.top-three').css('line-height', '4rem')
// $('.top-three-list p img').attr('src', './images/default-hui.png')
} else {
$('.topthree-desc').html('本輪前三名')
$('.topthree-desc').html('本輪MVP')
$('.top-three-list').css('display', 'block')
$('.top-three').css('line-height', '0rem')
if (topThreeArr.length < 3) {
let arr = new Array(3 - topThreeArr.length).fill({
avatar: './images/default-hui.png',
nick: '虚位以待',
uid: null,
num: 0
})
topThreeArr.push(...arr)
};
topThreeArr.map((item, index) => {
$('.top-three-list p img').eq(index).attr('src', item)
$(`.top-three-list .no${index + 1} .tx`).attr('uid', item.uid)
$(`.top-three-list .no${index + 1} .tx`).attr('src', item.avatar)
$(`.top-three-list .no${index + 1} .nick`).html(item.nick)
$(`.top-three-list .no${index + 1} .num span`).html(item.prizeDiamonds)
})
if (topThreeArr.length === 1) {
$('.top-three-list p img').eq(1).attr('src', './images/default-hui.png')
$('.top-three-list p img').eq(2).attr('src', './images/default-hui.png')
} else if (topThreeArr.length === 2) {
$('.top-three-list p img').eq(2).attr('src', './images/default-hui.png')
}
}
// 点击跳转个人主页
$('.draw-time .top-three .top-three-list .on').off()
$('.draw-time .top-three .top-three-list .on').click(function () {
let uid = $(this).find('.tx').attr('uid');
openPerson(uid)
})
}
// 獲取每一輪抽獎的相關配置
@@ -463,7 +496,7 @@ const getListItem = (roundId, type) => {
roundId,
type
},
success (res) {
success(res) {
if (res.code === 200) {
listItem = res.data
renderListItem()
@@ -471,7 +504,7 @@ const getListItem = (roundId, type) => {
toastMsg(res.message)
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -542,13 +575,13 @@ const getPreviousResults = (count, roundId) => {
count,
roundId
},
success (res) {
success(res) {
if (res.code === 200) {
previousResults = res.data
renderPreviousResults()
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤,請退出重進')
}
})
@@ -602,12 +635,23 @@ const sendUserDrawInfo = (itemId, num) => {
toastMsg(res.message)
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤,請退出重進')
}
})
}
//跳转个人主页
function openPerson(uid) {
if (!browser.app) return
if (browser.ios) {
window.webkit.messageHandlers.openPersonPage.postMessage(uid);
} else if (browser.android) {
if (androidJsObj && typeof androidJsObj === 'object') {
window.androidJsObj.openPersonPage(uid);
}
}
}
/******************************************** 今日排名相關 ********************************************/
@@ -642,7 +686,7 @@ const getListRank = (type, page) => {
page,
pageSize
},
success (res) {
success(res) {
if (res.code === 200) {
if (type === 1) {
// 鉆石榜單
@@ -676,7 +720,7 @@ const getListRank = (type, page) => {
toastMsg(res.message)
}
},
error (err) {
error(err) {
toastMsg('網絡錯誤')
}
})
@@ -875,8 +919,9 @@ $(function () {
// }
if (browser.app) {
if (browser.android) {
window.androidJsObj.openChargePage();
window.androidJsObj.openChargePage(6);
} else if (browser.ios) {
window.webkit.messageHandlers.chargePayClickPage.postMessage(6);
window.location.href = urlPrefix + '/peko/modules/pay/index.html?channelType=4';
}
}
@@ -1017,14 +1062,14 @@ $(function () {
})
// 播放3s動畫
let player1 = new SVGA.Player('.draw-time');
let parser1 = new SVGA.Parser('.draw-time');
parser1.load('./images/draw.svga', function (videoItem) {
// player.loops = 2;
player1.clearsAfterStop = false;
player1.setVideoItem(videoItem);
player1.startAnimation();
})
// let player1 = new SVGA.Player('.draw-time');
// let parser1 = new SVGA.Parser('.draw-time');
// parser1.load('./images/draw.svga', function (videoItem) {
// // player.loops = 2;
// player1.clearsAfterStop = false;
// player1.setVideoItem(videoItem);
// player1.startAnimation();
// })
// 關閉碎片不足提示彈窗
$('.cancel-btn').on('click', function () {