perf:统一用户信息组件的数据来源

This commit is contained in:
Xwen
2024-01-07 21:19:54 +08:00
parent d0b64b6521
commit 1898068f6b
2 changed files with 9 additions and 5 deletions

View File

@@ -17,8 +17,12 @@
>
</div>
<div class="status" v-if="userInfo.userLimit">
<el-tag round effect="light" :type="userInfo.userLimit.type">
{{ userInfo.userLimit.label }}
<el-tag
round
effect="light"
:type="getStatusInfo(userInfo.userLimit)?.type"
>
{{ getStatusInfo(userInfo.userLimit)?.label }}
</el-tag>
</div>
</div>
@@ -107,7 +111,7 @@ const Init = () => {
userInfo.role = props.userInfo.role;
userInfo.id = props.userInfo.id;
userInfo.level = props.userInfo.level;
userInfo.userLimit = getStatusInfo(props.userInfo.userLimit);
userInfo.userLimit = props.userInfo.userLimit;
iconUrl.value = iconUrlHandler(userInfo.icon);
}

View File

@@ -48,7 +48,7 @@
<div class="score">积分3005</div>
<div class="status">
<span>状态</span>
<span> {{ getStatusInfo(userInfo.userLimit.label) }}</span>
<span> {{ getStatusInfo(userInfo.userLimit) }}</span>
</div>
</div>
<div class="hobby">
@@ -98,7 +98,7 @@ const statusTypeList = [
},
];
const getStatusInfo = (type) => {
return statusTypeList.filter((item) => item.value === type)[0];
return statusTypeList.filter((item) => item.value === type)[0]?.label;
};
</script>