新增弹幕功能

This commit is contained in:
dragon
2025-02-21 18:46:36 +08:00
parent 191e2ea19b
commit da84cf9eb6
8 changed files with 425 additions and 186 deletions

View File

@@ -87,7 +87,7 @@ body {
box-sizing: border-box;
padding: 0 0.13333rem 0 0.04rem;
overflow: hidden;
margin-bottom: 0.66667rem;
margin-bottom: 0.4rem;
}
.header .danmu #my_container .my_container_in img {
@@ -108,11 +108,89 @@ body {
font-weight: 500;
}
.header .ramadanBlessings {
width: 10rem;
height: 3.73333rem;
background: url(../images/page2_dmBg.png) no-repeat;
background-size: 100% 100%;
position: relative;
margin: -0.8rem auto 0;
}
.header .ramadanBlessings .title {
width: 5.33333rem;
height: 1.36rem;
line-height: 1.36rem;
text-align: center;
color: #FFED26;
font-size: 0.42667rem;
font-weight: 600;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: -0.4rem;
background: url(../images/page2Title.png) no-repeat;
background-size: 100% 100%;
}
.header .ramadanBlessings input {
width: 6.48rem;
height: 0.82667rem;
line-height: 0.82667rem;
border: 0.02667rem solid #2A823C;
border-radius: 0.17333rem;
outline: none;
background: #003A22;
color: #FFED26;
font-size: 0.37333rem;
font-weight: 600;
box-sizing: border-box;
padding: 0 0.26667rem;
position: absolute;
left: 0.93333rem;
top: 1.2rem;
}
.header .ramadanBlessings input::placeholder {
color: #FFED26;
font-size: 0.37333rem;
font-weight: 400;
}
.header .ramadanBlessings .send {
width: 1.6rem;
height: 0.8rem;
background: url(../images/send.png) no-repeat;
background-size: 100% 100%;
text-align: center;
line-height: 0.8rem;
font-size: 0.37333rem;
color: #140600;
font-weight: 600;
position: absolute;
top: 1.21333rem;
right: 0.8rem;
}
.header .ramadanBlessings p {
width: 7.37333rem;
height: 0.69333rem;
line-height: 0.45333rem;
color: #FFED26;
font-size: 0.32rem;
font-weight: 400;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 0.8rem;
text-align: center;
}
.header .tab {
width: 9.62667rem;
height: 1.22667rem;
text-align: center;
margin: 9rem auto 0;
margin: 0.4rem auto 0;
display: flex;
justify-content: space-around;
}
@@ -149,7 +227,7 @@ body {
.page1 {
width: 100%;
position: relative;
margin: -3.46667rem auto 0;
margin: 0 auto 0;
}
.page1 .lanternBox {
@@ -1194,78 +1272,6 @@ body {
margin: 0 auto 0rem;
}
.page22 .tip {
display: none;
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 99;
background: rgba(0, 0, 0, 0.5);
}
.page22 .tip .tip_in {
width: 9.18667rem;
height: 4.85333rem;
background: linear-gradient(90deg, #066A43, #00482B);
border-radius: 0.4rem;
border: 0.02667rem solid #FFED26;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.page22 .tip .tip_in .title {
width: 100%;
text-align: center;
color: #FFED26;
font-size: 0.42667rem;
font-weight: 600;
margin: 0.70667rem auto 0.42667rem;
}
.page22 .tip .tip_in p {
width: 7.70667rem;
min-height: 0.81333rem;
margin: 0 auto;
color: #FFED26;
font-size: 0.37333rem;
font-weight: 600;
line-height: 0.45333rem;
}
.page22 .tip .tip_in .close {
width: 3.54667rem;
height: 1.01333rem;
text-align: center;
line-height: 1.01333rem;
color: #140600;
font-size: 0.37333rem;
font-weight: 600;
background: url(../images/page2_pubBut.png) no-repeat;
background-size: 100% 100%;
position: absolute;
top: 3.2rem;
left: 0.57333rem;
}
.page22 .tip .tip_in .ok {
width: 3.54667rem;
height: 1.01333rem;
text-align: center;
line-height: 1.01333rem;
color: #140600;
font-size: 0.37333rem;
font-weight: 600;
background: url(../images/page1PubBut.png) no-repeat;
background-size: 100% 100%;
position: absolute;
top: 3.2rem;
right: 0.57333rem;
}
.page22 .unfortunately {
display: none;
position: fixed;
@@ -1474,6 +1480,7 @@ body {
.page2 {
display: none;
margin-top: 3.2rem;
}
.page2 .todayCoinsPool {
@@ -2389,3 +2396,75 @@ body {
.Turkiye .page1 .c .page1_2 .answering {
width: 7.5rem;
}
.tip {
display: none;
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 99;
background: rgba(0, 0, 0, 0.5);
}
.tip .tip_in {
width: 9.18667rem;
height: 4.85333rem;
background: linear-gradient(90deg, #066A43, #00482B);
border-radius: 0.4rem;
border: 0.02667rem solid #FFED26;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.tip .tip_in .title {
width: 100%;
text-align: center;
color: #FFED26;
font-size: 0.42667rem;
font-weight: 600;
margin: 0.70667rem auto 0.42667rem;
}
.tip .tip_in p {
width: 7.70667rem;
min-height: 0.81333rem;
margin: 0 auto;
color: #FFED26;
font-size: 0.37333rem;
font-weight: 600;
line-height: 0.45333rem;
}
.tip .tip_in .close {
width: 3.54667rem;
height: 1.01333rem;
text-align: center;
line-height: 1.01333rem;
color: #140600;
font-size: 0.37333rem;
font-weight: 600;
background: url(../images/page2_pubBut.png) no-repeat;
background-size: 100% 100%;
position: absolute;
top: 3.2rem;
left: 0.57333rem;
}
.tip .tip_in .ok {
width: 3.54667rem;
height: 1.01333rem;
text-align: center;
line-height: 1.01333rem;
color: #140600;
font-size: 0.37333rem;
font-weight: 600;
background: url(../images/page1PubBut.png) no-repeat;
background-size: 100% 100%;
position: absolute;
top: 3.2rem;
right: 0.57333rem;
}

View File

@@ -90,7 +90,7 @@ body {
box-sizing: border-box;
padding: 0 px2rem(10) 0 px2rem(3);
overflow: hidden;
margin-bottom: px2rem(50);
margin-bottom: px2rem(30);
img {
display: block;
@@ -113,11 +113,89 @@ body {
}
}
.ramadanBlessings {
width: px2rem(750);
height: px2rem(280);
background: url(../images/page2_dmBg.png) no-repeat;
background-size: 100% 100%;
position: relative;
margin: -0.8rem auto 0;
.title {
width: px2rem(400);
height: px2rem(102);
line-height: px2rem(102);
text-align: center;
color: #FFED26;
font-size: px2rem(32);
font-weight: 600;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: px2rem(-30);
background: url(../images/page2Title.png) no-repeat;
background-size: 100% 100%;
}
input {
width: px2rem(486);
height: px2rem(62);
line-height: px2rem(62);
border: px2rem(2) solid #2A823C;
border-radius: px2rem(13);
outline: none;
background: #003A22;
color: #FFED26;
font-size: px2rem(28);
font-weight: 600;
box-sizing: border-box;
padding: 0 px2rem(20);
position: absolute;
left: px2rem(70);
top: px2rem(90);
&::placeholder {
color: #FFED26;
font-size: px2rem(28);
font-weight: 400;
}
}
.send {
width: px2rem(120);
height: px2rem(60);
background: url(../images/send.png) no-repeat;
background-size: 100% 100%;
text-align: center;
line-height: px2rem(60);
font-size: px2rem(28);
color: #140600;
font-weight: 600;
position: absolute;
top: px2rem(91);
right: px2rem(60);
}
p {
width: px2rem(553);
height: px2rem(52);
line-height: px2rem(34);
color: #FFED26;
font-size: px2rem(24);
font-weight: 400;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: px2rem(60);
text-align: center;
}
}
.tab {
width: px2rem(722);
height: px2rem(92);
text-align: center;
margin: 9rem auto 0;
margin: 0.4rem auto 0;
display: flex;
justify-content: space-around;
@@ -157,8 +235,8 @@ body {
.page1 {
width: 100%;
position: relative;
margin: px2rem(-260) auto 0;
// display: none;
margin: 0 auto 0;
// display: none;px2rem(-260)
.lanternBox {
width: px2rem(750);
@@ -1222,77 +1300,7 @@ body {
}
}
.tip {
display: none;
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 99;
background: rgba(0, 0, 0, .5);
.tip_in {
width: px2rem(689);
height: px2rem(364);
background: linear-gradient(90deg, #066A43, #00482B);
border-radius: px2rem(30);
border: px2rem(2) solid #FFED26;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
.title {
width: 100%;
text-align: center;
color: #FFED26;
font-size: px2rem(32);
font-weight: 600;
margin: px2rem(53) auto px2rem(32);
}
p {
width: px2rem(578);
min-height: px2rem(61);
margin: 0 auto;
color: #FFED26;
font-size: px2rem(28);
font-weight: 600;
line-height: px2rem(34);
}
.close {
width: px2rem(266);
height: px2rem(76);
text-align: center;
line-height: px2rem(76);
color: #140600;
font-size: px2rem(28);
font-weight: 600;
background: url(../images/page2_pubBut.png) no-repeat;
background-size: 100% 100%;
position: absolute;
top: px2rem(240);
left: px2rem(43);
}
.ok {
width: px2rem(266);
height: px2rem(76);
text-align: center;
line-height: px2rem(76);
color: #140600;
font-size: px2rem(28);
font-weight: 600;
background: url(../images/page1PubBut.png) no-repeat;
background-size: 100% 100%;
position: absolute;
top: px2rem(240);
right: px2rem(43);
}
}
}
.unfortunately {
display: none;
@@ -1503,6 +1511,7 @@ body {
.page2 {
display: none;
margin-top: 3.2rem;
.todayCoinsPool {
width: px2rem(750);
@@ -1713,6 +1722,7 @@ body {
.page3_in1 {
padding-top: px2rem(10);
.timeOutBox {
width: px2rem(438);
height: px2rem(90);
@@ -2422,16 +2432,92 @@ body {
background: url(../images/header-tr.png) no-repeat;
background-size: 100% 100%;
}
.header .tab div span{
.header .tab div span {
width: 2.78667rem;
}
.page2 .ramadanGifts .c .gifyBigBox .gift{
.page2 .ramadanGifts .c .gifyBigBox .gift {
width: 21rem;
.giftBox{
.giftBox {
margin-right: px2rem(90);
}
}
.page1 .c .page1_2 .answering{
.page1 .c .page1_2 .answering {
width: 7.5rem;
}
}
.tip {
display: none;
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 99;
background: rgba(0, 0, 0, .5);
.tip_in {
width: px2rem(689);
height: px2rem(364);
background: linear-gradient(90deg, #066A43, #00482B);
border-radius: px2rem(30);
border: px2rem(2) solid #FFED26;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
.title {
width: 100%;
text-align: center;
color: #FFED26;
font-size: px2rem(32);
font-weight: 600;
margin: px2rem(53) auto px2rem(32);
}
p {
width: px2rem(578);
min-height: px2rem(61);
margin: 0 auto;
color: #FFED26;
font-size: px2rem(28);
font-weight: 600;
line-height: px2rem(34);
}
.close {
width: px2rem(266);
height: px2rem(76);
text-align: center;
line-height: px2rem(76);
color: #140600;
font-size: px2rem(28);
font-weight: 600;
background: url(../images/page2_pubBut.png) no-repeat;
background-size: 100% 100%;
position: absolute;
top: px2rem(240);
left: px2rem(43);
}
.ok {
width: px2rem(266);
height: px2rem(76);
text-align: center;
line-height: px2rem(76);
color: #140600;
font-size: px2rem(28);
font-weight: 600;
background: url(../images/page1PubBut.png) no-repeat;
background-size: 100% 100%;
position: absolute;
top: px2rem(240);
right: px2rem(43);
}
}
}

View File

@@ -20,7 +20,7 @@
<div class="time text2"></div>
<!-- 弹幕 -->
<div class="danmu" style="display: none;">
<div class="danmu">
<div id="my_container">
<!-- <div class="my_container_in">
<img src="./images/logo.png" alt="" class="tx">
@@ -29,6 +29,13 @@
</div>
</div>
<!-- 发送弹幕 -->
<div class="ramadanBlessings">
<div class="title text64"></div>
<input type="text text65" placeholder="">
<div class="send text66"></div>
<p class="text67"></p>
</div>
<!-- tab切换 -->
<div class="tab">
<div class="act text3"></div>
@@ -171,16 +178,8 @@
</div>
</div>
</div>
<!-- 页面2 -->
<div class="page22">
<!-- 发送弹幕 -->
<div class="ramadanBlessings">
<div class="title">Ramadan Blessings</div>
<input type="text" placeholder="Happy Ramadan">
<div class="send">Send</div>
<p>Each time you send a blessing, it will consume 77 diamonds</p>
</div>
<!-- 任务 -->
<div class="task">
<div class="t">
@@ -297,15 +296,6 @@
</div>
<div class="b"></div>
</div>
<!-- 确认发送弹幕弹窗 -->
<div class="tip">
<div class="tip_in">
<div class="title">Tip</div>
<p>It costs 77 diamonds to send a Ramadan Blessing. Are you sure you want to send it?</p>
<div class="close">Cancel</div>
<div class="ok">Confirm</div>
</div>
</div>
<!-- 转盘未获奖弹窗 -->
<div class="unfortunately">
<div class="unfortunately_in">
@@ -331,7 +321,6 @@
</div>
</div>
</div>
<!-- 页面3 -->
<div class="page2">
<div class="todayCoinsPool">
@@ -507,7 +496,15 @@
</div>
</div>
</div>
<!-- 确认发送弹幕弹窗 -->
<div class="tip">
<div class="tip_in">
<div class="title text60"></div>
<p class="text61"></p>
<div class="close text62"></div>
<div class="ok text63"></div>
</div>
</div>
<!-- 免责声明 -->
<div class="disclaimer text33"></div>
</body>

View File

@@ -105,7 +105,7 @@ $(function () {
langReplace = window.lang.replace;
localLang = window.lang;
translateFun();
// blessGetConfig();
blessGetConfig();
questionConfig();
}, 100)
})
@@ -154,6 +154,14 @@ function translateFun() {
$('.text41').html(langReplace(localLang.demoModule.text41));
$('.text42').html(langReplace(localLang.demoModule.text42));
$('.text43').html(langReplace(localLang.demoModule.text43));
$('.text60').html(langReplace(localLang.demoModule.text60));
$('.text61').html(langReplace(localLang.demoModule.text61));
$('.text62').html(langReplace(localLang.demoModule.text62));
$('.text63').html(langReplace(localLang.demoModule.text63));
$('.text64').html(langReplace(localLang.demoModule.text64));
$('.header .ramadanBlessings input').attr('placeholder', langReplace(localLang.demoModule.text65));
$('.text66').html(langReplace(localLang.demoModule.text66));
$('.text67').html(langReplace(localLang.demoModule.text67));
$('.page2 .rewardsPub .rewardsPub_in .box img').attr("src", langReplace(localLang.demoModule.text45))
if (browser.ios) {
$('.text33').html(langReplace(localLang.demoModule.text33));
@@ -409,8 +417,8 @@ function bless(bless) {
})
}
// 发送弹幕
$('.page2 .ramadanBlessings .send').click(function () {
var text = $('.page2 .ramadanBlessings input').val();
$('.ramadanBlessings .send').click(function () {
var text = $('.ramadanBlessings input').val();
if (text.length > 20 || text.length == 0) {
toastMsg('内容不能为空并且不能超过20个字符');
return;
@@ -419,16 +427,16 @@ $('.page2 .ramadanBlessings .send').click(function () {
bodyScroolFun(true);
})
// 确认发送按钮
$('.page2 .tip .tip_in .ok').click(function () {
var text = $('.page2 .ramadanBlessings input').val();
$('.tip .tip_in .ok').click(function () {
var text = $('.ramadanBlessings input').val();
bodyScroolFun(false);
$('.page2 .tip').hide();
$('.tip').hide();
bless(text)
})
// 取消发送按钮
$('.page2 .tip .tip_in .close').click(function () {
$('.tip .tip_in .close').click(function () {
bodyScroolFun(false);
$('.page2 .tip').hide();
$('.tip').hide();
})
// 转盘未获奖弹窗
$('.page2 .unfortunately .unfortunately_in .close,.page2 .unfortunately .unfortunately_in .but').click(function () {
@@ -475,6 +483,7 @@ function animationFun() {
// // ===============================================页面三===============================================
var countupTime;//倒计时容器
//tab切换
$('.page2 .list .c .page3_in1 .page3TabBox div').click(function () {
var i = $(this).index() + 1;
@@ -502,4 +511,44 @@ $('.page2 .list .c .page3_in1 .no1 .rewards').click(function () {
$('.page2 .rewardsPub .rewardsPub_in .close').click(function () {
$('.page2 .rewardsPub').hide();
bodyScroolFun(false);
})
})
// 倒計時
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 .list .c .page3_in1 .timeOutBox .days b').text(d);
$('.page2 .list .c .page3_in1 .timeOutBox .hours b').text(h);
$('.page2 .list .c .page3_in1 .timeOutBox .mins b').text(m);
$('.page2 .list .c .page3_in1 .timeOutBox .secs b').text(s);
} else {
getConfig();
}
if (leftTime > 0) {
leftTime = leftTime - 1000;
}
countupTime = setTimeout(function () {
countup(leftTime);
}, 1000);
}
//补0操作
function getzf(num) {
if (parseInt(num) < 10) {
num = '0' + num;
}
return num;
}

View File

@@ -50,7 +50,14 @@ langAr = {
text43: `عشاء فاخر(3/30)`,
text44: `لم يحن وقت الإجابة بعد`,
text45: `./images/rewardsPage3-ar.png`,
text46: ``,
text60: `تنبيه`,
text61: `يتطلب إرسال تهنئة رمضان 77 ماسة. هل أنت متأكد أنك تريد إرسالها؟`,
text62: `إلغاء`,
text63: `تأكيد`,
text64: `تهنئة رمضان`,
text65: `رمضان مبارك`,
text66: `إرسال`,
text67: `في كل مرة ترسل فيها تهنئة، سيتم خصم 77 عملة`,
}
}

View File

@@ -55,6 +55,13 @@ langEn = {
text43: `Fancy Dinner(3/30)`,
text44: `It is not yet time to answer`,
text45: `./images/rewardsPage3.png`,
text46: ``,
text60: `Tip`,
text61: `It costs 77 diamonds to send a Ramadan Blessing. Are you sure you want to send it?`,
text62: `Cancel`,
text63: `Confirm`,
text64: `Ramadan Blessings`,
text65: `Happy Ramadan`,
text66: `Send`,
text67: `Each time you send a blessing, it will consume 77 coins`,
}
}

View File

@@ -50,7 +50,14 @@ langTr = {
text43: `Şık Akşam Yemeği(3/30)`,
text44: `Yanıt verme zamanı henüz gelmedi`,
text45: `./images/rewardsPage3-tr.png`,
text46: ``,
text60: `İpucu`,
text61: `Ramazan Bereketi göndermek 77 elmas gerektirir. Göndermek istediğinizden emin misiniz?`,
text62: `İptal`,
text63: `Onayla`,
text64: `Ramazan Kutlamaları`,
text65: `Mutlu Ramazanlar`,
text66: `Gönder`,
text67: `Her kutlama gönderdiğinizde 77 jeton harcanacaktır`,
}
}

View File

@@ -50,7 +50,14 @@ langZh = {
text43: `丰盛晚餐(3/30)`,
text44: `还未到答题时间`,
text45: `./images/rewardsPage3.png`,
text46: ``,
text60: `提示`,
text61: `發送齋月祝福需要 77 顆鑽石。您確定要發送嗎?`,
text62: `取消`,
text63: `確認`,
text64: `齋月祝福`,
text65: `齋月快樂`,
text66: `發送`,
text67: `每次發送祝福都會消耗77枚硬幣`,
}