框架初始化
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div class="tags">
|
||||
<el-tag
|
||||
ref="tagRef"
|
||||
v-for="tag in tags"
|
||||
:key="tag.title"
|
||||
class="mR10 tabs"
|
||||
:closable="tag.close"
|
||||
:effect="tag.checked ? 'dark' : 'plain'"
|
||||
@click="tagChange(tag)"
|
||||
@close="delectTag(tag, index)"
|
||||
>
|
||||
<el-icon class="tabs-icon">
|
||||
<component :is="tag.icon"></component>
|
||||
</el-icon>
|
||||
{{ tag.title }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||
import store from '../../store/index.js'
|
||||
import { useStore } from 'vuex'
|
||||
const tabsMenuValue = ref('')
|
||||
const nameScroll = ref(false)
|
||||
const tagRef = ref()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const globalStore = useStore() // 该方法用于返回store 实例
|
||||
// 监听路由的变化(防止浏览器后退/前进不变化 tabsMenuValue)
|
||||
watch(
|
||||
() => route.path,
|
||||
() => {
|
||||
let params = {
|
||||
title: route.meta.name,
|
||||
url: route.path,
|
||||
icon: 'Menu',
|
||||
close: true,
|
||||
checked: true,
|
||||
}
|
||||
globalStore.dispatch('tabs/addTabs', params)
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
)
|
||||
const tags = store.getters.tabsMenuList
|
||||
|
||||
const tagChange = (item) => {
|
||||
item.checked = true
|
||||
router.push(item.url)
|
||||
}
|
||||
const delectTag = (item, index) => {
|
||||
globalStore.dispatch('tabs/delectTag', item)
|
||||
}
|
||||
onMounted(() => {
|
||||
nextTick(() => {})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tags {
|
||||
width: 95%;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
overflow: scroll;
|
||||
white-space: nowrap;
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.tabs {
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,85 @@
|
||||
<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";
|
||||
|
||||
import { noticeLists } from "../../../api/modules/index.js";
|
||||
const visible = ref(false);
|
||||
const activeName = ref("first");
|
||||
const notList = ref("first");
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
noticeLists().then((res) => {
|
||||
notList.value = res.data.data;
|
||||
});
|
||||
});
|
||||
});
|
||||
</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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,65 @@
|
||||
.el-container {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
|
||||
.el-aside {
|
||||
width: auto;
|
||||
overflow: inherit;
|
||||
}
|
||||
|
||||
.el-header,
|
||||
.el-footer {
|
||||
height: auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.main-tabs {
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
background-color: #fff;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.el-main {
|
||||
background: #f0f2f5;
|
||||
padding: 10px 13px;
|
||||
box-sizing: border-box;
|
||||
// 防止切换出现横向滚动条
|
||||
overflow-x: hidden;
|
||||
|
||||
.main-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// background-color: #f5f5f5;
|
||||
// box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
|
||||
// border-radius: 4px;
|
||||
// padding: 20px;
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
overflow-x: hidden !important;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.shake {
|
||||
animation: shake 0.5s linear;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
from {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<el-container class="container">
|
||||
<el-aside :style="{ backgroundColor: themeConfig.backgroundColor }"
|
||||
><Menu></Menu
|
||||
></el-aside>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<Header></Header>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<div class="main-tabs flx-row" v-if="themeConfig.istags">
|
||||
<tabs></tabs>
|
||||
</div>
|
||||
|
||||
<div class="main-box">
|
||||
<router-view :class="{ shake: disabled }"></router-view>
|
||||
</div>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script setup name="layout">
|
||||
import { useRouter, onBeforeRouteUpdate } from 'vue-router'
|
||||
import { ref, watch } from 'vue'
|
||||
import store from '../store/index.js'
|
||||
import Header from './header/index.vue'
|
||||
import Menu from './menu/index.vue'
|
||||
import tabs from './Tabs/index.vue'
|
||||
const themeConfig = store.getters.themeConfig
|
||||
console.log(themeConfig.backgroundColor)
|
||||
|
||||
let router = useRouter()
|
||||
const disabled = ref(false)
|
||||
// onMounted(() => {
|
||||
// disabled.value = true
|
||||
// setTimeout(() => {
|
||||
// disabled.value = false
|
||||
// }, 1500)
|
||||
// })
|
||||
|
||||
watch(
|
||||
() => router.currentRoute.value.path,
|
||||
(newValue, oldValue) => {
|
||||
console.log('watch', newValue)
|
||||
console.log('watch', oldValue)
|
||||
if (newValue == oldValue) {
|
||||
} else {
|
||||
disabled.value = true
|
||||
setTimeout(() => {
|
||||
disabled.value = false
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<template v-for="subItem in menuList" :key="subItem.path">
|
||||
<el-sub-menu
|
||||
v-if="subItem.children && subItem.children.length > 0"
|
||||
:index="subItem.path"
|
||||
>
|
||||
<template #title>
|
||||
<el-icon>
|
||||
<component :is="subItem.meta.icon"></component>
|
||||
</el-icon>
|
||||
<span>{{ subItem.meta.title }}</span>
|
||||
</template>
|
||||
<Menu-items :menuList="subItem.children"></Menu-items>
|
||||
<!--<template v-for="child in subItem.children" :key="child.path">
|
||||
<template v-if="child.children && child.children.length > 0">
|
||||
<Menu-items :menuList="child.children"></Menu-items>
|
||||
</template>
|
||||
<el-menu-item v-else :index="child.path">
|
||||
<el-icon>
|
||||
<component :is="child.meta.icon"></component>
|
||||
</el-icon>
|
||||
<template #title>
|
||||
<span>{{ child.meta.title }}</span>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</template> -->
|
||||
</el-sub-menu>
|
||||
<el-menu-item v-else :index="subItem.path">
|
||||
<el-icon>
|
||||
<component :is="subItem.meta.icon"></component>
|
||||
</el-icon>
|
||||
<template #title>
|
||||
<span>{{ subItem.meta.title }}</span>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps(["menuList"]);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.icons {
|
||||
width: 24px;
|
||||
height: 18px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<template v-for="subItem in menuList" :key="subItem.path">
|
||||
<el-menu-item v-if="!subItem.children" :index="subItem.url" :route="subItem.url">
|
||||
<el-icon>
|
||||
<component :is="subItem.icon"></component>
|
||||
</el-icon>
|
||||
<span>{{ subItem.title }}</span>
|
||||
</el-menu-item>
|
||||
<!--有多级菜单-->
|
||||
<el-sub-menu v-if="subItem.children" :key="subItem.url" :index="subItem.url">
|
||||
<template #title>
|
||||
<el-icon>
|
||||
<component :is="subItem.icon"></component>
|
||||
</el-icon>
|
||||
<span> {{ subItem.title }}</span>
|
||||
</template>
|
||||
<!--递归组件,把遍历的值传回子组件,完成递归调用-->
|
||||
<menu-items :menuList="subItem.children"></menu-items>
|
||||
</el-sub-menu>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps(["menuList"]);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.icons {
|
||||
width: 24px;
|
||||
height: 18px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,118 @@
|
||||
.menu {
|
||||
transition: all 0.3s ease;
|
||||
background: #20222a;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.logo {
|
||||
transition: width 0.3s ease;
|
||||
height: 55px;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 2px solid #1d1e26;
|
||||
box-shadow: 2px 0 6px rgb(0 21 41 / 35%);
|
||||
|
||||
span {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
color: #dadada;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 30px;
|
||||
object-fit: contain;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-scrollbar {
|
||||
height: calc(100% - 55px);
|
||||
|
||||
.el-menu {
|
||||
// flex: 1;
|
||||
overflow: auto;
|
||||
overflow-x: hidden;
|
||||
border: none !important;
|
||||
width: 100% !important;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
background-color: #20222a;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: #41444b;
|
||||
}
|
||||
|
||||
.el-menu-item {
|
||||
width: 200px;
|
||||
|
||||
&.is-active {
|
||||
background-color: #060708 !important;
|
||||
}
|
||||
|
||||
&.is-active::before {
|
||||
content: "";
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
background: $bg-color;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
.href {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: #bdbdc0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// .el-menu--popup {
|
||||
// .el-menu-item {
|
||||
// background-color: #20222a;
|
||||
// width: 200px;
|
||||
|
||||
// i {
|
||||
// margin-right: 5px;
|
||||
// }
|
||||
|
||||
// i,
|
||||
// span {
|
||||
// color: hsla(0, 0%, 100%, 0.7);
|
||||
// }
|
||||
// //
|
||||
// &:hover {
|
||||
|
||||
// i,
|
||||
// span {
|
||||
// color: #fff !important;
|
||||
// }
|
||||
// }
|
||||
|
||||
// &.is-active {
|
||||
// background-color: #060708 !important;
|
||||
|
||||
// &:before {
|
||||
// content: "";
|
||||
// top: 0;
|
||||
// left: 0;
|
||||
// bottom: 0;
|
||||
// width: 4px;
|
||||
// background: $bg-color;
|
||||
// position: absolute;
|
||||
// }
|
||||
|
||||
// i,
|
||||
// span {
|
||||
// color: #fff !important;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<div
|
||||
id="guide"
|
||||
class="menu"
|
||||
:style="{
|
||||
width: store.getters.isCollapse == true ? '' : '200px',
|
||||
height: '100%',
|
||||
color: themeConfig.textColor,
|
||||
}"
|
||||
>
|
||||
<div class="logo" v-if="!store.getters.isCollapse">
|
||||
<img src="../../assets/logo.png" alt="" style="margin-right: 5px" /> 创兴佳
|
||||
</div>
|
||||
<div class="logo" v-else>
|
||||
<img src="../../assets/logo.png" alt="" />
|
||||
</div>
|
||||
<el-scrollbar style="height: 100%">
|
||||
<el-menu
|
||||
:default-active="activeMenu"
|
||||
:router="true"
|
||||
:collapse="store.getters.isCollapse"
|
||||
:collapse-transition="false"
|
||||
:unique-opened="true"
|
||||
:background-color="themeConfig.backgroundColor"
|
||||
:text-color="themeConfig.textColor"
|
||||
:active-text-color="themeConfig.primary"
|
||||
>
|
||||
<menuItems :menuList="menuList"></menuItems>
|
||||
</el-menu>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, reactive, ref } from "vue";
|
||||
import { getMenuList } from "../../api/modules/index.js";
|
||||
import store from "../../store/index.js";
|
||||
import menuItems from "./components/menuItems.vue";
|
||||
// 引入本地路由表渲染导航栏
|
||||
import menuTable from "./menuTable.js";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
const route = useRoute();
|
||||
const activeMenu = computed(() => {
|
||||
return route.path;
|
||||
});
|
||||
const menuList = ref([]);
|
||||
const handleOpen = (key, keyPath) => {
|
||||
console.log(key, keyPath);
|
||||
};
|
||||
const handleClose = (key, keyPath) => {
|
||||
console.log(key, keyPath);
|
||||
};
|
||||
const themeConfig = store.getters.themeConfig;
|
||||
|
||||
// 菜单表存在后端的操作方式
|
||||
onMounted(() => {
|
||||
getMenuList().then((res) => {
|
||||
menuList.value = res.data.data.menuList;
|
||||
console.log(menuItems.value);
|
||||
});
|
||||
// 获取本地菜单表渲染
|
||||
// menuList.value = menuTable;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.menu {
|
||||
// width: 200px;
|
||||
.logo {
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
padding: 0 20px;
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
img {
|
||||
width: 25px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,114 @@
|
||||
// 菜单列表改了路由要记得改菜单相互匹配
|
||||
const menuTable = [
|
||||
{
|
||||
title: "首页",
|
||||
url: "/home",
|
||||
icon: "HomeFilled",
|
||||
},
|
||||
{
|
||||
title: "用户管理",
|
||||
url: "/home",
|
||||
icon: "HomeFilled",
|
||||
},
|
||||
{
|
||||
title: "页面管理",
|
||||
url: "/page",
|
||||
icon: "Checked",
|
||||
children: [
|
||||
{
|
||||
title: "表单页",
|
||||
url: "/form",
|
||||
icon: "Checked",
|
||||
children: [
|
||||
{
|
||||
title: "基础表单",
|
||||
url: "/baseForm",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/stepFrom",
|
||||
title: "步骤表单",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/advancedForm",
|
||||
title: "高级表单",
|
||||
icon: "Menu",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
url: "/system",
|
||||
title: "表格管理",
|
||||
icon: "Grid",
|
||||
children: [
|
||||
{
|
||||
url: "/Department",
|
||||
title: "基础表格",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/UserList",
|
||||
title: "内嵌表格",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/RoleList",
|
||||
title: "滑动加载",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/MenuList",
|
||||
title: "可编辑Table",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/importExcel",
|
||||
title: "导入Excel",
|
||||
icon: "Menu",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
url: "/goods",
|
||||
title: "列表页",
|
||||
icon: "List",
|
||||
children: [
|
||||
{
|
||||
url: "/goodCategory",
|
||||
title: "基础列表",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/cardList",
|
||||
title: "卡片列表",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/searchList",
|
||||
title: "搜索列表",
|
||||
icon: "Menu",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
url: "/ErrorMessage",
|
||||
title: "异常页面",
|
||||
icon: "WarningFilled",
|
||||
children: [
|
||||
{
|
||||
url: "/404",
|
||||
title: "404",
|
||||
icon: "Menu",
|
||||
},
|
||||
{
|
||||
url: "/500",
|
||||
title: "500",
|
||||
icon: "Menu",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
export default menuTable;
|
||||
Reference in New Issue
Block a user