🔨 批量执行.

This commit is contained in:
lijiahangmax
2024-03-15 00:26:53 +08:00
parent 6bd2640af7
commit 8caf8de9f6
20 changed files with 106 additions and 57 deletions

View File

@@ -108,6 +108,9 @@ export function formatDuration(start: number, end?: number): string {
return '';
}
const duration = (end - start) / 1000;
if (duration < 1) {
return `${duration.toFixed(1)}s`;
}
const minutes = Math.floor(duration / 60);
const seconds = Math.floor(duration % 60);
let result = '';
@@ -188,7 +191,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);
@@ -221,7 +224,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);