fix: 大厅限红动态显示+K格式化,在线人数动态计算

- 限红从 item.limit_money 动态拆分显示(上限/下限),不再硬编码
- 上限值≥1000自动显示为K格式(如50000→50K)
- 在线人数改为动态计算(基础800+时段浮动+随机数)
- 注入全局 $fk 方法用于金额K格式化
This commit is contained in:
li
2026-02-11 16:29:34 +08:00
parent 124cbf36ce
commit 27cdc9a568
2 changed files with 31 additions and 4 deletions
+14
View File
@@ -12,6 +12,20 @@ import {
Vue.config.productionTip = false;
Vue.prototype.$api = api;
const formatK = (val) => {
if (val === null || val === undefined || val === '') return val
if (typeof val === 'string' && val.includes('-')) {
return val.split('-').map(s => formatK(isNaN(s) ? s : Number(s))).join('-')
}
const n = Number(val)
if (isNaN(n)) return val
if (n >= 1000 || n <= -1000) {
const k = n / 1000
return (k % 1 === 0 ? k.toFixed(0) : k) + 'K'
}
return val
}
Vue.prototype.$fk = formatK
Vue.use(uView);
Vue.use(router);
App.mpType = "app";
+17 -4
View File
@@ -52,7 +52,7 @@
<!-- Online Count Bottom -->
<view class="online-count-box">
<text class="label">{{ $lang.onlineCount }}</text>
<text class="count">2506</text>
<text class="count">{{ onlineNum }}</text>
</view>
</scroll-view>
@@ -75,7 +75,7 @@
<text class="table-name">{{ item.table_name }}</text>
</view>
<view class="header-right">
<text class="limit-info">{{ $lang.maxLimit }}:50000 {{ $lang.minLimit }}:20</text>
<text class="limit-info">{{ $lang.maxLimit }}:{{ $fk(item.limit_money ? item.limit_money.split('-')[1] : 0) }} {{ $lang.minLimit }}:{{ item.limit_money ? item.limit_money.split('-')[0] : 0 }}</text>
<view class="status-dot" :class="{ 'is-live': item.status===1 }"></view>
</view>
</view>
@@ -94,7 +94,7 @@
}"
:class="getCellClass(cell.result)"
>
<text class="cell-text">{{ getResultText(cell.result) }}</text>
<text class="cell-text">{{ getResultText(cell.result, item.game_id) }}</text>
</view>
</view>
<!-- 牛牛/三卡: 表格路单 -->
@@ -164,6 +164,7 @@ export default {
allTables: [],
loading: false,
timer: null,
onlineNum: 0,
// Roadmap config
cellWidth: 16.5, // slightly adjusted for mobile fit
@@ -229,11 +230,18 @@ export default {
});
if (res.Success && res.Data) {
this.processData(res.Data);
this.updateOnlineNum();
}
} catch(e) {
console.error(e);
}
},
updateOnlineNum() {
const hour = new Date().getHours();
const base = 800;
const extra = (hour >= 0 && hour < 6) ? 200 : 0;
this.onlineNum = base + extra + Math.floor(Math.random() * 100);
},
processData(data) {
// Transform data for UI
this.allTables = data.map(item => {
@@ -273,7 +281,12 @@ export default {
if (result === 3) return 'cell-green';
return '';
},
getResultText(result) {
getResultText(result, gameId) {
if (gameId == 2) {
if (result === 1) return '龙';
if (result === 2) return '虎';
if (result === 3) return '和';
}
if (result === 1) return '庄';
if (result === 2) return '闲';
if (result === 3) return '和';