初始化

This commit is contained in:
13218645326 2023-12-03 14:23:45 +08:00
parent 32f8aa7437
commit 200959cf2a
18 changed files with 368 additions and 54 deletions

View File

@ -1,11 +1,54 @@
<template> <template>
<subMenu></subMenu> <subMenu :menuList="menuInfo.menuList" :collapse="menuInfo.collapse" :backgroundColor="menuInfo.backgroundColor" :textColor="menuInfo.textColor"
:activeTextColor="menuInfo.activeTextColor" :defaultActive="menuInfo.defaultActive"
<RouterView /> :defaultOpeneds="menuInfo.defaultOpeneds" :uniqueOpened="menuInfo.uniqueOpened" :menuTrigger="menuInfo.menuTrigger"
:router="menuInfo.router" :collapseTransition="menuInfo.collapseTransition" :popperEffect="menuInfo.popperEffect" :isCustomLink="menuInfo.isCustomLink" :customLinkCallBack="menuInfo.customLinkCallBack"></subMenu>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import subMenu from './sideBar/subMenu.vue'; import {list } from "router/routerData"
import subMenu from './sideBar/subMenu.vue';
const routes = useRoute()
const router = useRouter()
const menuInfo:any = reactive({
collapse:false,
backgroundColor:'#d3e6f3',
textColor:"",
activeTextColor:'',
defaultActive:"",
defaultOpeneds:['staticDefault_PathParent'],
router:false,
collapseTransition:true,
menuList:list,
isCustomLink:true,
customLinkCallBack:(ev:any)=>{
console.log("customLinkCallBack",ev)
if(ev.startsWith('staticDefault')){
return
}
router.push({
name:ev
})
}
})
onMounted(()=>{
console.log("routes",router.getRoutes())
// initRouteList()
})
const initRouteList = ()=>{
const routeList = router.getRoutes()
menuInfo.menuList = routeList.find(ele=>ele.meta.routeListRoot)?.children
menuInfo.defaultOpeneds = menuInfo.menuList[0].path
console.log("menuInfo.menuList",menuInfo.menuList)
}
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -1,7 +1,7 @@
<template> <template>
<template v-for="item in props.menuList" :key="item.path"> <template v-for="item in props.menuList" :key="item.path">
<el-sub-menu :index="item.path" v-if="item.children && item.children.length > 0"> <el-sub-menu :index="item.name" v-if="item.children && item.children.length > 0">
<template #title v-if="item.meta.icon"> <template #title v-if="item.meta.icon">
<el-icon> <el-icon>
<Edit /> <Edit />
@ -11,7 +11,7 @@
<template #title v-else>{{ item.meta.title }}</template> <template #title v-else>{{ item.meta.title }}</template>
<menuItem :menuList="(item.children as any)" /> <menuItem :menuList="(item.children as any)" />
</el-sub-menu> </el-sub-menu>
<el-menu-item :index="item.path" v-else> <el-menu-item :index="item.name" v-else >
<template v-if="item.meta.icon"> <template v-if="item.meta.icon">
<el-icon > <el-icon >
<Search/> </el-icon> <Search/> </el-icon>
@ -26,14 +26,26 @@
<script lang="ts" setup> <script lang="ts" setup>
const emits = defineEmits(['selectItem'])
const menuInfo: any = reactive({ const menuInfo: any = reactive({
list: [] list: []
}) })
// //
const props = defineProps({ const props = defineProps({
menuList: { menuList: {
type: Array, type: Array,
default: [] default: []
},
isCustomLink:{
type: Boolean,
default: false
} }
}) })
const handleSelectItem =(ev:any)=>{
console.log("ev=========666",ev)
emits("selectItem",ev)
}
</script> </script>

View File

