Files
ReelShortWeb/src/utils/format.js
T
Vicky 44c2c46a68 chore(web): 收口前几轮后台改动(品牌 / 媒资上传 / 轮播图 / 类型管理 / 操作日志 / App 用户)
为什么:这些改动在前几轮就已完成并在 :3005 验证过,但一直留在工作区没有入库。
下一步 3-4 的四个页面依赖其中的公共样式入口(src/styles/business/index.css)与
api/admin 的公共类型(PageResult 等),如果不先收口,新页面的提交就会夹带旧改动,
既说不清 diff 边界,也让 index.css 这类多轮共用的文件长期处于半提交状态。

本提交只做归档,不改行为:
- 品牌与接口基址改成 FruitShorts / 短剧服务(.env.*、README、vite 代理)
- 去掉前端 mock 数据目录(src/data、src/permissions、stores/auth),改为走真实接口
- 新增 api/admin 下的接口封装与 src/utils/uploader.ts(媒资分片直传)
- 新增/改造:轮播图管理、类型管理、操作日志、App 用户管理、后台布局与公共样式
2026-10-15 13:28:01 +08:00

24 lines
885 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 播放量等大数值的展示格式:12345 → 1.2万,3100000 → 310.0万 */
export function formatCount(value) {
const num = Number(value || 0)
if (!Number.isFinite(num)) return '0'
if (num >= 100000000) return `${(num / 100000000).toFixed(2)}亿`
if (num >= 10000) return `${(num / 10000).toFixed(1)}万`
return String(num)
}
/**
* 时间展示:直接返回实体的接口给的是 ISO 时间(2026-10-15T13:22:03),
* 和后台其它页面「yyyy-MM-dd HH:mm:ss」的观感不一致,这里统一成后者。
*/
export function formatDateTime(value) {
if (!value) return '-'
const text = String(value).replace('T', ' ')
return text.length > 19 ? text.slice(0, 19) : text
}
/** el-table-column 的 formatter 适配(签名是 row, column, cellValue) */
export function dateCell(_row, _column, cellValue) {
return formatDateTime(cellValue)
}