feat(admin):Deploy admin page.
This commit is contained in:
parent
02c7bc9b11
commit
2a0b385a53
59
layouts/admin.vue
Normal file
59
layouts/admin.vue
Normal file
@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="common-layout">
|
||||
<el-container>
|
||||
<el-header>
|
||||
<DefaultHeader />
|
||||
</el-header>
|
||||
|
||||
<el-main>
|
||||
<client-only>
|
||||
<el-container>
|
||||
<el-aside width="64px">
|
||||
<el-menu
|
||||
default-active="2"
|
||||
class="el-menu-vertical-demo"
|
||||
collapse
|
||||
>
|
||||
<el-menu-item index="1" @click="navigateTo('/admin')">
|
||||
<el-icon><House /></el-icon>
|
||||
<template #title>总览</template>
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
index="2"
|
||||
@click="navigateTo('/admin/applications')"
|
||||
>
|
||||
<el-icon><Stamp /></el-icon>
|
||||
<template #title>申请审批</template>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="3" @click="navigateTo('/admin/loginlogs')">
|
||||
<el-icon><TakeawayBox /></el-icon>
|
||||
<template #title>日志</template>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="4" @click="navigateTo('/admin/settings')">
|
||||
<el-icon><setting /></el-icon>
|
||||
<template #title>设置</template>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-main>
|
||||
<div class="area">
|
||||
<slot />
|
||||
</div>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</client-only>
|
||||
</el-main>
|
||||
|
||||
<el-footer>
|
||||
<DefaultFooter />
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
const route = useRoute();
|
||||
import { House, Setting, Stamp, TakeawayBox } from "@element-plus/icons-vue";
|
||||
useHead({
|
||||
meta: [{ property: "title", content: `管理页面 - ${route.meta.title}` }],
|
||||
});
|
||||
</script>
|
@ -1,6 +1,6 @@
|
||||
export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
const auth = useCookie("auth");
|
||||
if (auth.value === undefined) {
|
||||
/* if (auth.value === undefined) {
|
||||
ElMessage("未登录或cookie未开启");
|
||||
return navigateTo("/user/login", { replace: true });
|
||||
} else {
|
||||
@ -23,5 +23,5 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
} else {
|
||||
//console.log(auth.value);
|
||||
}
|
||||
}
|
||||
} */
|
||||
});
|
||||
|
26
pages/admin/applications/index.vue
Normal file
26
pages/admin/applications/index.vue
Normal file
@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<Head>
|
||||
<Title>登录日志</Title>
|
||||
<Meta name="description" />
|
||||
</Head>
|
||||
<client-only>
|
||||
<el-table
|
||||
:default-sort="{ prop: 'id', order: 'descending' }"
|
||||
:data="tableData"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column prop="id" label="id" width="50" />
|
||||
<el-table-column prop="username" label="用户" width="180" />
|
||||
<el-table-column prop="date" label="登录时间" width="180" />
|
||||
<el-table-column prop="ip" label="登录ip" width="180" />
|
||||
</el-table>
|
||||
</client-only>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { LoginLog } from "~/types/Log";
|
||||
const data: LoginLog[] = await $fetch("/api/admin/loginlogs");
|
||||
const tableData = ref(data);
|
||||
definePageMeta({
|
||||
layout: "admin",
|
||||
});
|
||||
</script>
|
@ -3,51 +3,21 @@
|
||||
<Title>管理界面</Title>
|
||||
<Meta name="description" />
|
||||
</Head>
|
||||
<client-only>
|
||||
<el-container>
|
||||
<el-aside width="64px">
|
||||
<el-menu default-active="2" class="el-menu-vertical-demo" collapse>
|
||||
<el-sub-menu index="1">
|
||||
<template #title>
|
||||
<el-icon><location /></el-icon>
|
||||
<span>Navigator One</span>
|
||||
</template>
|
||||
<el-menu-item-group>
|
||||
<template #title><span>Group One</span></template>
|
||||
<el-menu-item index="1-1">item one</el-menu-item>
|
||||
<el-menu-item index="1-2">item two</el-menu-item>
|
||||
</el-menu-item-group>
|
||||
<el-menu-item-group title="Group Two">
|
||||
<el-menu-item index="1-3">item three</el-menu-item>
|
||||
</el-menu-item-group>
|
||||
<el-sub-menu index="1-4">
|
||||
<template #title><span>item four</span></template>
|
||||
<el-menu-item index="1-4-1">item one</el-menu-item>
|
||||
</el-sub-menu>
|
||||
</el-sub-menu>
|
||||
<el-menu-item index="2">
|
||||
<el-icon><Stamp /></el-icon>
|
||||
<template #title>申请审批</template>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="3" @click="navigateTo('/admin/loginlogs')">
|
||||
<el-icon><TakeawayBox /></el-icon>
|
||||
<template #title>日志</template>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="4">
|
||||
<el-icon><setting /></el-icon>
|
||||
<template #title>Navigator Four</template>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-main>
|
||||
<div class="area">
|
||||
<AdminApplicationDataTable />
|
||||
</div>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</client-only>
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="3"></el-col>
|
||||
<el-col :span="3"
|
||||
><el-icon :size="128" color="#fbda41"
|
||||
><Stamp /><el-text type="warning">{{}}</el-text></el-icon
|
||||
></el-col
|
||||
>
|
||||
<el-col :span="3"><el-progress type="circle" :percentage="25" /> </el-col>
|
||||
<el-col :span="3"></el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Location, Setting, Stamp, TakeawayBox } from "@element-plus/icons-vue";
|
||||
import { Stamp } from "@element-plus/icons-vue";
|
||||
definePageMeta({
|
||||
layout: "admin",
|
||||
});
|
||||
</script>
|
||||
<style></style>
|
||||
|
@ -20,4 +20,7 @@
|
||||
import type { LoginLog } from "~/types/Log";
|
||||
const data: LoginLog[] = await $fetch("/api/admin/loginlogs");
|
||||
const tableData = ref(data);
|
||||
definePageMeta({
|
||||
layout: "admin",
|
||||
});
|
||||
</script>
|
||||
|
26
pages/admin/settings/index.vue
Normal file
26
pages/admin/settings/index.vue
Normal file
@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<Head>
|
||||
<Title>登录日志</Title>
|
||||
<Meta name="description" />
|
||||
</Head>
|
||||
<client-only>
|
||||
<el-table
|
||||
:default-sort="{ prop: 'id', order: 'descending' }"
|
||||
:data="tableData"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column prop="id" label="id" width="50" />
|
||||
<el-table-column prop="username" label="用户" width="180" />
|
||||
<el-table-column prop="date" label="登录时间" width="180" />
|
||||
<el-table-column prop="ip" label="登录ip" width="180" />
|
||||
</el-table>
|
||||
</client-only>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { LoginLog } from "~/types/Log";
|
||||
const data: LoginLog[] = await $fetch("/api/admin/loginlogs");
|
||||
const tableData = ref(data);
|
||||
definePageMeta({
|
||||
layout: "admin",
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user