|
@@ -33,6 +33,7 @@ import videoIcon from '../images/videoIcon.png'
|
|
import noVideoIcon from '../images/videoIcon.png'
|
|
import noVideoIcon from '../images/videoIcon.png'
|
|
import vipIcon from '../images/vipIcon.png'
|
|
import vipIcon from '../images/vipIcon.png'
|
|
import noVipIcon from '../images/vipIcon.png'
|
|
import noVipIcon from '../images/vipIcon.png'
|
|
|
|
+import icon_back from '@/common/images/icon_back.png'
|
|
|
|
|
|
import { getUserInfo, getUserType, getAuth, setAuth } from '@/helpers/utils'
|
|
import { getUserInfo, getUserType, getAuth, setAuth } from '@/helpers/utils'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
@@ -53,9 +54,9 @@ export default defineComponent({
|
|
user: {} as any,
|
|
user: {} as any,
|
|
userType: '',
|
|
userType: '',
|
|
showChange: false,
|
|
showChange: false,
|
|
- iconList:[] as any
|
|
|
|
|
|
+ iconList: [] as any
|
|
})
|
|
})
|
|
- mitt.on('mittFn',()=>{
|
|
|
|
|
|
+ mitt.on('mittFn', () => {
|
|
console.log('mittFn')
|
|
console.log('mittFn')
|
|
setUser()
|
|
setUser()
|
|
})
|
|
})
|
|
@@ -66,7 +67,7 @@ export default defineComponent({
|
|
setUser()
|
|
setUser()
|
|
})
|
|
})
|
|
})
|
|
})
|
|
- const setUser = ()=>{
|
|
|
|
|
|
+ const setUser = () => {
|
|
states.user = getUserInfo()
|
|
states.user = getUserInfo()
|
|
states.userType = getUserType()
|
|
states.userType = getUserType()
|
|
if (states.user.userType) {
|
|
if (states.user.userType) {
|
|
@@ -81,32 +82,32 @@ export default defineComponent({
|
|
}
|
|
}
|
|
// iconList
|
|
// iconList
|
|
|
|
|
|
- if(states.userType == 'TEACHER'){
|
|
|
|
|
|
+ if (states.userType == 'TEACHER') {
|
|
states.iconList = []
|
|
states.iconList = []
|
|
- if(states.user.tag.indexOf('STYLE') != -1){
|
|
|
|
|
|
+ if (states.user.tag.indexOf('STYLE') != -1) {
|
|
states.iconList.push(styleIcon)
|
|
states.iconList.push(styleIcon)
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
states.iconList.push(nostyleIcon)
|
|
states.iconList.push(nostyleIcon)
|
|
}
|
|
}
|
|
- if(states.user.tag.indexOf('VIDEO') != -1){
|
|
|
|
|
|
+ if (states.user.tag.indexOf('VIDEO') != -1) {
|
|
states.iconList.push(videoIcon)
|
|
states.iconList.push(videoIcon)
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
states.iconList.push(noVideoIcon)
|
|
states.iconList.push(noVideoIcon)
|
|
}
|
|
}
|
|
- if(states.user.tag.indexOf('LIVE') != -1){
|
|
|
|
|
|
+ if (states.user.tag.indexOf('LIVE') != -1) {
|
|
states.iconList.push(onlineIcon)
|
|
states.iconList.push(onlineIcon)
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
states.iconList.push(noOnlineIcon)
|
|
states.iconList.push(noOnlineIcon)
|
|
}
|
|
}
|
|
- if(states.user.tag.indexOf('MUSIC') != -1){
|
|
|
|
|
|
+ if (states.user.tag.indexOf('MUSIC') != -1) {
|
|
states.iconList.push(ablumIcon)
|
|
states.iconList.push(ablumIcon)
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
states.iconList.push(noAblumIcon)
|
|
states.iconList.push(noAblumIcon)
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
states.iconList = []
|
|
states.iconList = []
|
|
}
|
|
}
|
|
- console.log('查看用户登录态',states.user)
|
|
|
|
|
|
+ console.log('查看用户登录态', states.user)
|
|
}
|
|
}
|
|
const gotoPage = (val: string) => {
|
|
const gotoPage = (val: string) => {
|
|
router.push({ path: val })
|
|
router.push({ path: val })
|
|
@@ -115,22 +116,20 @@ export default defineComponent({
|
|
const token = getAuth()
|
|
const token = getAuth()
|
|
let userType = ''
|
|
let userType = ''
|
|
let str = ''
|
|
let str = ''
|
|
- let nowPath = route.fullPath;
|
|
|
|
|
|
+ let nowPath = route.fullPath
|
|
|
|
|
|
if (states.userType == 'TEACHER') {
|
|
if (states.userType == 'TEACHER') {
|
|
userType = 'STUDENT'
|
|
userType = 'STUDENT'
|
|
str = '学生'
|
|
str = '学生'
|
|
- if(nowPath.indexOf('userInfo')!= -1){
|
|
|
|
|
|
+ if (nowPath.indexOf('userInfo') != -1) {
|
|
nowPath = '/studentInfo'
|
|
nowPath = '/studentInfo'
|
|
}
|
|
}
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
userType = 'TEACHER'
|
|
userType = 'TEACHER'
|
|
str = '老师'
|
|
str = '老师'
|
|
- if(nowPath.indexOf('studentInfo')!= -1){
|
|
|
|
|
|
+ if (nowPath.indexOf('studentInfo') != -1) {
|
|
nowPath = '/userInfo'
|
|
nowPath = '/userInfo'
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
ElMessageBox.confirm(`是否确定切换到${str}?`, '提示', {
|
|
ElMessageBox.confirm(`是否确定切换到${str}?`, '提示', {
|
|
type: 'warning'
|
|
type: 'warning'
|
|
@@ -141,12 +140,10 @@ export default defineComponent({
|
|
loginUserType: userType
|
|
loginUserType: userType
|
|
})
|
|
})
|
|
)
|
|
)
|
|
- router.push({ path: nowPath,query:{...route.query} })
|
|
|
|
- setTimeout(()=>{
|
|
|
|
- window.location.reload()
|
|
|
|
- },500)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ router.push({ path: nowPath, query: { ...route.query } })
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ window.location.reload()
|
|
|
|
+ }, 500)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
const logout = async () => {
|
|
const logout = async () => {
|
|
@@ -182,7 +179,7 @@ export default defineComponent({
|
|
<>
|
|
<>
|
|
<ElDropdown
|
|
<ElDropdown
|
|
onCommand={val => this.changeState(val)}
|
|
onCommand={val => this.changeState(val)}
|
|
- popper-class='loginPopper'
|
|
|
|
|
|
+ popper-class="loginPopper"
|
|
trigger="click"
|
|
trigger="click"
|
|
v-slots={{
|
|
v-slots={{
|
|
dropdown: () => (
|
|
dropdown: () => (
|
|
@@ -200,14 +197,23 @@ export default defineComponent({
|
|
alt=""
|
|
alt=""
|
|
/> */}
|
|
/> */}
|
|
<div class={classes.titleWrap}>
|
|
<div class={classes.titleWrap}>
|
|
- <p class={classes.title}>{this.user.username}</p>
|
|
|
|
- <img class={classes.vipLogo} src={this.user.isVip?vipIcon:noVipIcon} alt="" />
|
|
|
|
|
|
+ <p class={classes.title}>{this.user.username}</p>
|
|
|
|
+ <img
|
|
|
|
+ class={classes.vipLogo}
|
|
|
|
+ src={this.user.isVip ? vipIcon : noVipIcon}
|
|
|
|
+ alt=""
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
<div class={classes.iconList}>
|
|
<div class={classes.iconList}>
|
|
- {this.userType == 'TEACHER'? <p class={classes.teacherTag}>{'老师'}</p>: <p class={classes.studentTag}>{'学生'}</p>}
|
|
|
|
- {this.iconList.map(item=><img class={classes.icon} src={item} alt="" /> )}
|
|
|
|
|
|
+ {this.userType == 'TEACHER' ? (
|
|
|
|
+ <p class={classes.teacherTag}>{'老师'}</p>
|
|
|
|
+ ) : (
|
|
|
|
+ <p class={classes.studentTag}>{'学生'}</p>
|
|
|
|
+ )}
|
|
|
|
+ {this.iconList.map(item => (
|
|
|
|
+ <img class={classes.icon} src={item} alt="" />
|
|
|
|
+ ))}
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
{/* <img src={userBanner} alt="" /> */}
|
|
{/* <img src={userBanner} alt="" /> */}
|
|
</div>
|
|
</div>
|
|
@@ -235,44 +241,55 @@ export default defineComponent({
|
|
|
|
|
|
<ElDropdownMenu>
|
|
<ElDropdownMenu>
|
|
{this.userType == 'TEACHER' ? (
|
|
{this.userType == 'TEACHER' ? (
|
|
- <ElDropdownItem command="teacher">
|
|
|
|
- <img
|
|
|
|
- class={classes.dropdownImg}
|
|
|
|
- src={peopleIcon}
|
|
|
|
- alt=""
|
|
|
|
- />{' '}
|
|
|
|
- 个人中心
|
|
|
|
|
|
+ <ElDropdownItem command="teacher" class="backItem">
|
|
|
|
+ <div class="dropdownItemWrap">
|
|
|
|
+ <img
|
|
|
|
+ class={classes.dropdownImg}
|
|
|
|
+ src={peopleIcon}
|
|
|
|
+ alt=""
|
|
|
|
+ />{' '}
|
|
|
|
+ 个人中心
|
|
|
|
+ </div>
|
|
|
|
+ <img src={icon_back} alt="" class="icon_back" />
|
|
</ElDropdownItem>
|
|
</ElDropdownItem>
|
|
) : (
|
|
) : (
|
|
- <ElDropdownItem command="strudent">
|
|
|
|
- <img
|
|
|
|
- class={classes.dropdownImg}
|
|
|
|
- src={peopleIcon}
|
|
|
|
- alt=""
|
|
|
|
- />{' '}
|
|
|
|
- 个人中心
|
|
|
|
|
|
+ <ElDropdownItem command="strudent" class="backItem">
|
|
|
|
+ <div class="dropdownItemWrap">
|
|
|
|
+ <img
|
|
|
|
+ class={classes.dropdownImg}
|
|
|
|
+ src={peopleIcon}
|
|
|
|
+ alt=""
|
|
|
|
+ />{' '}
|
|
|
|
+ 个人中心
|
|
|
|
+ </div>
|
|
|
|
+ <img src={icon_back} alt="" class="icon_back" />
|
|
</ElDropdownItem>
|
|
</ElDropdownItem>
|
|
)}
|
|
)}
|
|
{/* <ElDropdownItem onClick={gotoPage('')}><img class={classes.dropdownImg} src={planIcon} alt="" /> 创作中心</ElDropdownItem> */}
|
|
{/* <ElDropdownItem onClick={gotoPage('')}><img class={classes.dropdownImg} src={planIcon} alt="" /> 创作中心</ElDropdownItem> */}
|
|
{this.showChange ? (
|
|
{this.showChange ? (
|
|
- <ElDropdownItem command="change">
|
|
|
|
- <img
|
|
|
|
- class={classes.dropdownImg}
|
|
|
|
- src={changeIcon}
|
|
|
|
- alt=""
|
|
|
|
- />{' '}
|
|
|
|
- 角色切换
|
|
|
|
|
|
+ <ElDropdownItem command="change" class="backItem">
|
|
|
|
+ <div class="dropdownItemWrap">
|
|
|
|
+ <img
|
|
|
|
+ class={classes.dropdownImg}
|
|
|
|
+ src={changeIcon}
|
|
|
|
+ alt=""
|
|
|
|
+ />{' '}
|
|
|
|
+ 角色切换
|
|
|
|
+ </div>
|
|
|
|
+ <div class="changeWrap">
|
|
|
|
+ <span> {this.userType == 'TEACHER' ?'学生':'老师'}</span>
|
|
|
|
+ <img src={icon_back} alt="" class="icon_back" />
|
|
|
|
+ </div>
|
|
</ElDropdownItem>
|
|
</ElDropdownItem>
|
|
) : null}
|
|
) : null}
|
|
|
|
|
|
<ElDropdownItem command="back" class="backItem">
|
|
<ElDropdownItem command="back" class="backItem">
|
|
- <div class="backWrap">
|
|
|
|
- <img
|
|
|
|
- class={classes.dropdownImg}
|
|
|
|
- src={backIcon}
|
|
|
|
- alt=""
|
|
|
|
- />{' '}
|
|
|
|
- 退出登录
|
|
|
|
|
|
+ <div class='lineItem'>
|
|
|
|
+ <div class="backWrap">
|
|
|
|
+ <img class="backIcon" src={backIcon} alt="" />{' '}
|
|
|
|
+ 退出登录
|
|
|
|
+ </div>
|
|
|
|
+ <img src={icon_back} alt="" class="icon_back" />
|
|
</div>
|
|
</div>
|
|
</ElDropdownItem>
|
|
</ElDropdownItem>
|
|
</ElDropdownMenu>
|
|
</ElDropdownMenu>
|