2023-05-02 09:44:23 +00:00
|
|
|
|
<script setup lang="ts">
|
2023-05-13 06:05:05 +00:00
|
|
|
|
import KUNGalgameSettingsPanel from './setting-panel/KUNGalgameSettingPanel.vue'
|
2023-05-11 05:19:28 +00:00
|
|
|
|
import { Icon } from '@iconify/vue'
|
|
|
|
|
import { onBeforeMount, ref } from 'vue'
|
2023-05-02 18:20:22 +00:00
|
|
|
|
import 'animate.css'
|
2023-05-12 15:13:31 +00:00
|
|
|
|
import router from '@/router'
|
2023-05-03 12:16:10 +00:00
|
|
|
|
interface topBar {
|
2023-05-10 10:04:28 +00:00
|
|
|
|
index: number
|
2023-05-10 07:57:05 +00:00
|
|
|
|
name: string
|
|
|
|
|
router: string
|
2023-05-03 12:16:10 +00:00
|
|
|
|
}
|
2023-05-10 10:04:28 +00:00
|
|
|
|
const topBarItem: topBar[] = [
|
|
|
|
|
{ index: 1, name: '所有帖子', router: '/pool' },
|
|
|
|
|
{ index: 2, name: '发布帖子', router: 'edit' },
|
|
|
|
|
{ index: 3, name: '技术交流', router: 'technology' },
|
|
|
|
|
{ index: 4, name: '关于我们', router: 'kungalgame' },
|
|
|
|
|
{ index: 5, name: '返回主页', router: '/' },
|
2023-05-02 15:22:46 +00:00
|
|
|
|
]
|
2023-05-02 18:20:22 +00:00
|
|
|
|
// 初始不展示用户头像点击信息
|
2023-05-12 15:13:31 +00:00
|
|
|
|
let isShowInfo = ref(false)
|
2023-05-02 09:44:23 +00:00
|
|
|
|
|
2023-05-02 18:20:22 +00:00
|
|
|
|
// 初始进入页面 header 没有附加样式
|
2023-05-02 15:22:46 +00:00
|
|
|
|
let topicStyle = {}
|
2023-05-02 09:44:23 +00:00
|
|
|
|
|
2023-05-02 15:22:46 +00:00
|
|
|
|
// 接受父组件的传值
|
|
|
|
|
let props = defineProps(['isMainPage', 'isTopicPage'])
|
2023-05-02 09:44:23 +00:00
|
|
|
|
|
2023-05-02 15:22:46 +00:00
|
|
|
|
const isMain = props.isMainPage
|
2023-05-02 18:20:22 +00:00
|
|
|
|
const isTopicPage = props.isTopicPage
|
2023-05-02 15:22:46 +00:00
|
|
|
|
// 如果是主页的话删除 “返回主页” 项目
|
|
|
|
|
if (isMain) {
|
2023-05-02 18:20:22 +00:00
|
|
|
|
topBarItem.pop()
|
2023-05-02 15:22:46 +00:00
|
|
|
|
}
|
2023-05-02 18:20:22 +00:00
|
|
|
|
// 如果是帖子页的话定位为 sticky,距离底部 10px
|
2023-05-02 15:22:46 +00:00
|
|
|
|
if (isTopicPage) {
|
|
|
|
|
topicStyle = {
|
|
|
|
|
top: 0,
|
|
|
|
|
position: 'sticky',
|
|
|
|
|
}
|
2023-05-02 09:44:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-02 15:22:46 +00:00
|
|
|
|
// 根据导航条的项目个数操作 css 中导航条的宽度
|
|
|
|
|
let navItemNum = topBarItem.length
|
|
|
|
|
const navItemNumString = navItemNum + '00px'
|
|
|
|
|
|
2023-05-12 18:23:22 +00:00
|
|
|
|
// 用户点击设置按钮时的操作
|
|
|
|
|
const isShowPanel = ref(true)
|
|
|
|
|
|
2023-05-02 18:20:22 +00:00
|
|
|
|
// 用户点击头像时的操作
|
2023-05-12 15:13:31 +00:00
|
|
|
|
const handleClickAvatar = () => {
|
|
|
|
|
// isShowInfo.value = !isShowInfo.value
|
|
|
|
|
router.push('/kungalgamer')
|
|
|
|
|
}
|
2023-05-11 05:19:28 +00:00
|
|
|
|
|
|
|
|
|
// 用户点击网站设置时的操作
|
2023-05-12 18:23:22 +00:00
|
|
|
|
const handleSittingsClick = () => {
|
|
|
|
|
isShowPanel.value = !isShowPanel.value
|
|
|
|
|
}
|
2023-05-11 05:19:28 +00:00
|
|
|
|
onBeforeMount(() => {})
|
2023-04-14 13:58:13 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2023-05-02 15:22:46 +00:00
|
|
|
|
<div class="header" :style="topicStyle">
|
2023-04-14 13:58:13 +00:00
|
|
|
|
<!-- 顶部左侧交互栏 -->
|
|
|
|
|
<div class="nav-top">
|
|
|
|
|
<div class="kungal-info">
|
2023-05-02 09:44:23 +00:00
|
|
|
|
<!-- 网站的名字和网站图标 -->
|
2023-04-18 17:05:27 +00:00
|
|
|
|
<img src="../assets/images/favicon.png" alt="KUNgal" />
|
|
|
|
|
<span>KUNGalgame</span>
|
2023-04-14 13:58:13 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="top-bar">
|
|
|
|
|
<ul>
|
2023-05-02 09:44:23 +00:00
|
|
|
|
<!-- 顶部单个板块 -->
|
2023-05-10 10:04:28 +00:00
|
|
|
|
<li v-for="kun in topBarItem" :key="kun.index">
|
|
|
|
|
<router-link :to="{ path: kun.router }">{{ kun.name }}</router-link>
|
|
|
|
|
</li>
|
2023-05-02 09:44:23 +00:00
|
|
|
|
<!-- 顶部板块下部的 hover 效果 -->
|
2023-04-14 13:58:13 +00:00
|
|
|
|
<div class="top-bar-box"></div>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="kungalgamer-info">
|
2023-05-11 05:19:28 +00:00
|
|
|
|
<span @click="handleSittingsClick"><Icon icon="uiw:setting-o" /></span>
|
2023-05-03 12:16:10 +00:00
|
|
|
|
<img
|
|
|
|
|
src="../assets/images/KUN.jpg"
|
|
|
|
|
alt="KUN"
|
2023-05-12 15:13:31 +00:00
|
|
|
|
@click="handleClickAvatar"
|
2023-05-03 12:16:10 +00:00
|
|
|
|
/>
|
2023-05-02 18:20:22 +00:00
|
|
|
|
<div class="triangle" v-if="isShowInfo"></div>
|
|
|
|
|
<div class="kungalgamer" v-if="isShowInfo">
|
|
|
|
|
<div>用户主页</div>
|
|
|
|
|
<div>更改头像</div>
|
|
|
|
|
</div>
|
2023-04-14 13:58:13 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-05-12 18:23:22 +00:00
|
|
|
|
<transition name="kungalgame-panel">
|
|
|
|
|
<KUNGalgameSettingsPanel v-if="isShowPanel" />
|
|
|
|
|
</transition>
|
2023-04-14 13:58:13 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
2023-05-02 15:22:46 +00:00
|
|
|
|
<style lang="less" scoped>
|
2023-05-12 18:23:22 +00:00
|
|
|
|
.kungalgame-panel-enter-active,
|
|
|
|
|
.kungalgame-panel-leave-active {
|
|
|
|
|
transition: right 0.5s;
|
|
|
|
|
}
|
|
|
|
|
.kungalgame-panel-enter, .kungalgame-panel-leave-to /* .fade-leave-active below version 2.1.8 */ {
|
2023-05-13 06:05:05 +00:00
|
|
|
|
right: -600px;
|
2023-05-12 18:23:22 +00:00
|
|
|
|
}
|
2023-04-18 08:04:47 +00:00
|
|
|
|
/* 头部样式 */
|
2023-04-14 13:58:13 +00:00
|
|
|
|
.header {
|
2023-04-18 08:04:47 +00:00
|
|
|
|
/* 头部高度 */
|
|
|
|
|
height: 58px;
|
|
|
|
|
/* 头部下方阴影 */
|
2023-05-02 15:22:46 +00:00
|
|
|
|
box-shadow: 0 2px 4px 0 @kungalgame-trans-blue-1;
|
2023-04-18 08:04:47 +00:00
|
|
|
|
/* 头部背景 */
|
|
|
|
|
backdrop-filter: blur(5px);
|
2023-05-02 15:22:46 +00:00
|
|
|
|
background-color: @kungalgame-trans-white-5;
|
2023-04-18 08:04:47 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
2023-05-11 05:19:28 +00:00
|
|
|
|
/* 相对于设置面板定位 */
|
|
|
|
|
position: relative;
|
2023-05-02 18:20:22 +00:00
|
|
|
|
z-index: 1007;
|
2023-05-12 15:13:31 +00:00
|
|
|
|
margin-bottom: 7px;
|
2023-04-14 13:58:13 +00:00
|
|
|
|
}
|
|
|
|
|
.nav-top {
|
2023-04-18 08:04:47 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2023-04-14 13:58:13 +00:00
|
|
|
|
}
|
|
|
|
|
.kungal-info {
|
2023-04-18 08:04:47 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2023-05-02 15:22:46 +00:00
|
|
|
|
img {
|
|
|
|
|
height: 50px;
|
|
|
|
|
margin-left: 50px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
span {
|
|
|
|
|
margin-left: 20px;
|
|
|
|
|
margin-right: 7px;
|
|
|
|
|
color: @kungalgame-font-color-3;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
2023-04-14 13:58:13 +00:00
|
|
|
|
}
|
2023-05-02 15:22:46 +00:00
|
|
|
|
|
2023-05-02 18:20:22 +00:00
|
|
|
|
// 顶部交互栏
|
2023-05-02 15:22:46 +00:00
|
|
|
|
@navNumber: v-bind(navItemNum);
|
|
|
|
|
|
2023-04-14 13:58:13 +00:00
|
|
|
|
.top-bar {
|
2023-04-18 08:04:47 +00:00
|
|
|
|
position: relative;
|
|
|
|
|
text-align: center;
|
2023-05-02 15:22:46 +00:00
|
|
|
|
width: v-bind(navItemNumString);
|
|
|
|
|
ul {
|
|
|
|
|
align-items: center;
|
|
|
|
|
display: flex;
|
|
|
|
|
right: 5%;
|
|
|
|
|
.top-bar-box {
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
height: 7px;
|
|
|
|
|
left: 0;
|
|
|
|
|
position: absolute;
|
|
|
|
|
transition: 0.5s;
|
|
|
|
|
width: calc(100% / @navNumber);
|
|
|
|
|
}
|
2023-05-10 10:04:28 +00:00
|
|
|
|
a {
|
|
|
|
|
// 转变 a 标签为块级元素
|
|
|
|
|
display: block;
|
2023-05-02 15:22:46 +00:00
|
|
|
|
color: @kungalgame-blue-5;
|
2023-05-10 10:04:28 +00:00
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
li {
|
2023-05-02 15:22:46 +00:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
display: block;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
line-height: 58px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
&:hover {
|
|
|
|
|
background-color: @kungalgame-blue-0;
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
transition: 0.5s;
|
|
|
|
|
}
|
|
|
|
|
&:nth-child(1):hover ~ .top-bar-box {
|
|
|
|
|
background-color: @kungalgame-red-3;
|
|
|
|
|
left: calc(100% / @navNumber * 0);
|
|
|
|
|
}
|
2023-04-18 08:04:47 +00:00
|
|
|
|
|
2023-05-02 15:22:46 +00:00
|
|
|
|
&:nth-child(2):hover ~ .top-bar-box {
|
|
|
|
|
background-color: @kungalgame-yellow-3;
|
|
|
|
|
left: calc(100% / @navNumber * 1);
|
|
|
|
|
}
|
2023-04-18 08:04:47 +00:00
|
|
|
|
|
2023-05-02 15:22:46 +00:00
|
|
|
|
&:nth-child(3):hover ~ .top-bar-box {
|
|
|
|
|
background-color: @kungalgame-blue-3;
|
|
|
|
|
left: calc(100% / @navNumber * 2);
|
|
|
|
|
}
|
2023-04-18 08:04:47 +00:00
|
|
|
|
|
2023-05-02 15:22:46 +00:00
|
|
|
|
&:nth-child(4):hover ~ .top-bar-box {
|
|
|
|
|
background-color: @kungalgame-green-3;
|
|
|
|
|
left: calc(100% / @navNumber * 3);
|
|
|
|
|
}
|
|
|
|
|
&:nth-child(5):hover ~ .top-bar-box {
|
|
|
|
|
background-color: @kungalgame-purple-3;
|
|
|
|
|
left: calc(100% / @navNumber * 4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-18 08:04:47 +00:00
|
|
|
|
|
|
|
|
|
/* 用户个人信息 */
|
2023-05-02 18:20:22 +00:00
|
|
|
|
|
2023-04-14 13:58:13 +00:00
|
|
|
|
.kungalgamer-info {
|
2023-04-18 08:04:47 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2023-05-02 18:20:22 +00:00
|
|
|
|
img {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
height: 40px;
|
|
|
|
|
position: relative;
|
2023-05-11 05:19:28 +00:00
|
|
|
|
margin-right: 50px;
|
2023-05-02 18:20:22 +00:00
|
|
|
|
}
|
|
|
|
|
> span {
|
|
|
|
|
color: @kungalgame-font-color-2;
|
2023-05-11 05:19:28 +00:00
|
|
|
|
font-size: 25px;
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
margin-right: 30px;
|
2023-05-02 18:20:22 +00:00
|
|
|
|
}
|
2023-04-18 08:04:47 +00:00
|
|
|
|
}
|
2023-05-02 18:20:22 +00:00
|
|
|
|
.triangle {
|
|
|
|
|
position: absolute;
|
|
|
|
|
border-width: 10px;
|
|
|
|
|
border-style: solid;
|
|
|
|
|
border-color: transparent;
|
|
|
|
|
border-bottom-color: @kungalgame-trans-white-2;
|
|
|
|
|
top: 50px;
|
2023-05-10 07:57:05 +00:00
|
|
|
|
right: 124px;
|
2023-04-18 08:04:47 +00:00
|
|
|
|
}
|
2023-05-02 18:20:22 +00:00
|
|
|
|
.kungalgamer {
|
|
|
|
|
top: 70px;
|
2023-05-10 07:57:05 +00:00
|
|
|
|
right: 95px;
|
2023-05-02 18:20:22 +00:00
|
|
|
|
position: absolute;
|
|
|
|
|
background-color: @kungalgame-trans-white-2;
|
|
|
|
|
box-shadow: @shadow;
|
|
|
|
|
div {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
padding: 7px;
|
|
|
|
|
&:hover {
|
|
|
|
|
background-color: @kungalgame-trans-red-3;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-14 13:58:13 +00:00
|
|
|
|
}
|
2023-05-11 05:19:28 +00:00
|
|
|
|
|
|
|
|
|
@media (max-width: 1000px) {
|
|
|
|
|
span {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-14 13:58:13 +00:00
|
|
|
|
</style>
|