不再统计命令使用详细数据

This commit is contained in:
fofolee 2024-01-23 13:39:56 +08:00
parent be8b38f94d
commit 6fd5b87a33
2 changed files with 50 additions and 33 deletions

View File

@ -1,7 +1,7 @@
<template>
<router-view v-slot="{ Component }">
<!-- <transition name="fade"> -->
<component ref="view" :is="Component" />
<component ref="view" :is="Component" />
<!-- </transition> -->
</router-view>
<QuickCommand />
@ -115,7 +115,8 @@ export default defineComponent({
},
enterPlugin(enter) {
// 使
this.usageStatistics(enter.code, this.parseDate(new Date()));
// this.usageStatistics(enter.code, this.parseDate(new Date()));
this.updateExp();
this.$q.dark.set(utools.isDarkColors());
this.enterData = enter;
this.$router.push(enter.code);
@ -168,20 +169,39 @@ export default defineComponent({
runCommandSilently(featureCode) {
this.runCommand(featureCode);
},
usageStatistics(featureCode, runTime) {
let statisticsData = this.utools.getDB("cfg_statisticsData");
let thisYear = runTime.year;
if (!statisticsData[thisYear]) statisticsData[thisYear] = [];
statisticsData[thisYear].push({
code: featureCode,
time: {
month: runTime.month,
day: runTime.day,
hour: runTime.hour,
minute: runTime.minute,
},
});
this.utools.putDB(statisticsData, "cfg_statisticsData");
// usageStatistics(featureCode, runTime) {
// let statisticsData = this.utools.getDB("cfg_statisticsData");
// let thisYear = runTime.year;
// if (!statisticsData[thisYear]) statisticsData[thisYear] = [];
// statisticsData[thisYear].push({
// code: featureCode,
// time: {
// month: runTime.month,
// day: runTime.day,
// hour: runTime.hour,
// minute: runTime.minute,
// },
// });
// this.utools.putDB(statisticsData, "cfg_statisticsData");
// },
updateExp() {
let exp = this.utools.getDB("cfg_exp");
if (typeof exp !== "object") {
exp += 1;
this.utools.putDB(exp, "cfg_exp");
return;
}
try {
let statisticsData = this.utools.getDB("cfg_statisticsData");
exp = Object.values(statisticsData)
.map((x) => x.length)
.reduce((x, y) => x + y);
// BUG
this.utools.delDB("cfg_statisticsData");
} catch (error) {
exp = 0;
}
this.utools.putDB(exp, "cfg_exp");
},
parseDate: (dateString) => {
return {
@ -197,19 +217,19 @@ export default defineComponent({
if (this.utools.getStorage("st_v300Inited")) return;
window.showUb.help();
//
let statisticsData = this.utools.getDB("cfg_statisticsData");
_.forIn(statisticsData, (data, year) => {
statisticsData[year] = data.map((x) => {
if (!x.command) return x;
let code =
x.command.code === "options" ? "configuration" : x.command.code;
return {
code: code,
time: x.time,
};
});
});
this.utools.putDB(statisticsData, "cfg_statisticsData");
// let statisticsData = this.utools.getDB("cfg_statisticsData");
// _.forIn(statisticsData, (data, year) => {
// statisticsData[year] = data.map((x) => {
// if (!x.command) return x;
// let code =
// x.command.code === "options" ? "configuration" : x.command.code;
// return {
// code: code,
// time: x.time,
// };
// });
// });
// this.utools.putDB(statisticsData, "cfg_statisticsData");
//
this.utools.delAll("qc_default");
this.utools.setStorage("st_v300Inited", true);

View File

@ -170,10 +170,7 @@ export default {
methods: {
getUserInfo() {
Object.assign(this.userInfo, this.$root.utools.whole.getUser());
let statisticsData = this.$root.utools.getDB("cfg_statisticsData");
this.userInfo.exp = Object.values(statisticsData)
.map((x) => x.length)
.reduce((x, y) => x + y);
this.userInfo.exp = this.$root.utools.getDB("cfg_exp");
this.userInfo.level = this.levelDetail
.filter((x) => this.userInfo.exp > x.minExp)
.pop().lv;