完善顶部内容

This commit is contained in:
柏码の讲师 2023-08-19 20:03:54 +08:00
parent 67021f539e
commit e4352aac26

View File

@ -1,24 +1,26 @@
<script setup> <script setup>
import {get, logout} from '@/net' import {get, logout} from '@/net'
import router from "@/router"; import router from "@/router";
import {ref} from "vue"; import {reactive, ref} from "vue";
import { import {
Back,
Bell, Bell,
ChatDotSquare, Collection, DataLine, Document, Files, ChatDotSquare, Collection, DataLine, Document, Files,
Location, Lock, Location, Lock, Message,
Monitor, Monitor,
Notification, Operation, Notification, Operation,
Position, Position,
School, School, Umbrella, User
Umbrella, User
} from "@element-plus/icons-vue"; } from "@element-plus/icons-vue";
import {useStore} from "@/store"; import {useStore} from "@/store";
const store = useStore(); const store = useStore();
const loading = ref(true) const loading = ref(true)
const isCollapse = ref(false) const isCollapse = ref(false)
const search = reactive({
text: '',
type: '1'
})
get('/api/user/info', (data) => { get('/api/user/info', (data) => {
store.user = data store.user = data
@ -35,12 +37,45 @@ function userLogout() {
<el-container style="height: 100%" v-if="!loading"> <el-container style="height: 100%" v-if="!loading">
<el-header class="main-content-header"> <el-header class="main-content-header">
<el-image class="logo" src="https://element-plus.org/images/element-plus-logo.svg"/> <el-image class="logo" src="https://element-plus.org/images/element-plus-logo.svg"/>
<div style="flex: 1" class="user-info"> <div style="flex: 1;text-align: center;margin: 0 20px">
<el-input v-model="search.text" style="width: 100%;max-width: 500px">
<template #prepend>
<el-icon><Search/></el-icon>
</template>
<template #append>
<el-select v-model="search.type" style="width: 120px">
<el-option value="1" label="帖子广场"/>
<el-option value="2" label="校园活动"/>
<el-option value="3" label="表白墙"/>
<el-option value="4" label="教务通知"/>
</el-select>
</template>
</el-input>
</div>
<div class="user-info">
<div class="profile"> <div class="profile">
<div>{{store.user.username}}</div> <div>{{store.user.username}}</div>
<div>{{store.user.email}}</div> <div>{{store.user.email}}</div>
</div> </div>
<el-dropdown>
<el-avatar :size="38" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"/> <el-avatar :size="38" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"/>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<el-icon><Operation /></el-icon>
个人设置
</el-dropdown-item>
<el-dropdown-item>
<el-icon><Message/></el-icon>
消息列表
</el-dropdown-item>
<el-dropdown-item @click="userLogout" divided>
<el-icon><Back/></el-icon>
退出登录
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div> </div>
</el-header> </el-header>
<el-container> <el-container>
@ -175,6 +210,10 @@ function userLogout() {
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
.el-avatar:hover {
cursor: pointer;
}
.profile { .profile {
text-align: right; text-align: right;
margin-right: 20px; margin-right: 20px;