feat: 修改页面显示bug;使用公共头部

This commit is contained in:
Bunny 2025-03-01 22:18:18 +08:00
parent 65f6ef27e2
commit 40fbf97519
13 changed files with 105 additions and 63 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

View File

@ -23,4 +23,6 @@
body { body {
background: var(--background-color); background: var(--background-color);
//user-select: none;
//overflow: hidden;
} }

View File

@ -1,19 +1,36 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useRouter } from 'vue-router'; import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import BarOp from '@/components/CommonHeader/HeaderBarOp.vue'; import BarOp from '@/components/CommonHeader/HeaderBarOp.vue';
import dayjs from '@/plugins/dayjs';
import { resetRouter } from '@/router'; import { resetRouter } from '@/router';
const router = useRouter(); const router = useRouter();
const route = useRoute();
const time = ref('');
/** 显示时间 */
const displayTime = () => {
time.value = dayjs(new Date()).format('YYYY-MM-DD dddd HH:mm:ss');
setInterval(() => {
time.value = dayjs(new Date()).format('YYYY-MM-DD dddd HH:mm:ss');
}, 1000);
};
onMounted(() => {
displayTime();
});
</script> </script>
<template> <template>
<header class="h-[105px]"> <header>
<div class="time c-primary">2025年2月25日22:45:14</div> <div class="time c-primary">{{ time }}</div>
<div class="title"> <div class="title">
<h1 class="c-white">智慧智能监管中心</h1> <h1 class="c-white">{{ route.meta.title }}</h1>
<h2 class="c-primary-secondary">车辆监控中心</h2> <h2 class="c-primary-secondary">{{ route.meta.subtitle }}</h2>
<img <img
alt="icon-setting" alt="icon-setting"
class="ml-[-284px]" class="ml-[-284px]"
@ -30,6 +47,7 @@ const router = useRouter();
<style lang="scss" scoped> <style lang="scss" scoped>
header { header {
position: relative; position: relative;
height: 108px;
background: url('@/assets/images/header/bg-parking-header.png') no-repeat center; background: url('@/assets/images/header/bg-parking-header.png') no-repeat center;
background-size: cover; background-size: cover;
} }

View File

@ -1,18 +1,21 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useRoute, useRouter } from 'vue-router';
import CommonHeader from '@/components/CommonHeader/CommonHeader.vue';
import LayoutHeader from '@/components/CommonHeader/LayoutHeader.vue'; import LayoutHeader from '@/components/CommonHeader/LayoutHeader.vue';
import LayoutContent from '@/layout/components/layout-content/index.vue';
import LayoutFooter from '@/layout/components/layout-footer/index.vue'; const router = useRouter();
const route = useRoute();
</script> </script>
<template> <template>
<div class="layout-container"> <div class="layout-container">
<div class="particle"> <layout-header v-if="route.name === 'welcome'" />
<layout-header /> <common-header v-else />
<layout-content /> <main>
<router-view />
<layout-footer /> </main>
</div>
</div> </div>
</template> </template>
@ -23,14 +26,5 @@ import LayoutFooter from '@/layout/components/layout-footer/index.vue';
height: 100%; height: 100%;
background: url('@/assets/images/bg/bg-layout.png') no-repeat center; background: url('@/assets/images/bg/bg-layout.png') no-repeat center;
background-size: cover; background-size: cover;
.particle {
position: absolute;
top: 0;
width: 100%;
height: 100%;
background: url('@/assets/images/bg/bg-particle.png') no-repeat center;
background-size: cover;
}
} }
</style> </style>

View File

