|
|
@ -3,7 +3,7 @@
|
|
|
|
:class="[prefixCls, 'flex', 'justify-between', store.getMenuTheme === 'dark'? 'is-host' : 'is-white']">
|
|
|
|
:class="[prefixCls, 'flex', 'justify-between', store.getMenuTheme === 'dark'? 'is-host' : 'is-white']">
|
|
|
|
<ApplicationAppLogo/>
|
|
|
|
<ApplicationAppLogo/>
|
|
|
|
<el-menu
|
|
|
|
<el-menu
|
|
|
|
:default-active="$route.meta.parentPath || $route.path"
|
|
|
|
:default-active="defaultActive"
|
|
|
|
mode="horizontal"
|
|
|
|
mode="horizontal"
|
|
|
|
:ellipsis="false"
|
|
|
|
:ellipsis="false"
|
|
|
|
router
|
|
|
|
router
|
|
|
@ -14,6 +14,7 @@
|
|
|
|
</el-menu>
|
|
|
|
</el-menu>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="login-action-wrap flex items-center">
|
|
|
|
<div class="login-action-wrap flex items-center">
|
|
|
|
|
|
|
|
<!-- 首页展示搜索按钮 -->
|
|
|
|
<el-popover popper-class="search-popper" v-if="activeRoute === '/'" placement="bottom-end" :width="434" trigger="click">
|
|
|
|
<el-popover popper-class="search-popper" v-if="activeRoute === '/'" placement="bottom-end" :width="434" trigger="click">
|
|
|
|
<template #reference>
|
|
|
|
<template #reference>
|
|
|
|
<el-icon>
|
|
|
|
<el-icon>
|
|
|
@ -22,6 +23,7 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
|
|
|
|
@keydown.enter="handleSearch"
|
|
|
|
v-model="keyword"
|
|
|
|
v-model="keyword"
|
|
|
|
placeholder="请输入关键字"
|
|
|
|
placeholder="请输入关键字"
|
|
|
|
:suffix-icon="ElIconSearch"
|
|
|
|
:suffix-icon="ElIconSearch"
|
|
|
@ -29,6 +31,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-popover>
|
|
|
|
</el-popover>
|
|
|
|
<el-divider v-if="activeRoute === '/'" direction="vertical" style="border-left: 1px solid #000"/>
|
|
|
|
<el-divider v-if="activeRoute === '/'" direction="vertical" style="border-left: 1px solid #000"/>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="login-btn cursor-pointer" v-if="!token" @click="setLoginVisible(true)">登录</div>
|
|
|
|
<div class="login-btn cursor-pointer" v-if="!token" @click="setLoginVisible(true)">登录</div>
|
|
|
|
<el-dropdown popper-class="login-popper" @command="handleCommand" v-else trigger="click">
|
|
|
|
<el-dropdown popper-class="login-popper" @command="handleCommand" v-else trigger="click">
|
|
|
|
<div class="el-dropdown-link text-xl" style="line-height: 100px;">
|
|
|
|
<div class="el-dropdown-link text-xl" style="line-height: 100px;">
|
|
|
@ -67,6 +70,16 @@ const {setLoginVisible, setInfo, setToken} = useUserInfo()
|
|
|
|
const token = computed(() => useUserInfo().$state.token);
|
|
|
|
const token = computed(() => useUserInfo().$state.token);
|
|
|
|
const userInfo = ref()
|
|
|
|
const userInfo = ref()
|
|
|
|
const keyword = ref('')
|
|
|
|
const keyword = ref('')
|
|
|
|
|
|
|
|
const defaultActive = computed((): string=>{
|
|
|
|
|
|
|
|
// const routes = ['index', 'inform', 'rules', 'warning', 'tptsps', 'case', 'comment', 'about']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!route.meta.parentPath && route.path.includes('search')) {
|
|
|
|
|
|
|
|
return ('/' + ( route.params.id === 'index' ? '' : route.params.id)) as unknown as string
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
return ( route.meta.parentPath || route.path ) as unknown as string
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
function handleCommand(command: string) {
|
|
|
|
function handleCommand(command: string) {
|
|
|
|
if (command === '5') {
|
|
|
|
if (command === '5') {
|
|
|
|
ElMessageBox.confirm(
|
|
|
|
ElMessageBox.confirm(
|
|
|
@ -98,15 +111,8 @@ function handleCommand(command: string) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watchEffect(() => {
|
|
|
|
|
|
|
|
console.log('useUserInfo().$state.info>>>>>>> header', useUserInfo().$state.info)
|
|
|
|
|
|
|
|
userInfo.value = useUserInfo().$state.info;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleChange(val: any) {
|
|
|
|
function handleChange(val: any) {
|
|
|
|
|
|
|
|
store.setSearchVal('')
|
|
|
|
activeRoute.value = val.path;
|
|
|
|
activeRoute.value = val.path;
|
|
|
|
if (val.meta.hasOwnProperty('headerHost') && val.meta.headerHost) {
|
|
|
|
if (val.meta.hasOwnProperty('headerHost') && val.meta.headerHost) {
|
|
|
|
store.setMenuTheme('dark')
|
|
|
|
store.setMenuTheme('dark')
|
|
|
@ -121,6 +127,15 @@ function handleChange(val: any) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleSearch() {
|
|
|
|
|
|
|
|
router.push({
|
|
|
|
|
|
|
|
path: '/search/index',
|
|
|
|
|
|
|
|
query:{
|
|
|
|
|
|
|
|
keywords: keyword.value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
watch(() => route, (val) => {
|
|
|
|
watch(() => route, (val) => {
|
|
|
|
activeRoute.value = val.path;
|
|
|
|
activeRoute.value = val.path;
|
|
|
|
if (val.meta.hasOwnProperty('headerHost') && val.meta.headerHost) {
|
|
|
|
if (val.meta.hasOwnProperty('headerHost') && val.meta.headerHost) {
|
|
|
@ -136,6 +151,10 @@ watch(() => route, (val) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {deep: true})
|
|
|
|
}, {deep: true})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watchEffect(() => {
|
|
|
|
|
|
|
|
console.log('useUserInfo().$state.info>>>>>>> header', useUserInfo().$state.info)
|
|
|
|
|
|
|
|
userInfo.value = useUserInfo().$state.info;
|
|
|
|
|
|
|
|
})
|
|
|
|
watchEffect(() => {
|
|
|
|
watchEffect(() => {
|
|
|
|
handleChange(route)
|
|
|
|
handleChange(route)
|
|
|
|
})
|
|
|
|
})
|
|
|
|