Browse Source

登录逻辑修改,信件管理,人员管理显示界面样式调整

厅长信箱
21819 2 years ago
parent
commit
7a5c6528e2
  1. 5
      src/components/LoginView.vue
  2. 2
      src/components/ManageMail.vue
  3. 5
      src/components/ManageUser.vue
  4. 40
      src/layout/Index.vue

5
src/components/LoginView.vue

@ -22,6 +22,7 @@
import { reactive } from 'vue' import { reactive } from 'vue'
import axios from 'axios' import axios from 'axios'
import router from '../router' import router from '../router'
import { ElMessage } from 'element-plus'
const login = reactive({ const login = reactive({
account: '', account: '',
@ -35,9 +36,11 @@ const inputCheck = () => {
const sendCaptcha = () => { const sendCaptcha = () => {
axios.post('/api/captcha', login, { headers: { 'Content-Type': 'application/json' } }).then(res => { axios.post('/api/captcha', login, { headers: { 'Content-Type': 'application/json' } }).then(res => {
ElMessage.success('验证码发送成功')
console.log(res) console.log(res)
login.captcha = res.data login.captcha = res.data
}).catch(err => { }).catch(err => {
ElMessage.error('验证码发送失败')
console.log(err) console.log(err)
}) })
} }
@ -47,9 +50,11 @@ const loginIn = () => {
console.log(res) console.log(res)
if (res.data === 200) { if (res.data === 200) {
sessionStorage.setItem('user', login.account) sessionStorage.setItem('user', login.account)
ElMessage.success('登录成功')
router.push('/') router.push('/')
} }
}).catch(err => { }).catch(err => {
ElMessage.error('登录失败')
console.log(err) console.log(err)
}) })
} }

2
src/components/ManageMail.vue

@ -1,4 +1,5 @@
<template> <template>
<div style="width: 90vw;margin: 0 auto;">
<el-form :model="form" label-width="150px" style="margin-top: 20px; margin-right: -50px;;"> <el-form :model="form" label-width="150px" style="margin-top: 20px; margin-right: -50px;;">
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
@ -92,6 +93,7 @@
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>

5
src/components/ManageUser.vue

@ -1,4 +1,5 @@
<template> <template>
<div style="width: 90vw; margin: 0 auto;">
<el-form :model="form" label-width="150px" style="margin-top: 20px; margin-right: -50px;;"> <el-form :model="form" label-width="150px" style="margin-top: 20px; margin-right: -50px;;">
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
@ -41,7 +42,8 @@
<el-dialog v-model="newUser" title="新增用户" width="40%"> <el-dialog v-model="newUser" title="新增用户" width="40%">
<el-form :model="newForm" label-width="150px"> <el-form :model="newForm" label-width="150px">
<el-form-item label="新管理员姓名"> <el-form-item label="新管理员姓名">
<el-input v-model="newForm.realName" placeholder="请输入新管理员姓名" max-length="200px"></el-input> <el-input v-model="newForm.realName" placeholder="请输入新管理员姓名"
max-length="200px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="新管理员手机号"> <el-form-item label="新管理员手机号">
<el-input v-model="newForm.phone" placeholder="请输入新管理员手机号"></el-input> <el-input v-model="newForm.phone" placeholder="请输入新管理员手机号"></el-input>
@ -92,6 +94,7 @@
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>

40
src/layout/Index.vue

@ -1,10 +1,11 @@
<template> <template>
<header class="flex v-center between"> <header class="flex v-center between">
<div> <div style="display: inline-flex;align-items: center;justify-content: center;height: 100%;">
<el-image src="public\police-icon.png" style="width: 40px;height: 40px;margin-right: 10px;"></el-image>
<div class="title"><a href="">局长信箱即接即办管理端</a></div> <div class="title"><a href="">局长信箱即接即办管理端</a></div>
</div> </div>
<div> <div>
<el-button type="primary" @click="router.push('/login')">退出</el-button> <el-button type="primary" @click="logout">退出</el-button>
</div> </div>
</header> </header>
<div class="flex"> <div class="flex">
@ -12,19 +13,27 @@
<nav> <nav>
<a class="flex v-center center wrap pointer" @click="router.push('/')"> <a class="flex v-center center wrap pointer" @click="router.push('/')">
<el-icon><HomeFilled /></el-icon> <el-icon>
<HomeFilled />
</el-icon>
<span>首页</span> <span>首页</span>
</a> </a>
<a class="flex v-center center wrap pointer" @click="router.push('/holiday')"> <a class="flex v-center center wrap pointer" @click="router.push('/holiday')">
<el-icon><Platform /></el-icon> <el-icon>
<Platform />
</el-icon>
<span>节假日管理</span> <span>节假日管理</span>
</a> </a>
<a class="flex v-center center wrap pointer" @click="router.push('/mailbox')"> <a class="flex v-center center wrap pointer" @click="router.push('/mailbox')">
<el-icon><Menu /></el-icon> <el-icon>
<Menu />
</el-icon>
<span>信件管理</span> <span>信件管理</span>
</a> </a>
<a class="flex v-center center wrap pointer" @click="router.push('/user')"> <a class="flex v-center center wrap pointer" @click="router.push('/user')">
<el-icon><User /></el-icon> <el-icon>
<User />
</el-icon>
<span>人员管理</span> <span>人员管理</span>
</a> </a>
</nav> </nav>
@ -37,42 +46,61 @@ import { HomeFilled, Platform, Setting, Menu, User} from '@element-plus/icons-vu
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import axios from 'axios';
import { ElMessage } from 'element-plus'
const router = useRouter(); const router = useRouter();
const logout = () => {
sessionStorage.removeItem('user');
axios.post('/api/logout')
.then((res) => { if (res.data === 200) { ElMessage.success('登出成功'); } })
.catch((e) => { console.log(e) });
router.push('/login');
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:root { :root {
--header-height: 80px; --header-height: 80px;
} }
header { header {
background-color: #162582; background-color: #162582;
color: #fff; color: #fff;
height: var(--header-height); height: var(--header-height);
padding: 0 20px; padding: 0 20px;
.title { .title {
font-size: 28px; font-size: 28px;
a { a {
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
} }
} }
} }
aside { aside {
background-color: #071254; background-color: #071254;
color: #fff; color: #fff;
width: 100px; width: 100px;
height: calc(100vh - var(--header-height)); height: calc(100vh - var(--header-height));
nav { nav {
a { a {
height: 100px; height: 100px;
color: #707ab6; color: #707ab6;
&:hover { &:hover {
color: #fff; color: #fff;
} }
.el-icon { .el-icon {
font-size: 50px; font-size: 50px;
} }
span { span {
width: 100%; width: 100%;
text-align: center; text-align: center;

Loading…
Cancel
Save