新增情人节

This commit is contained in:
Dragon
2024-02-06 17:12:09 +08:00
parent 956c3c26f9
commit a598111ede
61 changed files with 5018 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,391 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>熱戀情人節</title>
<link rel="stylesheet" href="../../common/css/reset.css">
<link rel="stylesheet" href="./css/index.css">
</head>
<body>
<!-- 頂部返回 -->
<div class="back">
<img src="./images/travel/back.png" alt="">
</div>
<!-- 頭部 -->
<div class="header">
<div class="rule_icon"></div>
</div>
<!-- tab切換 -->
<div class="tab">
<div class="act">萌動花盒</div>
<div>甜蜜升溫</div>
<div>熱戀時刻</div>
</div>
<!-- 頁面1 -->
<div class="page1">
<div class="bg1">
<!-- 標題 -->
<img src="./images/page1Bg1Title.png" alt="" class="title">
<!-- 愛心盒子 -->
<img src="./images/loveBox.png" alt="" class="loveBox">
<!-- 文案 -->
<p class="p1">活動期間開出「萌動花盒」中的6種不同禮物</p>
<p class="p2">可獲得「初心萌動」限定銘牌</p>
<p class="p3">今日獎勵已發放</p>
<p class="p4">獎勵自動發放每日僅可領取一次點亮結果和獎勵每日中午12點自動刷新</p>
<!-- 銘牌 -->
<img src="./images/mp.png" alt="" class="mp">
<!-- 點亮列錶 -->
<div class="giftListBox">
<div class="giftList giftList1 filter">
<div class="qp"></div>
<img src="./images/1.png" alt="" class="gift">
<div class="giftName">白玫瑰</div>
<div class="giftVAlue">1314鉆</div>
</div>
<div class="giftList giftList2 filter">
<div class="qp"></div>
<img src="./images/2.png" alt="" class="gift">
<div class="giftName">紅玫瑰</div>
<div class="giftVAlue">1314鉆</div>
</div>
<div class="giftList giftList3 filter">
<div class="qp"></div>
<img src="./images/3.png" alt="" class="gift">
<div class="giftName">粉玫瑰</div>
<div class="giftVAlue">1314鉆</div>
</div>
<div class="giftList giftList4 filter">
<div class="qp"></div>
<img src="./images/4.png" alt="" class="gift">
<div class="giftName">彩玫瑰</div>
<div class="giftVAlue">1314鉆</div>
</div>
<div class="giftList giftList5 filter">
<div class="qp"></div>
<img src="./images/5.png" alt="" class="gift">
<div class="giftName">熾熱愛戀</div>
<div class="giftVAlue">1314鉆</div>
</div>
<div class="giftList giftList6 filter">
<div class="qp"></div>
<img src="./images/6.png" alt="" class="gift">
<div class="giftName">純白愛戀</div>
<div class="giftVAlue">1314鉆</div>
</div>
</div>
</div>
<div class="bg2">
<!-- 標題 -->
<img src="./images/page1Bg2Title.png" alt="" class="title">
<!-- 列錶 -->
<ul>
<li class="liTitle">
<div>點亮時間</div>
<div>獲得獎勵</div>
</li>
<li>
<div class="left">
<p>2024/2/1</p>
<span>00:00:00</span>
</div>
<div>xxxx銘牌</div>
</li>
<li class="null">
<div>暫無點亮記錄,快去集齊禮物吧~</div>
</li>
</ul>
</div>
</div>
<!-- 頁面2 -->
<div class="page2">
<div class="box">
<!-- 標題 -->
<img src="./images/page2Title.png" alt="" class="title">
<!-- 購買記錄icon -->
<img src="./images/page2Buy_icon.png" alt="" class="page2Buy_icon">
<!-- 文案 -->
<i class="i1">剩余時間:00天12時12分</i>
<i class="i2">活動期間送禮到達指定任務值,可解鎖超珍稀限時禮物直購權</i>
<i class="i3">1鉆石送禮=1禮物值</i>
<!-- 任務 -->
<div class="tasks tasks1 taskss">
<div class="giftBox">
<div class="qp"></div>
<img src="./images/tasks1.png" alt="" class="gift">
<div class="giftName">心動一剎</div>
<div class="giftVAlue">13140鉆</div>
</div>
<p class="p1">每達到52000禮物值可解鎖1次直購權</p>
<p class="p2">禮物值</p>
<p class="p3">當前可購買: X個</p>
<div class="line">
<span></span>
<i class="i">0/1000</i>
</div>
<div class="buy">
<img src="./images/diamond.png" alt="" class="diamond">
1314購買
</div>
</div>
<div class="tasks2 taskss">
<div class="giftBox">
<div class="qp"></div>
<img src="./images/tasks2.png" alt="" class="gift">
<div class="giftName">絕對寵溺</div>
<div class="giftVAlue">33440鉆</div>
</div>
<p class="p1">每達到1314520禮物值可解鎖1次直購權</p>
<p class="p2">禮物值</p>
<p class="p3">當前可購買: X個</p>
<div class="line">
<span></span>
<i class="i">0/2000</i>
</div>
<div class="buy">
<img src="./images/diamond.png" alt="" class="diamond">
3344購買
</div>
</div>
</div>
</div>
<!-- 頁面3 -->
<div class="page3">
<!-- 獎勵任務 -->
<div class="box">
<!-- 文案 -->
<i class="i2">突破熱戀值,領取限時裝扮獎勵!
女性用戶獲得粉色裝扮,男性用戶獲得藍色裝扮
每個用戶僅能獲取1次將自動發放至「我的裝扮」</i>
<!-- 任務 -->
<div class="tasks tasks1">
<div class="giftBox">
<div class="qp"></div>
<!-- <img src="./images/logo.png" alt="" class="gift"> -->
<div class="giftName">糖果戀人頭飾</div>
<div class="giftVAlue">13140熱戀值</div>
</div>
<p class="p1">糖果戀人頭飾-情人節限定</p>
<p class="p2">熱戀值</p>
<p class="p3">有效期24H</p>
<div class="line">
<span></span>
<i class="i">0/1000</i>
</div>
<div class="buy">
未完成
</div>
</div>
<div class="tasks2">
<div class="giftBox">
<div class="qp"></div>
<!-- <img src="./images/logo.png" alt="" class="gift"> -->
<div class="giftName">糖果戀人氣泡</div>
<div class="giftVAlue">33440熱戀值</div>
</div>
<p class="p1">糖果戀人氣泡·情人節限定</p>
<p class="p2">熱戀值</p>
<p class="p3">有效期24H</p>
<div class="line">
<span></span>
<i class="i">0/1000</i>
</div>
<div class="buy">
未完成
</div>
</div>
</div>
<!-- 前三 -->
<div class="top3">
<!-- 標題 -->
<div class="title">熱戀榜單</div>
<!-- 榜單獎勵 -->
<img src="./images/page3Rule_icon.png" alt="" class="rule_icon">
<!-- 前三列錶 -->
<div class="no1">
<img src="./images/page3Top1.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="leftlogo">
<img src="./images/logo.png" alt="" class="rightlogo">
<div class="name">我是男用戶6...<i> & </i>我是女用戶6...</div>
<span class="score">9999熱戀值</span>
</div>
<div class="no2">
<img src="./images/page3Top2.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="leftlogo">
<img src="./images/logo.png" alt="" class="rightlogo">
<div class="name">我是男用戶6...<i> & </i>我是女用戶6...</div>
<span class="score">9999熱戀值</span>
</div>
<div class="no3">
<img src="./images/page3Top3.png" alt="" class="ts">
<img src="./images/logo.png" alt="" class="leftlogo">
<img src="./images/logo.png" alt="" class="rightlogo">
<div class="name">我是男用戶6...<i> & </i>我是女用戶6...</div>
<span class="score">9999熱戀值</span>
</div>
</div>
<!-- 非前三 -->
<ul>
<li>
<div class="num">4</div>
<img src="./images/logo.png" alt="" class="leftTx">
<img src="./images/logo.png" alt="" class="rightTx">
<div class="leftName">我是男用戶的...</div>
<div class="rightName">我是男用戶的...</div>
<div class="score">0</div>
</li>
</ul>
<!-- 自己組合 -->
<div class="my">
<img src="./images/top.png" alt="" class="icon">
<div class="scroll">
<div class="myBox">
<div class="num">4</div>
<img src="./images/logo.png" alt="" class="leftTx">
<img src="./images/logo.png" alt="" class="rightTx">
<div class="leftName">1我是男用戶的...</div>
<div class="rightName">1我是男用戶的...</div>
<div class="score">0</div>
</div>
</div>
</div>
</div>
<!-- 購買記錄彈窗 -->
<div class="buyRecords">
<div class="buyRecords_in">
<!-- 標題 -->
<img src="./images/page2RuleTitle.png" alt="" class="title">
<!-- 列錶 -->
<ul>
<li class="liTitle">
<div>購買時間</div>
<div>購買禮物</div>
</li>
<li>
<div class="left">
<p>2024/2/1</p>
<span>00:00:00</span>
</div>
<div>xxxx禮物*1個</div>
</li>
<li class="null">
<div>暫無購買記錄~</div>
</li>
</ul>
</div>
</div>
<!-- 活動規則彈窗 -->
<div class="rule">
<div class="rule_in">
<!-- 標題 -->
<img src="./images/ruleTitle.png" alt="" class="title">
<!-- 列錶 -->
<ul>
<li>一、活動時間:</li>
<li> 2024年2月12日12:00:00—2024年2月16日23:59:59</li>
<li> 二、熱戀情人節</li>
<li> 1. 萌動花盒</li>
<li> a. 活動期間5200鉆石萌動花盒幸運禮物限時上線花盒內有6種不同禮物每次送出隨機解鎖1種</li>
<li> b.每送出花盒內的一種禮物皆可點亮對應拼圖所有拼圖全部點亮即可獲得24H【初心萌動】銘牌獎勵</li>
<li> c. 拼圖進度每日中午12點重置活動期間每天均可完成1次 </li>
<li>2. 甜蜜升溫</li>
<li> a. 活動期間,超珍稀禮物直購限時開放,贈送禮物每達指定價值即可解鎖直購</li>
<li>b. 贈送禮物價值每滿520000鉆即可購買【心動一剎131400鉆】</li>
<li>c. 贈送禮物價值每滿13145200鉆即可購買【絕對寵溺334400鉆】</li>
<li>d. 購買的禮物將直接放入背包當中</li>
<li>3. 熱戀時刻</li>
<li>a. 活動時間2月14日0:00:00—2月14日23:59:59</li>
<li>b. 活動時間內比拼熱戀值收到10鉆=1熱戀值</li>
<li>c. 活動時間內熱戀值滿13140可獲得24H【糖果戀人】頭像框獎勵熱戀值滿33440可獲得24H【糖果戀人】氣泡獎勵</li>
<li>d. 大頭號牌照房房主和家族長不可以組成CP不參與榜單活動排名</li>
<li>e. 榜單獎勵TOP1可額外獲得情侶靚號5203344&3344520*30天TOP1-3均可獲得【摯愛唯一】專屬銘牌、頭像框、資料卡、專屬開屏1天</li>
<li>三、特別說明</li>
<li>1.靚號持有者需要在活動結束後2周內確認靚號否則將自動過期無法使用</li>
<li>2.本活動最終解釋權歸PIKO所有本活動以及獎勵與蘋果公司無關</li>
</ul>
</div>
</div>
<!-- 活動結束彈窗 -->
<div class="end">
<div class="end_in">
<img src="./images/endTitle.png" alt="" class="title">
<div class="but">檢視榜單</div>
</div>
</div>
<!-- 購買失敗彈窗 -->
<div class="failureBuy">
<div class="failureBuy_in">
<img src="./images/failureBuyTitle.png" alt="" class="title">
<div class="text">鉆石余額不足</div>
<div class="but close">關閉</div>
<div class="but ok">前往充值</div>
</div>
</div>
<!-- 購買成功彈窗 -->
<div class="success">
<div class="success_in">
<img src="./images/buyTitle.png" alt="" class="title">
<div class="giftListSuccess">
<div class="qp"></div>
<img src="./images/logo.png" alt="" class="gift">
<div class="giftName">禮物名稱</div>
<div class="giftVAlue">0鉆</div>
</div>
<div class="text">xxxx禮物名*1已發放至「我的背包」</div>
<div class="but">知道了</div>
</div>
</div>
<!-- 二次確認購買彈窗 -->
<div class="sure">
<div class="sure_in">
<img src="./images/sureTitle.png" alt="" class="title">
<div class="text">購買成功後將自動發放至「我的背包」</div>
<div class="giftListSuccess">
<div class="qp"></div>
<img src="./images/logo.png" alt="" class="gift">
<div class="giftName">禮物名稱</div>
<div class="giftVAlue">0鉆</div>
</div>
<div class="but close">下次再說</div>
<div class="but ok">立即購買</div>
</div>
</div>
<!-- 榜單獎勵彈窗 -->
<div class="page3Rule">
<div class="page3Rule_in">
<img src="./images/page3Title.png" alt="" class="title">
<div class="box">
<img src="./images/page3Rule_inBg.png" alt="">
</div>
</div>
</div>
</body>
</html>
<script src="../../common/js/flexible.js"></script>
<script src="../../common/js/jquery-3.2.1.min.js"></script>
<script src="../../common/js/common2.js"></script>
<script src="../../common/js/layer.js"></script>
<script src="../../common/js/vconsole.min.js"></script>
<script src="../../common/js/route-constant.js"></script>
<script src="./js/index.js"></script>

