💄 修改表单宽度.

This commit is contained in:
lijiahang
2024-03-13 17:23:42 +08:00
parent 81ae46c181
commit 149e5bc40c
19 changed files with 131 additions and 92 deletions

View File

@@ -98,6 +98,31 @@ export function formatSecond(second: number, p = 'HH:mm') {
return dateFormat(new Date(~~second * 1000), p);
}
/**
* 格式化持续时间
* @param start
* @param end
*/
export function formatDuration(start: number, end?: number): string {
if (!end) {
return '';
}
const duration = (end - start) / 1000;
const minutes = Math.floor(duration / 60);
const seconds = Math.floor(duration % 60);
let result = '';
if (minutes > 0) {
result += `${minutes}min`;
if (seconds > 0) {
result += ' ';
}
}
if (seconds > 0) {
result += `${seconds}s`;
}
return result;
}
/**
* 格式化数字为 ,分割
*/
@@ -163,7 +188,7 @@ export const resetObject = (obj: any, ignore: string[] = []) => {
export const objectTruthKeyCount = (obj: any, ignore: string[] = []) => {
return Object.keys(obj)
.filter(s => !ignore.includes(s))
.reduce(function (acc, curr) {
.reduce(function(acc, curr) {
const currVal = obj[curr];
return acc + ~~(currVal !== undefined && currVal !== null && currVal?.length !== 0 && currVal !== '');
}, 0);
@@ -196,7 +221,7 @@ export function detectZoom() {
* 获取唯一的 UUID
*/
export function getUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);