mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 08:57:19 +08:00
style: fix some style
This commit is contained in:
parent
05b106203c
commit
a21700ee02
@ -12,9 +12,10 @@
|
|||||||
<!-- 全屏 -->
|
<!-- 全屏 -->
|
||||||
<screenfull />
|
<screenfull />
|
||||||
<!-- 国际化 -->
|
<!-- 国际化 -->
|
||||||
<div class="inter" :title="langs ? '中文' : '英文'" @click="toggleLang">
|
<div class="inter" :title="langs ? '中文' : 'English'" @click="toggleLang">
|
||||||
<img :src="langs ? ch : en" />
|
<img :src="langs ? ch : en" />
|
||||||
</div>
|
</div>
|
||||||
|
<i class="el-icon-setting hsset" :title="$t('message.hssystemSet')" @click="onPanel"></i>
|
||||||
<!-- 退出登陆 -->
|
<!-- 退出登陆 -->
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
@ -47,6 +48,8 @@ import { useI18n } from "vue-i18n";
|
|||||||
import ch from "/@/assets/ch.png";
|
import ch from "/@/assets/ch.png";
|
||||||
import en from "/@/assets/en.png";
|
import en from "/@/assets/en.png";
|
||||||
import favicon from "/favicon.ico";
|
import favicon from "/favicon.ico";
|
||||||
|
import { emitter } from "/@/utils/mitt";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Navbar",
|
name: "Navbar",
|
||||||
components: {
|
components: {
|
||||||
@ -76,6 +79,10 @@ export default defineComponent({
|
|||||||
router.push("/login");
|
router.push("/login");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function onPanel() {
|
||||||
|
emitter.emit("openPanel");
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document
|
document
|
||||||
.querySelector(".el-dropdown__popper")
|
.querySelector(".el-dropdown__popper")
|
||||||
@ -97,7 +104,8 @@ export default defineComponent({
|
|||||||
logout,
|
logout,
|
||||||
ch,
|
ch,
|
||||||
en,
|
en,
|
||||||
favicon
|
favicon,
|
||||||
|
onPanel
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -147,6 +155,18 @@ export default defineComponent({
|
|||||||
width: 25px;
|
width: 25px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.hsset {
|
||||||
|
width: 40px;
|
||||||
|
height: 48px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
margin-right: 5px;
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
background: #f0f0f0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.el-dropdown-link {
|
.el-dropdown-link {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="right-panel" :class="{ show: show }" class="right-panel-container">
|
<div :class="{ show: show }" class="right-panel-container">
|
||||||
<div class="right-panel-background" />
|
<div class="right-panel-background" />
|
||||||
<div class="right-panel">
|
<div ref="target" class="right-panel">
|
||||||
<div
|
|
||||||
class="handle-button"
|
|
||||||
:title="show ? '关闭设置' : '打开设置'"
|
|
||||||
@click="show = !show"
|
|
||||||
>
|
|
||||||
<i :class="show ? 'el-icon-close' : 'el-icon-setting'" />
|
|
||||||
</div>
|
|
||||||
<div class="right-panel-items">
|
<div class="right-panel-items">
|
||||||
|
<div class="project-configuration">
|
||||||
|
<h3>项目配置</h3>
|
||||||
|
<i class="el-icon-close" @click="show = !show"></i>
|
||||||
|
</div>
|
||||||
|
<el-divider />
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -19,26 +17,19 @@
|
|||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import { addClass, removeClass } from "../../../utils/operate";
|
import { addClass, removeClass } from "../../../utils/operate";
|
||||||
import { ref, watch, getCurrentInstance, onMounted, onBeforeMount } from "vue";
|
import { ref, watch, getCurrentInstance, onMounted, onBeforeMount } from "vue";
|
||||||
import { useEventListener } from "@vueuse/core";
|
import { useEventListener, onClickOutside } from "@vueuse/core";
|
||||||
|
import { emitter } from "/@/utils/mitt";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "panel",
|
name: "panel",
|
||||||
setup() {
|
setup() {
|
||||||
let vm: any;
|
|
||||||
|
|
||||||
let show = ref(false);
|
let show = ref(false);
|
||||||
|
|
||||||
watch(
|
const target = ref(null);
|
||||||
show,
|
|
||||||
(val, prevVal) => {
|
onClickOutside(target, event => {
|
||||||
val ? addEventClick() : () => {};
|
show.value = false;
|
||||||
if (val) {
|
});
|
||||||
addClass(document.body, "showright-panel");
|
|
||||||
} else {
|
|
||||||
removeClass(document.body, "showright-panel");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
const addEventClick = (): void => {
|
const addEventClick = (): void => {
|
||||||
useEventListener("click", closeSidebar);
|
useEventListener("click", closeSidebar);
|
||||||
@ -52,14 +43,15 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeMount(() => {
|
emitter.on("openPanel", () => {
|
||||||
vm = getCurrentInstance();
|
show.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show,
|
show,
|
||||||
|
target
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -84,7 +76,7 @@ export default {
|
|||||||
|
|
||||||
.right-panel {
|
.right-panel {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 260px;
|
max-width: 300px;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -131,4 +123,34 @@ export default {
|
|||||||
line-height: 48px;
|
line-height: 48px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.right-panel-items {
|
||||||
|
margin-top: 60px;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-configuration {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
height: 30px;
|
||||||
|
position: fixed;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
top: 15px;
|
||||||
|
margin-left: 10px;
|
||||||
|
i {
|
||||||
|
font-size: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-divider--horizontal) {
|
||||||
|
width: 90%;
|
||||||
|
margin: 20px auto 0 auto;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -15,6 +15,14 @@
|
|||||||
<vxe-switch v-model="tagsVal" open-label="开" close-label="关" @change="tagsChange"></vxe-switch>
|
<vxe-switch v-model="tagsVal" open-label="开" close-label="关" @change="tagsChange"></vxe-switch>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<el-divider />
|
||||||
|
<vxe-button
|
||||||
|
status="danger"
|
||||||
|
style="width: 90%;margin: 24px 15px;"
|
||||||
|
content="清空缓存并返回登录页"
|
||||||
|
icon="fa fa-sign-out"
|
||||||
|
@click="onReset"
|
||||||
|
></vxe-button>
|
||||||
</panel>
|
</panel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -24,11 +32,14 @@ import { onMounted, reactive, toRefs } from "vue";
|
|||||||
import { storageLocal } from "/@/utils/storage";
|
import { storageLocal } from "/@/utils/storage";
|
||||||
import { toggleClass } from "/@/utils/operate";
|
import { toggleClass } from "/@/utils/operate";
|
||||||
import { emitter } from "/@/utils/mitt";
|
import { emitter } from "/@/utils/mitt";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "setting",
|
name: "setting",
|
||||||
components: { panel },
|
components: { panel },
|
||||||
setup() {
|
setup() {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
|
function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
|
||||||
const targetEl = target || document.body;
|
const targetEl = target || document.body;
|
||||||
let { className } = targetEl;
|
let { className } = targetEl;
|
||||||
@ -88,12 +99,18 @@ export default {
|
|||||||
emitter.emit("tagViewsChange", showVal);
|
emitter.emit("tagViewsChange", showVal);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function onReset() {
|
||||||
|
storageLocal.clear();
|
||||||
|
router.push("/login");
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(settings),
|
...toRefs(settings),
|
||||||
localOperate,
|
localOperate,
|
||||||
greyChange,
|
greyChange,
|
||||||
weekChange,
|
weekChange,
|
||||||
tagsChange
|
tagsChange,
|
||||||
|
onReset
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -68,6 +68,7 @@ export const buttonConfig = {
|
|||||||
hssearch: "搜索",
|
hssearch: "搜索",
|
||||||
hsexpendAll: "全部展开",
|
hsexpendAll: "全部展开",
|
||||||
hscollapseAll: "全部折叠",
|
hscollapseAll: "全部折叠",
|
||||||
|
hssystemSet: "系统设置",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
@ -84,6 +85,7 @@ export const buttonConfig = {
|
|||||||
hssearch: "Search",
|
hssearch: "Search",
|
||||||
hsexpendAll: "Expand All",
|
hsexpendAll: "Expand All",
|
||||||
hscollapseAll: "Collapse All",
|
hscollapseAll: "Collapse All",
|
||||||
|
hssystemSet: "System Set",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
|
|
||||||
.is-active > .el-submenu__title,
|
.is-active > .el-submenu__title,
|
||||||
.is-active > .el-submenu__title i {
|
.is-active > .el-submenu__title i {
|
||||||
|
transition: color 0.3s;
|
||||||
color: $subMenuActiveText !important;
|
color: $subMenuActiveText !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,42 +1,46 @@
|
|||||||
interface ProxyStorage {
|
interface ProxyStorage {
|
||||||
getItem(key: string): any
|
getItem(key: string): any;
|
||||||
setItem(Key: string, value: string): void
|
setItem(Key: string, value: string): void;
|
||||||
removeItem(key: string): void
|
removeItem(key: string): void;
|
||||||
|
clear(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sessionStorage operate
|
//sessionStorage operate
|
||||||
class sessionStorageProxy implements ProxyStorage {
|
class sessionStorageProxy implements ProxyStorage {
|
||||||
|
protected storage: ProxyStorage;
|
||||||
protected storage: ProxyStorage
|
|
||||||
|
|
||||||
constructor(storageModel: ProxyStorage) {
|
constructor(storageModel: ProxyStorage) {
|
||||||
this.storage = storageModel
|
this.storage = storageModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 存
|
// 存
|
||||||
public setItem(key: string, value: any): void {
|
public setItem(key: string, value: any): void {
|
||||||
this.storage.setItem(key, JSON.stringify(value))
|
this.storage.setItem(key, JSON.stringify(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取
|
// 取
|
||||||
public getItem(key: string): any {
|
public getItem(key: string): any {
|
||||||
return JSON.parse(this.storage.getItem(key)) || null
|
return JSON.parse(this.storage.getItem(key)) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删
|
// 删
|
||||||
public removeItem(key: string): void {
|
public removeItem(key: string): void {
|
||||||
this.storage.removeItem(key)
|
this.storage.removeItem(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 清空
|
||||||
|
public clear(): void {
|
||||||
|
this.storage.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//localStorage operate
|
//localStorage operate
|
||||||
class localStorageProxy extends sessionStorageProxy implements ProxyStorage {
|
class localStorageProxy extends sessionStorageProxy implements ProxyStorage {
|
||||||
constructor(localStorage: ProxyStorage) {
|
constructor(localStorage: ProxyStorage) {
|
||||||
super(localStorage)
|
super(localStorage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const storageSession = new sessionStorageProxy(sessionStorage)
|
export const storageSession = new sessionStorageProxy(sessionStorage);
|
||||||
|
|
||||||
export const storageLocal = new localStorageProxy(localStorage)
|
export const storageLocal = new localStorageProxy(localStorage);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user