修复用户信息获取错误的BUG

This commit is contained in:
fofolee 2025-02-12 00:14:11 +08:00
parent 039a820952
commit 343572568c
4 changed files with 21 additions and 30 deletions

View File

@ -31,6 +31,7 @@ export default defineComponent({
cronJobs: {},
enterData: {},
subInputEvent: null,
isVIP: false,
};
},
created: function () {

View File

@ -1,14 +1,14 @@
<template>
<q-menu anchor="top end" self="top start">
<q-list>
<q-item clickable :disable="!user.isVIP">
<q-item clickable :disable="!$root.isVIP">
<q-item-section side>
<q-icon name="color_lens" />
</q-item-section>
<q-item-section>主颜色</q-item-section>
<q-tooltip>你可以更改界面的主题色会员限定 😎</q-tooltip>
<q-menu
v-if="user.isVIP"
v-if="$root.isVIP"
anchor="center left"
self="center right"
style="min-width: 250px"
@ -29,13 +29,13 @@
</div>
</q-menu>
</q-item>
<q-item clickable :disable="!user.isVIP" class="bg-img-menu">
<q-item clickable :disable="!$root.isVIP" class="bg-img-menu">
<q-item-section side>
<q-icon name="image" />
</q-item-section>
<q-item-section>背景图片设置</q-item-section>
<q-tooltip>设置背景图片会员限定 😎</q-tooltip>
<q-menu v-if="user.isVIP" anchor="center left" self="center right">
<q-menu v-if="$root.isVIP" anchor="center left" self="center right">
<q-list style="min-width: 280px">
<q-item>
<q-item-section>
@ -84,7 +84,7 @@
</q-list>
</q-menu>
</q-item>
<q-item clickable :disable="!user.isVIP">
<q-item clickable :disable="!$root.isVIP">
<q-item-section side>
<q-icon name="blur_on" />
</q-item-section>
@ -97,6 +97,7 @@
:min="0"
:max="12"
:step="1"
:disable="!$root.isVIP"
color="primary"
@update:model-value="toggleGlassEffect"
size="34px"
@ -109,7 +110,7 @@
</div>
</q-item-section>
</q-item>
<q-item clickable :disable="!user.isVIP">
<q-item clickable :disable="!$root.isVIP">
<q-item-section side>
<q-icon name="label" />
</q-item-section>
@ -120,7 +121,7 @@
<q-item-section side>
<q-toggle
v-model="$root.profile.denseTagBar"
:disable="!user.isVIP"
:disable="!$root.isVIP"
color="primary"
@update:model-value="$root.saveProfile"
/>
@ -149,9 +150,6 @@ import pictureCompress from "picture-compressor";
export default {
name: "PersonalizeMenu",
props: {
user: Object,
},
data() {
return {
selectFileLight: null,

View File

@ -9,7 +9,6 @@
>
<!-- 用户信息 -->
<UserInfo
ref="user"
:allQuickCommandsLength="allQuickCommandsLength"
:allFeaturesLength="allFeaturesLength"
/>
@ -49,7 +48,7 @@
<q-icon name="keyboard_arrow_left" />
</q-item-section>
<q-item-section>个性化设置</q-item-section>
<PersonalizeMenu :user="$refs.user" />
<PersonalizeMenu />
</q-item>
<!-- 收藏 -->

View File

@ -4,7 +4,7 @@
<q-avatar size="48px">
<q-img :src="userInfo.avatar" />
<q-badge
v-if="isVIP"
v-if="$root.isVIP"
floating
color="deep-orange"
:label="isDoubleVIP ? 'V²' : 'V'"
@ -146,20 +146,11 @@ export default {
showPayPage: false,
memberPrice: 2,
isPluginVIP: false,
isUtoolsVIP: false,
isDoubleVIP: false,
goodsId: "3LHZ9WdXnUnBSgGRzr2c7bDOyGJBzUyD",
};
},
computed: {
isDoubleVIP() {
return this.isUtoolsVIP && this.isPluginVIP;
},
isVIP() {
return this.isUtoolsVIP || this.isPluginVIP;
},
isUtoolsVIP() {
return this.userInfo.type === "member";
},
},
props: {
allFeaturesLength: Number,
allQuickCommandsLength: Number,
@ -168,7 +159,7 @@ export default {
this.getUserInfo();
},
methods: {
getUserInfo() {
async getUserInfo() {
Object.assign(this.userInfo, this.$root.utools.whole.getUser());
this.userInfo.exp = this.$root.utools.getDB("cfg_exp");
this.userInfo.level = this.levelDetail
@ -183,11 +174,13 @@ export default {
).toFixed(2)
)
: 1;
this.$root.utools.whole.fetchUserPayments().then((ret) => {
console.log("PayInfo:", ret);
!ret.filter((x) => x.goods_id === this.goodsId).length ||
(this.isPluginVIP = true);
});
let ret = await this.$root.utools.whole.fetchUserPayments();
console.log("PayInfo:", ret);
this.isPluginVIP = ret.find((x) => x.goods_id === this.goodsId);
this.isUtoolsVIP = this.userInfo.type === "member";
this.isDoubleVIP = this.isUtoolsVIP && this.isPluginVIP;
this.$root.isVIP = this.isUtoolsVIP || this.isPluginVIP;
},
thinkOver() {
let that = this;