feat:页面header添加主题切换
This commit is contained in:
parent
6d1f8fcbcb
commit
6fe3ab6eb9
|
@ -1,16 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="user-bar">
|
<div class="user-bar">
|
||||||
<div class="screen panel-item hidden-sm-and-down" @click="screen">
|
<div class="screen panel-item hidden-sm-and-down" @click="screen">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<el-icon-full-screen />
|
<el-icon-full-screen />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="panel-item hidden-sm-and-down" @click="openBook">
|
<!-- <div class="panel-item hidden-sm-and-down" @click="openBook">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<el-icon-files />
|
<el-icon-files />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div> -->
|
</div> -->
|
||||||
<!-- <div class="msg panel-item" @click="showMsg">
|
<!-- <div class="msg panel-item" @click="showMsg">
|
||||||
<el-badge :hidden="msgList.length == 0" :value="msgList.length" class="badge" type="danger">
|
<el-badge :hidden="msgList.length == 0" :value="msgList.length" class="badge" type="danger">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<el-icon-chat-dot-round />
|
<el-icon-chat-dot-round />
|
||||||
|
@ -51,236 +51,278 @@
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</div> -->
|
</div> -->
|
||||||
<!-- <el-button @click="markRead">全部设为已读</el-button> -->
|
<!-- <el-button @click="markRead">全部设为已读</el-button> -->
|
||||||
<el-dropdown class="user panel-item" trigger="click" @command="handleUser">
|
<div class="login_config">
|
||||||
<div class="user-avatar">
|
<el-button
|
||||||
<el-avatar :size="34" shape="square">{{ userNameF }}</el-avatar>
|
:icon="config.dark ? 'el-icon-sunny' : 'el-icon-moon'"
|
||||||
<label>{{ userName }}</label>
|
circle
|
||||||
<el-icon class="el-icon--right">
|
type="info"
|
||||||
<el-icon-arrow-down />
|
@click="configDark"
|
||||||
</el-icon>
|
></el-button>
|
||||||
</div>
|
</div>
|
||||||
<template #dropdown>
|
<el-dropdown
|
||||||
<el-dropdown-menu>
|
class="user panel-item"
|
||||||
<el-dropdown-item command="uc">帐号信息</el-dropdown-item>
|
trigger="click"
|
||||||
<!-- <el-dropdown-item command="clearCache">清除缓存</el-dropdown-item> -->
|
@command="handleUser"
|
||||||
<el-dropdown-item divided command="outLogin">退出登录</el-dropdown-item>
|
>
|
||||||
</el-dropdown-menu>
|
<div class="user-avatar">
|
||||||
</template>
|
<el-avatar :size="34" shape="square">{{ userNameF }}</el-avatar>
|
||||||
</el-dropdown>
|
<label>{{ userName }}</label>
|
||||||
</div>
|
<el-icon class="el-icon--right">
|
||||||
|
<el-icon-arrow-down />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item command="uc">帐号信息</el-dropdown-item>
|
||||||
|
<!-- <el-dropdown-item command="clearCache">清除缓存</el-dropdown-item> -->
|
||||||
|
<el-dropdown-item divided command="outLogin"
|
||||||
|
>退出登录</el-dropdown-item
|
||||||
|
>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
|
||||||
<el-dialog v-model="searchVisible" :width="700" title="搜索" class="drawerBG" center destroy-on-close>
|
<el-dialog
|
||||||
<search @success="searchVisible = false"></search>
|
v-model="searchVisible"
|
||||||
</el-dialog>
|
:width="700"
|
||||||
|
title="搜索"
|
||||||
|
class="drawerBG"
|
||||||
|
center
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<search @success="searchVisible = false"></search>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import search from "./search.vue";
|
import search from "./search.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
search,
|
search,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userName: "",
|
userName: "",
|
||||||
userNameF: "",
|
userNameF: "",
|
||||||
searchVisible: false,
|
searchVisible: false,
|
||||||
msg: false,
|
msg: false,
|
||||||
msgList: {},
|
msgList: {},
|
||||||
};
|
config: {
|
||||||
},
|
lang: this.$TOOL.data.get("APP_LANG") || this.$CONFIG.LANG,
|
||||||
created() {
|
dark: this.$TOOL.data.get("APP_DARK") || false,
|
||||||
var userInfo = this.$TOOL.data.get("USER_INFO");
|
},
|
||||||
this.userName = userInfo.username;
|
};
|
||||||
this.userNameF = this.userName.substring(0, 1);
|
},
|
||||||
|
watch: {
|
||||||
},
|
"config.dark"(val) {
|
||||||
methods: {
|
if (val) {
|
||||||
openBook() {
|
document.documentElement.classList.add("dark");
|
||||||
window.open('/media/ehs_guide.pdf')
|
this.$TOOL.data.set("APP_DARK", val);
|
||||||
},
|
} else {
|
||||||
getMyVents() {
|
document.documentElement.classList.remove("dark");
|
||||||
this.$API.ecm.myevent.list
|
this.$TOOL.data.remove("APP_DARK");
|
||||||
.req({ is_read: false, page: 0 })
|
}
|
||||||
.then((res) => {
|
},
|
||||||
this.msgList = res;
|
},
|
||||||
});
|
created() {
|
||||||
},
|
var userInfo = this.$TOOL.data.get("USER_INFO");
|
||||||
goEvent() {
|
this.userName = userInfo.username;
|
||||||
this.$router.push({ name: "event" })
|
this.userNameF = this.userName.substring(0, 1);
|
||||||
},
|
},
|
||||||
createhandele(id) {
|
methods: {
|
||||||
this.$router.push({
|
openBook() {
|
||||||
name: "eventhandlefrom",
|
window.open("/media/ehs_guide.pdf");
|
||||||
query: {
|
},
|
||||||
id: id,
|
configDark() {
|
||||||
},
|
this.config.dark = this.config.dark ? false : true;
|
||||||
});
|
},
|
||||||
this.msg = false;
|
getMyVents() {
|
||||||
},
|
this.$API.ecm.myevent.list
|
||||||
handele(id) {
|
.req({ is_read: false, page: 0 })
|
||||||
this.$router.push({
|
.then((res) => {
|
||||||
name: "eventhandlefrom",
|
this.msgList = res;
|
||||||
query: {
|
});
|
||||||
id: id,
|
},
|
||||||
},
|
goEvent() {
|
||||||
});
|
this.$router.push({ name: "event" });
|
||||||
this.msg = false;
|
},
|
||||||
},
|
createhandele(id) {
|
||||||
//个人信息
|
this.$router.push({
|
||||||
handleUser(command) {
|
name: "eventhandlefrom",
|
||||||
if (command == "uc") {
|
query: {
|
||||||
this.$router.push({ path: "/usercenter" });
|
id: id,
|
||||||
}
|
},
|
||||||
if (command == "cmd") {
|
});
|
||||||
this.$router.push({ path: "/cmd" });
|
this.msg = false;
|
||||||
}
|
},
|
||||||
if (command == "clearCache") {
|
handele(id) {
|
||||||
this.$confirm(
|
this.$router.push({
|
||||||
"清除缓存会将系统初始化,包括登录状态、主题、语言设置等,是否继续?",
|
name: "eventhandlefrom",
|
||||||
"提示",
|
query: {
|
||||||
{
|
id: id,
|
||||||
type: "info",
|
},
|
||||||
}
|
});
|
||||||
)
|
this.msg = false;
|
||||||
.then(() => {
|
},
|
||||||
const loading = this.$loading();
|
//个人信息
|
||||||
this.$TOOL.data.clear();
|
handleUser(command) {
|
||||||
this.$router.replace({ path: "/login" });
|
if (command == "uc") {
|
||||||
setTimeout(() => {
|
this.$router.push({ path: "/usercenter" });
|
||||||
loading.close();
|
}
|
||||||
location.reload();
|
if (command == "cmd") {
|
||||||
}, 1000);
|
this.$router.push({ path: "/cmd" });
|
||||||
})
|
}
|
||||||
.catch(() => {
|
if (command == "clearCache") {
|
||||||
//取消
|
this.$confirm(
|
||||||
});
|
"清除缓存会将系统初始化,包括登录状态、主题、语言设置等,是否继续?",
|
||||||
}
|
"提示",
|
||||||
if (command == "outLogin") {
|
{
|
||||||
this.$confirm("确认是否退出当前用户?", "提示", {
|
type: "info",
|
||||||
type: "warning",
|
}
|
||||||
confirmButtonText: "退出",
|
)
|
||||||
confirmButtonClass: "el-button--danger",
|
.then(() => {
|
||||||
})
|
const loading = this.$loading();
|
||||||
.then(() => {
|
this.$TOOL.data.clear();
|
||||||
this.$TOOL.data.remove("TOKEN")
|
this.$router.replace({ path: "/login" });
|
||||||
this.$router.push(`/login?redirect=${this.$route.fullPath}`).then(() => { location.reload() })
|
setTimeout(() => {
|
||||||
})
|
loading.close();
|
||||||
.catch(() => {
|
location.reload();
|
||||||
//取消退出
|
}, 1000);
|
||||||
});
|
})
|
||||||
}
|
.catch(() => {
|
||||||
},
|
//取消
|
||||||
//全屏
|
});
|
||||||
screen() {
|
}
|
||||||
var element = document.documentElement;
|
if (command == "outLogin") {
|
||||||
this.$TOOL.screen(element);
|
this.$confirm("确认是否退出当前用户?", "提示", {
|
||||||
},
|
type: "warning",
|
||||||
//显示短消息
|
confirmButtonText: "退出",
|
||||||
showMsg() {
|
confirmButtonClass: "el-button--danger",
|
||||||
this.msg = true;
|
})
|
||||||
this.getMyVents();
|
.then(() => {
|
||||||
},
|
this.$TOOL.data.remove("TOKEN");
|
||||||
//标记已读
|
this.$router
|
||||||
markRead() {
|
.push(`/login?redirect=${this.$route.fullPath}`)
|
||||||
this.msgList = [];
|
.then(() => {
|
||||||
},
|
location.reload();
|
||||||
//搜索
|
});
|
||||||
search() {
|
})
|
||||||
this.searchVisible = true;
|
.catch(() => {
|
||||||
},
|
//取消退出
|
||||||
},
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//全屏
|
||||||
|
screen() {
|
||||||
|
var element = document.documentElement;
|
||||||
|
this.$TOOL.screen(element);
|
||||||
|
},
|
||||||
|
//显示短消息
|
||||||
|
showMsg() {
|
||||||
|
this.msg = true;
|
||||||
|
this.getMyVents();
|
||||||
|
},
|
||||||
|
//标记已读
|
||||||
|
markRead() {
|
||||||
|
this.msgList = [];
|
||||||
|
},
|
||||||
|
//搜索
|
||||||
|
search() {
|
||||||
|
this.searchVisible = true;
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.user-bar {
|
.user-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-bar .panel-item {
|
.user-bar .panel-item {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-bar .panel-item i {
|
.user-bar .panel-item i {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-bar .panel-item:hover {
|
.user-bar .panel-item:hover {
|
||||||
background: rgba(0, 0, 0, 0.1);
|
background: rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-bar .user-avatar {
|
.user-bar .user-avatar {
|
||||||
height: 49px;
|
height: 49px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-bar .user-avatar label {
|
.user-bar .user-avatar label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-list li {
|
.msg-list li {
|
||||||
border-top: 1px solid #eee;
|
border-top: 1px solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-list li a {
|
.msg-list li a {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-list li a:hover {
|
.msg-list li a:hover {
|
||||||
background: #ecf5ff;
|
background: #ecf5ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-list__icon {
|
.msg-list__icon {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-list__main {
|
.msg-list__main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-list__main h2 {
|
.msg-list__main h2 {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-list__main p {
|
.msg-list__main p {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #999;
|
color: #999;
|
||||||
line-height: 1.8;
|
line-height: 1.8;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-list__time {
|
.msg-list__time {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .msg-list__main h2 {
|
.dark .msg-list__main h2 {
|
||||||
color: #d0d0d0;
|
color: #d0d0d0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .msg-list li {
|
.dark .msg-list li {
|
||||||
border-top: 1px solid #363636;
|
border-top: 1px solid #363636;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .msg-list li a:hover {
|
.dark .msg-list li a:hover {
|
||||||
background: #383838;
|
background: #383838;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue