优化合成礼物超出提示以及投入交互

This commit is contained in:
Dragon
2024-01-11 12:01:09 +08:00
parent 0fc37c0289
commit 0d1261e87c
4 changed files with 123 additions and 64 deletions

View File

@@ -770,10 +770,16 @@ body {
.refining .refining_in p {
margin-top: 0.98667rem;
width: 100%;
width: 90%;
text-align: center;
color: #fff;
font-size: 0.32rem;
margin: 0.98667rem auto 0;
line-height: 0.45rem;
}
.refining .refining_in p b {
color: #00E5F9;
}
.refining .refining_in div {
@@ -781,7 +787,7 @@ body {
display: flex;
justify-content: space-between;
box-sizing: border-box;
margin-top: 0.74667rem;
margin-top: 0.53333rem;
padding: 0 0.73333rem;
}

View File

@@ -17,6 +17,7 @@
url('../../../common/fonts/PingFang-Regular.ttf') format('truetype'),
url('../../../common/fonts/PingFang-Regular.ttf') format('svg');
}
.back {
position: fixed;
top: px2rem(50);
@@ -52,7 +53,8 @@ body {
.step1 {
display: none;
.step_tips{
.step_tips {
width: px2rem(684);
height: px2rem(328);
// margin: px2rem(553) px2rem(30) 0;
@@ -61,6 +63,7 @@ body {
left: px2rem(30);
z-index: 999;
}
.step_but {
width: px2rem(108);
height: px2rem(121);
@@ -71,9 +74,11 @@ body {
z-index: 999;
}
}
.step2 {
display: none;
.step_tips{
.step_tips {
width: px2rem(684);
height: px2rem(328);
// margin: px2rem(1043) px2rem(30) 0;
@@ -82,6 +87,7 @@ body {
left: px2rem(30);
z-index: 999;
}
.xuxian_qp {
width: px2rem(126);
height: px2rem(75);
@@ -90,6 +96,7 @@ body {
left: px2rem(374);
z-index: 999;
}
.xuxian_bar {
width: 1.8rem;
height: 1.3rem;
@@ -98,6 +105,7 @@ body {
right: 0.85rem;
z-index: 999;
}
.step_but {
width: px2rem(108);
height: px2rem(121);
@@ -108,9 +116,11 @@ body {
z-index: 999;
}
}
.step3 {
display: none;
.step_tips{
.step_tips {
width: px2rem(684);
height: px2rem(328);
position: absolute;
@@ -118,6 +128,7 @@ body {
left: px2rem(30);
z-index: 999;
}
.xuxian_c {
width: px2rem(708);
height: px2rem(295);
@@ -126,6 +137,7 @@ body {
left: px2rem(21);
z-index: 999;
}
.step_but {
width: px2rem(108);
height: px2rem(121);
@@ -135,9 +147,11 @@ body {
z-index: 999;
}
}
.step4 {
display: none;
.step_tips{
.step_tips {
width: px2rem(684);
height: px2rem(328);
position: absolute;
@@ -145,7 +159,8 @@ body {
left: px2rem(30);
z-index: 999;
}
.xuxian_c{
.xuxian_c {
width: px2rem(690);
height: px2rem(690);
position: absolute;
@@ -153,6 +168,7 @@ body {
left: px2rem(30);
z-index: 999;
}
.success_wrap {
display: none;
z-index: 999;
@@ -176,15 +192,18 @@ body {
background: url(../images/qipao3.png) no-repeat;
background-size: 100% 100%;
}
span {
margin-top: px2rem(22);
font-family: 'pingfang-regular';
font-size: px2rem(24);
color: #fff;
b {
color: #FDD411;
}
}
p {
margin-top: px2rem(14);
font-family: 'pingfang-regular';
@@ -192,6 +211,7 @@ body {
color: #fff;
}
}
.bad_wrap {
display: none;
z-index: 999;
@@ -214,15 +234,18 @@ body {
background: url(../images/qipao_bad.png) no-repeat;
background-size: 100% 100%;
}
span {
margin-top: px2rem(22);
font-family: 'pingfang-regular';
font-size: px2rem(24);
color: #fff;
b {
color: #FDD411;
}
}
p {
margin-top: px2rem(14);
font-family: 'pingfang-regular';
@@ -230,12 +253,13 @@ body {
color: #fff;
}
}
}
.head_wrap {
height: px2rem(1139);
}
.header {
width: 100%;
height: px2rem(1018);
@@ -253,7 +277,7 @@ body {
left: 50%;
transform: translateX(-50%);
}
.record_icon {
width: px2rem(48);
height: px2rem(123);
@@ -377,9 +401,11 @@ body {
width: 100%;
display: flex;
justify-content: space-evenly;
.tab_item {
width: px2rem(188);
height: px2rem(60);
img {
width: 100%;
height: 100%;
@@ -460,6 +486,7 @@ body {
background: url(../images/but_active.png) no-repeat;
background-size: 100% 100%;
}
.xs_but_active {
background: url(../images/xs_but_active.png) no-repeat;
background-size: 100% 100%;
@@ -482,6 +509,7 @@ body {
color: #fff;
font-size: px2rem(22);
text-align: center;
span {
color: #FBE5B5;
}
@@ -803,10 +831,16 @@ body {
p {
margin-top: px2rem(74);
width: 100%;
width: 90%;
text-align: center;
color: #fff;
font-size: px2rem(24);
margin: px2rem(74) auto 0;
line-height: 0.45rem;
b {
color: #00E5F9;
}
}
div {
@@ -814,7 +848,7 @@ body {
display: flex;
justify-content: space-between;
box-sizing: border-box;
margin-top: px2rem(56);
margin-top: px2rem(40);
padding: 0 px2rem(55);
img {
@@ -1050,6 +1084,7 @@ body {
border-radius: 50%;
border: 1px solid #C6ADFF;
}
.no_tx {
display: block;
width: px2rem(73);
@@ -1239,15 +1274,18 @@ body {
background: url(../images/qipao3.png) no-repeat;
background-size: 100% 100%;
}
span {
margin-top: px2rem(22);
font-family: 'pingfang-regular';
font-size: px2rem(24);
color: #fff;
b {
color: #FDD411;
}
}
p {
margin-top: px2rem(14);
font-family: 'pingfang-regular';
@@ -1296,15 +1334,18 @@ body {
background: url(../images/qipao3.png) no-repeat;
background-size: 100% 100%;
}
span {
margin-top: px2rem(22);
font-family: 'pingfang-regular';
font-size: px2rem(24);
color: #fff;
b {
color: #FDD411;
}
}
p {
margin-top: px2rem(14);
font-family: 'pingfang-regular';
@@ -1353,15 +1394,18 @@ body {
background: url(../images/qipao_bad.png) no-repeat;
background-size: 100% 100%;
}
span {
margin-top: px2rem(22);
font-family: 'pingfang-regular';
font-size: px2rem(24);
color: #fff;
b {
color: #FDD411;
}
}
p {
margin-top: px2rem(14);
font-family: 'pingfang-regular';
@@ -1378,4 +1422,4 @@ body {
transform: translateX(-50%);
top: 56%;
}
}
}

View File

@@ -8,7 +8,7 @@
<title>魔法小屋</title>
<link rel="stylesheet" href="../../common/css/reset.css">
<link rel="stylesheet" href="./css/swiper-bundle.min.css">
<link rel="stylesheet" href="./css/index.css?v=1.2">
<link rel="stylesheet" href="./css/index.css?v=1.20">
</head>
<body>
@@ -150,7 +150,7 @@
</div>
</div>
<!-- 添加減少彈框 -->
<div class="investment">
<div class="investment" style="z-index: 99;">
<div class="investment_in">
<!-- <img src="./images/del.png" alt="" class="closeBut"> -->
<p class="title">選擇投入:</p>
@@ -245,4 +245,4 @@
<script src="../../common/js/vconsole.min.js"></script>
<script src="../../common/js/route-constant.js"></script>
<script src="./js/swiper-bundle.min.js"></script>
<script src="./js/index.js?v=1.2"></script>
<script src="./js/index.js?v=1.20"></script>

View File

@@ -7,7 +7,7 @@ const showLoading = (content = '加載中...') => {
type: 2,
shadeClose: false,
content,
success(e) {
success (e) {
layerIndex = $(e).attr('index')
}
})
@@ -25,7 +25,7 @@ const toastMsg = (content = '操作完成', time = 2) => {
var mySwiper
function swiperFun(mySwiper) {
function swiperFun (mySwiper) {
mySwiper = new Swiper('.swiper', {
loop: false, // 循環模式選項
// 如果需要分頁器
@@ -80,31 +80,31 @@ $(function () {
window.webkit.messageHandlers.initShowNav.postMessage(0)
}
}
document.addEventListener('touchstart', function (event) {
// document.addEventListener('touchstart', function (event) {
if (event.touches.length > 1) {
// if (event.touches.length > 1) {
event.preventDefault();
// event.preventDefault();
}
// }
})
// })
var lastTouchEnd = 0;
// var lastTouchEnd = 0;
document.addEventListener('touchend', function (event) {
// document.addEventListener('touchend', function (event) {
var now = (new Date()).getTime();
// var now = (new Date()).getTime();
if (now - lastTouchEnd <= 300) {
// if (now - lastTouchEnd <= 300) {
event.preventDefault();
// event.preventDefault();
}
// }
lastTouchEnd = now;
// lastTouchEnd = now;
}, false)
// }, false)
changeTab(tabIndex)
noticeFun();
getXsDataFun();
@@ -113,7 +113,7 @@ $(function () {
}, 100);
})
// 播放svg
function svgaFun() {
function svgaFun () {
player1 = new SVGA.Player('.luzis');
parser1 = new SVGA.Parser('.luzis');
parser1.load('./images/luzi.svga', function (videoItem) {
@@ -132,7 +132,7 @@ function svgaFun() {
})
})
}
function xsSvgaFun() {
function xsSvgaFun () {
player1 = new SVGA.Player('.luzis');
parser1 = new SVGA.Parser('.luzis');
parser1.load('./images/xs_luzi.svga', function (videoItem) {
@@ -153,6 +153,15 @@ $('.header .but').click(function () {
if (ifs == 1) {
if (headerBut) {
headerBut = false;
var valArr = $('.speed_rogress .speed_rogress_top p').text().match(/\d+(\.\d+)?/g);
// console.log(valArr[0])
// console.log(valArr[1] * 0.5)
// console.log((valArr[0] - valArr[1])>= valArr[1]* 0.5 ? '超过百分之五十了':'合理范围内');
if ((valArr[0] - valArr[1]) / valArr[1] >= 0.3) {
$('.refining .refining_in p').html('當前投入禮物值<b>已超過</b>煉制進度值,確認繼續煉制嗎?')
} else {
$('.refining .refining_in p').html('確認選擇這些背包禮物進行煉制嗎?')
}
$('.refining').show();
}
} else {
@@ -160,7 +169,7 @@ $('.header .but').click(function () {
}
})
//公告欄
function guangGao() {
function guangGao () {
clearInterval(timeInterval);
timeInterval = setInterval(function () {
$('.header .notice ul').animate({
@@ -173,12 +182,12 @@ function guangGao() {
}, 2000);
}
// 輪播
function noticeFun() {
function noticeFun () {
showLoading();
networkRequest({
type: 'GET',
url: urlPrefix + '/gift/compound/record/top',
success(res) {
success (res) {
if (res.code === 200) {
var str = ``;
res.data.forEach(res => {
@@ -193,18 +202,18 @@ function noticeFun() {
}
hideLoading(layerIndex);
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進');
}
})
}
// 合成禮物列錶
function getDataFun() {
function getDataFun () {
showLoading();
networkRequest({
type: 'GET',
url: urlPrefix + '/gift/compound/giftList',
success(res) {
success (res) {
if (res.code === 200) {
getDataArr = res.data;
getDataArr.forEach((res, index) => {
@@ -217,18 +226,18 @@ function getDataFun() {
}
hideLoading(layerIndex);
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進');
}
})
}
// 限時合成禮物列錶
function getXsDataFun() {
function getXsDataFun () {
showLoading();
networkRequest({
type: 'GET',
url: urlPrefix + '/gift/compound/limit/giftList',
success(res) {
success (res) {
if (res.code === 200) {
if (tabIndex == 1) {
console.log('渲染限時合成禮物');
@@ -241,25 +250,25 @@ function getXsDataFun() {
}
xsOpen = true;
$(".header .tab_wrap").show();
} else if(res.code === 26001){
} else if (res.code === 26001) {
xsOpen = false;
$(".header .tab_wrap").hide();
}else if(res.code === 26002){
} else if (res.code === 26002) {
$(".header .tab_wrap").show();
xsOpen = false;
}else {
} else {
toastMsg(res.message);
// console.log(res);
}
hideLoading(layerIndex);
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進');
}
})
}
// 初始化渲染合成禮物
function dataRendering(getDataArrIndex) {
function dataRendering (getDataArrIndex) {
// console.log('getDataArrIndex',getDataArr);
$('.header .qipao img').attr('src', getDataArr[getDataArrIndex].giftUrl);
$('.header .qipao img').attr('RewardId', getDataArr[getDataArrIndex].compoundRewardId);
@@ -334,13 +343,13 @@ $('.header .right_but').click(function () {
}
})
// 獲取背包禮物
function listUserBackpackFun() {
function listUserBackpackFun () {
showLoading();
networkRequest({
type: 'GET',
url: urlPrefix + '/backpack/listUserBackpack',
data: { uid: pubInfo.uid },
success(res) {
success (res) {
if (res.code === 200) {
if (res.data.length == 0) {
// $('.bottom .b_Top').after(`
@@ -408,7 +417,7 @@ function listUserBackpackFun() {
// 點擊背包禮物列錶
$('.bottom .swiper .swiper-slide div').click(function () {
// 防止合成時點擊繼續添加
if(headerBut){
if (headerBut) {
// console.log('防止合成時點擊繼續添加');
$(this).parent().siblings().children().removeClass('div_active');
$(this).addClass('div_active').siblings().removeClass('div_active');
@@ -432,19 +441,19 @@ function listUserBackpackFun() {
}
hideLoading(layerIndex);
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進');
}
})
}
//合成記錄
function recordFun(pageNum) {
function recordFun (pageNum) {
showLoading();
networkRequest({
type: 'GET',
url: urlPrefix + '/gift/compound/record',
data: { pageNum, pageSize: 10 },
success(res) {
success (res) {
if (res.code === 200) {
if (res.data.length == 0 && pageNum == 1) {
$('.record').hide();
@@ -487,7 +496,7 @@ function recordFun(pageNum) {
}
hideLoading(layerIndex);
},
error(err) {
error (err) {
isLock = true;
toastMsg('網絡錯誤,請退出重進');
}
@@ -582,7 +591,7 @@ $(".investment .investment_in .num input").on("input", function () {
if (val > Number($('.bottom .swiper .swiper-slide .div_active strong b').text())) {
val = 0;
$(this).val(0);
toastMsg('超出已擁有數量');
toastMsg('背包庫存數量不足');
getDataArr[0].fraction = lastNum;
// $('.bottom .swiper .swiper-slide .div_active strong i').text("0");
} else if (val == '') {
@@ -630,7 +639,7 @@ $('.investment .investment_in .num .add').click(function (event) {
console.log(indes);
arrs[indes].goldprice = goldprice;
if (val > num) {
toastMsg('已超出現有數量');
toastMsg('背包庫存數量不足');
val = val - 1;
$('.bottom .swiper .swiper-slide .div_active').attr(`nums`, val);
arrs[indes].num = Number($('.bottom .swiper .swiper-slide .div_active').attr('nums'));
@@ -701,9 +710,9 @@ $('.refining .refining_in div .ok').click(function () {
}
})
// console.log('arr22222',arr2);
arr2.map((item,index)=>{
if(item.num !=''){
if(parseInt(item.num) != 0){
arr2.map((item, index) => {
if (item.num != '') {
if (parseInt(item.num) != 0) {
// console.log(item,index);
arr3.push(item)
}
@@ -715,7 +724,7 @@ $('.refining .refining_in div .ok').click(function () {
setTimeout(() => {
$('.header .luzi').css({ "background": "none" });
}, 120);
console.log('compoundParam',compoundParam);
console.log('compoundParam', compoundParam);
$('.refining').hide();
if (tabIndex == 0) {
svgaFun();
@@ -730,13 +739,13 @@ $('.refining .refining_in div .ok').click(function () {
contentType: 'application/json;charset=UTF-8',
url: urlPrefix + '/gift/compound',
data: JSON.stringify(compoundParam),
success(res) {
success (res) {
if (res.code === 200) {
$('.speed_rogress .speed_rogress_top p span').text(0)
$('.investment .investment_in .num input').val(0)
if (tabIndex == 0) {
$('.gxn .gxn_in .qb img').attr('src',res.data.picUrl);
$('.gxn .gxn_in .qb img').attr('src', res.data.picUrl);
$('.gxn .gxn_in p b').text(res.data.giftName);
changeTab(0)
noticeFun();
@@ -773,7 +782,7 @@ $('.refining .refining_in div .ok').click(function () {
}
hideLoading(layerIndex);
},
error(err) {
error (err) {
toastMsg('網絡錯誤,請退出重進');
}
})
@@ -858,7 +867,7 @@ $('.bottom .b_Top img').click(function () {
// tab切換
var tabIndex = 0;
function changeTab(tabIndex) {
function changeTab (tabIndex) {
if (tabIndex == 0) {
$("body").css('background', '#462978');
$('.tab_wrap .tab_item').eq(0).find('img').attr('src', "./images/pt_tab_active.png");
@@ -965,7 +974,7 @@ $('.tab_wrap .tab_item').click(function () {
})
// 用戶首次進入限時爐引導
function firstEnterFun() {
function firstEnterFun () {
$('.step_wrap .step1').show();
$('.guide_mask').show();
}