Files
aida_front/src/views/Administrator.vue

357 lines
10 KiB
Vue
Raw Normal View History

2024-03-08 16:51:24 +08:00
<template>
<div class="administrator_page">
<div class="administrator_page_left">
<div class="administrator_title ">
<div class="modal_title_text" @click="setBack">
<i class="fi fi-sr-left"></i>
<div class="modal_title_intro administrator_title_text">Back</div>
</div>
</div>
2024-03-08 16:51:24 +08:00
<div class="modal_title_text">Administrator</div>
<a-menu
id="dddddd"
class="menu_list_content"
theme="dark"
v-model:openKeys="openKeys"
v-model:selectedKeys="selectedKeys"
mode="inline"
@click="handleClick"
>
2024-08-05 16:15:43 +08:00
<div v-for="(menu) in rootSubmenuKeys" :key="menu.key" >
2024-03-08 16:51:24 +08:00
<a-menu-item :key="menu.key" :name="menu.name" :route="menu.route" v-if="!menu.children">
<template #icon>
<span :class="['icon','iconfont', 'menu_icon', menu.icon]"></span>
</template>
2024-07-30 10:04:25 +08:00
<span class="menu_title" :title="menu.name">{{menu.name}}</span>
2024-03-08 16:51:24 +08:00
</a-menu-item>
<a-sub-menu :key="menu.key" v-else>
<template #icon>
<span :class="['icon','iconfont', 'menu_icon', menu.icon]"></span>
</template>
<template #expandIcon><span :class="['icon','iconfont', 'menu_icon', menu.expandIcon]"></span></template>
2024-07-30 10:04:25 +08:00
<template #title><span class="menu_title" :title="menu.name">{{menu.name}}</span></template>
2024-03-08 16:51:24 +08:00
<div >
2024-07-30 10:04:25 +08:00
<a-menu-item v-for="child in menu.children" :key="child.key" :name="child.name" :route="child.route"><span class="menu_title" :title="child.name">{{child.name}}</span></a-menu-item>
2024-03-08 16:51:24 +08:00
</div>
</a-sub-menu>
</div>
</a-menu>
</div>
<div class="administrator_page_right">
<div class="administrator_page_right_header">
<div class="page_name">
<div v-show="!routers.length" class="page_name_title">{{nowPageName}}</div>
<a-breadcrumb v-show="routers.length" :routes="routers">
<template #itemRender="{ route, routes, paths }">
<span v-if="routes.indexOf(route) === routes.length - 1">
{{ route.breadcrumbName }}
</span>
<router-link v-else :to="`${paths.join('/')}`">
{{ route.breadcrumbName }}
</router-link>
</template>
</a-breadcrumb>
</div>
</div>
<div class="administrator_page_right_content">
<router-view v-slot="{ Component }">
<keep-alive>
<component :is="Component" />
</keep-alive>
</router-view>
2024-03-08 16:51:24 +08:00
</div>
</div>
</div>
</template>
<script lang="ts">
import { LoadingOutlined } from "@ant-design/icons-vue";
import { message, Upload } from "ant-design-vue";
2025-04-30 14:01:52 +08:00
import { defineComponent, onMounted, h, ref, nextTick, computed,reactive, toRefs, onBeforeMount } from "vue";
2024-03-08 16:51:24 +08:00
import { MailOutlined, AppstoreOutlined, SettingOutlined } from '@ant-design/icons-vue';
import { Https } from "@/tool/https";
import { useStore } from "vuex";
import { useRouter,useRoute } from 'vue-router'
2025-09-01 14:03:30 +08:00
import adminRouter from "@/tool/adminRouter";
2024-03-08 16:51:24 +08:00
import GO from "@/tool/GO";
2024-08-05 16:15:43 +08:00
import { country } from "@/tool/country";
2024-03-08 16:51:24 +08:00
import { getUploadUrl } from "@/tool/util";
// import { forEach } from "jszip";
import scaleImage from "@/component/HomePage/scaleImage.vue";
import { openGuide,driverObj__,driverIndex__ } from "@/tool/guide";
import { useI18n } from "vue-i18n";
2024-08-22 14:49:46 +08:00
import store from "@/store";
2024-03-08 16:51:24 +08:00
export default defineComponent({
components: {
MailOutlined,
AppstoreOutlined,
SettingOutlined,
},
props: ["msg",'sketchCatecoryList'],
setup() {
const router = useRouter()
2024-08-22 14:49:46 +08:00
// const route:any = useRoute()
2025-09-04 13:10:18 +08:00
const {t,locale} = useI18n()
2025-09-01 14:03:30 +08:00
2024-08-22 14:49:46 +08:00
const store:any = useStore()
2025-04-16 10:43:54 +08:00
let userDetail:any= computed(()=>{
return store.state.UserHabit.userDetail
})
const state:any = reactive({
2025-09-04 13:10:18 +08:00
userDetailLanguage:computed(()=>store.state.UserHabit.userDetail.language),
// 5,7
rootSubmenuKeys: [],
openKeys: [],
selectedKeys: ['sub1'],
nowPageName:'All User',//当前页面名称
2024-03-08 16:51:24 +08:00
});
let routers:any = ref([])
const onOpenChange = (openKeys: string[]) => {
2025-09-01 14:03:30 +08:00
const latestOpenKey:any = openKeys.find(key => state.openKeys.indexOf(key) === -1);
if (state.rootSubmenuKeys.indexOf(latestOpenKey!) === -1) {
state.openKeys = openKeys;
} else {
state.openKeys = latestOpenKey ? [latestOpenKey] : [];
}
2024-03-08 16:51:24 +08:00
};
let handleClick = (event:any) => {
// state.selectedKeys = [Number(event.key)]
2025-09-08 14:50:59 +08:00
console.log(event.item)
2024-03-08 16:51:24 +08:00
state.nowPageName = event.item.name
router.push({path:event.item.route})
}
let setBack = ()=>{
router.push('/home');
}
2025-09-04 13:10:18 +08:00
watch(()=>state.userDetailLanguage,(newVal)=>{
if(locale.value == newVal || !newVal)return
locale.value = newVal
var vuex_systemUser: any = sessionStorage.getItem("vuex_systemUser");
let langList = []
if(vuex_systemUser == 5 || vuex_systemUser == 7){
langList = adminRouter.schoolOrEnterprise(t);
}else{
langList = adminRouter.all(t);
}
langList.forEach((item:any,index) => {
state.rootSubmenuKeys[index].name = item.name
})
})
2024-03-08 16:51:24 +08:00
onMounted(() => {
2025-09-04 13:10:18 +08:00
store.dispatch('getLangType').then(()=>{
}).catch(()=>{
})
2025-09-01 14:03:30 +08:00
var vuex_systemUser: any = sessionStorage.getItem("vuex_systemUser");
if(vuex_systemUser == 5 || vuex_systemUser == 7){
state.rootSubmenuKeys = adminRouter.schoolOrEnterprise(t);
2025-04-16 10:43:54 +08:00
}else{
2025-09-01 14:03:30 +08:00
state.rootSubmenuKeys = adminRouter.all(t);
2025-04-16 10:43:54 +08:00
}
const route = router.currentRoute.value
if(state.rootSubmenuKeys.some((item:any) => item.route === route.path) || route.path == "/administrator"){
router.push(state.rootSubmenuKeys[0].route)
}else{
router.push('/administrator')
}
2025-04-30 14:01:52 +08:00
// state.rootSubmenuKeys.forEach((item:any) => {
// if(item.children){
// item.children.forEach((item:any) => {
// if(item.route == router.currentRoute.value.path){
// state.selectedKeys[0] = item.key
// }
// });
// }else{
// if(item.route == router.currentRoute.value.path){
// state.selectedKeys[0] = item.key
// }
// }
// });
2024-08-05 16:15:43 +08:00
//储存所有用户id和name
Https.axiosGet(Https.httpUrls.getAllUserId,).then((rv: any) => {
if (rv) {
2024-08-22 14:49:46 +08:00
store.commit('setAllUserList',rv);
2024-08-05 16:15:43 +08:00
}
})
Https.axiosGet(Https.httpUrls.getCities,).then((rv: any) => {
if (rv) {
store.commit('setAllCitiesList',rv);
}
})
2025-04-16 10:43:54 +08:00
Https.axiosGet(Https.httpUrls.getAllGenerateFuncName,).then((rv: any) => {
if (rv) {
store.commit('setAllGenerateType',rv);
}
})
2024-08-05 16:15:43 +08:00
let allCountry = country
sessionStorage.setItem('allCountry',JSON.stringify(allCountry));
// state.nowPageName = state.rootSubmenuKeys[0].name
// router.push(state.rootSubmenuKeys[0].route)
2024-03-08 16:51:24 +08:00
})
2025-04-30 14:01:52 +08:00
onBeforeMount(()=>{
state.selectedKeys = ['sub1']
})
2024-03-08 16:51:24 +08:00
return {
...toRefs(state),
onOpenChange,
routers,
handleClick,
setBack,
2024-03-08 16:51:24 +08:00
};
},
data(prop) {
return {
}
},
mounted() {
},
watch:{
// newWindowState:{
// handler(newVal,oldVal){
// console.log(newVal);
// if(newVal){
// this.newWindow?.close();
// }
// }
// },
},
methods: {
},
});
</script>
<style lang="less">
.administrator_page {
width: 100%;
height: 100%;
display: flex;
background: rgba(243,244,248,0.4);
.administrator_title{
display: flex;
align-items: center;
position: sticky;
top: 0;
z-index: 222;
.modal_title_text{
cursor: pointer;
display: flex;
margin-bottom: 0;
font-size: 1.8rem;
}
.administrator_title_text{
line-height: 1;
}
.modal_title_text:hover .administrator_title_text{
text-decoration: underline;
}
i{
font-size: 1.2rem;
display: flex;
align-items: center;
margin-right: 1rem;
}
}
2024-03-08 16:51:24 +08:00
.administrator_page_left{
2024-08-05 16:15:43 +08:00
width: 20%;
2024-03-08 16:51:24 +08:00
padding-top: 20px;
.modal_title_text{
// font-size: var(--aida-fsize1-8);
line-height: 10rem;
text-align: center;
}
.ant-menu-dark.menu_list_content{
padding-left: 1.8rem;
2024-08-05 16:15:43 +08:00
// width: 30rem;
width: 100%;
height: calc(100% - 16rem);
2024-03-08 16:51:24 +08:00
background: #FFFFFF;
flex-shrink: 0;
2024-08-05 16:15:43 +08:00
overflow-y: auto;
&::-webkit-scrollbar{
width: 0;
}
2024-03-08 16:51:24 +08:00
.menu_icon{
font-size: 2.4rem;
color: #808185;
}
.ant-menu-item{
padding-left: 3.1rem !important;
display: flex;
align-items: center;
height: 6.6rem;
border-radius: 3.3rem 0px 0px 3.3rem;
box-sizing: border-box;
&.ant-menu-item-only-child{
padding-left: 5.6rem !important;
}
}
.ant-menu-submenu-title{
padding-left: 3.1rem !important;
height: 6.6rem;
}
.ant-menu-inline.ant-menu-sub{
background: #FFFFFF;
padding-left: 4rem;
2024-03-08 16:51:24 +08:00
}
.menu_title{
font-size: 1.8rem;
font-weight: normal;
color: #808185;
}
.ant-menu-item-selected{
background: #F3F4F8;
.menu_title{
2025-06-03 14:57:18 +08:00
color: #000;
2024-03-08 16:51:24 +08:00
}
.menu_icon{
color: #808185;
}
}
}
}
.administrator_page_right{
flex: 1;
2024-08-05 16:15:43 +08:00
width: 80%;
2025-05-08 14:09:12 +08:00
display: flex;
flex-direction: column;
2024-03-08 16:51:24 +08:00
.administrator_page_right_header{
display: flex;
justify-content: space-between;
align-items: center;
height: 6.6rem;
padding: 0 2.8rem 0 3.0rem;
.page_name{
border-left: solid .4rem #161F29;
.page_name_title,.ant-breadcrumb-link{
font-size: 1.8rem;
font-weight: normal;
color: #333333;
padding-left: 1.2rem;
line-height: 1.8rem;
}
}
}
.administrator_page_right_content{
height: 100%;
padding-left: 3rem;
}
}
}
</style>