update:代码备份
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user