@ -2,11 +2,10 @@ import type { App } from 'vue';
import { createRouter, createWebHashHistory, type RouteRecordRaw } from 'vue-router'; import { createRouter, createWebHashHistory, type RouteRecordRaw } from 'vue-router';
import error from '@/router/modules/error'; import error from '@/router/modules/error';
import home from '@/router/modules/home';
import remaining from '@/router/modules/remaining'; import remaining from '@/router/modules/remaining';
// 静态路由 // 静态路由
const routes: RouteRecordRaw[] = [...remaining, ...home, ...error]; const routes: RouteRecordRaw[] = [...remaining, ...error];
const router = createRouter({ const router = createRouter({
history: createWebHashHistory(), history: createWebHashHistory(),
routes, routes,

View File

@ -1,11 +1,10 @@
import Layout from '@/layout/index.vue';
import type { RouteConfigsTable } from '@/types/router/Route'; import type { RouteConfigsTable } from '@/types/router/Route';
const routes: RouteConfigsTable[] = [ const routes: RouteConfigsTable[] = [
{ {
path: '/', path: '/welcome',
name: '/', name: 'welcome',
component: Layout, component: () => import('@/views/home/index.vue'),
meta: { transition: 'fade', title: '后台管理系统大标题' }, meta: { transition: 'fade', title: '后台管理系统大标题' },
}, },
{ {

View File

@ -1,8 +1,16 @@
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/index.vue'; import Layout from '@/layout/index.vue';
import home from '@/router/modules/home';
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
{
path: '/',
name: 'layout',
component: Layout,
redirect: 'welcome',
children: [...home],
},
{ {
path: '/redirect', path: '/redirect',
component: Layout, component: Layout,

21
src/views/home/index.vue Normal file
View File

@ -0,0 +1,21 @@
<script lang="ts" setup>
import LayoutContent from '@/views/home/layout-content/index.vue';
import LayoutFooter from '@/views/home/layout-footer/index.vue';
</script>
<template>
<div class="particle">
<layout-content />
<layout-footer />
</div>
</template>
<style lang="scss" scoped>
.particle {
width: 100%;
height: 100%;
background: url('@/assets/images/bg/bg-particle.png') no-repeat center;
background-size: cover;
}
</style>

View File

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import PageList from '@/layout/components/layout-content/page-list.vue'; import PageList from '@/views/home/layout-content/page-list.vue';
</script> </script>
<template> <template>

View File

@ -7,23 +7,23 @@ const router = useRouter();
<template> <template>
<ul class="page-list flex-x-between"> <ul class="page-list flex-x-between">
<li class="flex-y-center" @click="router.push('/smart-parking')"> <li class="flex-y-center" @click="router.push('/smart-parking')">
<img alt="car" src="@/assets/images/icon/smart/car.png" /> <img alt="car" src="../../../assets/images/icon/smart/car.png" />
<span>智慧停车</span> <span>智慧停车</span>
</li> </li>
<li class="flex-y-center"> <li class="flex-y-center">
<img alt="distribution" src="@/assets/images/icon/smart/distribution.png" /> <img alt="distribution" src="../../../assets/images/icon/smart/distribution.png" />
<span>智慧配送</span> <span>智慧配送</span>
</li> </li>
<li class="flex-y-center"> <li class="flex-y-center">
<img alt="muck" src="@/assets/images/icon/smart/muck.png" /> <img alt="muck" src="../../../assets/images/icon/smart/muck.png" />
<span>智慧渣土</span> <span>智慧渣土</span>
</li> </li>
<li class="flex-y-center"> <li class="flex-y-center">
<img alt="clean-city" src="@/assets/images/icon/smart/clean-city.png" /> <img alt="clean-city" src="../../../assets/images/icon/smart/clean-city.png" />
<span>智慧洁城</span> <span>智慧洁城</span>
</li> </li>
<li class="flex-y-center"> <li class="flex-y-center">
<img alt="lamp" src="@/assets/images/icon/smart/lamp.png" /> <img alt="lamp" src="../../../assets/images/icon/smart/lamp.png" />
<span>智慧路灯</span> <span>智慧路灯</span>
</li> </li>
</ul> </ul>

View File

@ -2,26 +2,21 @@
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const router = useRouter(); const router = useRouter();
const list = [
{ icon: 'material-symbols:home-and-garden', name: '园区', target: '/' },
{ icon: 'ri:community-fill', name: '园区', target: '/' },
{ icon: 'ri:community-fill', name: '园区', target: '/' },
{ icon: 'ri:community-fill', name: '园区', target: '/' },
];
</script> </script>
<template> <template>
<footer class="flex-y-around"> <footer class="flex-y-around">
<ul class="flex-x-between"> <ul class="flex-x-between">
<li> <li v-for="(item, index) in list" :key="index">
<img alt="" src="@/assets/images/icon/icon-4.png" /> <i :class="`i-${item.icon}`" />
<span>园区</span> <span class="hover">{{ item.name }}</span>
</li>
<li>
<img alt="" src="@/assets/images/icon/icon-5.png" />
<span>园区</span>
</li>
<li>
<img alt="" src="@/assets/images/icon/icon-6.png" />
<span>园区</span>
</li>
<li>
<img alt="" src="@/assets/images/icon/icon-7.png" />
<span>园区</span>
</li> </li>
</ul> </ul>
</footer> </footer>
@ -47,6 +42,12 @@ footer {
background: url('@/assets/images/bg/bg-main-2.png') no-repeat center; background: url('@/assets/images/bg/bg-main-2.png') no-repeat center;
background-size: cover; background-size: cover;
i {
width: 26px;
height: 26px;
font-size: 26px;
}
img { img {
width: 26px; width: 26px;
height: 26px; height: 26px;

View File

@ -0,0 +1,5 @@
<script lang="ts" setup></script>
<template></template>
<style lang="scss" scoped></style>

View File

@ -1,5 +1,4 @@
<script lang="ts" setup> <script lang="ts" setup>
import CommonHeader from '@/components/CommonHeader/CommonHeader.vue';
import ParkingContent from '@/views/smart-parking/components/parking-content/index.vue'; import ParkingContent from '@/views/smart-parking/components/parking-content/index.vue';
import ParkingFooter from '@/views/smart-parking/components/parking-footer/index.vue'; import ParkingFooter from '@/views/smart-parking/components/parking-footer/index.vue';
</script> </script>
@ -9,7 +8,7 @@ import ParkingFooter from '@/views/smart-parking/components/parking-footer/index
<div class="arrow left-[38px]"> <div class="arrow left-[38px]">
<img alt="左箭头" src="@/assets/images/arrow/arrow-left.png" /> <img alt="左箭头" src="@/assets/images/arrow/arrow-left.png" />
</div> </div>
<common-header /> <!--<common-header />-->
<parking-content /> <parking-content />
<parking-footer /> <parking-footer />
<div class="arrow right-[38px]"> <div class="arrow right-[38px]">
@ -20,22 +19,18 @@ import ParkingFooter from '@/views/smart-parking/components/parking-footer/index
<style scoped> <style scoped>
.layout { .layout {
position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: url('@/assets/images/bg/bg.png') no-repeat center;
background-size: cover;
}
.arrow { .arrow {
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
cursor: pointer; cursor: pointer;
z-index: 1;
img { img {
width: 65px; width: 65px;
} }
}
} }
</style> </style>