Files
li 27cdc9a568 fix: 大厅限红动态显示+K格式化,在线人数动态计算
- 限红从 item.limit_money 动态拆分显示(上限/下限),不再硬编码
- 上限值≥1000自动显示为K格式(如50000→50K)
- 在线人数改为动态计算(基础800+时段浮动+随机数)
- 注入全局 $fk 方法用于金额K格式化
2026-02-11 16:29:34 +08:00

42 lines
928 B
JavaScript

import Vue from "vue";
import uView from "uview-ui";
import "./uni.promisify.adaptor";
import store from "@/store";
import api from "@/request/api";
import App from "./App";
import {
router,
RouterMount
} from "@/router.js";
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";
const app = new Vue({
store,
...App,
});
// #ifdef H5
RouterMount(app, router, "#app");
// #endif
// #ifndef H5
app.$mount(); //为了兼容小程序及
// #endif