From 8729fc7f5bcd304184429a4f0aa5efd450c45d0d Mon Sep 17 00:00:00 2001 From: qf Date: Mon, 6 Feb 2023 18:46:18 +0800 Subject: [PATCH] =?UTF-8?q?23=E6=83=85=E4=BA=BA=E8=8A=82=EF=BC=9A=E8=B4=AD?= =?UTF-8?q?=E4=B9=B0=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E6=9C=AA=E4=B8=AD?= =?UTF-8?q?=E5=A5=96=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/2023-Valentines-Day/js/index.js | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/view/peko/activity/2023-Valentines-Day/js/index.js b/view/peko/activity/2023-Valentines-Day/js/index.js index 7930f49..8b344fc 100644 --- a/view/peko/activity/2023-Valentines-Day/js/index.js +++ b/view/peko/activity/2023-Valentines-Day/js/index.js @@ -77,6 +77,7 @@ function getLetterInit() { $('.letter-wrap .letter .imgbox img').attr('src', res.data.keepsake.icon) $('.letter-wrap .letter p e').text(res.data.keepsakeNum) $('.letter-wrap .get_letter').attr('id', res.data.keepsake.id) + $('.letter-wrap .get_letter').attr('type', res.data.keepsake.type) if (nowTime >= res.data.endTime) { $('.letter-wrap .get_letter').css('filter', 'grayscale(0.7)') } @@ -111,6 +112,7 @@ function getPetitionInit() { $(`.petition-wrap .gift-wrap .li${i + 1} .giftbg img`).attr('src', res.icon) $(`.petition-wrap .gift-wrap .li${i + 1} span`).html(res.name) $(`.petition-wrap .gift-wrap .li${i + 1} .btn`).attr('id', res.id) + $(`.petition-wrap .gift-wrap .li${i + 1} .btn`).attr('type', res.type) $(`.petition-wrap .gift-wrap .li${i + 1} .btn`).html(res.type == 2 ? '兌換銘牌' : res.type == 3 ? '兌換資料卡' : res.type == 4 ? '兌換頭飾' : '兌換座駕') $(`.petition-wrap .gift-wrap .li${i + 1} p e`).html(res.price) }) @@ -119,6 +121,7 @@ function getPetitionInit() { $('.petition-wrap .number-wrap .giftbg img').attr('src', res.icon) $('.petition-wrap .number-wrap span').html(res.name) $('.petition-wrap .number-wrap .btn').attr('id', res.id) + $('.petition-wrap .number-wrap .btn').attr('type', res.type) $('.petition-wrap .number-wrap p e').html(res.price) }) @@ -350,7 +353,7 @@ function getDrawRecord(drawPage, tab) { } // 购买信物、兑换、抽奖 (道具id,数量) -function buy(id, num) { +function buy(id, num, type ) { showLoading() networkRequest({ type: 'POST', @@ -379,7 +382,12 @@ function buy(id, num) { $('.gx').show() } } else { - toastMsg(res.message) + if(type == 6) { + toastMsg('很遺憾沒有抽到,距離靚號就差一點啦~') + }else { + toastMsg(res.message) + } + canGet = true } @@ -558,6 +566,7 @@ $('.letter-wrap .get_letter').click(function () { toastMsg('活動未開始~') } else { let id = $(this).attr('id') + let type = $(this).attr('type') let num = $('.letter-wrap .but input').val() if (num == 0) { toastMsg('至少投入1') @@ -565,7 +574,7 @@ $('.letter-wrap .get_letter').click(function () { } if (canGet) { console.log('id:', id, 'num:', num); - buy(id, num) + buy(id, num, type) } else { toastMsg('信物獲取中,請稍後~') } @@ -614,7 +623,8 @@ $('.petition-wrap .gift-wrap li .btn').click(function () { let liIndex = $(this).parents('li').index() let num = $('.petition-wrap .gift-wrap li').eq(liIndex).find('.but input').val(); let id = $('.petition-wrap .gift-wrap li').eq(liIndex).find('.btn').attr('id'); - buy(id, num) + let type = $('.petition-wrap .gift-wrap li').eq(liIndex).find('.btn').attr('type'); + buy(id, num, type) }) // 靓号按钮输入框 // 投入+ @@ -650,8 +660,9 @@ $('.petition-wrap .number-wrap .but').on('input', 'input', function () { // 抽取靓号 $('.petition-wrap .number-wrap .btn').click(function () { let id = $(this).attr('id'); + let type = $(this).attr('type'); let num = $('.petition-wrap .number-wrap .but input').val(); - buy(id, num) + buy(id, num, type) }) // 关闭恭喜获得弹窗