@ -2,22 +2,15 @@
<el-menu :collapse="props.collapse" :background-color="props.backgroundColor" :text-color="props.textColor" <el-menu :collapse="props.collapse" :background-color="props.backgroundColor" :text-color="props.textColor"
:active-text-color="props.activeTextColor" :default-active="props.defaultActive" :active-text-color="props.activeTextColor" :default-active="props.defaultActive"
:default-openeds="props.defaultOpeneds" :unique-opened="props.uniqueOpened" :menu-trigger="props.menuTrigger" :default-openeds="props.defaultOpeneds" :unique-opened="props.uniqueOpened" :menu-trigger="props.menuTrigger"
:router="props.router" :collapse-transition="props.collapseTransition" :popper-effect="props.popperEffect"> :router="props.router" :collapse-transition="props.collapseTransition" :popper-effect="props.popperEffect" @select="customLinkCallBackFn">
<menuItem :menuList="props.menuList"> <menuItem :menuList="props.menuList" :isCustomLink="props.isCustomLink" >
</menuItem> </menuItem>
</el-menu> </el-menu>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import menuItem from "./menuItem.vue" import menuItem from "./menuItem.vue"
import { ref } from 'vue'
import {
Document,
Menu as IconMenu,
Location,
Setting,
} from '@element-plus/icons-vue'
const props: any = defineProps({ const props: any = defineProps({
collapse: { collapse: {
type: Boolean, type: Boolean,
@ -41,7 +34,7 @@ const props: any = defineProps({
}, },
defaultOpeneds: { defaultOpeneds: {
type: Array, type: Array,
default: ["/test1"] default: []
}, },
uniqueOpened: { uniqueOpened: {
type: Boolean, type: Boolean,
@ -65,23 +58,22 @@ const props: any = defineProps({
}, },
menuList: { menuList: {
type: Array, type: Array,
default: [{ default: []
meta: { },
title: "666", isCustomLink:{
icon: "Search" type: Boolean,
}, default: false,
path: '/test1', },
children: [{ customLinkCallBack:{
meta: { type:Function,
title: "666", default:()=>{}
icon: "Search"
},
path: '/test1/test11',
}
]
}]
} }
}) })
const customLinkCallBackFn =(ev:any)=>{
console.log("2342423",ev)
props.customLinkCallBack(ev)
}
</script> </script>

View File

@ -2,7 +2,7 @@ import './assets/main.css'
import { createApp } from 'vue' import { createApp } from 'vue'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import 'element-plus/dist/index.css'
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
import * as ElementPlusIconsVue from '@element-plus/icons-vue' import * as ElementPlusIconsVue from '@element-plus/icons-vue'

View File

@ -1,4 +1,5 @@
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
const routes: Array<RouteRecordRaw> = [ const routes: Array<RouteRecordRaw> = [
{ {
path: '/index', path: '/index',
@ -7,21 +8,100 @@ const routes: Array<RouteRecordRaw> = [
meta: { meta: {
title: '主页面', title: '主页面',
keepAlive: true, keepAlive: true,
AuthFlag: true AuthFlag: true,
routeListRoot: true
}, },
children:[{ children:[
{
path: 'configuration', path: 'swiperConfig',
name: 'configuration', name: 'swiperConfig',
component: () => import('views/AppMain.vue'), component: () => import('views/configuration/swiperConfig.vue'),
meta: { meta: {
title: '主页面', title: '轮播图配置',
keepAlive: true, keepAlive: true,
AuthFlag: true AuthFlag: true
}
}, },
} {
path: 'specialInformationConfiguration',
name: 'specialInformationConfiguration',
component: () => import('views/configuration/specialInformationConfiguration.vue'),
meta: {
title: '专题资讯配置',
keepAlive: true,
AuthFlag: true
}
},
{
path: 'privacyAgreement',
name: 'privacyAgreement',
component: () => import('views/configuration/privacyAgreement.vue'),
meta: {
title: '隐私协议模板管理',
keepAlive: true,
AuthFlag: true
}
},
{
path: 'enterpriseManagement',
name: 'enterpriseManagement',
component: () => import('views/enterpriseManagement/AppMain.vue'),
meta: {
title: '企业管理',
keepAlive: true,
AuthFlag: true
},
},
{
path: 'enterpriseType',
name: 'configuration',
component: () => import('views/enterpriseManagement/enterpriseType.vue'),
meta: {
title: '企业类型',
keepAlive: true,
AuthFlag: true
}
},
{
path: 'enterpriseEntryReview',
name: 'enterpriseEntryReview',
component: () => import('views/enterpriseManagement/enterpriseEntryReview.vue'),
meta: {
title: '企业入驻审核',
keepAlive: true,
AuthFlag: true
},
},
{
path: 'businessReview',
name: 'businessReview',
component: () => import('views/enterpriseManagement/businessReview.vue'),
meta: {
title: '企业业务开通审核',
keepAlive: true,
AuthFlag: true
}
},
{
path: 'enterpriseInfo',
name: 'enterpriseInfo',
component: () => import('views/enterpriseManagement/enterpriseInfo.vue'),
meta: {
title: '企业信息',
keepAlive: true,
AuthFlag: true
}
}
] ]
} },
] ]
const router = createRouter({ const router = createRouter({

106
src/router/routerData.ts Normal file
View File

@ -0,0 +1,106 @@
export const list = [
{
name: "staticDefault_PathParent",
path: 'staticDefault_PathParent',
meta: {
title: '配置管理',
keepAlive: true,
AuthFlag: true
},
children: [
{
path: 'swiperConfig',
name: 'swiperConfig',
component: 'views/configuration/swiperConfig.vue',
meta: {
title: '轮播图配置',
keepAlive: true,
AuthFlag: true
}
},
{
path: 'specialInformationConfiguration',
name: 'specialInformationConfiguration',
component: 'views/configuration/specialInformationConfiguration.vue',
meta: {
title: '专题资讯配置',
keepAlive: true,
AuthFlag: true
}
},
{
path: 'privacyAgreement',
name: 'privacyAgreement',
component: 'views/configuration/privacyAgreement.vue',
meta: {
title: '隐私协议模板管理',
keepAlive: true,
AuthFlag: true
}
},
]
},
{
name: "企业管理",
path: '',
meta: {
title: '轮播图配置',
keepAlive: true,
AuthFlag: true
},
children: [
{
path: 'enterpriseManagement',
name: 'enterpriseManagement',
component: 'views/enterpriseManagement/AppMain.vue',
meta: {
title: '企业管理',
keepAlive: true,
AuthFlag: true
},
},
{
path: 'enterpriseType',
name: 'configuration',
component: 'views/enterpriseManagement/enterpriseType.vue',
meta: {
title: '企业类型',
keepAlive: true,
AuthFlag: true
}
},
{
path: 'enterpriseEntryReview',
name: 'enterpriseEntryReview',
component: 'views/enterpriseManagement/enterpriseEntryReview.vue',
meta: {
title: '企业入驻审核',
keepAlive: true,
AuthFlag: true
},
},
{
path: 'businessReview',
name: 'businessReview',
component: 'views/enterpriseManagement/businessReview.vue',
meta: {
title: '企业业务开通审核',
keepAlive: true,
AuthFlag: true
}
},
{
path: 'enterpriseInfo',
name: 'enterpriseInfo',
component: 'views/enterpriseManagement/enterpriseInfo.vue',
meta: {
title: '企业信息',
keepAlive: true,
AuthFlag: true
}
}
]
}
]

View File

@ -1,9 +1,9 @@
<script setup lang="ts">
import TheWelcome from '../components/TheWelcome.vue'
</script>
<template> <template>
<main> <div>
<TheWelcome />
</main> </div>
</template> </template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
<router-view></router-view>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,9 @@
<template>
<div>
<router-view></router-view>
</div>
</template>
<script setup lang="ts"></script>
<style scoped lang="scss"></style>

View File

@ -1,9 +1,9 @@
<template> <template>
<div> <div>
<router-view></router-view>
</div> </div>
</template> </template>
<script setup lang="ts"></script> <script setup lang="ts"></script>
<style scoped></style> <style scoped lang="scss"></style>