mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
✨ 成功完成签到&战绩页面渲染
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user