This commit is contained in:
hezhidong
2025-05-16 08:55:13 +08:00
parent e62c3fce70
commit 839703dc1a
66 changed files with 5029 additions and 0 deletions
@@ -0,0 +1,64 @@
<template>
<el-icon class="icon-style" id="collapseIcon" @click="changeShrinkage">
<component :is="!isCollapse ? 'Fold' : 'Expand'"></component>
</el-icon>
<el-breadcrumb separator="/" id="breadcrumb">
<el-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="index">
<span class="no-redirect" v-if="index === breadcrumbList.length - 1" :style="{ color: themeConfig.footColor }">{{ item.meta.name }}</span>
<span class="redirect" v-else @click="handleRedirect(item.path)" :style="{ color: themeConfig.footColor }">{{ item.meta.name }}</span>
</el-breadcrumb-item>
</el-breadcrumb>
</template>
<script setup>
import { watch, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import store from "../../../store";
import { useStore } from "vuex";
const route = useRoute();
const router = useRouter();
const breadcrumbList = ref([]);
const isCollapse = ref(false);
const globalStore = useStore();
const themeConfig = store.getters.themeConfig;
const initBreadcrumbList = () => {
breadcrumbList.value = route.matched;
console.log(route.matched);
};
const handleRedirect = (path) => {
router.push(path);
};
const changeShrinkage = () => {
isCollapse.value = !store.getters.isCollapse;
globalStore.dispatch("user/changeIsCollapse", isCollapse.value);
};
watch(
route,
() => {
initBreadcrumbList();
},
{ deep: true, immediate: true }
);
</script>
<style lang="scss" scoped>
.no-redirect {
// color: #97a8be;
cursor: text;
}
.redirect {
font-weight: 600;
cursor: pointer;
&:hover {
color: #97a8be;
}
}
.icon-style {
font-size: 20px;
cursor: pointer;
margin-right: 20px;
}
</style>
@@ -0,0 +1,25 @@
export const steps = () => [{
element: "#guide",
popover: {
title: "菜单栏",
description: "Body of the popover",
position: "left",
},
},
{
element: "#breadcrumb",
popover: {
title: "标签页",
description: "",
position: "bottom",
},
},
{
element: "#screenFul",
popover: {
title: "全屏",
description: "Body of the popover",
position: "bottom",
},
},
];
@@ -0,0 +1,33 @@
<template>
<el-icon @click="handleDriver"><Position /></el-icon>
</template>
<script setup>
import Driver from 'driver.js'
import 'driver.js/dist/driver.min.css'
import { onMounted, ref } from 'vue'
import { steps } from './index.js'
let driver = ref('')
onMounted(() => {
driver.value = new Driver({
className: 'scoped-class', //包裹driver.js弹窗的类名 className to wrap driver.js popover
animate: true, // 高亮元素改变时是否显示动画 Animate while changing highlighted element
opacity: 0.75, //背景透明度(0 表示只有弹窗并且没有遮罩) Background opacity (0 means only popovers and without overlay)
padding: 10, // 元素与边缘的距离 Distance of element from around the edges
allowClose: true, // 是否允许点击遮罩时关闭 Whether clicking on overlay should close or not
overlayClickNext: false, //是否允许点击遮罩时移到到下一步 Should it move to next step on overlay click
doneBtnText: '完成', // 最终按钮上的文本 Text on the final button
closeBtnText: '跳过', // 当前步骤关闭按钮上的文本 Text on the close button for this step
nextBtnText: '下一步', //当前步骤下一步按钮上的文本 Next button text for this step
prevBtnText: '上一步',
})
})
const handleDriver = () => {
driver.value.defineSteps(steps)
driver.value.start()
}
</script>
<style lang="scss" scoped></style>
+66
View File
@@ -0,0 +1,66 @@
<template>
<el-icon class="icon-style" @click="dialogVisible = true"><Search /></el-icon>
<el-dialog v-model="dialogVisible" :show-close="false">
<template #header>
<el-input
v-model="searchValue"
placeholder="搜索"
class="input-with-select"
>
<template #prepend>
<el-button :icon="Search" />
</template>
</el-input>
</template>
<div class="centent col-center">暂无搜索结果🦁🦁🦁🦁</div>
<template #footer>
<div class="footer-tip flx-row">
<span>↩</span> 确认 <span class="ml10">⇅</span>切换
<span class="ml10" style="font-size: 10px">ESC</span>关闭
</div>
</template>
</el-dialog>
</template>
<script setup>
import { Search, Top, Bottom } from '@element-plus/icons-vue'
import { nextTick, onMounted, ref } from 'vue'
const dialogVisible = ref(false)
const searchValue = ref('')
onMounted(() => {
nextTick(() => {
document.addEventListener('keyup', function (e) {
if (e.keyCode == 27) {
dialogVisible.value = false
}
})
})
})
</script>
<style lang="scss" scoped>
.input-with-select {
height: 40px;
}
.footer-tip {
height: 20px;
padding: 0;
font-size: 12px;
span {
display: flex;
width: 20px;
height: 18px;
padding-bottom: 2px;
margin-right: 0.4em;
background-color: linear-gradient(-225deg, #d5dbe4, #f8f8f8);
border-radius: 2px;
box-shadow: inset 0 -2px #cdcde6, inset 0 0 1px 1px #fff,
0 1px 2px 1px #1e235a66;
align-items: center;
justify-content: center;
}
}
</style>
+62
View File
@@ -0,0 +1,62 @@
<template>
<el-dropdown placement="bottom">
<div class="flx-center">
<div class="avatar">
<img src="../../../assets/images/avart.jpg" alt="avatar" />
</div>
<span class="username" :style="{ color: themeConfig.footColor }">BIG CUTE</span>
</div>
<template #dropdown>
<el-dropdown-menu>
<!-- <el-dropdown-item>个人中心</el-dropdown-item> -->
<el-dropdown-item @click="gotoLogin">退出登录</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<script setup>
import { ArrowDown } from "@element-plus/icons-vue";
import { nextTick, onMounted, ref } from "vue";
import store from "../../../store/index.js";
import { useRouter } from "vue-router";
const router = useRouter();
const themeConfig = store.getters.themeConfig;
const handleClick = () => {
// eslint-disable-next-line no-alert
alert("button click");
};
const gotoLogin = () => {
sessionStorage.removeItem("token");
router.push("/login");
};
</script>
<style lang="scss" scoped>
.el-dropdown {
cursor: pointer;
.el-tooltip__trigger {
display: flex;
flex-flow: row;
align-items: center;
}
}
.username {
font-size: 15px;
margin: 0 0 0 10px;
}
.avatar {
width: 35px;
height: 35px;
border-radius: 50%;
overflow: hidden;
cursor: pointer;
margin-left: 20px;
img {
width: 100%;
height: 100%;
}
}
</style>
@@ -0,0 +1,33 @@
<template>
<el-icon id="fullscreen" class="icon-style" @click="handleFullScreen">
<component :is="icon ? 'Rank' : 'FullScreen'"></component>
</el-icon>
</template>
<script setup>
import screenfull from 'screenfull'
import { ref, onMounted, onBeforeMount } from 'vue'
import { ElMessage } from 'element-plus'
let icon = ref(screenfull.isFullscreen)
const handleFullScreen = () => {
if (screenfull.isEnabled) {
screenfull.toggle()
}
}
const changeIcon = () => {
icon.value = screenfull.isFullscreen
}
onMounted(() => {
screenfull.on('change', changeIcon)
})
onBeforeMount(() => {
screenfull.off('change')
})
</script>
<style scoped></style>
+78
View File
@@ -0,0 +1,78 @@
<template>
<el-popover :width="400" placement="bottom" trigger="click">
<!-- <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> -->
<el-tabs v-model="activeName" class="demo-tabs">
<el-tab-pane label="通知" name="first">
<div class="notice-lists">
<div class="item one-cut-txt" v-for="item in notList" :key="item.id">
<span class="type">通知</span> {{ item.text }}
</div>
</div>
</el-tab-pane>
<el-tab-pane label="公告" name="second">
<div class="notice-lists">
<div class="item one-cut-txt" v-for="item in notList" :key="item.id">
<span class="type">公告</span> {{ item.text }}
</div>
</div>
</el-tab-pane>
<el-tab-pane label="系统消息" name="third">
<div class="notice-lists">
<div class="item one-cut-txt" v-for="item in notList" :key="item.id">
<span class="type" style="color: rgb(47, 96, 194); background-color: #e8f3ff"
>系统消息</span
>
{{ item.text }}
</div>
</div>
</el-tab-pane>
</el-tabs>
<template #reference>
<el-icon class="icon-style" @click="visible = !visible"><bell /></el-icon>
</template>
</el-popover>
</template>
<script setup name="messages">
import { Bell } from "@element-plus/icons-vue";
import { nextTick, onMounted, ref } from "vue";
const visible = ref(false);
const activeName = ref("first");
const notList = ref("first");
onMounted(() => {});
</script>
<style lang="scss" scoped>
.icon-style {
font-size: 20px;
cursor: pointer;
margin: 0 11px;
}
.notice-lists {
height: 260px;
overflow: scroll;
.item {
font-size: 14px;
padding: 10px;
color: #666;
.type {
font-size: 10px;
padding: 5px 10px;
font-weight: 500;
line-height: 0px;
color: #fa4a1e;
text-align: left;
border-radius: 6px;
background: #fa4a1e14;
&.error-type {
color: #4060c7;
background: #e8f3ff;
}
}
}
}
</style>
+192
View File
@@ -0,0 +1,192 @@
<template>
<el-icon @click="openDrawer" class="icon-style"><Setting /></el-icon>
<el-drawer v-model="drawerVisible" title="布局设置" size="300px">
<el-divider>主题颜色</el-divider>
<div class="flx-row">
<div
class="theme-item"
v-for="item in colorList"
:key="item"
:style="{ backgroundColor: item }"
@click="changePrimary(item)"
>
<el-icon v-if="item == themeConfig.primary" class="icon"
><Select
/></el-icon>
</div>
</div>
<el-divider>导航栏颜色</el-divider>
<div class="flx-row">
<div
class="theme-item"
v-for="item in tabColorList"
:key="item"
:style="{ backgroundColor: item }"
@click="changeTabCole(item)"
>
<el-icon v-if="item == themeConfig.tabColor" class="icon"
><Select
/></el-icon>
</div>
</div>
<!-- <el-switch v-model="value2" class="mt-2" style="margin-left: 24px" inline-prompt :active-icon="Check" :inactive-icon="Close" /> -->
<div class="flx-row">
<div class="flx-tit">侧边栏模式</div>
<el-switch
v-model="value2"
@change="changeGreyOrWeak($event)"
class="mt-2"
style="margin-left: 24px"
inline-prompt
:active-icon="Sunny"
:inactive-icon="Moon"
/>
</div>
<div class="flx-row">
<div class="flx-tit">标签栏是否显示</div>
<el-switch
v-model="istags"
@change="changeTags($event)"
class="mt-2"
style="margin-left: 24px"
/>
</div>
<!-- <div class="theme-item">
<el-color-picker
v-model="themeConfig.primary"
:predefine="colorList"
@change="changePrimary"
>
</el-color-picker>
</div> -->
<!-- <div class="theme-item">
<span>暗黑模式</span>
<SwitchDark></SwitchDark>
</div>
<div class="theme-item">
<span>灰色模式</span>
<el-switch
v-model="themeConfig.isGrey"
@change="changeGreyOrWeak($event, 'grey')"
/>
</div>
<div class="theme-item">
<span>色弱模式</span>
<el-switch
v-model="themeConfig.isWeak"
@change="changeGreyOrWeak($event, 'weak')"
/>
</div>
<br />
<el-divider class="divider" content-position="center">
<el-icon><Setting /></el-icon>
界面设置
</el-divider>
<div class="theme-item">
<span>折叠菜单</span>
<el-switch v-model="isCollapse" />
</div>
<div class="theme-item">
<span>面包屑导航</span>
<el-switch v-model="themeConfig.breadcrumb" />
</div>
<div class="theme-item">
<span>标签栏</span>
<el-switch v-model="themeConfig.tabs" />
</div>
<div class="theme-item">
<span>页脚</span>
<el-switch v-model="themeConfig.footer" />
</div> -->
</el-drawer>
</template>
<script setup>
import { ref, computed, useAttrs } from 'vue'
import { Sunny, Moon } from '@element-plus/icons-vue'
import store from '../../../store/index.js'
import { mix } from '../../../utils/color.js'
import { useStore } from 'vuex'
const value2 = ref(true)
const istags = computed(() => {
return store.getters.themeConfig.istags
})
// 预定义主题颜色
const colorList = [
'#4060c7',
'#409EFF',
'#009688',
'#27ae60',
'#e74c3c',
'#fd726d',
'#f39c12',
'#9b59b6',
]
// 预导航栏颜色
const tabColorList = [
'#FFFFFF',
'#333333',
'#009688',
'#27ae60',
'#e74c3c',
'#fd726d',
'#f39c12',
'#9b59b6',
]
// 主题初始化
const globalStore = useStore()
const themeConfig = computed(() => {
return store.getters.themeConfig
})
const changePrimary = (val) => {
globalStore.dispatch('user/changeThem', val)
}
const changeTabCole = (val) => {
globalStore.dispatch('user/changeTabColor', val)
}
const drawerVisible = ref(false)
const openDrawer = () => {
drawerVisible.value = true
}
const changeGreyOrWeak = (e) => {
globalStore.dispatch('user/changeMenuColor', e)
}
const changeTags = (e) => {
globalStore.dispatch('user/changeTags', e)
}
</script>
<style scoped lang="scss">
.icon-style {
font-size: 20px;
cursor: pointer;
margin: 0 11px;
}
.flx-row {
flex-wrap: wrap;
}
.flx-tit {
color: #303133;
flex: 1;
font-size: 14px;
}
.theme-item {
margin: 16px 5px;
width: 20px;
height: 20px;
cursor: pointer;
border: 1px solid #ddd;
border-radius: 2px;
position: relative;
.icon {
color: #fff;
position: absolute;
top: 3px;
right: 3px;
font-size: 14px;
}
}
</style>
+89
View File
@@ -0,0 +1,89 @@
<template>
<div
class="header"
:style="{ backgroundColor: themeConfig.tabColor, color: themeConfig.footColor }"
>
<div class="header-lf flx-center">
<Breadcrumb></Breadcrumb>
</div>
<div class="header-ri flx-center">
<!-- <Search></Search> -->
<el-icon class="icon-style" @click="refresh"><Refresh /></el-icon>
<!-- <message></message> -->
<!-- <Driver></Driver> -->
<fullScreen></fullScreen>
<avatar></avatar>
<setting></setting>
</div>
</div>
</template>
<script setup name="header">
import { inject, ref } from "vue";
import store from "../../store/index.js";
// import { Setting, Search } from '@element-plus/icons-vue'
import avatar from "./components/avatar.vue";
import setting from "./components/setting.vue";
import Search from "./components/Search.vue";
import fullScreen from "./components/fullScreen.vue";
import message from "./components/message.vue";
import Breadcrumb from "./components/Breadcrumb.vue";
// import Driver from "./components/Driver/index.vue";
// 局部数据刷新
const refresh = inject("reload");
const themeConfig = store.getters.themeConfig;
</script>
<style scoped lang="scss">
.header {
border-bottom: 1px solid #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 15px;
height: 48px;
line-height: 48px;
.header-lf {
.collapse-icon {
font-size: 22px;
margin-right: 20px;
cursor: pointer;
}
}
.header-ri {
// margin-left:10px;
.message-box {
height: 100%;
position: relative;
.dot {
position: absolute;
top: -5px;
right: 10px;
background-color: #d54f50;
border-radius: 50%;
width: 8px;
height: 8px;
}
.bell-icon {
font-size: 22px;
margin-right: 20px;
cursor: pointer;
}
}
.icon-style {
font-size: 20px;
cursor: pointer;
margin: 0 0 0 11px;
}
}
}
</style>