update:代码备份

This commit is contained in:
2026-09-15 15:39:46 +08:00
parent c8533de5cf
commit 03fa2f4d48
56 changed files with 2107 additions and 636 deletions
+15
View File
@@ -100,6 +100,8 @@ export default defineStore("store", {
ringRank: [],
},
online: false,
// 设备电量属于运行时状态,null 表示当前没有有效数据。
deviceBattery: null,
game: {
roomID: "",
inBattle: false,
@@ -136,6 +138,17 @@ export default defineStore("store", {
updateOnline(online) {
this.online = online;
},
updateDeviceBattery(value) {
if (value === null || value === undefined || value === "") {
this.deviceBattery = null;
return;
}
const battery = Number(value);
this.deviceBattery = Number.isFinite(battery)
? Math.min(100, Math.max(0, battery))
: null;
},
async updateUser(user = {}) {
this.user = { ...getDefaultUser(), ...user };
this.user.lvlName = getLvlNameByScore(this.user.scores, this.config.randInfos)
@@ -151,6 +164,7 @@ export default defineStore("store", {
clearDevice() {
this.device = getDefaultDevice();
this.online = false;
this.deviceBattery = null;
},
async updateConfig(config) {
this.config = config;
@@ -199,6 +213,7 @@ export default defineStore("store", {
user: getDefaultUser(),
device: getDefaultDevice(),
online: false,
deviceBattery: null,
game: getDefaultGame(),
dailyCount: getDefaultDailyCount(),
deviceChargingDialogVisible: false,