feat: 新增首页

This commit is contained in:
luozhj33 2026-03-21 16:38:52 +08:00
parent 724eda0096
commit fb4be06ec8
3 changed files with 86 additions and 94 deletions

View File

@ -7,65 +7,5 @@ import { RouterLink, RouterView } from 'vue-router'
</template> </template>
<style scoped> <style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
.logo {
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
}
</style> </style>

View File

@ -1,35 +1,5 @@
@import './base.css'; @import './base.css';
#app { #app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
font-weight: normal; font-weight: normal;
} }
a,
.green {
text-decoration: none;
color: hsla(160, 100%, 37%, 1);
transition: 0.4s;
padding: 3px;
}
@media (hover: hover) {
a:hover {
background-color: hsla(160, 100%, 37%, 0.2);
}
}
@media (min-width: 1024px) {
body {
display: flex;
place-items: center;
}
#app {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0 2rem;
}
}

View File

@ -1,8 +1,90 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'
import sideBar from '../components/sideBar.vue';
import { useRouter } from 'vue-router'
const router = useRouter()
// // TODO
const menuItems = ref([
{ name: '造价计算', path: '/calculate', icon: '/icons/calculate' },
{ name: '钱包充值', path: '/pay', icon: '/icons/pay' },
{ name: '订阅记录', path: '/subscribe', icon: '/icons/subscribe' },
{ name: '开票记录', path: '/invoice', icon: '/icons/invoice' },
{ name: '我的账号', path: '/mine', icon: '/icons/mine' },
])
//
const navigate = (path: string) => {
router.push(path)
}
</script> </script>
<template> <template>
<main> <div style="width: 100vw; height: 100vh; display: flex; flex-direction: row;">
测试 <sideBar/>
</main> <div style="flex: 1; font-size: 60px; color: #111111; display: flex; flex-direction: column; align-items: center; justify-content: center;" selectable="false" space="false" decode="false">
欢迎使用众为计算工具
<div class="cards-container">
<div v-for="item in menuItems" :key="item.path" class="card" @click="navigate(item.path)">
<img :src="item.icon + '.png'" class="card-icon">
<span :to="item.path" class="card-name">{{ item.name }}</span>
</div>
</div>
</div>
</div>
</template> </template>
<style scoped>
.cards-container {
display: flex;
flex-wrap: wrap;
gap: 30px;
justify-content: center;
align-items: center;
max-width: 1200px;
height: 60vh; display: flex; flex-direction: row; align-items: center; justify-content: center;
}
.card {
width: 200px;
height: 250px;
background-color: #ffffff;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
border: 1px solid #f0f0f0;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
border-color: #666666;
}
.card-icon {
width: 64px;
height: 64px;
margin-bottom: 12px;
object-fit: contain;
}
.card-name {
margin-top: 10px;
font-size: 20px;
color: #333333;
font-weight: 500;
text-align: center;
}
.card:hover .card-name {
color: #666666;
}
</style>