提交代码

This commit is contained in:
zpc 2025-04-11 16:13:33 +08:00
parent 245533a784
commit d97bb20ac0
4 changed files with 44 additions and 30 deletions

View File

@ -45,13 +45,26 @@ export default {
return `${year}-${monty}-${day}`
},
/**
* 去除多余的0
* @param {*} numStr
* @returns
*/
removeTrailingZeros(numStr) {
if (numStr.includes('.')) {
numStr = numStr.replace(/0+$/, ''); // 移除末尾的零
if (numStr.endsWith('.')) {
numStr = numStr.slice(0, -1); // 处理小数点后全零的情况
}
}
return numStr;
},
detailPageTitle(obj) {
if (!obj) {
return ''
}
let goods_info = config.getGoodTypeFind(obj.type);
if(goods_info!=null){
if (goods_info != null) {
return goods_info.name;
}

View File

@ -462,7 +462,7 @@ export default {
//
const now = new Date();
const serverNow = new Date(now.getTime() + serverClientTimeDiff);
this.updateButtonState();
//
if (serverNow > endDate) {
clearInterval(this.countdownTimer);
@ -475,9 +475,11 @@ export default {
this.remainingTime = this.formatRemainingTime(endDate - serverNow, "距离开奖时间:");
return;
}
}, 1000);
this.updateButtonState();
},
onUnload() {
@ -588,11 +590,12 @@ export default {
},
updateButtonState() {
const currentDate = new Date(this.currentServerTime);
const currentDate = new Date();
const startDate = new Date(this.bonusData.start_time.replace(/-/g, '/'));
const endDate = new Date(this.bonusData.end_time.replace(/-/g, '/'));
const openDate = new Date(this.bonusData.open_time.replace(/-/g, '/'));
// console.log(currentDate,startDate);
if (currentDate < startDate) {
this.buttonText = "未开始";
} else if (currentDate >= startDate && currentDate <= endDate) {

View File

@ -607,7 +607,7 @@ export default {
imgurl: a.imgurl,
title: a.title,
// shang_title: item.shang_title,
pro: '概率:' + a.real_pro,
pro: '概率:' + this.$c.removeTrailingZeros(a.real_pro) +'%',
shang_info: {
title: item.shang_title,
color: item.shang_color

View File

@ -51,36 +51,18 @@
<view class="other-num">
<view class="other-item" @click="$c.to({ url: '/pages/user/yetx' })">
<view class="title">{{$config.getAppSetting('balance_name')}}</view>
<view class="num">{{ userinfo.money || '0.00' }}</view>
<view class="num">{{ formatNumber(userinfo.money) }}</view>
</view>
<view class="other-item" @click="$c.to({ url: '/pages/user/bi_jl' })">
<view class="title">{{$config.getAppSetting('currency1_name')}}</view>
<view class="num" style="color: #333333;">{{ userinfo.integral || 0 }}</view>
<view class="num" style="color: #333333;">{{ formatNumber(userinfo.integral) }}</view>
</view>
<view class="other-item" @click="$c.to({ url: '/pages/user/jf_jl' })">
<view class="title">{{$config.getAppSetting('currency2_name')}}</view>
<view class="num" style="color: #333333;">{{ userinfo.money2 || 0 }}</view>
<view class="num" style="color: #333333;">{{ formatNumber(userinfo.money2) }}</view>
</view>
<!-- <view class="other-item" @click="$c.to({ url: '/pages/user/my_coupon' })">
<view class="num">{{ userinfo.coupon || 0 }}</view>
<view class="title">欧气券</view>
</view> -->
</view>
<!-- <view class="money align-center justify-between br20">
<view class="align-center" style="margin-left: 32rpx;">
<text style="color: #333333; font-size: 28rpx;">{{$config.getAppSetting('balance_name')}}</text>
</view>
<view class="money-detail" @click="$c.to({ url: '/pages/user/yetx' })">
<text>{{ userinfo.money || '0.00' }}</text>
<uni-icons type="right" color="#666666"></uni-icons>
</view>
</view> -->
</view>
<view v-if="taskList.length > 0" class="task">
@ -713,9 +695,25 @@
url: '/pages/shouye/index'
})
}
},
/**
* 格式化数字如果小数部分是.00则只显示整数部分
* @param {Number|String} num - 要格式化的数字
* @param {String} defaultVal - 默认值当num为空时返回
* @return {String} - 格式化后的数字字符串
*/
formatNumber(num, defaultVal = '0') {
if (num === undefined || num === null || num === ''||num===0) {
return defaultVal;
}
const numStr = num.toString();
if (numStr.endsWith('.00')) {
return parseFloat(num).toFixed(0);
}
return numStr;
}
}
}
</script>