替换为繁体

This commit is contained in:
Dragon
2023-08-14 11:14:38 +08:00
parent 660cbde145
commit f00ef26431
2 changed files with 173 additions and 163 deletions

View File

@@ -26,20 +26,20 @@ const toastMsg = (content = '操作完成', time = 2) => {
skin: 'msg'
})
}
var xiqueNum = 0;//前剩余喜鹊数
var roomUid = 0;//房uid
var giftId = 0;//默认礼物id
var xiqueBut = true;//投放喜鹊锁
var data = null;//默日榜
var rankType = 1;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=爱意总榜)
var curDate;//天日期
var nextHourTimeStamp;//下一轮结束时间
var leftTime;//倒计时暂
var timeOut2;//存定
var redLineNum = 0;//红绳数
var page = 1;//页码
var pageSizeLack = true;// 下拉更多
var lack = true;// 抽奖锁
var xiqueNum = 0;//前剩余喜鵲數
var roomUid = 0;//房uid
var giftId = 0;//默認禮物id
var xiqueBut = true;//投放喜鵲鎖
var data = null;//默日榜
var rankType = 1;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=愛意總榜)
var curDate;//天日期
var nextHourTimeStamp;//下一輪結束時間
var leftTime;//倒計時暫
var timeOut2;//存定
var redLineNum = 0;//紅繩數
var page = 1;//頁碼
var pageSizeLack = true;// 下拉更多
var lack = true;// 抽獎鎖
// 初始化函數
$(function () {
setTimeout(function () {
@@ -76,22 +76,22 @@ function getConfig () {
data: {},
success (res) {
if (res.code === 200) {
// 理活动时间
// 理活動時間
$('.header .titleHeader').text(`活動時間:${dateFormat(res.data.startTime, 'yyyy年MM月dd日')}-${dateFormat(res.data.endTime, 'yyyy年MM月dd日')}`)
// 前用户喜鹊
// 前用戶喜鵲
xiqueNum = res.data.xiqueNum
$('.page1 .magpieBridge .birdNum b').text(`我的喜鵲: ${res.data.xiqueNum}`)
// 处理当前喜鹊进度状态
// 處理當前喜鵲進度狀態
var curXiqueNums = res.data.serverCurXiqueNum / res.data.serverMaxXiqueNum * 100;
$('.page1 .magpieBridge .line .line_in').css('width', curXiqueNums >= 100 ? '100%' : `${curXiqueNums}%`);
// 处理领取喜鹊头饰按钮状态
if (res.data.devotedBtnStatus == 0) {//投入按钮状态0=可投入1=可2=不能取,-1=已取)
// 處理領取喜鵲頭飾按鈕狀態
if (res.data.devotedBtnStatus == 0) {//投入按鈕狀態0=可投入1=可2=不能取,-1=已取)
$('.page1 .magpieBridge .buting').hide();
$('.page1 .magpieBridge .buterr').hide();
$('.page1 .magpieBridge .butout').hide();
$('.page1 .magpieBridge .but1').show();
$('.page1 .magpieBridge .but10').show();
} else if (res.data.devotedBtnStatus == 1) {//投入按钮状态0=可投入1=可2=不能取,-1=已取)
} else if (res.data.devotedBtnStatus == 1) {//投入按鈕狀態0=可投入1=可2=不能取,-1=已取)
$('.page1 .magpieBridge .buting').show();
$('.page1 .magpieBridge .but1').hide();
$('.page1 .magpieBridge .but10').hide();
@@ -104,7 +104,7 @@ function getConfig () {
$('.page1 .magpieBridge .but1').hide();
$('.page1 .magpieBridge .but10').hide();
}
// 理任务状态
// 理任務狀態
res.data.dailyTaskList.forEach((res, i) => {
$(`.page1 .task .box1 .task${i + 1} .p2`).text(`獎勵:喜鵲*${res.xiqueNum}`)
if (res.btnStatus == 1) {//已完成
@@ -131,7 +131,7 @@ function getConfig () {
}
})
}
// 取房Uid接口
// 取房Uid接口
function getRecommendRoom () {
showLoading()
networkRequest({
@@ -162,10 +162,10 @@ function redLineGetConfig () {
data: { pub_ticket: pubInfo.ticket, pub_uid: pubInfo.uid },
success (res) {
if (res.code === 200) {
// 设置红绳数
// 設置紅繩數
redLineNum = res.data.redLineNum;
$('.page2 .blessingTree .redRope b').text(res.data.redLineNum);
// 渲染祈福列
// 渲染祈福列
res.data.drawList.forEach((res, i) => {
$(`.page2 .blessingTree .lantern${i + 1}`).attr('id', res.id);
if (res.able) {
@@ -190,7 +190,7 @@ function redLineGetConfig () {
}
})
}
// 祈福抽接口
// 祈福抽接口
function redLineDraw (id) {
// showLoading()
networkRequest({
@@ -227,7 +227,7 @@ function redLineDraw (id) {
}
})
}
// 默认抽奖祈福按
// 默認抽獎祈福按
$('.page2 .blessingTree .but').click(function () {
if (redLineNum > 0) {
if (lack) {
@@ -235,10 +235,10 @@ $('.page2 .blessingTree .but').click(function () {
redLineDraw(null);
}
} else {
toastMsg('红绳数量不足,可参与投放喜鹊活动获得')
toastMsg('紅繩數量不足,可參與投放喜鵲活動獲得')
}
})
// 指定抽
// 指定抽
$('.page2 .blessingTree .lantern').click(function () {
var id = $(this).attr('id');
if (redLineNum > 0) {
@@ -247,10 +247,10 @@ $('.page2 .blessingTree .lantern').click(function () {
redLineDraw(id);
}
} else {
toastMsg('红绳数量不足,可参与投放喜鹊活动获得')
toastMsg('紅繩數量不足,可參與投放喜鵲活動獲得')
}
})
// 播放喜svg
// 播放喜svg
function blessingTreeSvgaFun1 () {
$('.page2 .blessingTree .blessingTreeSvga1').show();
setTimeout(function () {
@@ -270,7 +270,7 @@ function blessingTreeSvgaFun1 () {
})
})
}
// 播放喜svg
// 播放喜svg
function blessingTreeSvgaFun2 () {
$('.page2 .blessingTree .blessingTreeSvga2').show();
setTimeout(function () {
@@ -290,7 +290,7 @@ function blessingTreeSvgaFun2 () {
})
})
}
// 播放喜svg
// 播放喜svg
function blessingTreeSvgaFun3 () {
$('.page2 .blessingTree .blessingTreeSvga3').show();
setTimeout(function () {
@@ -310,7 +310,7 @@ function blessingTreeSvgaFun3 () {
})
})
}
// 播放喜svg
// 播放喜svg
function blessingTreeSvgaFun4 () {
$('.page2 .blessingTree .blessingTreeSvga4').show();
setTimeout(function () {
@@ -352,22 +352,22 @@ function fresh () {
}
})
}
// 刷新按
// 刷新按
$('.page2 .blessingTree .refresh').click(function () {
fresh();
})
// 定情信物礼物轮
// 定情信物禮物輪
function swiperFun () {
var mySwiper = new Swiper('.swiper', {
direction: "vertical",
loop: true,
autoplay: {
delay: 2000,//3秒切一次
delay: 2000,//3秒切一次
disableOnInteraction: false
}
})
}
// tab切
// tab切
$('.tabs div').click(function () {
var i = $(this).index() + 1;
$('.tabs').removeClass('tab1').removeClass('tab2').removeClass('tab3').removeClass('tab4');
@@ -390,7 +390,7 @@ $('.tabs div').click(function () {
getCpRank();
}
})
// 房间榜单接口
// 房間榜單接口
function getRoomRank () {
$('.page3 ul li').remove();
showLoading()
@@ -402,11 +402,11 @@ function getRoomRank () {
if (res.code === 200) {
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({
avatar: './images/logo.png',
nick: '位以待',
nick: '位以待',
score: "0"
})
top3.push(...arr)
@@ -417,7 +417,7 @@ function getRoomRank () {
$(`.page3 .no${index + 1} b`).text(`情緣值:${unitProcessing(res.score, 10000, 1, 'w')}`);
$(`.page3 .no${index + 1} .txBg`).attr('uid', res.uid);
})
// 跳前三房
// 跳前三房
$('.page3 .no .txBg').click(function () {
var uid = $(this).attr('uid');
if (browser.ios) {
@@ -444,7 +444,7 @@ function getRoomRank () {
`
})
$('.page3 ul').append(str);
// 跳非前三房
// 跳非前三房
$('.page3 ul li .tx').click(function () {
var uid = $(this).attr('uid');
if (browser.ios) {
@@ -455,7 +455,7 @@ function getRoomRank () {
}
}
})
// 理自己榜
// 理自己榜
var meRank = res.data.meRank;
$('.page3 .my .num').text(meRank.ranking == 0 ? '未上榜' : meRank.ranking);
$('.page3 .my .tx').attr('src', meRank.avatar);
@@ -472,7 +472,7 @@ function getRoomRank () {
}
})
}
// 取情榜接口
// 取情榜接口
function getRank (date, rankType) {
$('.page4 ul li').remove();
showLoading()
@@ -482,9 +482,9 @@ function getRank (date, rankType) {
data: { date, rankType },
success (res) {
if (res.code === 200) {
// 设置当天日期
// 設置當天日期
curDate = res.data.curDate;
// 理日期
// 理日期
if (res.data.dateList) {
res.data.dateList.forEach((res, i) => {
$('.page4 .timeList div').eq(i).text(`${res[6]}.${res[8]}${res[9]}`);
@@ -497,11 +497,11 @@ function getRank (date, rankType) {
}
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({
avatar: './images/logo.png',
nick: '位以待',
nick: '位以待',
score: "0"
})
top3.push(...arr)
@@ -512,7 +512,7 @@ function getRank (date, rankType) {
if (rankType == 1 || rankType == 2) {
$(`.page4 .no${index + 1} b`).text(`甜蜜值:${unitProcessing(res.score, 10000, 1, 'w')}`);
} else {
$(`.page4 .no${index + 1} b`).text(`值:${unitProcessing(res.score, 10000, 1, 'w')}`);
$(`.page4 .no${index + 1} b`).text(`值:${unitProcessing(res.score, 10000, 1, 'w')}`);
}
})
// 非前三
@@ -525,13 +525,13 @@ function getRank (date, rankType) {
<div class="name">${res.nick}</div>
<div class="score">
<img src="./images/loveIcon.png" alt="" class="loveIcon">
<b>${rankType == 1 || rankType == 2 ? "甜蜜值:" : '心值:'}${unitProcessing(res.score, 10000, 1, 'w')}</b>
<b>${rankType == 1 || rankType == 2 ? "甜蜜值:" : '心值:'}${unitProcessing(res.score, 10000, 1, 'w')}</b>
</div>
</li>
`
})
$('.page4 ul').append(str);
// 理自己榜
// 理自己榜
var meRank = res.data.meRank;
$('.page4 .my .num').text(meRank.ranking == 0 ? '未上榜' : meRank.ranking);
$('.page4 .my .tx').attr('src', meRank.avatar);
@@ -539,7 +539,7 @@ function getRank (date, rankType) {
if (rankType == 1 || rankType == 2) {
$('.page4 .my .score b').text(`甜蜜值:${unitProcessing(meRank.score, 10000, 1, 'w')}`);
} else {
$('.page4 .my .score b').text(`值:${unitProcessing(meRank.score, 10000, 1, 'w')}`);
$('.page4 .my .score b').text(`值:${unitProcessing(meRank.score, 10000, 1, 'w')}`);
}
hideLoading(layerIndex)
} else {
@@ -553,7 +553,7 @@ function getRank (date, rankType) {
}
})
}
// 首页任务切换
// 首頁任務切換
$('.page1 .task .tab div').click(function () {
var i = $(this).index() + 1;
if (i == 1) {
@@ -562,37 +562,37 @@ $('.page1 .task .tab div').click(function () {
$('.page1 .task').addClass('tasks2');
}
})
// 打开活动规则
// 打開活動規則
$('.header .rule').click(function () {
bodyScroolFun(true);
$('.rule_pub').show();
})
// 关闭活动规则
// 關閉活動規則
$('.rule_pub').click(function () {
bodyScroolFun(false);
$('.rule_pub').hide();
})
// 打开房间榜活动规则
// 打開房間榜活動規則
$('.page3 .rule').click(function () {
bodyScroolFun(true);
$('.page3 .roomRule').show();
})
// 关闭房间榜活动规则
// 關閉房間榜活動規則
$('.roomRule').click(function () {
bodyScroolFun(false);
$('.roomRule').hide();
})
// 打开房间榜活动规则
// 打開房間榜活動規則
$('.page4 .rule').click(function () {
bodyScroolFun(true);
$('.page4 .sweet').show();
})
// 关闭房间榜活动规则
// 關閉房間榜活動規則
$('.sweet').click(function () {
bodyScroolFun(false);
$('.sweet').hide();
})
// 祈愿树tab切
// 祈願樹tab切
$('.page2 .blessingTreeBoomt .tab div').click(function () {
var i = $(this).index() + 1;
if (i == 1) {
@@ -604,14 +604,14 @@ $('.page2 .blessingTreeBoomt .tab div').click(function () {
$('.page2 .blessingTreeBoomt2 .box2 ul li').remove();
}
})
//检测是否到底部
//檢測是否到底部
$(document).ready(function () {
$(".page2 .blessingTreeBoomt2 .box2 ul").scroll(function () {
var divHeight = $(this).height();
var nScrollHeight = $(this)[0].scrollHeight;
var nScrollTop = $(this)[0].scrollTop;
if (nScrollTop + divHeight >= nScrollHeight) {
console.log("到底部了");
console.log("到底部了");
if (pageSizeLack) {
pageSizeLack = false;
page++;
@@ -620,7 +620,7 @@ $(document).ready(function () {
}
});
});
// 祈福记录
// 祈福記錄
function pageRecord (page) {
showLoading()
networkRequest({
@@ -661,7 +661,7 @@ function pageRecord (page) {
}
})
}
// 取CP榜接口
// 取CP榜接口
function getCpRank () {
showLoading()
networkRequest({
@@ -678,8 +678,8 @@ function getCpRank () {
} else {
$('.page4 .loveList .txL').attr('src', './images/logo.png');
$('.page4 .loveList .txR').attr('src', './images/logo.png');
$('.page4 .loveList .leftName').text('位以待');
$('.page4 .loveList .rightName').text('位以待');
$('.page4 .loveList .leftName').text('位以待');
$('.page4 .loveList .rightName').text('位以待');
}
if (res.data.nextHourTimeStamp) {
@@ -702,27 +702,27 @@ function getCpRank () {
}
})
}
// 倒计时
// 倒計時
function countup () {
clearTimeout(timeOut2)
//获取当前时间
//獲取當前時間
// var now = nowTime;
var d = 0;
var h = 0;
var m = 0;
var s = 0;
//定义变量 d,h,m,s保存倒计时的时间
//定義變量 d,h,m,s保存倒計時的時間
var d, h, m, s;
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中
//將倒計時賦值到div中
$('.page4 .loveList .times span').eq(0).text(m);
$('.page4 .loveList .times span').eq(1).text(s);
leftTime = leftTime - 1000;
//递归每秒⽤countTime⽅法显⽰动态时间效果
//遞歸每秒調⽤countTime⽅法顯⽰動態時間效果
} else {
getCpRank();
// location.reload();
@@ -730,20 +730,20 @@ function countup () {
}
timeOut2 = setTimeout(countup, 1000);
}
//0操作
//0操作
function getzf (num) {
if (parseInt(num) < 10) {
num = '0' + num;
}
return num;
}
// 七夕榜tab切
var type = 'a';//a:甜蜜b:心
// 七夕榜tab切
var type = 'a';//a:甜蜜b:心
$('.page4 .page4Tab div').click(function () {
$('.page4 .dayAll').removeClass('dayAll2');
var i = $(this).index() + 1;
if (i == 1) {
rankType = 1;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=爱意总榜)
rankType = 1;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=愛意總榜)
data = null;
getRank(data, rankType);
$('.page4 .page4Tab').removeClass('page4Tab2');
@@ -756,37 +756,37 @@ $('.page4 .page4Tab div').click(function () {
type = 'b';
}
})
// 七夕榜日榜榜切
// 七夕榜日榜榜切
$('.page4 .dayAll div').click(function () {
var i = $(this).index() + 1;
if (i == 1) {
$('.page4 .dayAll').removeClass('dayAll2');
rankType = type == "a" ? 1 : 3;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=爱意总榜)
rankType = type == "a" ? 1 : 3;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=愛意總榜)
data = null;
getRank(data, rankType);
$('.page4 .timeList').show();
} else {
$('.page4 .dayAll').addClass('dayAll2');
rankType = type == "a" ? 2 : 4;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=爱意总榜)
rankType = type == "a" ? 2 : 4;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=愛意總榜)
data = null;
getRank(data, rankType);
$('.page4 .timeList').hide();
}
})
// 日榜切日期
// 日榜切日期
$('.page4 .timeList div').click(function () {
var datas = $(this).attr('data');
$(this).addClass('active').siblings().removeClass('active');
rankType = type == "a" ? 1 : 3;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=爱意总榜)
rankType = type == "a" ? 1 : 3;//排行榜1=甜蜜日榜2=甜蜜3=意日榜4=愛意總榜)
data = datas;
getRank(data, rankType);
})
// 关闭活动结束按
// 關閉活動結束按
$('.endActivity .endActivity_in .but').click(function () {
$('.endActivity').hide();
bodyScroolFun(false);
})
//取全服喜鹊奖励
//取全服喜鵲獎勵
function getXiqueReward () {
showLoading()
networkRequest({
@@ -796,7 +796,7 @@ function getXiqueReward () {
success (res) {
if (res.code === 200) {
getConfig();
toastMsg('取成功');
toastMsg('取成功');
} else {
toastMsg(res.message)
}
@@ -808,15 +808,15 @@ function getXiqueReward () {
}
})
}
// 取喜鹊奖励按钮
// 取喜鵲獎勵按鈕
$('.page1 .magpieBridge .buting').click(function () {
getXiqueReward();
})
// 取喜鹊未参与按钮
// 取喜鵲未參與按鈕
$('.page1 .magpieBridge .buterr').click(function () {
toastMsg('您未加搭建鹊桥活动,无法领取');
toastMsg('您未加搭建鵲橋活動,無法領取');
})
// 投放喜接口
// 投放喜接口
function devotedXique (num) {
// showLoading()
networkRequest({
@@ -842,7 +842,7 @@ function devotedXique (num) {
}
})
}
// 播放喜svg
// 播放喜svg
function svgaFun () {
player1 = new SVGA.Player('.xique');
parser1 = new SVGA.Parser('.xique');
@@ -857,12 +857,12 @@ function svgaFun () {
})
})
}
// 投放按
// 投放按
$('.page1 .magpieBridge .but1,.page1 .magpieBridge .but10').click(function () {
var clas = $(this).attr('class')
if (clas == 'but1') {
if (xiqueNum < 1) {
toastMsg('喜鹊数量不足,加任务获得吧~')
toastMsg('喜鵲數量不足,加任務獲得吧~')
return
}
if (xiqueBut) {
@@ -875,7 +875,7 @@ $('.page1 .magpieBridge .but1,.page1 .magpieBridge .but10').click(function () {
} else {
if (xiqueNum < 10) {
toastMsg('喜鹊数量不足,加任务获得吧~')
toastMsg('喜鵲數量不足,加任務獲得吧~')
return
}
if (xiqueBut) {
@@ -888,7 +888,7 @@ $('.page1 .magpieBridge .but1,.page1 .magpieBridge .but10').click(function () {
// devotedXique(10);
}
})
// 去完成任2按
// 去完成任2按
$('.page1 .task .box1 .task2 .but').click(function () {
var click = $(this).attr('click');
if (click != 0) {
@@ -901,7 +901,7 @@ $('.page1 .task .box1 .task2 .but').click(function () {
}
}
})
// 去完成任3按
// 去完成任3按
$('.page1 .task .box1 .task3 .but').click(function () {
var click = $(this).attr('click');
if (click != 0) {
@@ -913,4 +913,14 @@ $('.page1 .task .box1 .task3 .but').click(function () {
}
}
}
})
// 循環任務按鈕
$('.page1 .tasks2 .box2 .task2But').click(function(){
if (browser.ios) {
window.webkit.messageHandlers.openRoomForGiftId.postMessage(JSON.stringify({ uid: roomUid, giftId: giftId }))
} else if (browser.android) {
if (androidJsObj && typeof androidJsObj === 'object') {
window.androidJsObj.openRoomForGiftId(roomUid, giftId);
}
}
})