【优化】前端路由设置带参数打开选中且不多打开标签,对窄屏幕增加部分适配

pull/172/MERGE
小诺 1 year ago committed by 俞宝山
parent 9cd1fcea1d
commit 45ef6b6bda

@ -3,7 +3,7 @@
<a-menu <a-menu
v-model:selectedKeys="selectedKeys" v-model:selectedKeys="selectedKeys"
mode="horizontal" mode="horizontal"
v-if="menu && menu.length > 1" v-if="menu && menu.length > 1 && !isMobile"
class="module-menu" class="module-menu"
id="moduleMenu" id="moduleMenu"
> >
@ -22,7 +22,7 @@
</a-menu> </a-menu>
</div> </div>
<div v-else> <div v-else>
<a-popover v-if="menu.length > 1" placement="bottomLeft"> <a-popover v-if="menu.length > 1 && !isMobile" placement="bottomLeft">
<template #content> <template #content>
<a-row :gutter="[0, 5]" class="module-row"> <a-row :gutter="[0, 5]" class="module-row">
<div v-for="item in menu" :key="item.id"> <div v-for="item in menu" :key="item.id">
@ -56,6 +56,9 @@
const module = computed(() => { const module = computed(() => {
return store.module return store.module
}) })
const isMobile = computed(() => {
return store.isMobile
})
// //
watch(moduleUnfoldOpen, (newValue) => { watch(moduleUnfoldOpen, (newValue) => {
nextTick(() => { nextTick(() => {

@ -190,7 +190,7 @@
}, },
// tag // tag
isActive(route) { isActive(route) {
return route.fullPath === this.$route.fullPath return route.path === this.$route.path
}, },
// tag // tag
closeSelectedTag(tag, autoPushLatestView = true) { closeSelectedTag(tag, autoPushLatestView = true) {

@ -272,7 +272,7 @@
// //
nextTick(() => { nextTick(() => {
// //
const active = route.meta.active || route.fullPath const active = route.meta.active || route.path
selectedKeys.value = new Array(active) selectedKeys.value = new Array(active)
const pidKey = getParentKeys(pMenu.value.children, active) const pidKey = getParentKeys(pMenu.value.children, active)
const nextTickMenu = pMenu.value.children const nextTickMenu = pMenu.value.children
@ -316,6 +316,8 @@
showThis() showThis()
onMounted(() => { onMounted(() => {
onLayoutResize()
window.addEventListener('resize', onLayoutResize)
switchoverTopHeaderThemeColor() switchoverTopHeaderThemeColor()
}) })
watch(route, (newValue) => { watch(route, (newValue) => {

@ -18,11 +18,18 @@ export const viewTagsStore = defineStore({
getters: {}, getters: {},
actions: { actions: {
pushViewTags(route) { pushViewTags(route) {
const target = this.viewTags.find((item) => item.fullPath === route.fullPath) const target = this.viewTags.find((item) => item.path === route.path)
const isName = route.name const isName = route.name
if (!target && isName) { if (!target && isName) {
this.viewTags.push(route) this.viewTags.push(route)
} }
if (target) {
this.viewTags.forEach((item) => {
if (item.path === route.path) {
Object.assign(item, route)
}
})
}
}, },
removeViewTags(route) { removeViewTags(route) {
this.viewTags.forEach((item, index) => { this.viewTags.forEach((item, index) => {

@ -7,7 +7,6 @@
<script setup name="exmNestRoutor"> <script setup name="exmNestRoutor">
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { defineComponent, ref } from 'vue'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()

@ -2,7 +2,7 @@
<a-card :bordered="false"> <a-card :bordered="false">
<template #title> 快捷方式 </template> <template #title> 快捷方式 </template>
<a-row :gutter="10"> <a-row :gutter="10">
<a-col :span="6" :key="shortcut.id" v-for="shortcut in shortcutList"> <a-col :span="6" :key="shortcut.id" v-for="shortcut in shortcutList" :xs="12" :sm="8" :md="6" :lg="8" :xl="6">
<shortcutCard <shortcutCard
:icon="shortcut.icon ? shortcut.icon : 'menu-outlined'" :icon="shortcut.icon ? shortcut.icon : 'menu-outlined'"
:label="shortcut.title" :label="shortcut.title"
@ -16,7 +16,7 @@
<script setup name="shortcut"> <script setup name="shortcut">
import router from '@/router' import router from '@/router'
import userCenterApi from '@/api/sys/userCenterApi' import userCenterApi from '@/api/sys/userCenterApi'
import shortcutCard from '@/components/ShortcutCard/index.vue' import ShortcutCard from '@/components/ShortcutCard/index.vue'
import { onMounted } from 'vue' import { onMounted } from 'vue'
const shortcutList = ref([]) const shortcutList = ref([])

@ -12,7 +12,7 @@
<span style="color: #6d737b; margin: 2px">{{ userInfo.orgName }} | {{ userInfo.positionName }}</span> <span style="color: #6d737b; margin: 2px">{{ userInfo.orgName }} | {{ userInfo.positionName }}</span>
</div> </div>
</div> </div>
<span style="margin: 2px"> <span class="snowy-index-userinfo-time">
{{ currentTime }} {{ currentTime }}
</span> </span>
</div> </div>
@ -43,4 +43,12 @@
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.snowy-index-userinfo-time {
margin: 2px
}
@media (max-width: 992px) {
.snowy-index-userinfo-time {
display: none;
}
}
</style> </style>

@ -1,18 +1,18 @@
<template> <template>
<a-row :gutter="10"> <a-row :gutter="10">
<a-col :span="16"> <a-col :span="16" :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
<userInfo class="mb-2" /> <userInfo class="mb-2" />
<shortcut class="mb-2" /> <shortcut class="mb-2" />
<a-row :gutter="10"> <a-row :gutter="10">
<a-col :span="12"> <a-col :span="12" :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
<visLog class="mb-2" /> <visLog class="mb-2" />
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12" :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
<opLog class="mb-2" /> <opLog class="mb-2" />
</a-col> </a-col>
</a-row> </a-row>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8" :xs="24" :sm="24" :md="24" :lg="8" :xl="8">
<carousel class="mb-2" /> <carousel class="mb-2" />
<schedule class="mb-2" /> <schedule class="mb-2" />
<miniMessage class="mb-2" /> <miniMessage class="mb-2" />
@ -21,12 +21,11 @@
</template> </template>
<script setup name="indexHome"> <script setup name="indexHome">
import shortcutCard from '@/components/ShortcutCard/index.vue' import UserInfo from './components/userInfo.vue'
import userInfo from './components/userInfo.vue' import Shortcut from './components/shortcut.vue'
import shortcut from './components/shortcut.vue' import Schedule from './components/schedule.vue'
import schedule from './components/schedule.vue' import MiniMessage from './components/miniMessage.vue'
import miniMessage from './components/miniMessage.vue' import Carousel from './components/carousel.vue'
import carousel from './components/carousel.vue' import VisLog from './components/visLog.vue'
import visLog from './components/visLog.vue' import OpLog from './components/opLog.vue'
import opLog from './components/opLog.vue'
</script> </script>

@ -1,7 +1,7 @@
<template> <template>
<a-row> <a-row>
<a-col :span="5"> <a-col :xs="24" :sm="24" :md="24" :lg="5" :xl="5">
<a-card class="cardImp" :bordered="false" :loading="cardLoading"> <a-card class="cardImp mb-3" :bordered="false" :loading="cardLoading">
<a-tree <a-tree
v-if="treeData.length > 0" v-if="treeData.length > 0"
v-model:expandedKeys="defaultExpandedKeys" v-model:expandedKeys="defaultExpandedKeys"
@ -13,7 +13,7 @@
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" /> <a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
</a-card> </a-card>
</a-col> </a-col>
<a-col :span="19"> <a-col :xs="24" :sm="24" :md="24" :lg="19" :xl="19">
<a-card :bordered="false" style="margin-bottom: 10px"> <a-card :bordered="false" style="margin-bottom: 10px">
<a-form ref="searchFormRef" name="advanced_search" class="ant-advanced-search-form" :model="searchFormState"> <a-form ref="searchFormRef" name="advanced_search" class="ant-advanced-search-form" :model="searchFormState">
<a-row :gutter="24"> <a-row :gutter="24">

@ -1,6 +1,6 @@
<template> <template>
<a-row :gutter="24"> <a-row :gutter="10">
<a-col :md="24" :lg="7" style="padding-right: 0px"> <a-col :xs="24" :sm="24" :md="7" :lg="7" :xl="7" class="mb-3">
<a-card :bordered="false"> <a-card :bordered="false">
<div class="account-center-avatarHolder"> <div class="account-center-avatarHolder">
<div class="avatar"> <div class="avatar">
@ -32,8 +32,7 @@
</div> </div>
</a-card> </a-card>
</a-col> </a-col>
<a-col :xs="24" :sm="24" :md="17" :lg="17" :xl="17">
<a-col :md="24" :lg="17">
<a-card <a-card
:bordered="false" :bordered="false"
style="width: 100%" style="width: 100%"

Loading…
Cancel
Save