You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
265 lines
5.9 KiB
265 lines
5.9 KiB
<template> |
|
<div :class="!flog && false ? 'tabbar' : 'tabbar-active'"> |
|
<div class="container"> |
|
<div class="logo-box"> |
|
<div class="logo"><img :src="adminInfoStore.info.logo"></div> |
|
<div class="lesson">课图</div> |
|
</div> |
|
|
|
<div class="menu"> |
|
<ul> |
|
<li v-for="(item, index) in constRouter[0].children" :class="{ active: settingStore.useIndex === index }" |
|
v-show="!item.meta.hidden" @click="goToRouter(item, index)" :key="item.path"> |
|
<div>{{ item.meta.title }}</div> |
|
</li> |
|
<div v-if="userStore.isLogin"> |
|
<img :src="userStore.userInfo.icon" alt="" |
|
style="width: 24px; height: 24px; margin: 0 10px; border-radius: 50%" /> |
|
<el-dropdown @command="handleCommand"> |
|
<span class="el-dropdown-link" style="color: #fff;"> |
|
{{ userStore.userInfo.username }} |
|
<el-icon class="el-icon--right"> |
|
<arrow-down /> |
|
</el-icon> |
|
</span> |
|
<template #dropdown> |
|
<el-dropdown-menu> |
|
<el-dropdown-item command="A">退出登录</el-dropdown-item> |
|
</el-dropdown-menu> |
|
</template> |
|
</el-dropdown> |
|
</div> |
|
<li v-else @click="send">登录注册</li> |
|
<!-- skip('http://localhost:5173/#/login?redirect=/configurationPage') --> |
|
<!-- <li v-if="$route.path != '/home'" @click="$router.push('/')">回到首页</li> --> |
|
</ul> |
|
<div class="entry"> |
|
<!-- <div>企业入口</div> |
|
<div>教师入口</div> |
|
<div>学生入口</div> --> |
|
<!-- <div>登录注册</div> --> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</template> |
|
|
|
<script lang="ts" setup> |
|
import useAdminInfoStore from '@/store/module/adminInfo' |
|
const adminInfoStore = useAdminInfoStore() |
|
import { userGetInfoService } from '@/api/configuration'; |
|
import useUserStore from '@/store/module/user'; |
|
const userStore = useUserStore() |
|
import { constRouter } from '@/router/module/constRouter' |
|
import { useRouter, useRoute } from 'vue-router' |
|
import { computed, onMounted, ref } from 'vue' |
|
import useSettingStore from '@/store/module/setting' |
|
const $router = useRouter() |
|
const $route = useRoute() |
|
|
|
const settingStore = useSettingStore() |
|
const goToRouter = (item: any, index: number) => { |
|
console.log($route); |
|
|
|
settingStore.setuseIndex(index) |
|
$router.push({ path: `${item.path}` }) |
|
} |
|
const flog = ref(false) |
|
onMounted(() => { |
|
window.addEventListener('scroll', () => { |
|
if (window.scrollY >= 50) { |
|
flog.value = true |
|
} else if (flog.value && window.scrollY <= 50) { |
|
flog.value = false |
|
} |
|
}) |
|
}) |
|
function skip(url: string) { |
|
location.assign(url) |
|
} |
|
|
|
|
|
// ======================== |
|
let otherWin: any = null; |
|
function send() { |
|
if (otherWin) { |
|
otherWin.focus(); |
|
return |
|
} |
|
otherWin = window.open(import.meta.env.VITE_APP_OTHER_ORIGIN) |
|
|
|
} |
|
window.onmessage = e => { |
|
if (e.origin === import.meta.env.VITE_APP_OTHER_ORIGIN) { |
|
userStore.setToken(e.data) |
|
userStore.setUserInfo() |
|
} |
|
} |
|
// ======================== |
|
// 退出登录 |
|
function logout() { |
|
try { |
|
otherWin.postMessage('logout', import.meta.env.VITE_APP_OTHER_ORIGIN) |
|
} catch (error) { |
|
send() |
|
setTimeout(() => { |
|
otherWin.postMessage('logout', import.meta.env.VITE_APP_OTHER_ORIGIN) |
|
}, 500) |
|
} |
|
} |
|
const handleCommand = (command: string) => { |
|
switch (command) { |
|
case 'A': |
|
logout() |
|
break |
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
.logo-box { |
|
display: flex; |
|
align-items: center; |
|
column-gap: 20px; |
|
|
|
.logo { |
|
width: 50px; |
|
|
|
img { |
|
width: 100%; |
|
height: 100%; |
|
} |
|
} |
|
|
|
.lesson { |
|
font-size: 30px; |
|
font-weight: bolder; |
|
color: #fff; |
|
} |
|
} |
|
|
|
.tabbar { |
|
position: fixed; |
|
top: 0; |
|
z-index: 1; |
|
height: 120px; |
|
width: 100%; |
|
background-color: transparent; |
|
animation-duration: 0.3s; |
|
animation-name: tabber-to; |
|
} |
|
|
|
.tabbar-active { |
|
position: fixed; |
|
top: 0; |
|
height: 120px; |
|
width: 100%; |
|
background-color: #6da0ff; |
|
animation-duration: 0.3s; |
|
animation-name: tabber; |
|
z-index: 999; |
|
box-shadow: 0px 0px 43px rgba(0, 0, 0, 0.2); |
|
} |
|
|
|
@keyframes tabber { |
|
0% { |
|
// transform: translateY(-120px); |
|
background-color: transparent; |
|
} |
|
|
|
100% { |
|
// transform: translateY(0); |
|
background-color: #6da0ff; |
|
} |
|
} |
|
|
|
@keyframes tabber-to { |
|
0% { |
|
// transform: translateY(-120px); |
|
background-color: #6da0ff; |
|
} |
|
|
|
100% { |
|
// transform: translateY(0); |
|
background-color: transparent; |
|
} |
|
} |
|
|
|
.container { |
|
height: 100%; |
|
display: flex; |
|
align-items: center; |
|
justify-content: space-between; |
|
margin: 0 auto; |
|
width: $base-container-width; |
|
|
|
.menu { |
|
position: relative; |
|
padding: 0 20px; |
|
height: 100%; |
|
display: flex; |
|
align-items: center; |
|
|
|
ul { |
|
display: flex; |
|
align-items: center; |
|
|
|
li { |
|
padding: 12px 20px; |
|
color: #ffffff; |
|
font-size: 14px; |
|
cursor: pointer; |
|
transition: all 0.2s; |
|
position: relative; |
|
} |
|
|
|
li:hover { |
|
color: #0033f7; |
|
transform: translateY(-5px); |
|
} |
|
|
|
.active::before { |
|
content: ' '; |
|
display: block; |
|
position: absolute; |
|
top: 0px; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
width: 5px; |
|
height: 5px; |
|
border-radius: 50%; |
|
background-color: #fff; |
|
} |
|
} |
|
|
|
.entry { |
|
position: absolute; |
|
top: 5px; |
|
right: 30px; |
|
display: flex; |
|
align-content: center; |
|
|
|
div { |
|
// padding: 5px; |
|
margin: 5px; |
|
margin-right: 0; |
|
padding: 0 10px; |
|
border-right: 1px solid #fff; |
|
color: #fff; |
|
font-size: 14px; |
|
cursor: pointer; |
|
} |
|
|
|
div:last-child { |
|
border-right: none; |
|
} |
|
} |
|
} |
|
|
|
.logo { |
|
// height: 100%; |
|
display: flex; |
|
align-items: center; |
|
} |
|
} |
|
</style>
|
|
|