|
@@ -33,6 +33,7 @@ import styleIcon from '../images/styleIcon.png'
|
|
|
import nostyleIcon from '../images/noStyleIcon.png'
|
|
|
import videoIcon from '../images/videoIcon.png'
|
|
|
import noVideoIcon from '../images/noVideoIcon.png'
|
|
|
+import sVipIcon from '../images/vipIcon.png'
|
|
|
import vipIcon from '../images/vipIcon.png'
|
|
|
import noVipIcon from '../images/noVipIcon.png'
|
|
|
import icon_back from '@/common/images/icon_back.png'
|
|
@@ -75,6 +76,39 @@ export default defineComponent({
|
|
|
setUser()
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+ // 检验是否有对应徽章
|
|
|
+ const checkBadge = (type: string) => {
|
|
|
+ // tag : 老师点亮图标
|
|
|
+ // STYLE:个人风采
|
|
|
+ // VIDEO:视频课
|
|
|
+ // LIVE:直播课,
|
|
|
+ // MUSIC:曲目 逗号隔开
|
|
|
+ let status = false
|
|
|
+ const userInfo = getUserInfo()
|
|
|
+ switch (type) {
|
|
|
+ case 'STYLE':
|
|
|
+ case 'VIDEO':
|
|
|
+ case 'LIVE':
|
|
|
+ case 'MUSIC':
|
|
|
+ if (userInfo.tag) {
|
|
|
+ status = userInfo.tag.indexOf(type) > -1
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 'VIP':
|
|
|
+ status = userInfo.isVip > 0
|
|
|
+ break
|
|
|
+ case 'SVIP':
|
|
|
+ status =
|
|
|
+ userInfo.userVip?.vipType === 'SVIP' ||
|
|
|
+ userInfo.userVip?.vipType === 'PERMANENT_SVIP'
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ status = false
|
|
|
+ break
|
|
|
+ }
|
|
|
+ return status
|
|
|
+ }
|
|
|
const setUser = () => {
|
|
|
states.user = getUserInfo()
|
|
|
states.userType = getUserType()
|
|
@@ -92,27 +126,27 @@ export default defineComponent({
|
|
|
|
|
|
if (states.userType == 'TEACHER') {
|
|
|
states.iconList = []
|
|
|
- if (states.user.isVip) {
|
|
|
+ if (checkBadge('VIP') || checkBadge('SVIP')) {
|
|
|
states.iconList.push(memberIcon)
|
|
|
} else {
|
|
|
states.iconList.push(noMemberIcon)
|
|
|
}
|
|
|
- if (states.user.tag.indexOf('STYLE') != -1) {
|
|
|
+ if (checkBadge('STYLE')) {
|
|
|
states.iconList.push(styleIcon)
|
|
|
} else {
|
|
|
states.iconList.push(nostyleIcon)
|
|
|
}
|
|
|
- if (states.user.tag.indexOf('VIDEO') != -1) {
|
|
|
+ if (checkBadge('VIDEO')) {
|
|
|
states.iconList.push(videoIcon)
|
|
|
} else {
|
|
|
states.iconList.push(noVideoIcon)
|
|
|
}
|
|
|
- if (states.user.tag.indexOf('LIVE') != -1) {
|
|
|
+ if (checkBadge('LIVE')) {
|
|
|
states.iconList.push(onlineIcon)
|
|
|
} else {
|
|
|
states.iconList.push(noOnlineIcon)
|
|
|
}
|
|
|
- if (states.user.tag.indexOf('MUSIC') != -1) {
|
|
|
+ if (checkBadge('MUSIC')) {
|
|
|
states.iconList.push(ablumIcon)
|
|
|
} else {
|
|
|
states.iconList.push(noAblumIcon)
|
|
@@ -205,6 +239,7 @@ export default defineComponent({
|
|
|
...toRefs(states),
|
|
|
gotoPage,
|
|
|
changeRoute,
|
|
|
+ checkBadge,
|
|
|
logout,
|
|
|
changeState,
|
|
|
gotoFans
|
|
@@ -234,12 +269,21 @@ export default defineComponent({
|
|
|
/> */}
|
|
|
<div class={classes.titleWrap}>
|
|
|
<p class={classes.title}>{this.user.username}</p>
|
|
|
- <img
|
|
|
- class={classes.vipLogo}
|
|
|
- src={this.user.isVip ? vipIcon : noVipIcon}
|
|
|
- style="object-fit: cover;"
|
|
|
- alt=""
|
|
|
- />
|
|
|
+ {(this.checkBadge('VIP') ||
|
|
|
+ this.checkBadge('SVIP')) && (
|
|
|
+ <img
|
|
|
+ class={classes.vipLogo}
|
|
|
+ src={
|
|
|
+ this.checkBadge('SVIP')
|
|
|
+ ? sVipIcon
|
|
|
+ : this.checkBadge('VIP')
|
|
|
+ ? vipIcon
|
|
|
+ : noVipIcon
|
|
|
+ }
|
|
|
+ style="object-fit: cover;"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ )}
|
|
|
</div>
|
|
|
<div class={classes.iconList}>
|
|
|
{this.userType == 'TEACHER' ? (
|