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";