117 lines
2.7 KiB
Vue
117 lines
2.7 KiB
Vue
<template>
|
|
<div class="app-layout">
|
|
<el-drawer v-model="drawerVisible" direction="ltr" :size="250" class="mobile-drawer">
|
|
<div class="sidebar"><session-message /></div>
|
|
</el-drawer>
|
|
|
|
<el-aside v-if="!isMobile" width="250px" class="pc-aside">
|
|
<div class="sidebar"><session-message /></div>
|
|
</el-aside>
|
|
|
|
<el-container class="main-container">
|
|
<el-header class="header">
|
|
<el-icon v-if="isMobile" @click="drawerVisible = true" class="fold-button"><Fold/></el-icon>
|
|
<div class="title">智能家庭助手</div>
|
|
</el-header>
|
|
|
|
<el-main class="main-body">
|
|
<agent />
|
|
</el-main>
|
|
</el-container>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import Agent from "./components/Agent.vue";
|
|
import SessionMessage from "./components/SessionMessage.vue";
|
|
import { ref, onMounted, onUnmounted } from 'vue'
|
|
import { Fold } from '@element-plus/icons-vue'
|
|
|
|
const isMobile = ref(window.innerWidth < 768)
|
|
const drawerVisible = ref(false)
|
|
|
|
const onResize = () => {
|
|
isMobile.value = window.innerWidth < 768
|
|
if (!isMobile.value) drawerVisible.value = false
|
|
}
|
|
|
|
onMounted(() => window.addEventListener('resize', onResize))
|
|
onUnmounted(() => window.removeEventListener('resize', onResize))
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.app-layout {
|
|
display: flex;
|
|
height: 100vh;
|
|
background: linear-gradient(135deg, #f5f7fa, #eef1f6);
|
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
|
|
.pc-aside {
|
|
background: linear-gradient(180deg, #1f2937, #111827);
|
|
color: #fff;
|
|
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
|
|
overflow: hidden;
|
|
|
|
.sidebar {
|
|
padding: 20px 14px;
|
|
color: #e5e7eb;
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
.mobile-drawer {
|
|
background: linear-gradient(180deg, #1f2937, #111827);
|
|
|
|
.el-drawer__body {
|
|
|
|
}
|
|
|
|
.sidebar {
|
|
padding: 20px 14px;
|
|
color: #e5e7eb;
|
|
}
|
|
}
|
|
|
|
.main-container {
|
|
flex: 1;
|
|
min-width: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
backdrop-filter: blur(6px);
|
|
|
|
.header {
|
|
height: 56px;
|
|
background: rgba(255, 255, 255, 0.85);
|
|
backdrop-filter: blur(8px);
|
|
border-bottom: 1px solid #e5e7eb;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: relative;
|
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
|
|
|
|
.fold-button {
|
|
position: absolute;
|
|
left: 16px;
|
|
}
|
|
|
|
.title {
|
|
font-size: larger;
|
|
font-weight: 600;
|
|
letter-spacing: 1px;
|
|
background: linear-gradient(90deg, #3b82f6, #6366f1);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
}
|
|
}
|
|
|
|
.main-body {
|
|
background-color: white;
|
|
padding: 10px;
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
}
|
|
}
|
|
}
|
|
</style>
|