fix: 大厅限红动态显示+K格式化,在线人数动态计算
- 限红从 item.limit_money 动态拆分显示(上限/下限),不再硬编码 - 上限值≥1000自动显示为K格式(如50000→50K) - 在线人数改为动态计算(基础800+时段浮动+随机数) - 注入全局 $fk 方法用于金额K格式化
This commit is contained in:
@@ -12,6 +12,20 @@ import {
|
|||||||
|
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
Vue.prototype.$api = api;
|
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(uView);
|
||||||
Vue.use(router);
|
Vue.use(router);
|
||||||
App.mpType = "app";
|
App.mpType = "app";
|
||||||
|
|||||||
+17
-4
@@ -52,7 +52,7 @@
|
|||||||
<!-- Online Count Bottom -->
|
<!-- Online Count Bottom -->
|
||||||
<view class="online-count-box">
|
<view class="online-count-box">
|
||||||
<text class="label">{{ $lang.onlineCount }}</text>
|
<text class="label">{{ $lang.onlineCount }}</text>
|
||||||
<text class="count">2506</text>
|
<text class="count">{{ onlineNum }}</text>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
<text class="table-name">{{ item.table_name }}</text>
|
<text class="table-name">{{ item.table_name }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="header-right">
|
<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 class="status-dot" :class="{ 'is-live': item.status===1 }"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
}"
|
}"
|
||||||
:class="getCellClass(cell.result)"
|
: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>
|
||||||
</view>
|
</view>
|
||||||
<!-- 牛牛/三卡: 表格路单 -->
|
<!-- 牛牛/三卡: 表格路单 -->
|
||||||
@@ -164,6 +164,7 @@ export default {
|
|||||||
allTables: [],
|
allTables: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
timer: null,
|
timer: null,
|
||||||
|
onlineNum: 0,
|
||||||
|
|
||||||
// Roadmap config
|
// Roadmap config
|
||||||
cellWidth: 16.5, // slightly adjusted for mobile fit
|
cellWidth: 16.5, // slightly adjusted for mobile fit
|
||||||
@@ -229,11 +230,18 @@ export default {
|
|||||||
});
|
});
|
||||||
if (res.Success && res.Data) {
|
if (res.Success && res.Data) {
|
||||||
this.processData(res.Data);
|
this.processData(res.Data);
|
||||||
|
this.updateOnlineNum();
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error(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) {
|
processData(data) {
|
||||||
// Transform data for UI
|
// Transform data for UI
|
||||||
this.allTables = data.map(item => {
|
this.allTables = data.map(item => {
|
||||||
@@ -273,7 +281,12 @@ export default {
|
|||||||
if (result === 3) return 'cell-green';
|
if (result === 3) return 'cell-green';
|
||||||
return '';
|
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 === 1) return '庄';
|
||||||
if (result === 2) return '闲';
|
if (result === 2) return '闲';
|
||||||
if (result === 3) return '和';
|
if (result === 3) return '和';
|
||||||
|
|||||||
Reference in New Issue
Block a user