成功完成签到&战绩页面渲染

This commit is contained in:
BTMuli
2023-10-24 21:51:37 +08:00
parent 1914261e80
commit 16999f2e58
4 changed files with 73 additions and 55 deletions

View File

@@ -1,10 +1,11 @@
/**
* @file utils toolFunc.ts
* @description 一些工具函数
* @author BTMuli <bt-muli@outlook.com>
* @since Beta v0.3.0
* @since Beta v0.3.4
*/
import { v4 } from "uuid";
/**
* @description 时间戳转换为时间字符串
* @returns {string} 时间字符串 d天 hh:mm:ss
@@ -19,3 +20,17 @@ export function stamp2LastTime(time: number): string {
.toFixed(0)
.padStart(2, "0")}:${second.toFixed(0).padStart(2, "0")}`;
}
/**
* @description 获取 deviceID
* @since Beta v0.3.4
* @returns {string} deviceID
*/
export function getDeviceID(): string {
let deviceID = localStorage.getItem("deviceID");
if (deviceID === null) {
deviceID = v4();
localStorage.setItem("deviceID", deviceID);
}
return deviceID;
}