570 lines
27 KiB
HTML
570 lines
27 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="${lang,escape}">
|
|
<head>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
|
|
<meta name="description" content="${AppName!}">
|
|
<title>${AppName!}</title>
|
|
<meta charset="UTF-8">
|
|
<!-- import CSS -->
|
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/myframe/css/myframe.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/element-ui/lib/theme-chalk/index.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/fonts/themify-icons.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/fonts/font-awesome.min.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/css/common.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/css/main.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/css/elmain.css?v=1.0.0">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/css/panel.css">
|
|
|
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wangeditor/wangEditor.css">
|
|
<link rel="stylesheet" type="text/css" href="${base!}/assets/platform/plugins/viewer/viewer.min.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wp-upload-vue/css/wpupload.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/wp-upload-vue/font/iconfont.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/video/css/video-js.min.css">
|
|
<link rel="stylesheet" href="${base!}/assets/platform/css/vivify.min.css">
|
|
<link href="${base!}/assets/platform/plugins/vue-cron/vcrontab.css" rel="stylesheet"/>
|
|
|
|
<script src="${base!}/assets/platform/plugins/vue-cron/vcrontab.umd.min.js"></script>
|
|
<!-- import Vue before Element -->
|
|
<script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script>
|
|
|
|
<!-- vue-count-to -->
|
|
<script src="${base!}/assets/platform/plugins/vue-count-to/vue-count-to.min.js"></script>
|
|
|
|
<!-- wpupload -->
|
|
<script type="text/javascript" src="${base!}/assets/platform/plugins/wp-upload-vue/js/axios.min.js"></script>
|
|
<script type="text/javascript" src="${base!}/assets/platform/plugins/wp-upload-vue/font/iconfont.js"></script>
|
|
<script type="text/javascript" src="${base!}/assets/platform/plugins/wp-upload-vue/js/wpupload.js"></script>
|
|
|
|
<!--axios-->
|
|
<script src="${base!}/assets/platform/plugins/axios/axios.js"></script>
|
|
|
|
<!-- import JavaScript -->
|
|
<script src="${base!}/assets/platform/plugins/element-ui/lib/index.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/element-ui/lib/i18n/${lang,escape}.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/jquery/jquery-1.11.1.min.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/slimscroll/jquery.slimscroll.min.js"></script>
|
|
|
|
<!--后面就改这一段吧-->
|
|
<script src="${base!}/assets/platform/plugins/dd3s/dd3s.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/video/js/video.min.js"></script>
|
|
|
|
<!--g2-->
|
|
<script src="/assets/platform/plugins/g2/g2.min.js?v=4.1.9"></script>
|
|
<script src="/assets/platform/plugins/g2/data-set.js"></script>
|
|
<script src="/assets/platform/plugins/g2/g2plot.js?v=1.0.0"></script>
|
|
|
|
<!--echars-->
|
|
<script src="${base!}/assets/platform/plugins/echarts/echarts.min.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/echarts/infographic.js"></script><!--主题-->
|
|
<script src="${base!}/assets/platform/plugins/echarts/westeros.js"></script><!--主题-->
|
|
<script src="${base!}/assets/platform/plugins/echarts/walden.js"></script><!--主题-->
|
|
<script src="${base!}/assets/platform/plugins/echarts/macarons.js"></script><!--主题-->
|
|
<!-- <script src="https://cdn.staticfile.org/echarts/5.2.2/echarts.js"></script>-->
|
|
<!-- <script src="https://cdn.staticfile.org/echarts/5.2.2/i18n/langZH.js"></script>-->
|
|
|
|
|
|
<script src="${base!}/assets/platform/module/mixins/initTableMixins.js?v=1.0.3"></script>
|
|
<script src="${base!}/assets/platform/module/mixins/styleMixin.js"></script>
|
|
<script src="${base!}/assets/platform/js/includeModel.js?v=1.0.6"></script>
|
|
<script src="${base!}/assets/platform/js/component.js?v=1.0.2"></script>
|
|
<script src="${base!}/assets/platform/js/v.js?v=1.0.5"></script>
|
|
<script src="${base!}/assets/platform/plugins/wangeditor/wangEditor.js"></script>
|
|
<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/wangeditor@4.6.15/dist/wangEditor.min.js"></script>-->
|
|
<script type="text/javascript"
|
|
src="https://webapi.amap.com/maps?v=1.4.15&key=6ab3452804ba35050880b5e047436853&plugin=AMap.PolyEditor,AMap.PlaceSearch"></script>
|
|
|
|
<!--viewer-->
|
|
<script src="${base!}/assets/platform/plugins/viewer/viewer.min.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/viewer/jquery-viewer.min.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/vue-loader/httpVueLoader.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/vue-qrcode/vue-qrcode.min.js"></script>
|
|
|
|
|
|
<!-- pjax是异步加载html片段的工具,模拟前端路由机制 -->
|
|
<script src="${base!}/assets/platform/plugins/pjax/jquery.pjax.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/myframe/js/myframe.js"></script>
|
|
<!-- Array数组增加findIndex等方法,TreeTable用得到,兼容IE8 -->
|
|
<script src="${base!}/assets/platform/plugins/polyfill/polyfill.js"></script>
|
|
<!-- 时间日期处理工具类 -->
|
|
<script src="${base!}/assets/platform/plugins/moment/moment.min.js"></script>
|
|
<!-- 浏览器通知 -->
|
|
<script src="${base!}/assets/platform/plugins/push/push.min.js"></script>
|
|
<script src="${base!}/assets/platform/js/main.js?v=1.0.0"></script>
|
|
<script src="${base!}/assets/platform/js/offscreen.js"></script>
|
|
<!-- <script src="https://cdn.jsdelivr.net/npm/vue-echarts@4.0.2"></script>-->
|
|
<script src="${base!}/assets/platform/plugins/vue-charts/echartTheme.js"></script>
|
|
|
|
<!--拖拽js-->
|
|
<script src="${base!}/assets/platform/js/directive/v-sticky.js"></script>
|
|
|
|
<script src="${base!}/assets/platform/js/jquery.qrcode.min.js"></script>
|
|
|
|
<script src="${base!}/assets/platform/js/jr-qrcode.js"></script>
|
|
|
|
<!--字典混入-->
|
|
<script src="${base!}/components/plugins/sysDict/DictData.js"></script>
|
|
|
|
<script src="${base!}/assets/platform/js/chengSh.js"></script>
|
|
<script src="${base!}/assets/platform/js/util/commonUtil.js"></script>
|
|
<script src="${base!}/assets/platform/plugins/xlsx/xlsx.full.min.js"></script>
|
|
|
|
<!-- <script src="${base!}/assets/platform/js/chengSh.js"></script>-->
|
|
|
|
<script type="text/javascript">
|
|
const base = "${base!}";
|
|
const APP_DOMAIN = "${AppDomain!}";
|
|
const FILE_DOMAIN = "${AppFileDomain!}";
|
|
const AppMapCenterPointX = "${config.AppMapCenterPointX!}";
|
|
const AppMapCenterPointY = "${config.AppMapCenterPointY!}";
|
|
const isDisPlayCode = "${config.isDisPlayCode!}" === 'true'
|
|
const LOGO_URL = "${config.logoUrl!}"
|
|
|
|
window.sessionStorage.setItem("user", JSON.stringify(${json(@shiro.getPrincipal())}))
|
|
|
|
ELEMENT.locale(ELEMENT.lang['${lang,escape}']);
|
|
|
|
Vue.component('vuedraggable', window.vuedraggable)
|
|
Vue.component('guava', httpVueLoader('/components/plugins/Guava.vue'))
|
|
Vue.component('sign', httpVueLoader('/components/sign/sign.vue?v=' + new Date().getTime()))
|
|
Vue.component('file-upload', httpVueLoader('/components/plugins/FileUpload.vue?v=1.0.9'))
|
|
Vue.component('image-upload', httpVueLoader('/components/plugins/ImageUpload.vue'))
|
|
Vue.component('dict-tag', httpVueLoader('/components/plugins/sysDict/DictTag.vue'))
|
|
Vue.component('border-table', httpVueLoader('/components/plugins/BorderTable.vue'))
|
|
Vue.component('text-editor', httpVueLoader('/components/plugins/TextEditor.vue?v=' + new Date().getTime()))
|
|
Vue.component('el-tab-plus', httpVueLoader('/components/plugins/ELTabPlus.vue'))
|
|
Vue.component('dict-select', httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.1'))
|
|
Vue.component('enum-select', httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'))
|
|
Vue.component('custom-message', httpVueLoader('/components/plugins/CustomMessage.vue'))
|
|
|
|
Vue.use(httpVueLoader)
|
|
Vue.component(VueQrcode.name, VueQrcode)
|
|
|
|
const viewImage = function (filepath) {
|
|
let image = new Image();
|
|
image.src = APP_DOMAIN + FILE_STREAM_PREVIEW_ADDRESS + '?id=' + filepath;
|
|
let viewer = new Viewer(image);
|
|
viewer.show();
|
|
};
|
|
window.viewImage = viewImage;
|
|
Vue.prototype.$viewImage = viewImage
|
|
Vue.prototype.$auth = commonUtil.authService()
|
|
Vue.prototype.$axios = commonUtil.axiosService()
|
|
Vue.prototype.$downLoad = commonUtil.downLoadService
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="gallery-loader" style="background-color:transparent;">
|
|
<div class="loader"></div>
|
|
</div>
|
|
<div id="mainApp" class="app">
|
|
<header class="header header-fixed navbar" id="headerNavbar">
|
|
<div class="brand">
|
|
<a href="javascript:;" data-pjax class="navbar-brand" @click="goHome">
|
|
<div :style="{'background-image':'url('+LOGO_URL+')'}"
|
|
style=" width: 250px;
|
|
height: 80%;
|
|
margin-top: 5px;
|
|
background-repeat: no-repeat;
|
|
background-position: center center;
|
|
background-size: contain;"></div>
|
|
</a>
|
|
</div>
|
|
|
|
<ul class="nav navbar-nav" id="moduleCenter">
|
|
<li style="padding:0 17px" class="vivify popIn duration-1500">
|
|
<el-popover
|
|
width="450"
|
|
popper-class="appCenterPopover"
|
|
placement="top-start"
|
|
v-model="menuPopover"
|
|
trigger="visible">
|
|
<el-card shadow="never" class="appCenterCard">
|
|
<template #header>
|
|
<el-row type="flex" justify="space-between">
|
|
<div>
|
|
<el-link :underline="false">应用中心</el-link>
|
|
<a href="/platform/sys/entranceModule" data-pjax>
|
|
<i class="el-icon-edit" style="cursor: pointer;color: #1867b0"
|
|
v-if="${@shiro.hasRole('sysadmin')}"></i>
|
|
</a>
|
|
</div>
|
|
|
|
<div>
|
|
<el-link @click="goHome" type="primary" :underline="false">工作台</el-link>
|
|
<!-- <el-link @click="setUserDefaultEntranceModuleId" type="primary" :underline="false">-->
|
|
<!-- 设置为默认模块-->
|
|
<!-- </el-link>-->
|
|
</div>
|
|
</el-row>
|
|
</template>
|
|
<el-row :gutter="20" v-if="moduleMenus && moduleMenus.length>0">
|
|
<el-col v-for="item in moduleMenus" :key="item.id" :span="8" style="margin-bottom: 5px">
|
|
<div class="entranceDetail"
|
|
@click="enterEntranceModules(item)">
|
|
<div class="entranceIcon">
|
|
<el-image :src="CREATE_PREVIEW_URL(item.icon[0].id)"
|
|
style="height: 50px;width: 50px;border-radius: 50%"></el-image>
|
|
</div>
|
|
<a href="javascript:;">{{item.moduleName}}</a>
|
|
</div>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row type="flex" justify="end">
|
|
<el-button type="primary" size="mini" @click="menuPopover=!menuPopover">关闭</el-button>
|
|
</el-row>
|
|
</el-card>
|
|
<a href="javascript:" slot="reference" @click="toggleMenuPopover">
|
|
<i class="fa fa-th-large" aria-hidden="true"></i>
|
|
{{selectEntranceModule ? selectEntranceModule.moduleName : '应用中心'}}
|
|
</a>
|
|
</el-popover>
|
|
</li>
|
|
|
|
<li style="cursor: pointer" @click="menuPopover=true">
|
|
<i class="el-icon-sort"></i>
|
|
切换应用
|
|
</li>
|
|
</ul>
|
|
|
|
<!-- <el-breadcrumb separator-class="el-icon-arrow-right" style="line-height: 50px">-->
|
|
<!-- <el-breadcrumb-item>-->
|
|
<!-- <a href="/platform/home" data-pjax>首页</a>-->
|
|
<!-- </el-breadcrumb-item>-->
|
|
<!-- <el-breadcrumb-item v-for="item in breadcrumbMenus" :key="item.id">-->
|
|
<!-- <a v-if="item.href" data-pjax :href="item.href">-->
|
|
<!-- {{item.name}}-->
|
|
<!-- </a>-->
|
|
<!-- <span v-else>-->
|
|
<!-- {{item.name}}-->
|
|
<!-- </span>-->
|
|
<!-- </el-breadcrumb-item>-->
|
|
<!-- </el-breadcrumb>-->
|
|
|
|
|
|
<ul class="nav navbar-nav navbar-right">
|
|
<!--<li class="off-right">
|
|
<a href="/platform/sys/msg/user/unread" data-pjax>
|
|
<el-badge :value="unReadMsgNum" class="item">
|
|
<i class="el-icon-chat-dot-round" style="font-size: 20px"></i>
|
|
</el-badge>
|
|
</a>
|
|
</li>-->
|
|
<li class="off-right">
|
|
<a href="javascript:;" data-toggle="dropdown">
|
|
<span class="hidden-xs ml10" @click="clearCache">清除缓存</span>
|
|
</a>
|
|
</li>
|
|
<li class="off-right">
|
|
<a href="javascript:;" data-toggle="dropdown">
|
|
<span class="hidden-xs ml10">
|
|
${@shiro.getPrincipalProperty('username')}
|
|
(${@shiro.getPrincipalProperty('loginname')})
|
|
</span>
|
|
</a>
|
|
</li>
|
|
<li class="off-right">
|
|
<a href="${base!}/platform/login/logout">
|
|
<i class="ti-power-off"></i>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</header>
|
|
<section class="layout" style="display: flex;">
|
|
<!-- sidebar menu -->
|
|
<div id="asideMenu" class="sidebar">
|
|
<el-menu
|
|
@select="menuSelect"
|
|
unique-opened
|
|
:default-active="activeMenuIndex"
|
|
:default-openeds="openedMenus"
|
|
background-color="#04436c"
|
|
text-color="#fff"
|
|
active-text-color="#ab9be7">
|
|
<template v-for="firstMenu in leftMenus">
|
|
<el-submenu :index="firstMenu.id" v-if="firstMenu.children.length>0">
|
|
<template slot="title">
|
|
<i :class="firstMenu.icon ? firstMenu.icon : 'el-icon-location'"></i>
|
|
<span>{{firstMenu.name}}</span>
|
|
</template>
|
|
|
|
<template v-for="secondMenu in firstMenu.children">
|
|
<el-submenu :index="secondMenu.id" v-if="secondMenu.children.length>0">
|
|
<template slot="title">
|
|
<i :class="secondMenu.icon ? secondMenu.icon : 'el-icon-location'"></i>
|
|
<span>{{secondMenu.name}}</span>
|
|
</template>
|
|
|
|
<template v-for="thirdMenu in secondMenu.children">
|
|
<el-submenu :index="thirdMenu.id" v-if="thirdMenu.children.length>0">
|
|
<template slot="title">
|
|
<i :class="thirdMenu.icon ? thirdMenu.icon : 'el-icon-location'"></i>
|
|
<span>{{thirdMenu.name}}</span>
|
|
</template>
|
|
</el-submenu>
|
|
|
|
<a :href="thirdMenu.href" data-pjax v-else>
|
|
<el-menu-item :index="thirdMenu.id">
|
|
<i :class="thirdMenu.icon ? thirdMenu.icon : 'el-icon-location'"></i>
|
|
<span slot="title">{{thirdMenu.name}}</span>
|
|
</el-menu-item>
|
|
</a>
|
|
</template>
|
|
</el-submenu>
|
|
|
|
<a :href="secondMenu.href" data-pjax v-else>
|
|
<el-menu-item :index="secondMenu.id">
|
|
|
|
<i class="el-icon-menu"></i>
|
|
<span slot="title">{{secondMenu.name}}</span>
|
|
</el-menu-item>
|
|
</a>
|
|
</template>
|
|
</el-submenu>
|
|
|
|
<a :href="firstMenu.href" data-pjax v-else>
|
|
<el-menu-item :index="firstMenu.id">
|
|
|
|
<i class="el-icon-menu"></i>
|
|
<span slot="title">{{firstMenu.name}}</span>
|
|
</el-menu-item>
|
|
</a>
|
|
</template>
|
|
</el-menu>
|
|
</div>
|
|
|
|
<!-- main content -->
|
|
<section class="main-content" id="container">
|
|
${layoutContent}
|
|
</section>
|
|
</section>
|
|
</div>
|
|
|
|
<script>
|
|
window.sessionStorage.setItem('moduleMenus', JSON.stringify(${@shiro.userModuleMenus()}))
|
|
const leftMenuApp = new Vue({
|
|
el: '#asideMenu',
|
|
data() {
|
|
return {
|
|
moduleMenus: JSON.parse(window.sessionStorage.getItem('moduleMenus')),
|
|
leftMenus: [],
|
|
activeMenuIndex: '',
|
|
openedMenus: []
|
|
}
|
|
},
|
|
methods: {
|
|
loadMenu(moduleId) {
|
|
this.leftMenus = this.moduleMenus.find(v => v.id === moduleId)?.menus
|
|
},
|
|
|
|
menuSelect(index, indexPath) {
|
|
this.activeMenuIndex = index
|
|
this.openedMenus = indexPath
|
|
window.sessionStorage.setItem('menuIndex', index)
|
|
window.sessionStorage.setItem('menuIndexPath', JSON.stringify(indexPath))
|
|
},
|
|
|
|
openFirstMenu() {
|
|
if (window.location.pathname === '/platform/home') {
|
|
setTimeout(() => {
|
|
this.$nextTick(() => {
|
|
const aTag = document.querySelector('#leftMenu li a')
|
|
if (aTag) {
|
|
aTag.click()
|
|
}
|
|
})
|
|
}, 500)
|
|
} else {
|
|
const pathname = window.location.pathname
|
|
const a_selector = "#leftMenu li a[href='" + pathname + "']"
|
|
const getCurrentMenu = () => {
|
|
const a = document.querySelector(a_selector)
|
|
if (a) {
|
|
$(a).attr('style', 'color: #1867b0')
|
|
$(a).parent().parents("li").addClass("open")
|
|
$(a).parent().parents('ul.sub-menu').attr('style', 'display:block')
|
|
$(a).find("i").addClass("fa-dot-circle-o")
|
|
clearInterval(getCurrentMenuInterval)
|
|
}
|
|
}
|
|
const getCurrentMenuInterval = setInterval(getCurrentMenu, 100)
|
|
}
|
|
},
|
|
|
|
goHome() {
|
|
|
|
},
|
|
assignmentMenu() {
|
|
const menuIndexPath = window.sessionStorage.getItem('menuIndexPath')
|
|
if (menuIndexPath) {
|
|
this.openedMenus = JSON.parse(menuIndexPath)
|
|
} else {
|
|
this.openedMenus = []
|
|
}
|
|
const menuIndex = window.sessionStorage.getItem('menuIndex')
|
|
if (menuIndex) {
|
|
this.activeMenuIndex = menuIndex
|
|
} else {
|
|
this.activeMenuIndex = ''
|
|
}
|
|
}
|
|
|
|
|
|
// async getUserDefaultEntranceModuleId() {
|
|
// const resp = await $.get('/platform/sys/entranceModule/getUserDefaultEntranceModuleId')
|
|
// if (resp.code === 0) {
|
|
// this.userDefaultModuleId = resp.data
|
|
// }
|
|
// },
|
|
// async setUserDefaultEntranceModuleId() {
|
|
// const {id: moduleId, moduleName} = this.selectEntranceModule
|
|
// const msg = '您确定要将' + moduleName + '设置为默认模块吗?'
|
|
// const confirm = await this.$confirm(msg, '提示', {
|
|
// confirmButtonText: '确定',
|
|
// cancelButtonText: '取消',
|
|
// type: 'warning'
|
|
// })
|
|
// if ('confirm' !== confirm) return
|
|
// const resp = await $.get('/platform/sys/entranceModule/setUserDefaultEntranceModuleId', {moduleId})
|
|
// if (resp.code === 0) {
|
|
// this.$notify.success(resp.msg)
|
|
// } else {
|
|
// this.$notify.warning(resp.msg)
|
|
// }
|
|
// },
|
|
},
|
|
created() {
|
|
this.assignmentMenu()
|
|
}
|
|
})
|
|
|
|
const headerApp = new Vue({
|
|
el: '#headerNavbar',
|
|
data() {
|
|
return {
|
|
moduleMenus: JSON.parse(window.sessionStorage.getItem('moduleMenus')),
|
|
menuPopover: false,
|
|
selectEntranceModule: {},
|
|
breadcrumbMenus: [],
|
|
unReadMsgNum: 0,
|
|
appModuleId: "",
|
|
}
|
|
},
|
|
methods: {
|
|
getUnReadMsgNum() {
|
|
$.get('/platform/sys/msg/user/unread_num').then(res => {
|
|
if (res.code === 0) {
|
|
const totalSum = Object.values(res.data).reduce(function (sum, value) {
|
|
return sum + value;
|
|
}, 0);
|
|
this.unReadMsgNum = totalSum
|
|
if (totalSum > 0) {
|
|
this.$notify.info({
|
|
title: '消息',
|
|
message: '您有' + totalSum + '条未读消息,点击查看。',
|
|
onClick: () => {
|
|
sublime.jumpPagePjax('/platform/sys/msg/user/unread')
|
|
}
|
|
});
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
toggleMenuPopover() {
|
|
setTimeout(() => {
|
|
this.menuPopover = !this.menuPopover
|
|
}, 300)
|
|
},
|
|
goSetAppCenter() {
|
|
|
|
},
|
|
goHome() {
|
|
$.pjax({
|
|
url: '/platform/home',
|
|
container: '#container',
|
|
fragment: '#container',
|
|
timeout: 8000
|
|
});
|
|
},
|
|
setUserDefaultEntranceModuleId() {
|
|
|
|
},
|
|
enterEntranceModules(item) {
|
|
this.selectEntranceModule = item
|
|
this.menuPopover = false
|
|
leftMenuApp.loadMenu(item.id)
|
|
},
|
|
clearCache() {
|
|
this.$confirm('您确定要清除缓存吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(async () => {
|
|
const {code, msg} = await $.post('/platform/home/clearCache')
|
|
if (code === 0) {
|
|
this.$message.success(msg)
|
|
location.reload()
|
|
} else {
|
|
this.$message.warning(msg)
|
|
}
|
|
}).catch(() => {
|
|
|
|
});
|
|
},
|
|
async flushCache(){
|
|
const day = moment().format('YYYY-MM-DD')
|
|
if (window.localStorage.getItem('flushCache') !== day) {
|
|
const {code, msg} = await $.post('/platform/home/clearCache')
|
|
if (code === 0) {
|
|
location.reload()
|
|
}
|
|
window.localStorage.setItem('flushCache', day)
|
|
}
|
|
},
|
|
findParentNodes(data, targetHref, parents = []) {
|
|
for (const node of data) {
|
|
if (node && node.href === targetHref) {
|
|
return parents.concat(node);
|
|
}
|
|
if (node && node.children) {
|
|
const found = this.findParentNodes(node.children, targetHref, parents.concat(node));
|
|
if (found) {
|
|
return found;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
},
|
|
matchMenu(path = window.location.pathname) {
|
|
const parentNodes = this.findParentNodes(JSON.parse(window.sessionStorage.getItem('moduleMenus')).flatMap(v => v.menus), path)
|
|
if (parentNodes) {
|
|
const menuIndexPath = parentNodes.map(v => v.id)
|
|
const menuIndex = menuIndexPath[menuIndexPath.length - 1]
|
|
const menuParentIndex = menuIndexPath[0]
|
|
const module = JSON.parse(window.sessionStorage.getItem('moduleMenus')).find(v => v.containsMenu.includes(menuParentIndex))
|
|
this.enterEntranceModules(module)
|
|
this.appModuleId = module.id
|
|
window.sessionStorage.setItem('menuIndex', menuIndex)
|
|
window.sessionStorage.setItem('menuIndexPath', JSON.stringify(menuIndexPath))
|
|
leftMenuApp.assignmentMenu()
|
|
} else {
|
|
this.appModuleId = JSON.parse(window.sessionStorage.getItem('moduleMenus'))[0].id
|
|
this.enterEntranceModules(JSON.parse(window.sessionStorage.getItem('moduleMenus'))[0])
|
|
window.sessionStorage.removeItem('menuIndex')
|
|
window.sessionStorage.removeItem('menuIndexPath')
|
|
leftMenuApp.assignmentMenu()
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.matchMenu()
|
|
this.getUnReadMsgNum()
|
|
this.flushCache()
|
|
}
|
|
})
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|