mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-07-04 15:12:45 +08:00
不再统计命令使用详细数据
This commit is contained in:
parent
be8b38f94d
commit
6fd5b87a33
78
src/App.vue
78
src/App.vue
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view v-slot="{ Component }">
|
<router-view v-slot="{ Component }">
|
||||||
<!-- <transition name="fade"> -->
|
<!-- <transition name="fade"> -->
|
||||||
<component ref="view" :is="Component" />
|
<component ref="view" :is="Component" />
|
||||||
<!-- </transition> -->
|
<!-- </transition> -->
|
||||||
</router-view>
|
</router-view>
|
||||||
<QuickCommand />
|
<QuickCommand />
|
||||||
@ -115,7 +115,8 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
enterPlugin(enter) {
|
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.$q.dark.set(utools.isDarkColors());
|
||||||
this.enterData = enter;
|
this.enterData = enter;
|
||||||
this.$router.push(enter.code);
|
this.$router.push(enter.code);
|
||||||
@ -168,20 +169,39 @@ export default defineComponent({
|
|||||||
runCommandSilently(featureCode) {
|
runCommandSilently(featureCode) {
|
||||||
this.runCommand(featureCode);
|
this.runCommand(featureCode);
|
||||||
},
|
},
|
||||||
usageStatistics(featureCode, runTime) {
|
// usageStatistics(featureCode, runTime) {
|
||||||
let statisticsData = this.utools.getDB("cfg_statisticsData");
|
// let statisticsData = this.utools.getDB("cfg_statisticsData");
|
||||||
let thisYear = runTime.year;
|
// let thisYear = runTime.year;
|
||||||
if (!statisticsData[thisYear]) statisticsData[thisYear] = [];
|
// if (!statisticsData[thisYear]) statisticsData[thisYear] = [];
|
||||||
statisticsData[thisYear].push({
|
// statisticsData[thisYear].push({
|
||||||
code: featureCode,
|
// code: featureCode,
|
||||||
time: {
|
// time: {
|
||||||
month: runTime.month,
|
// month: runTime.month,
|
||||||
day: runTime.day,
|
// day: runTime.day,
|
||||||
hour: runTime.hour,
|
// hour: runTime.hour,
|
||||||
minute: runTime.minute,
|
// minute: runTime.minute,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
this.utools.putDB(statisticsData, "cfg_statisticsData");
|
// 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) => {
|
parseDate: (dateString) => {
|
||||||
return {
|
return {
|
||||||
@ -197,19 +217,19 @@ export default defineComponent({
|
|||||||
if (this.utools.getStorage("st_v300Inited")) return;
|
if (this.utools.getStorage("st_v300Inited")) return;
|
||||||
window.showUb.help();
|
window.showUb.help();
|
||||||
// 处理统计数据
|
// 处理统计数据
|
||||||
let statisticsData = this.utools.getDB("cfg_statisticsData");
|
// let statisticsData = this.utools.getDB("cfg_statisticsData");
|
||||||
_.forIn(statisticsData, (data, year) => {
|
// _.forIn(statisticsData, (data, year) => {
|
||||||
statisticsData[year] = data.map((x) => {
|
// statisticsData[year] = data.map((x) => {
|
||||||
if (!x.command) return x;
|
// if (!x.command) return x;
|
||||||
let code =
|
// let code =
|
||||||
x.command.code === "options" ? "configuration" : x.command.code;
|
// x.command.code === "options" ? "configuration" : x.command.code;
|
||||||
return {
|
// return {
|
||||||
code: code,
|
// code: code,
|
||||||
time: x.time,
|
// time: x.time,
|
||||||
};
|
// };
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
this.utools.putDB(statisticsData, "cfg_statisticsData");
|
// this.utools.putDB(statisticsData, "cfg_statisticsData");
|
||||||
// 删掉数据库内的默认命令
|
// 删掉数据库内的默认命令
|
||||||
this.utools.delAll("qc_default");
|
this.utools.delAll("qc_default");
|
||||||
this.utools.setStorage("st_v300Inited", true);
|
this.utools.setStorage("st_v300Inited", true);
|
||||||
|
@ -170,10 +170,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
Object.assign(this.userInfo, this.$root.utools.whole.getUser());
|
Object.assign(this.userInfo, this.$root.utools.whole.getUser());
|
||||||
let statisticsData = this.$root.utools.getDB("cfg_statisticsData");
|
this.userInfo.exp = this.$root.utools.getDB("cfg_exp");
|
||||||
this.userInfo.exp = Object.values(statisticsData)
|
|
||||||
.map((x) => x.length)
|
|
||||||
.reduce((x, y) => x + y);
|
|
||||||
this.userInfo.level = this.levelDetail
|
this.userInfo.level = this.levelDetail
|
||||||
.filter((x) => this.userInfo.exp > x.minExp)
|
.filter((x) => this.userInfo.exp > x.minExp)
|
||||||
.pop().lv;
|
.pop().lv;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user