完成音萌情人节活动

This commit is contained in:
Dragon
2024-02-05 20:32:02 +08:00
parent 4b0993dee3
commit f4a2bce138
59 changed files with 388 additions and 58 deletions

View File

@@ -364,7 +364,6 @@ body {
} }
.page2 .box .i1 { .page2 .box .i1 {
width: 3.78667rem;
height: 0.56rem; height: 0.56rem;
line-height: 0.56rem; line-height: 0.56rem;
border-radius: 0.56rem; border-radius: 0.56rem;
@@ -373,6 +372,7 @@ body {
font-size: 0.32rem; font-size: 0.32rem;
top: 2.53333rem; top: 2.53333rem;
background: #9789E9; background: #9789E9;
padding: 0 0.26667rem;
} }
.page2 .box .i2 { .page2 .box .i2 {
@@ -501,8 +501,7 @@ body {
height: 0.26667rem; height: 0.26667rem;
border-radius: 0.26667rem; border-radius: 0.26667rem;
position: absolute; position: absolute;
border: 0.02667rem solid #7151CE; left: 0.02667rem;
left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%); background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%);
@@ -643,12 +642,11 @@ body {
} }
.page2 .box .tasks2 .line span { .page2 .box .tasks2 .line span {
width: 10%; width: 98.8%;
height: 0.26667rem; height: 0.26667rem;
border-radius: 0.26667rem; border-radius: 0.26667rem;
position: absolute; position: absolute;
border: 0.02667rem solid #7151CE; left: 0.02667rem;
left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%); background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%);
@@ -833,8 +831,7 @@ body {
height: 0.26667rem; height: 0.26667rem;
border-radius: 0.26667rem; border-radius: 0.26667rem;
position: absolute; position: absolute;
border: 0.02667rem solid #7151CE; left: 0.02667rem;
left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%); background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%);
@@ -985,8 +982,7 @@ body {
height: 0.26667rem; height: 0.26667rem;
border-radius: 0.26667rem; border-radius: 0.26667rem;
position: absolute; position: absolute;
border: 0.02667rem solid #7151CE; left: 0.02667rem;
left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%); background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%);
@@ -1407,6 +1403,7 @@ body {
font-weight: 500; font-weight: 500;
background: url(../images/love_h.png) no-repeat; background: url(../images/love_h.png) no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
white-space: nowrap;
} }
.page3 .my .myBox .leftTx { .page3 .my .myBox .leftTx {

View File

@@ -374,7 +374,7 @@ body {
} }
.i1 { .i1 {
width: px2rem(284); // width: px2rem(284);
height: px2rem(42); height: px2rem(42);
line-height: px2rem(42); line-height: px2rem(42);
border-radius: px2rem(42); border-radius: px2rem(42);
@@ -383,6 +383,7 @@ body {
font-size: px2rem(24); font-size: px2rem(24);
top: px2rem(190); top: px2rem(190);
background: #9789E9; background: #9789E9;
padding: 0 px2rem(20);
} }
.i2 { .i2 {
@@ -510,8 +511,9 @@ body {
height: px2rem(20); height: px2rem(20);
border-radius: px2rem(20); border-radius: px2rem(20);
position: absolute; position: absolute;
border: px2rem(2) solid #7151CE; // border-left: px2rem(2) solid #7151CE;
left: 0; // border-right: px2rem(2) solid #7151CE;
left: px2rem(2);
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%); background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%);
@@ -655,12 +657,12 @@ body {
background: #7466c4; background: #7466c4;
span { span {
width: 10%; width: 98.8%;
height: px2rem(20); height: px2rem(20);
border-radius: px2rem(20); border-radius: px2rem(20);
position: absolute; position: absolute;
border: px2rem(2) solid #7151CE; // border: px2rem(2) solid #7151CE;
left: 0; left: px2rem(2);
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%); background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%);
@@ -848,8 +850,8 @@ body {
height: px2rem(20); height: px2rem(20);
border-radius: px2rem(20); border-radius: px2rem(20);
position: absolute; position: absolute;
border: px2rem(2) solid #7151CE; // border: px2rem(2) solid #7151CE;
left: 0; left: px2rem(2);
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%); background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%);
@@ -1004,8 +1006,8 @@ body {
height: px2rem(20); height: px2rem(20);
border-radius: px2rem(20); border-radius: px2rem(20);
position: absolute; position: absolute;
border: px2rem(2) solid #7151CE; // border: px2rem(2) solid #7151CE;
left: 0; left: px2rem(2);
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%); background: linear-gradient(90deg, #B4A8FE 0%, #DBF4FA 100%);
@@ -1438,6 +1440,7 @@ body {
font-weight: 500; font-weight: 500;
background: url(../images/love_h.png) no-repeat; background: url(../images/love_h.png) no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
white-space: nowrap
} }
.leftTx { .leftTx {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 847 KiB

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 800 KiB

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 KiB

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -118,7 +118,7 @@
<i class="i2">活动期间送礼到达指定任务值,可解锁超珍稀限时礼物直购权</i> <i class="i2">活动期间送礼到达指定任务值,可解锁超珍稀限时礼物直购权</i>
<i class="i3">1钻石送礼=1礼物值</i> <i class="i3">1钻石送礼=1礼物值</i>
<!-- 任务 --> <!-- 任务 -->
<div class="tasks"> <div class="tasks tasks1 taskss">
<div class="giftBox"> <div class="giftBox">
<div class="qp"></div> <div class="qp"></div>
<img src="./images/tasks1.png" alt="" class="gift"> <img src="./images/tasks1.png" alt="" class="gift">
@@ -137,7 +137,7 @@
1314购买 1314购买
</div> </div>
</div> </div>
<div class="tasks2"> <div class="tasks2 taskss">
<div class="giftBox"> <div class="giftBox">
<div class="qp"></div> <div class="qp"></div>
<img src="./images/tasks2.png" alt="" class="gift"> <img src="./images/tasks2.png" alt="" class="gift">
@@ -165,10 +165,10 @@
<div class="box"> <div class="box">
<!-- 文案 --> <!-- 文案 -->
<i class="i2">突破热恋值,领取限时装扮奖励! <i class="i2">突破热恋值,领取限时装扮奖励!
收礼方将获得粉色装扮,送礼方则获得蓝色装扮 女性用户获得粉色装扮,男性用户获得蓝色装扮
奖励自动发放至「我的装扮」</i> 每个用户仅能获取1次自动发放至「我的装扮」</i>
<!-- 任务 --> <!-- 任务 -->
<div class="tasks"> <div class="tasks tasks1">
<div class="giftBox"> <div class="giftBox">
<div class="qp"></div> <div class="qp"></div>
<!-- <img src="./images/logo.png" alt="" class="gift"> --> <!-- <img src="./images/logo.png" alt="" class="gift"> -->
@@ -200,8 +200,8 @@
<span></span> <span></span>
<i class="i">0/1000</i> <i class="i">0/1000</i>
</div> </div>
<div class="buy act"> <div class="buy">
完成 完成
</div> </div>
</div> </div>
</div> </div>
@@ -310,8 +310,13 @@
<li>d. 购买的礼物将直接放入背包当中</li> <li>d. 购买的礼物将直接放入背包当中</li>
<li>3. 热恋时刻</li> <li>3. 热恋时刻</li>
<li>a. 活动时间2月14日0:00:00—2月14日23:59:59</li> <li>a. 活动时间2月14日0:00:00—2月14日23:59:59</li>
<li>b. 活动时间内比拼热恋值收到10钻=1热恋值</li> <li>b. 活动时间内比拼热恋值收到1钻=1热恋值</li>
<li>c. 活动时间内,热恋值满</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.本活动最终解释权归音萌所有,本活动以及奖励与苹果公司无关;</li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@@ -26,7 +26,15 @@ const toastMsg = (content = '操作完成', time = 2) => {
skin: 'msg' skin: 'msg'
}) })
} }
var activityCode1;
var activityCode2;
var activityCode;
var diamondNum;
var taskCode;
var taskIcon;
var taskName;
var showValue;
var countupTime;
// 初始化函数 // 初始化函数
$(function () { $(function () {
getInfoFromClient() getInfoFromClient()
@@ -47,32 +55,85 @@ $(function () {
window.webkit.messageHandlers.closeWebView.postMessage(null) window.webkit.messageHandlers.closeWebView.postMessage(null)
} }
}) })
getTask(); getTask_MENG_DONG_HUA_HE();
getTask_TIAN_MI_SHENG_WEN();
getRank();
}, 100) }, 100)
}) })
// 获取任务接口 // 获取榜单接口
function getTask () { function getRank () {
showLoading() showLoading()
networkRequest({ networkRequest({
type: 'get', type: 'get',
url: urlPrefix + '/activity/task/user', url: urlPrefix + '/act/2024Valentines/cpRank/getRank',
data: { componentCode: 1 },
success (res) { success (res) {
if (res.code === 200) { if (res.code === 200) {
// 渲染合成列表 // 处理任务
$('.page1 .bg1 .giftListBox .giftList').remove(); 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 = ''; var str = '';
res.data.forEach((res, i) => { $('.page3 ul li').remove();
notTop3.forEach((res, i) => {
str += ` str += `
<div class="giftList giftList${i + 1} ${res.completed ? '' : 'filter'}"> <li>
<div class="qp"></div> <div class="num">${res.ranking}</div>
<img src="${res.taskIcon}" alt="" class="gift"> <img src="${res.leftAvatar}" alt="" class="leftTx">
<div class="giftName">${res.taskName}</div> <img src="${res.rightAvatar}" alt="" class="rightTx">
<div class="giftVAlue">${res.showValue}</div> <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> </div>
` `
}); })
$('.page1 .bg1 .giftListBox').append(str); $('.page3 .my .scroll').append(strMy)
} else { } else {
toastMsg(res.message) toastMsg(res.message)
} }
@@ -84,17 +145,275 @@ function getTask () {
} }
}) })
} }
// 获取萌动礼盒点亮任务接口
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切换
$('.tab div').click(function () { $('.tab div').click(function () {
var i = $(this).index() + 1;
var i = $(this).index() + 1; var i = $(this).index() + 1;
$('.page1,.page2,.page3').hide(); $('.page1,.page2,.page3').hide();
$(`.page${i}`).show(); $(`.page${i}`).show();
$(this).addClass(`act`).siblings().removeClass('act') $(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 () { $('.page2 .box .page2Buy_icon').click(function () {
recordPage(activityCode2, 'TIAN_MI_SHENG_WEN',);
$('.buyRecords').show(); $('.buyRecords').show();
bodyScroolFun(true); bodyScroolFun(true);
}) })
@@ -137,6 +456,10 @@ $('.page3 .my .icon').click(function () {
// 关闭活动结束弹窗 // 关闭活动结束弹窗
$('.end .end_in .but').click(function () { $('.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(); $('.end').hide();
bodyScroolFun(false); bodyScroolFun(false);
}) })
@@ -148,7 +471,7 @@ $('.failureBuy .failureBuy_in .close').click(function () {
}) })
// 跳转充值弹窗 // 跳转充值弹窗
$('.failureBuy .failureBuy_in .close').click(function () { $('.failureBuy .failureBuy_in .ok').click(function () {
$('.failureBuy').hide(); $('.failureBuy').hide();
bodyScroolFun(false); bodyScroolFun(false);
if (browser.android) { if (browser.android) {
@@ -171,12 +494,6 @@ $('.sure .sure_in .close').click(function () {
bodyScroolFun(false); bodyScroolFun(false);
}) })
// 二次确认弹窗
$('.sure .sure_in .ok').click(function () {
$('.sure').hide();
bodyScroolFun(false);
})
// 关闭榜单奖励 // 关闭榜单奖励
$('.page3Rule').click(function () { $('.page3Rule').click(function () {
$('.page3Rule').hide(); $('.page3Rule').hide();
@@ -188,3 +505,11 @@ $('.page3 .top3 .rule_icon').click(function () {
$('.page3Rule').show(); $('.page3Rule').show();
bodyScroolFun(true); bodyScroolFun(true);
}) })
//补0操作
function getzf (num) {
if (parseInt(num) < 10) {
num = '0' + num;
}
return num;
}