项目初始化

This commit is contained in:
leilei
2025-09-19 17:24:46 +08:00
commit 293951a610
107 changed files with 10222 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { defineStore } from 'pinia'
import { generateUUID } from '@/utils/tools.js'
export const useMeterStore = defineStore('meter', {
state: () => ({
udid: ''
}),
actions: {
initUdid() {
var udid = window.localStorage.getItem('UDID')
if (!udid) {
udid = generateUUID();
window.localStorage.setItem("UDID", udid);
}
this.setUdid(udid)
},
setUdid(udid) {
this.udid = udid
},
getUdid() {
return this.udid
},
getSudid() {
var typedArray = new Uint8Array(this.udid.match(/[\da-f]{2}/gi).map(function (h) {
return parseInt(h, 16)
}));
const sudid = btoa(String.fromCharCode.apply(null, typedArray)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
return sudid
}
}
})