beelink/src/components/NavTop.vue
2020-10-14 11:12:03 +08:00

235 lines
7.5 KiB
Vue

<template>
<div class="nav">
<div class="logo" :style="{'background-color': types == 0 ? 'unset' : ''}">
<img src="@/static/images/logo.png" alt="" class="img">
<div class="title" :style="{'color': types == 0 ? '#07AD97' : ''}">Beelink</div>
</div>
<div class="navigation">
<div class="item" v-for="(i,j) in nav" :key="j" @click="navto(j)">
{{i.name}}
</div>
</div>
<div style="width: 100%"></div>
<div class="setting">
<a-dropdown :trigger="['click']" :getPopupContainer="triggerNode => triggerNode.parentNode">
<div class="item" @click="e => e.preventDefault()">
<img src="@/static/images/shijian.png" alt="" class="icon">
<div class="name">{{userinfo.zoneStr}}</div>
<img src="@/static/images/jiantou2.png" alt="" class="down">
</div>
<template v-slot:overlay>
<a-menu>
<a-menu-item key="0">
<div class="selitem">
<span>时区1</span>
</div>
</a-menu-item>
<a-menu-item key="1">
<div class="selitem">
<span>时区2</span>
</div>
</a-menu-item>
<a-menu-item key="3">
<div class="selitem">
<span>时区3</span>
</div>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
<a-dropdown :trigger="['click']" :getPopupContainer="triggerNode => triggerNode.parentNode">
<div class="item" @click="e => e.preventDefault()">
<img src="@/static/images/qianbi.png" alt="" class="icon">
<div class="name">{{userinfo.currency}}</div>
<img src="@/static/images/jiantou2.png" alt="" class="down">
</div>
<template v-slot:overlay>
<a-menu>
<a-menu-item key="0">
<div class="selitem">
<span>时区1</span>
</div>
</a-menu-item>
<a-menu-item key="1">
<div class="selitem">
<span>时区2</span>
</div>
</a-menu-item>
<a-menu-item key="3">
<div class="selitem">
<span>时区3</span>
</div>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
<a-dropdown :trigger="['click']" :getPopupContainer="triggerNode => triggerNode.parentNode">
<div class="item" @click="e => e.preventDefault()">
<img src="@/static/images/yuyan.png" alt="" class="icon">
<div class="name">{{userinfo.language}}</div>
<img src="@/static/images/jiantou2.png" alt="" class="down">
</div>
<template v-slot:overlay>
<a-menu>
<a-menu-item key="0">
<div class="selitem">
<span>时区1</span>
</div>
</a-menu-item>
<a-menu-item key="1">
<div class="selitem">
<span>时区2</span>
</div>
</a-menu-item>
<a-menu-item key="3">
<div class="selitem">
<span>时区3</span>
</div>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
<div class="item" style="border-right: none;">
<img src="@/static/images/rili.png" alt="" class="icon">
<div class="name">日历</div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.nav{
display: flex;
min-width: 1366px;
user-select: none;
.logo{
width: 171px;
height: 57px;
background-color: #06C7AE;
display: flex;
align-items: center;
flex-shrink: 0;
.img{
width: 38px;
height: 38px;
margin-left: 14px;
border-radius: 50%;
}
.title{
margin-left: 9px;
font-size: 17px;
color: #fff;
}
}
.navigation{
display: flex;
align-items: center;
flex-shrink: 0;
margin-left: 28px;
.item{
padding: 0 28px;
height: 18px;
border-right: 1px solid #eee;
font-size: 11px;
color: #111;
font-weight: bold;
&:last-child{
border-right: none;
}
}
}
.setting{
display: flex;
align-items: center;
flex-shrink: 0;
padding: 0 16px;
.selitem{
text-align: center;
font-size: 11px;
color: #111;
}
.item{
display: flex;
align-items: center;
border-right: 1px solid #eee;
padding: 0 23px;
height: 18rpx;
.icon{
width: 16px;
height: 16px;
}
.name{
margin-left: 6px;
font-size: 11px;
color: #111;
font-weight: bold;
}
.down{
width: 9px;
height: 5px;
margin-left: 20px;
}
}
}
}
</style>
<script lang="ts">
import router from '@/router';
import store from '@/store';
import { computed, defineComponent, ref } from 'vue';
import { useRoute } from 'vue-router';
export default defineComponent({
props:{
type: {
type: Number,
default:0
}
},
setup(props){
// console.log(useRoute().currentRoute.value.name)
const routes = useRoute();
console.log(routes.path);
const types = ref(props.type)
console.log(types.value)
interface Nav{
name: string;
route: string;
}
const nav: Array<Nav> = [
{
name: "直播管理",
route: "/regime/live"
},
{
name: "视频管理",
route: "/regime/video"
},
{
name: "订阅者管理",
route: "/regime/subscriber"
},
{
name: "个人中心",
route: "/mine/archives"
}
]
const userinfo = computed(() => {
return store.state.userinfo;
})
function navto(index: number){
router.push({
path: nav[index].route
})
}
return {
nav,
types,
navto,
userinfo
}
}
})
</script>