| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <template>
- <div class="home-page">
- <div class="card">
- <div class="card-title">常用菜单</div>
- <div class="menu-grid">
- <div
- v-for="item in commonMenus"
- :key="item.id"
- class="menu-item"
- @click="go(item.path)"
- >
- <div class="menu-icon">{{ item.title.slice(0, 1) }}</div>
- <div class="menu-title">{{ item.title }}</div>
- </div>
- </div>
- <el-empty v-if="!commonMenus.length" description="暂无常用菜单" />
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { storeToRefs } from 'pinia'
- import usePortalMenuStore from '@/store/modules/portalMenu'
- const router = useRouter()
- const portalMenuStore = usePortalMenuStore()
- const { getCommonMenus: commonMenus } = storeToRefs(portalMenuStore as any)
- onMounted(async () => {
- if (!portalMenuStore.loaded) {
- await portalMenuStore.loadPortalMenus()
- }
- })
- const go = (path: string) => {
- router.push(path)
- }
- </script>
- <style scoped lang="scss">
- .home-page {
- min-height: calc(100vh - 50px);
- padding: 16px;
- background: #f5f7fa;
- }
- .card {
- background: #fff;
- border-radius: 10px;
- padding: 16px;
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
- }
- .card-title {
- font-size: 16px;
- font-weight: 600;
- margin-bottom: 12px;
- color: #303133;
- }
- .menu-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
- gap: 12px;
- }
- .menu-item {
- border: 1px solid #ebeef5;
- border-radius: 8px;
- padding: 12px;
- cursor: pointer;
- transition: all 0.2s;
- &:hover {
- border-color: #409eff;
- transform: translateY(-1px);
- }
- }
- .menu-icon {
- width: 32px;
- height: 32px;
- border-radius: 50%;
- background: #ecf5ff;
- color: #409eff;
- display: flex;
- align-items: center;
- justify-content: center;
- font-weight: 600;
- margin-bottom: 8px;
- }
- .menu-title {
- font-size: 13px;
- color: #606266;
- }
- </style>
|