feat: 账号数据看板、账户详情、投放数据
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-27 17:36:31
|
||||
*/
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export function toFixed(num: number | string, n: number): number {
|
||||
return parseFloat(parseFloat(num.toString()).toFixed(n));
|
||||
}
|
||||
@ -82,3 +84,12 @@ export function formatTableField(fieldItem: any, rowValue: any, showExactValue =
|
||||
|
||||
return `${fieldItem.prefix || ''}${value}${fieldItem.suffix || ''}`;
|
||||
}
|
||||
|
||||
export function exactFormatTime(val: number, curYearFmt = 'MM-DD HH:mm', otherYearFmt = 'YYYY-MM-DD HH:mm') {
|
||||
if (!val) return '-';
|
||||
const year = dayjs(val * 1000).year();
|
||||
const currYear = dayjs().year();
|
||||
const diff = year - currYear;
|
||||
const fmt = diff === 0 ? curYearFmt : otherYearFmt;
|
||||
return dayjs(val * 1000).format(fmt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user