mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
新增 BattleReportDialog、SpyReportDialog、NumberWithTooltip 等组件,完善舰队模拟器功能。重构并引入 Sheet、Sidebar、Tooltip、Skeleton 等 UI 组件,优化界面结构。实现 battle.worker 支持战斗计算,增加 universeStore、fleetStorageLogic 等核心逻辑,完善多语言与类型定义。
27 lines
637 B
TypeScript
27 lines
637 B
TypeScript
import CryptoJS from 'crypto-js'
|
|
import pkg from '../../package.json'
|
|
|
|
// 数据加密
|
|
export const encryptData = (data: any): string => {
|
|
try {
|
|
const jsonStr = JSON.stringify(data)
|
|
const encrypted = CryptoJS.AES.encrypt(jsonStr, pkg.name).toString()
|
|
return encrypted
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
return ''
|
|
}
|
|
|
|
// 数据解密
|
|
export const decryptData = (data: string): any => {
|
|
try {
|
|
const bytes = CryptoJS.AES.decrypt(data, pkg.name)
|
|
const decryptedStr = bytes.toString(CryptoJS.enc.Utf8)
|
|
return JSON.parse(decryptedStr)
|
|
} catch (error) {
|
|
console.error(error)
|
|
return {}
|
|
}
|
|
}
|