View File

@@ -0,0 +1,531 @@
let urlPrefix = getUrlPrefix()
let browser = checkVersion()
let env = EnvCheck();
if (env == 'test') {
new VConsole();
}
// 封裝layer消息提醒框
let layerIndex
const showLoading = (content = '加載中...') => {
layer.open({
type: 2,
shadeClose: false,
content,
success (e) {
layerIndex = $(e).attr('index')
}
})
}
const hideLoading = (index) => {
layer.close(index)
}
const toastMsg = (content = '操作完成', time = 2) => {
layer.open({
content,
time,
skin: 'msg'
})
}
var activityCode1;
var activityCode2;
var activityCode;
var diamondNum;
var taskCode;
var taskIcon;
var taskName;
var showValue;
var countupTime;
// 初始化函數
$(function () {
getInfoFromClient()
setTimeout(function () {
// 頁面全屏
if (browser.app) {
if (browser.android) {
window.androidJsObj.initShowNav(false)
} else {
window.webkit.messageHandlers.initShowNav.postMessage(0)
}
};
// 頂部返回事件
$('.back').click(() => {
if (browser.android) {
window.androidJsObj.closeWebView()
} else {
window.webkit.messageHandlers.closeWebView.postMessage(null)
}
})
getTask_MENG_DONG_HUA_HE();
getTask_TIAN_MI_SHENG_WEN();
getRank();
}, 100)
})
// 獲取榜單接口
function getRank () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/act/2024Valentines/cpRank/getRank',
success (res) {
if (res.code === 200) {
// 處理任務
res.data.cpTaskList.forEach((val, i) => {
console.log(res.status);
if (val.status == 2) {
$(`.page3 .box .tasks${i + 1} .buy`).addClass("act");
$(`.page3 .box .tasks${i + 1} .buy`).text("已完成");
$(`.page3 .box .tasks${i + 1} .line .i`).text(`${res.data.score > val.score ? val.score : res.data.score}/${val.score}`);
$(`.page3 .box .tasks${i + 1} .line span`).css('width', `${(res.data.score / val.score) * 100 >= 100 ? 98.8 : (res.data.score / val.score) * 100}%`)
} else {
$(`.page3 .box .tasks${i + 1} .buy`).removeClass("act");
$(`.page3 .box .tasks${i + 1} .buy`).text("未完成");
$(`.page3 .box .tasks${i + 1} .line .i`).text(`${res.data.score > val.score ? val.score : res.data.score}/${val.score}`);
$(`.page3 .box .tasks${i + 1} .line span`).css('width', `${(res.data.score / val.score) * 100 >= 100 ? 98.8 : (res.data.score / val.score) * 100}%`)
}
});
// 處理前三
var top3 = res.data.rankList.slice(0, 3);
var notTop3 = res.data.rankList.slice(3);
if (top3.length < 3) {
let arr = new Array(3 - top3.length).fill({
leftAvatar: './images/logo.png',
rightAvatar: './images/logo.png',
leftNick: '虛位以待',
rightNick: '虛位以待',
score: "0"
})
top3.push(...arr)
}
top3.forEach((res, i) => {
$(`.page3 .top3 .no${i + 1} .leftlogo`).attr('src', res.leftAvatar);
$(`.page3 .top3 .no${i + 1} .rightlogo`).attr('src', res.rightAvatar);
$(`.page3 .top3 .no${i + 1} .name`).html(`${res.leftNick.length > 6 ? res.leftNick.slice(0, 6) + '...' : res.leftNick}<i> & </i>${res.rightNick.length > 6 ? res.rightNick.slice(0, 6) + '...' : res.rightNick}`);
$(`.page3 .top3 .no${i + 1} .score`).text(unitProcessing(res.score, 10000, 1, 'w') + '熱戀值')
})
// 非前三
var str = '';
$('.page3 ul li').remove();
notTop3.forEach((res, i) => {
str += `
<li>
<div class="num">${res.ranking}</div>
<img src="${res.leftAvatar}" alt="" class="leftTx">
<img src="${res.rightAvatar}" alt="" class="rightTx">
<div class="leftName">${res.leftNick}</div>
<div class="rightName">${res.rightNick}</div>
<div class="score">${unitProcessing(res.score, 10000, 1, 'w')}</div>
</li>
`
})
$('.page3 ul').append(str);
// 處理自己榜單排名
$('.page3 .my .myBox').remove();
var strMy = '';
res.data.meRankList.forEach((res, i) => {
strMy += `
<div class="myBox">
<div class="num">${res.ranking == 0 ? '未上榜' : res.ranking}</div>
<img src="${res.leftAvatar}" alt="" class="leftTx">
<img src="${res.rightAvatar}" alt="" class="rightTx">
<div class="leftName">${res.leftNick}</div>
<div class="rightName">${res.rightNick}</div>
<div class="score">${unitProcessing(res.score, 10000, 1, 'w')}</div>
</div>
`
})
$('.page3 .my .scroll').append(strMy)
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 獲取萌動禮盒點亮任務接口
function activityInfo () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/activity/info',
data: { activityCode: activityCode2 },
success (res) {
if (res.code === 200) {
if (res.data.endTime - res.timestamp > 0) {
countup(res.data.endTime - res.timestamp);
} else {
$('.end').show();
bodyScroolFun(true);
}
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 倒計時
function countup (leftTime) {
clearTimeout(countupTime)
//獲取當前時間
// var now = nowTime;
var d = 0;
var h = 0;
var m = 0;
var s = 0;
//定義變數 d,h,m,s保存倒計時的時間
var d, h, m, s;
//遞歸每秒調⽤countTime⽅法顯⽰動態時間效果
if (leftTime > 0) {
d = getzf(Math.floor(leftTime / 1000 / 60 / 60 / 24));
h = getzf(Math.floor(leftTime / 1000 / 60 / 60 % 24));
m = getzf(Math.floor(leftTime / 1000 / 60 % 60));
s = getzf(Math.floor(leftTime / 1000 % 60));
//將倒計時賦值到div中
$('.page2 .box .i1').text(`剩余時間:${d}${h}${m}${s}`);
} else {
$('.page2 .box .i1').text(`剩余時間:已結束`);
}
if (leftTime > 0) {
leftTime = leftTime - 1000;
}
countupTime = setTimeout(function () {
countup(leftTime);
}, 1000);
}
// 獲取萌動禮盒點亮任務接口
function getTask_MENG_DONG_HUA_HE () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/activity/task/user',
data: { componentCode: "MENG_DONG_HUA_HE" },
success (res) {
if (res.code === 200) {
// 渲染合成列錶
$('.page1 .bg1 .giftListBox .giftList').remove();
var str = '';
res.data[0].children.forEach((res, i) => {
str += `
<div class="giftList giftList${i + 1} ${res.completed ? '' : 'filter'}">
<div class="qp"></div>
<img src="${res.taskIcon}" alt="" class="gift">
<div class="giftName">${res.taskName}</div>
<div class="giftVAlue">${res.taskValue}鉆</div>
</div>
`
});
$('.page1 .bg1 .giftListBox').append(str);
activityCode1 = 'ACT_2024_VALENTINES_DAY';
recordPage(activityCode1, 'MENG_DONG_HUA_HE',);
if (res.data[0].reward.granted) {
$('.page1 .bg1 .p3').show();
} else {
$('.page1 .bg1 .p3').hide();
}
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 獲取甜蜜升溫任務接口
function getTask_TIAN_MI_SHENG_WEN () {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/activity/task/user',
data: { componentCode: "TIAN_MI_SHENG_WEN" },
success (res) {
if (res.code === 200) {
activityCode2 = 'ACT_2024_VALENTINES_DAY';
res.data.forEach((res, i) => {
$(`.page2 .box .tasks${i + 1} .giftBox .gift`).attr('src', res.taskIcon);
$(`.page2 .box .tasks${i + 1} .giftBox .giftName`).text(res.reward.rewardName);
$(`.page2 .box .tasks${i + 1} .giftBox .giftVAlue`).text(res.reward.showValue + '鉆');
$(`.page2 .box .tasks${i + 1} .p1`).text(`每達到${res.taskValue}禮物值可解鎖1次直購權`);
$(`.page2 .box .tasks${i + 1} .line .i`).text(`${res.completeValue % res.taskValue}/${res.taskValue}`);
$(`.page2 .box .tasks${i + 1} .line span`).css('width', `${(res.completeValue % res.taskValue / res.taskValue) * 100 >= 100 ? 98.8 : (res.completeValue % res.taskValue / res.taskValue) * 100}%`);
$(`.page2 .box .tasks${i + 1} .p3`).text(`當前可購買: ${Math.floor(res.activityValue / res.taskValue)}`);
$(`.page2 .box .tasks${i + 1} .buy`).html(`<img src="./images/diamond.png" alt="" class="diamond">
${res.reward.showValue}購買`);
$(`.page2 .box .tasks${i + 1} .buy`).attr('activityCode', res.activityCode);
$(`.page2 .box .tasks${i + 1} .buy`).attr('taskCode', res.taskCode);
$(`.page2 .box .tasks${i + 1} .buy`).attr('diamondNum', res.reward.showValue);
$(`.page2 .box .tasks${i + 1} .buy`).attr('num', Math.floor(res.activityValue / res.taskValue));
$(`.page2 .box .tasks${i + 1} .buy`).attr('taskIcon', res.taskIcon);
$(`.page2 .box .tasks${i + 1} .buy`).attr('taskName', res.reward.rewardName);
$(`.page2 .box .tasks${i + 1} .buy`).attr('showValue', res.reward.showValue);
})
activityInfo();
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 購買接口
function exchange (activityCode, diamondNum, taskCode, taskIcon, taskName, showValue) {
showLoading()
networkRequest({
type: 'post',
url: urlPrefix + '/activity/task/exchange',
data: { activityCode, diamondNum, taskCode, num: 1 },
success (res) {
if (res.code === 200) {
$('.success .success_in .giftListSuccess .gift').attr('src', taskIcon);
$('.success .success_in .giftListSuccess .giftName').text(taskName);
$('.success .success_in .giftListSuccess .giftVAlue').text(`${showValue}`);
$('.success .success_in .text').text(`${taskName}*1已發放至「我的背包」`);
$('.success').show();
getTask_TIAN_MI_SHENG_WEN();
bodyScroolFun(true);
} else if (res.code == 31005) {
$('.failureBuy').show();
bodyScroolFun(true);
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 購買禮物按鈕
$(`.page2 .box .taskss .buy`).click(function () {
var num = $(this).attr('num');
activityCode = $(this).attr('activityCode');
diamondNum = $(this).attr('diamondNum');
taskCode = $(this).attr('taskCode');
taskIcon = $(this).attr('taskIcon');
taskName = $(this).attr('taskName');
showValue = $(this).attr('showValue');
if (num > 0) {//true
$('.sure .sure_in .giftListSuccess .gift').attr('src', taskIcon);
$('.sure .sure_in .giftListSuccess .giftName').text(taskName);
$('.sure .sure_in .giftListSuccess .giftVAlue').text(showValue + '鉆');
$('.sure').show();
bodyScroolFun(true);
} else {
toastMsg('當前購買次數不足~')
}
});
// 二次確認彈窗
$('.sure .sure_in .ok').click(function () {
exchange(activityCode, diamondNum, taskCode, taskIcon, taskName, showValue);
$('.sure').hide();
bodyScroolFun(false);
})
// tab切換
$('.tab div').click(function () {
var i = $(this).index() + 1;
$('.page1,.page2,.page3').hide();
$(`.page${i}`).show();
$(this).addClass(`act`).siblings().removeClass('act')
if (i == 3) {
getRank();
}
})
// 記錄接口
function recordPage (activityCode, componentCode) {
showLoading()
networkRequest({
type: 'get',
url: urlPrefix + '/activity/task/user/record/page',
data: { activityCode, componentCode, pageNum: 1, pageSize: 9999 },
success (res) {
if (res.code === 200) {
var str = '';
if (componentCode == 'MENG_DONG_HUA_HE') {
$('.page1 .bg2 ul li').remove()
if (res.data.records.length <= 0) {
str = `<li class="null"><div>暫無點亮記錄,快去集齊禮物吧~</div></li>`
} else {
res.data.records.forEach(res => {
str += `
<li class="liTitle">
<div>點亮時間</div>
<div>獲得獎勵</div>
</li>
<li>
<div class="left">
<p>${dateFormat(res.createTime, 'yyyy/MM/dd')}</p>
<span>${dateFormat(res.createTime, 'hh/mm/ss')}</span>
</div>
<div>${res.rewardName}銘牌</div>
</li>
`})
}
$('.page1 .bg2 ul').append(str);
} else if (componentCode == 'TIAN_MI_SHENG_WEN') {
$('.buyRecords .buyRecords_in ul li').remove();
if (res.data.records.length <= 0) {
str = `<li class="null"><div>暫無購買記錄~</div></li>`
} else {
res.data.records.forEach(res => {
str += `
<li class="liTitle">
<div>購買時間</div>
<div>購買禮物</div>
</li>
<li>
<div class="left">
<p>${dateFormat(res.createTime, 'yyyy/MM/dd')}</p>
<span>${dateFormat(res.createTime, 'hh/mm/ss')}</span>
</div>
<div>${res.rewardName}禮物*1個</div>
</li>
`})
}
$('.buyRecords .buyRecords_in ul').append(str);
}
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網路錯誤,請退出重進')
}
})
}
// 打開購買記錄
$('.page2 .box .page2Buy_icon').click(function () {
recordPage(activityCode2, 'TIAN_MI_SHENG_WEN',);
$('.buyRecords').show();
bodyScroolFun(true);
})
// 關閉購買記錄
$('.buyRecords').click(function () {
$('.buyRecords').hide();
bodyScroolFun(false);
})
// 打開規則記錄
$('.header .rule_icon').click(function () {
$('.rule').show();
bodyScroolFun(true);
})
// 關閉規則記錄
$('.rule').click(function () {
$('.rule').hide();
bodyScroolFun(false);
})
// 自己榜單展開按鈕
var scrollBool = true;
$('.page3 .my .icon').click(function () {
$('.page3 .my .scroll').scrollTop(0)
if (scrollBool) {
$('.page3 .my').css({ "height": "8.74667rem", "background": "url(./images/myBg.png) no-repeat", "background-size": "100% 100%" })
$('.page3 .my .scroll').css({ "overflow-y": "scroll" })
$('.page3 .my .icon').attr('src', './images/bottom.png')
bodyScroolFun(true);
} else {
$('.page3 .my').css({ "height": "2.2rem", "background": "url(./images/myBg2.png) no-repeat", "background-size": "100% 100%" })
$('.page3 .my .scroll').css({ "overflow-y": "hidden" })
$('.page3 .my .icon').attr('src', './images/top.png')
bodyScroolFun(false);
}
scrollBool = !scrollBool;
})
// 關閉活動結束彈窗
$('.end .end_in .but').click(function () {
$('.page1,.page2,.page3').hide();
$(`.page${3}`).show();
$('.tab div').removeClass('act');
$('.tab div').eq(2).addClass('act');
$('.end').hide();
bodyScroolFun(false);
})
// 關閉充值彈窗
$('.failureBuy .failureBuy_in .close').click(function () {
$('.failureBuy').hide();
bodyScroolFun(false);
})
// 跳轉充值彈窗
$('.failureBuy .failureBuy_in .ok').click(function () {
$('.failureBuy').hide();
bodyScroolFun(false);
if (browser.app) {
if (browser.android) {
let channel = pubInfo.deviceInfo.channel;
console.log(pubInfo.deviceInfo);
if (channel == "google") {
window.androidJsObj.openChargePage(6);
} else {
window.androidJsObj.openChargePage(6);
window.location.href = urlPrefix + '/peko/modules/pay/index.html?channelType=4';
}
} else if (browser.ios) {
let channel = pubInfo.deviceInfo.channel;
if (channel == "appstore") {
window.webkit.messageHandlers.openChargePage.postMessage(null);
} else {
window.webkit.messageHandlers.chargePayClickPage.postMessage(6);
window.location.href = urlPrefix + '/peko/modules/pay/index.html?channelType=4';
}
}
} else {
toastMsg('請在app內打開')
}
})
// 關閉購買成功彈窗
$('.success .success_in .but').click(function () {
$('.success').hide();
bodyScroolFun(false);
})
// 關閉二次確認彈窗
$('.sure .sure_in .close').click(function () {
$('.sure').hide();
bodyScroolFun(false);
})
// 關閉榜單獎勵
$('.page3Rule').click(function () {
$('.page3Rule').hide();
bodyScroolFun(false);
})
// 打開榜單獎勵
$('.page3 .top3 .rule_icon').click(function () {
$('.page3Rule').show();
bodyScroolFun(true);
})
//補0操作
function getzf (num) {
if (parseInt(num) < 10) {
num = '0' + num;
}
return num;
}