修复用户信息获取错误的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: {}, cronJobs: {},
enterData: {}, enterData: {},
subInputEvent: null, subInputEvent: null,
isVIP: false,
}; };
}, },
created: function () { created: function () {

View File

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

View File

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

View File

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