From 7729108ebec6d4a171e9939b7457b1bd09dc5507 Mon Sep 17 00:00:00 2001 From: fofolee Date: Tue, 19 Apr 2022 12:15:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E7=AD=89?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ConfigurationMenu.vue | 15 +++-- src/components/popup/UserInfo.vue | 89 +++++++++++++++++++++------- 2 files changed, 78 insertions(+), 26 deletions(-) diff --git a/src/components/ConfigurationMenu.vue b/src/components/ConfigurationMenu.vue index 8d93d31..5011e37 100644 --- a/src/components/ConfigurationMenu.vue +++ b/src/components/ConfigurationMenu.vue @@ -221,13 +221,13 @@ 个性化设置 - + 主颜色 - 你可以更改界面的主题色,Level 3 以上限定 - + 你可以更改界面的主题色,会员限定 + - + 面板视图背景图片 为面板视图设置一张背景图片,Level 2 以上限定
请不要选择尺寸太大的图片,将影响插件载入速度
为面板视图设置一张背景图片,会员限定
请不要选择尺寸太大的图片,将影响插件载入速度 - + - +
- {{ userLevel.number }}Level - 使用本插件次数越多,等级越高,uTools VIP 有额外加成哟 -
不要问我为什么 VIP 有加成,因为我白嫖了一个永久 VIP
- 所以怎么也加点「会员特权」吧
- 至于这个等级有啥用,我也不知道╮(╯▽╰)╭ -
+ 等级越高意味着你对本插件的依赖程度越高
距离下一级还剩{{ (1 - userLevel.process) * 100 }}%当前经验 {{ userInfo.exp }}
距离下一级还剩 + {{ (1 - userInfo.process) * 100 }}%
@@ -62,16 +52,75 @@ export default { data() { return { - userInfo: utools.getUser(), - userLevel: { - number: 1, - process: 0.4, + userInfo: { + exp: 0, + level: 1, + process: 0, + type: "", + avatar: "", + nickname: "", }, + levelDetail: [ + { + lv: 1, + minExp: 0, + upExp: 100, + }, + { + lv: 2, + minExp: 100, + upExp: 200, + }, + { + lv: 3, + minExp: 300, + upExp: 300, + }, + { + lv: 4, + minExp: 600, + upExp: 600, + }, + { + lv: 5, + minExp: 1200, + upExp: 999999, + }, + ], }; }, + computed: { + isVIP() { + return this.userInfo.type === "member"; + }, + }, props: { allFeaturesLength: Number, allQuickCommandsLength: Number, }, + mounted() { + this.getUserInfo(); + }, + methods: { + getUserInfo() { + Object.assign(this.userInfo, utools.getUser()); + let statisticsData = this.$root.utools.getDB( + this.$root.utools.DBPRE.CFG + "statisticsData" + ); + this.userInfo.exp = Object.values(statisticsData) + .map((x) => x.length) + .reduce((x, y) => x + y); + this.userInfo.level = this.levelDetail + .filter((x) => this.userInfo.exp > x.minExp) + .pop().lv; + let currentLevelDetail = this.levelDetail[this.userInfo.level - 1]; + this.userInfo.process = parseFloat( + ( + (this.userInfo.exp - currentLevelDetail.minExp) / + currentLevelDetail.upExp + ).toFixed(1) + ); + }, + }, };