fix bug
This commit is contained in:
@@ -2,8 +2,8 @@ package io.v.nutz.web.commons.proc;
|
||||
|
||||
import io.v.nutz.base.utils.DateUtil;
|
||||
import io.v.nutz.base.utils.StringUtil;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.ActionContext;
|
||||
import org.nutz.mvc.ActionInfo;
|
||||
|
||||
@@ -237,7 +237,6 @@ public class XssSqlFilterProcessor extends AbstractProcessor {
|
||||
if (decodedValue.contains("--") ||
|
||||
decodedValue.contains("/*") ||
|
||||
decodedValue.contains("*/") ||
|
||||
decodedValue.contains("#") ||
|
||||
Pattern.compile("[;'\"\\\\]").matcher(decodedValue).find()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -406,14 +406,14 @@ public class ShiroUtil extends io.v.nutz.util.ShiroUtil {
|
||||
*
|
||||
* @return {@link String}
|
||||
*/
|
||||
public static String userModuleMenus() {
|
||||
public static List<Sys_menu> userModuleMenus() {
|
||||
List<Sys_menu> menus = (List<Sys_menu>) getPrincipalProperty("moduleMenus");
|
||||
if (Lang.isEmpty(menus)) {
|
||||
SysUserService sysUserService = Mvcs.getIoc().get(SysUserServiceImpl.class);
|
||||
sysUserService.deleteCacheAndUpdate(getUserId());
|
||||
menus = (List<Sys_menu>) getPrincipalProperty("moduleMenus");
|
||||
}
|
||||
return Json.toJson(menus);
|
||||
return menus;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -619,6 +619,27 @@ ol.list-style-none, ul.list-style-none {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.sidebar .el-menu i{
|
||||
margin-right: 5px;
|
||||
width: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sidebar .el-menu .el-menu-item.is-active{
|
||||
background-color: #ecf5ff;
|
||||
}
|
||||
|
||||
.sidebar .el-menu .el-menu-item.is-active a{
|
||||
color: #0e78c5;
|
||||
}
|
||||
|
||||
.sidebar .el-menu .el-menu-item a{
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
min-width: 200px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.sidebar .nav-title {
|
||||
font-size: 11px;
|
||||
padding: 25px 15px 0;
|
||||
@@ -8590,3 +8611,29 @@ td.no-b {
|
||||
.w-e-toolbar, .w-e-text-container {
|
||||
z-index: 1 !important;
|
||||
}
|
||||
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 6px;
|
||||
border: 2px solid transparent;
|
||||
background-color: hsla(0, 0%, 67%, 0.5);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background-color: hsla(0, 0%, 67%, 0.8);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,23 @@ $.ajaxSetup({
|
||||
}
|
||||
});
|
||||
|
||||
function pjaxReplace(url, data = {}) {
|
||||
const { pathname, search } = location
|
||||
if (url === pathname + search) {
|
||||
return
|
||||
}
|
||||
$.pjax({
|
||||
url: url,
|
||||
container: "#container",
|
||||
maxCacheLength: 0,
|
||||
push: false,
|
||||
replace: true,
|
||||
fragment: "#container",
|
||||
timeout: 8000,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
function removeHTMLTag(str) {
|
||||
str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag
|
||||
str = str.replace(/[ | ]*\n/g, '\n'); //去除行尾空白
|
||||
@@ -202,13 +219,8 @@ var sublime = function () {
|
||||
|
||||
function initHome() {
|
||||
$(".gallery-loader").fadeOut();
|
||||
$.get(base + "/platform/home/path?url=" + window.location.href + "&rnd=" + new Date().getTime(), function (data) {
|
||||
// $("#leftnav").html(data);
|
||||
bindLeft();
|
||||
}, "html");
|
||||
//PJAX实现
|
||||
if ($.support.pjax) {
|
||||
|
||||
$(document).pjax('a[data-pjax]', '#container', {
|
||||
maxCacheLength: 0,
|
||||
push: false,
|
||||
@@ -273,40 +285,7 @@ var sublime = function () {
|
||||
},
|
||||
//2022/02/14 zxy pjax跳转自定义页面
|
||||
jumpPagePjax(pageUrl) {
|
||||
// const url = new URL(location.protocol + "//" + location.host + jump_url)
|
||||
// const pathname = url.pathname
|
||||
// headerNavBarVueApp.matchMenu(pathname)
|
||||
// setTimeout(() => {
|
||||
// const a = document.querySelector('a[href="' + pathname + '"][data-pjax]')
|
||||
// if (a) {
|
||||
// a.href = jump_url
|
||||
// a.click()
|
||||
// a.href = pathname
|
||||
// // leftMenuApp.assignmentMenu()
|
||||
// }
|
||||
// }, 0)
|
||||
const index = pageUrl.indexOf("?")
|
||||
const doMainUrl = index > -1 ? pageUrl.substring(0, index) : pageUrl
|
||||
const {protocol, host} = window.location
|
||||
const nodes = document.querySelectorAll('a[data-pjax]')
|
||||
for (let node of nodes) {
|
||||
if (node.hasAttribute('data-pjax') && node.href.trim() === protocol + "//" + host + doMainUrl) {
|
||||
const metaHref = node.href
|
||||
node.href = pageUrl
|
||||
node.click()
|
||||
|
||||
//父级节点展开
|
||||
const links = $(node).parents('li'),
|
||||
parentLink = $(node).closest("li");
|
||||
links.addClass("open")
|
||||
links.children(".sub-menu").slideDown()
|
||||
parentLink.removeClass("open")
|
||||
|
||||
node.href = metaHref
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
store.dispatch('pjaxRoute', pageUrl)
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
!(function (e, r) {
|
||||
"object" == typeof exports && "undefined" != typeof module
|
||||
? (module.exports = r())
|
||||
: "function" == typeof define && define.amd
|
||||
? define(r)
|
||||
: ((e || self).createPersistedState = r())
|
||||
})(this, function () {
|
||||
var e = function (e) {
|
||||
return (
|
||||
(function (e) {
|
||||
return !!e && "object" == typeof e
|
||||
})(e) &&
|
||||
!(function (e) {
|
||||
var t = Object.prototype.toString.call(e)
|
||||
return (
|
||||
"[object RegExp]" === t ||
|
||||
"[object Date]" === t ||
|
||||
(function (e) {
|
||||
return e.$$typeof === r
|
||||
})(e)
|
||||
)
|
||||
})(e)
|
||||
)
|
||||
},
|
||||
r = "function" == typeof Symbol && Symbol.for ? Symbol.for("react.element") : 60103
|
||||
function t(e, r) {
|
||||
return !1 !== r.clone && r.isMergeableObject(e) ? u(Array.isArray(e) ? [] : {}, e, r) : e
|
||||
}
|
||||
function n(e, r, n) {
|
||||
return e.concat(r).map(function (e) {
|
||||
return t(e, n)
|
||||
})
|
||||
}
|
||||
function o(e) {
|
||||
return Object.keys(e).concat(
|
||||
(function (e) {
|
||||
return Object.getOwnPropertySymbols
|
||||
? Object.getOwnPropertySymbols(e).filter(function (r) {
|
||||
return e.propertyIsEnumerable(r)
|
||||
})
|
||||
: []
|
||||
})(e)
|
||||
)
|
||||
}
|
||||
function c(e, r) {
|
||||
try {
|
||||
return r in e
|
||||
} catch (e) {
|
||||
return !1
|
||||
}
|
||||
}
|
||||
function u(r, i, a) {
|
||||
;((a = a || {}).arrayMerge = a.arrayMerge || n), (a.isMergeableObject = a.isMergeableObject || e), (a.cloneUnlessOtherwiseSpecified = t)
|
||||
var f = Array.isArray(i)
|
||||
return f === Array.isArray(r)
|
||||
? f
|
||||
? a.arrayMerge(r, i, a)
|
||||
: (function (e, r, n) {
|
||||
var i = {}
|
||||
return (
|
||||
n.isMergeableObject(e) &&
|
||||
o(e).forEach(function (r) {
|
||||
i[r] = t(e[r], n)
|
||||
}),
|
||||
o(r).forEach(function (o) {
|
||||
;(function (e, r) {
|
||||
return c(e, r) && !(Object.hasOwnProperty.call(e, r) && Object.propertyIsEnumerable.call(e, r))
|
||||
})(e, o) ||
|
||||
(i[o] =
|
||||
c(e, o) && n.isMergeableObject(r[o])
|
||||
? (function (e, r) {
|
||||
if (!r.customMerge) return u
|
||||
var t = r.customMerge(e)
|
||||
return "function" == typeof t ? t : u
|
||||
})(o, n)(e[o], r[o], n)
|
||||
: t(r[o], n))
|
||||
}),
|
||||
i
|
||||
)
|
||||
})(r, i, a)
|
||||
: t(i, a)
|
||||
}
|
||||
u.all = function (e, r) {
|
||||
if (!Array.isArray(e)) throw new Error("first argument should be an array")
|
||||
return e.reduce(function (e, t) {
|
||||
return u(e, t, r)
|
||||
}, {})
|
||||
}
|
||||
var i = u
|
||||
return function (e) {
|
||||
var r = (e = e || {}).storage || (window && window.localStorage),
|
||||
t = e.key || "vuex"
|
||||
function n(e, r) {
|
||||
var t = r.getItem(e)
|
||||
try {
|
||||
return "string" == typeof t ? JSON.parse(t) : "object" == typeof t ? t : void 0
|
||||
} catch (e) {}
|
||||
}
|
||||
function o() {
|
||||
return !0
|
||||
}
|
||||
function c(e, r, t) {
|
||||
return t.setItem(e, JSON.stringify(r))
|
||||
}
|
||||
function u(e, r) {
|
||||
return Array.isArray(r)
|
||||
? r.reduce(function (r, t) {
|
||||
return (function (e, r, t, n) {
|
||||
return (
|
||||
!/^(__proto__|constructor|prototype)$/.test(r) &&
|
||||
((r = r.split ? r.split(".") : r.slice(0)).slice(0, -1).reduce(function (e, r) {
|
||||
return (e[r] = e[r] || {})
|
||||
}, e)[r.pop()] = t),
|
||||
e
|
||||
)
|
||||
})(
|
||||
r,
|
||||
t,
|
||||
((n = e),
|
||||
void 0 ===
|
||||
(n = ((o = t).split ? o.split(".") : o).reduce(function (e, r) {
|
||||
return e && e[r]
|
||||
}, n))
|
||||
? void 0
|
||||
: n)
|
||||
)
|
||||
var n, o
|
||||
}, {})
|
||||
: e
|
||||
}
|
||||
function a(e) {
|
||||
return function (r) {
|
||||
return e.subscribe(r)
|
||||
}
|
||||
}
|
||||
;(
|
||||
e.assertStorage ||
|
||||
function () {
|
||||
r.setItem("@@", 1), r.removeItem("@@")
|
||||
}
|
||||
)(r)
|
||||
var f,
|
||||
s = function () {
|
||||
return (e.getState || n)(t, r)
|
||||
}
|
||||
return (
|
||||
e.fetchBeforeUse && (f = s()),
|
||||
function (n) {
|
||||
e.fetchBeforeUse || (f = s()),
|
||||
"object" == typeof f &&
|
||||
null !== f &&
|
||||
(n.replaceState(
|
||||
e.overwrite
|
||||
? f
|
||||
: i(n.state, f, {
|
||||
arrayMerge:
|
||||
e.arrayMerger ||
|
||||
function (e, r) {
|
||||
return r
|
||||
},
|
||||
clone: !1
|
||||
})
|
||||
),
|
||||
(e.rehydrated || function () {})(n)),
|
||||
(e.subscriber || a)(n)(function (n, i) {
|
||||
;(e.filter || o)(n) && (e.setState || c)(t, (e.reducer || u)(i, e.paths), r)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
//# sourceMappingURL=vuex-persistedstate.umd.js.map
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,8 @@
|
||||
|
||||
<!-- import Vue before Element -->
|
||||
<script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/vuex/vuex.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/vuex-persistedstate/vuex-persistedstate.umd.js"></script>
|
||||
|
||||
<!-- vue-count-to -->
|
||||
<script src="${base!}/assets/platform/plugins/vue-count-to/vue-count-to.min.js"></script>
|
||||
@@ -209,6 +211,86 @@
|
||||
const hasProposalAdminRole = "${@shiro.hasAnyRoles('sysadmin','jdh10')}" === 'true'
|
||||
</script>
|
||||
|
||||
<script>
|
||||
window.sessionStorage.setItem('moduleMenus', JSON.stringify(${json(@shiro.userModuleMenus())}))
|
||||
window.sessionStorage.setItem('menus', JSON.stringify(${json(@shiro.getPrincipalProperty('menus'))}))
|
||||
window.store = new Vuex.Store({
|
||||
plugins: [
|
||||
createPersistedState({
|
||||
key: "zhgh-vuex",
|
||||
paths: ["openedMenus", "activeMenuIndex", "activeMenuModuleId"],
|
||||
storage: window.sessionStorage
|
||||
})
|
||||
],
|
||||
state: {
|
||||
//当前激活的菜单
|
||||
activeMenuIndex: null,
|
||||
//激活的菜单模块
|
||||
activeMenuModuleId: null,
|
||||
moduleMenus: JSON.parse(window.sessionStorage.getItem("moduleMenus")),
|
||||
menus: JSON.parse(window.sessionStorage.getItem("menus"))
|
||||
},
|
||||
mutations: {
|
||||
//设置激活的菜单
|
||||
setActiveMenuIndex(state, payload) {
|
||||
state.activeMenuIndex = payload
|
||||
},
|
||||
//设置激活的菜单模块
|
||||
setActiveMenuModuleId(state, payload) {
|
||||
state.activeMenuModuleId = payload
|
||||
},
|
||||
//设置打开的菜单
|
||||
setOpenedMenus(state, payload) {
|
||||
state.openedMenus = payload
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
pjaxRoute({commit, dispatch, state, getters}, href) {
|
||||
const {pathname, search} = new URL(href, window.location.origin)
|
||||
const matchMenu = state.menus.find(v => v.href === pathname)
|
||||
if (!matchMenu) {
|
||||
commit("setActiveMenuIndex", null)
|
||||
commit("setOpenedMenus", [])
|
||||
if (!state.activeModuleId && state.moduleMenus) {
|
||||
commit("setActiveMenuModuleId", state.moduleMenus[0].id)
|
||||
}
|
||||
pjaxReplace(pathname === "/platform/home" ? pathname : pathname)
|
||||
return
|
||||
}
|
||||
|
||||
//拷贝一份
|
||||
let cloneMenu = JSON.parse(JSON.stringify(matchMenu))
|
||||
//找出所有父菜单包括自己
|
||||
let parentMenus = []
|
||||
while (cloneMenu && cloneMenu.parentId) {
|
||||
cloneMenu = state.menus.find((m) => m.id === cloneMenu.parentId)
|
||||
if (cloneMenu) {
|
||||
parentMenus.unshift(cloneMenu)
|
||||
}
|
||||
}
|
||||
parentMenus.push(matchMenu)
|
||||
|
||||
//获取到该菜单所属的模块
|
||||
const moduleId = state.moduleMenus.find(v=>v.containsMenu.includes(parentMenus[0].id))?.id
|
||||
|
||||
//判断下是否跨模块跳转
|
||||
if (moduleId !== state.activeMenuModuleId) {
|
||||
commit("setActiveMenuModuleId", moduleId)
|
||||
}
|
||||
Vue.nextTick(() => {
|
||||
//重新设置展开菜单
|
||||
commit("setOpenedMenus", parentMenus.map((menu) => menu.id))
|
||||
//设置当前激活菜单
|
||||
commit("setActiveMenuIndex", matchMenu.id)
|
||||
//跳转
|
||||
pjaxReplace(matchMenu.href ? matchMenu.href + (search || "") : "/platform/home")
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
#app {
|
||||
background-color: rgb(240, 242, 245);
|
||||
@@ -303,13 +385,6 @@
|
||||
</div>
|
||||
|
||||
<ul class="nav navbar-nav">
|
||||
<!--<li>
|
||||
<a href="javascript:" slot="reference">
|
||||
<i class="fa fa-th-large" aria-hidden="true"></i>
|
||||
系统模块
|
||||
</a>
|
||||
</li>-->
|
||||
|
||||
<li style="padding:0 10px" class="vivify popIn duration-1500">
|
||||
<el-popover
|
||||
width="450"
|
||||
@@ -337,7 +412,7 @@
|
||||
<el-row gutter="20">
|
||||
<el-col v-for="item in entranceModules" :span="8">
|
||||
<div class="entranceDetail"
|
||||
:class="item.id==selectEntranceModule.id?'entranceDetail-selected':''"
|
||||
:class="item.id==selectEntranceModuleId?'entranceDetail-selected':''"
|
||||
@click="enterEntranceModules(item)">
|
||||
<div class="entranceIcon">
|
||||
<el-image :src="APP_DOMAIN+FILE_STREAM_PREVIEW_ADDRESS+'?id='+item.icon[0].id"
|
||||
@@ -372,56 +447,14 @@
|
||||
</li>
|
||||
</ul>
|
||||
</header>
|
||||
<section class="layout">
|
||||
<section class="layout" style="display: flex;">
|
||||
<!-- sidebar menu -->
|
||||
<aside class="sidebar offscreen-left" id="asideMenu">
|
||||
<!-- main navigation -->
|
||||
<nav class="main-navigation" data-height="auto" data-size="6px" data-distance="0" data-rail-visible="true"
|
||||
data-wheel-step="10">
|
||||
|
||||
<ul id="leftMenu" class="nav leftMenu" style="display: initial;">
|
||||
<li v-for="fm in headerNavBarVueApp.firstMenus">
|
||||
|
||||
<a :href="fm.href && fm.href.startsWith('/')?fm.href:'javascript:;'">
|
||||
<i v-if="Object.keys(headerNavBarVueApp.secondMenus).includes(fm.path)"
|
||||
class="toggle-accordion"></i>
|
||||
<i :class="fm.icon?fm.icon:'ti-map'"></i>
|
||||
<span>
|
||||
{{fm.name}}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
|
||||
<ul class="sub-menu" v-if="Object.keys(headerNavBarVueApp.secondMenus).includes(fm.path)">
|
||||
<li v-for="sm in headerNavBarVueApp.secondMenus[fm.path]">
|
||||
<a :href="sm.href && sm.href.startsWith('/')?sm.href:'javascript:;'">
|
||||
<i v-if="headerNavBarVueApp.secondMenus[sm.path]"
|
||||
class="toggle-accordion"></i>
|
||||
<i :class="sm.icon?sm.icon:'ti-map'" class="leftMenu__twoIcon"></i>
|
||||
<span>
|
||||
{{sm.name}}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<ul class="sub-menu" v-if="headerNavBarVueApp.secondMenus[sm.path]">
|
||||
<li v-for="tm in headerNavBarVueApp.secondMenus[sm.path]">
|
||||
<a :href="tm.href && tm.href.startsWith('/')?tm.href:'javascript:;'">
|
||||
<span>
|
||||
<i class="leftMenu__twoIcon fa fa-circle-o"></i>
|
||||
{{tm.name}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</aside>
|
||||
<div id="asideMenu" class="sidebar">
|
||||
<el-menu unique-opened :default-active="activeMenuIndex" :default-openeds="openedMenus" @select="menuSelect"
|
||||
style="width: 250px;">
|
||||
<menu-list :menus="leftMenus" :depth="0"></menu-list>
|
||||
</el-menu>
|
||||
</div>
|
||||
<!-- main content -->
|
||||
<section class="main-content" id="container">
|
||||
${layoutContent}
|
||||
@@ -430,117 +463,125 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.headerNavBarVueApp = new Vue({
|
||||
const leftMenuApp = new Vue({
|
||||
el: '#asideMenu',
|
||||
components: {
|
||||
"menu-list": {
|
||||
name: "menu-list",
|
||||
template:
|
||||
/*language=HTML*/
|
||||
`
|
||||
<div>
|
||||
<template v-for="(item, index) in menus">
|
||||
<el-submenu :index="item.id" v-if="item.children && item.children.length > 0">
|
||||
<template #title>
|
||||
<i class="fa fa-tags"></i>
|
||||
<span>{{ item.name }}</span>
|
||||
</template>
|
||||
<menu-list :menus="item.children" :depth="depth + 1"/>
|
||||
</el-submenu>
|
||||
<el-menu-item :index="item.id" v-else>
|
||||
<a :href="item.href" data-pjax>
|
||||
<i :class="item.icon ? item.icon : 'fa fa-link'"></i>
|
||||
<span>{{ item.name }}</span>
|
||||
</a>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</div>
|
||||
`,
|
||||
props: ["menus", "depth"]
|
||||
}
|
||||
},
|
||||
store,
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
leftMenus() {
|
||||
if (this.selectEntranceModuleId) {
|
||||
return this.moduleMenus.find(v => v.id === this.selectEntranceModuleId)?.menus
|
||||
}
|
||||
return []
|
||||
},
|
||||
|
||||
moduleMenus() {
|
||||
return this.$store.state.moduleMenus
|
||||
},
|
||||
selectEntranceModuleId() {
|
||||
return this.$store.state.activeMenuModuleId || null
|
||||
},
|
||||
selectEntranceModule() {
|
||||
if (this.selectEntranceModuleId && this.moduleMenus) {
|
||||
return this.moduleMenus.find(v => v.id === this.selectEntranceModuleId)
|
||||
}
|
||||
return {}
|
||||
},
|
||||
//当前选中菜单
|
||||
activeMenuIndex() {
|
||||
return this.$store.state.activeMenuIndex
|
||||
},
|
||||
//当前打开的菜单 数组 包含所有父菜单
|
||||
openedMenus() {
|
||||
return this.$store.state.openedMenus
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
menuSelect(index, indexPath) {
|
||||
this.$store.commit("setActiveMenuIndex", index)
|
||||
this.$store.commit("setOpenedMenus", indexPath)
|
||||
},
|
||||
|
||||
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 = ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.assignmentMenu()
|
||||
}
|
||||
})
|
||||
|
||||
const headerNavBarVueApp = new Vue({
|
||||
el: '#headerNavbar',
|
||||
store,
|
||||
data() {
|
||||
return {
|
||||
entranceModules: [],
|
||||
selectEntranceModule: null,
|
||||
leftMenus: [],
|
||||
firstMenus: [],
|
||||
secondMenus: {},
|
||||
userDefaultModuleId: null,
|
||||
menuPopover: false,
|
||||
appModuleId: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
entranceModules() {
|
||||
return this.$store.state.moduleMenus
|
||||
},
|
||||
selectEntranceModuleId() {
|
||||
return this.$store.state.activeMenuModuleId || null
|
||||
},
|
||||
selectEntranceModule() {
|
||||
if (this.selectEntranceModuleId && this.moduleMenus) {
|
||||
return this.moduleMenus.find(v => v.id === this.selectEntranceModuleId)
|
||||
}
|
||||
return {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getEntranceModule() {
|
||||
const resp = await $.get('/platform/sys/entranceModule/getEntranceModule')
|
||||
if (resp.code === 0) {
|
||||
this.entranceModules = resp.data
|
||||
if (this.selectEntranceModule) {
|
||||
if (this.entranceModules.some(v => v.id === this.selectEntranceModule.id)) {
|
||||
this.selectEntranceModule = this.entranceModules.find(v => v.id === this.selectEntranceModule.id)
|
||||
this.openFirstMenu()
|
||||
return
|
||||
}
|
||||
}
|
||||
if (this.entranceModules) {
|
||||
if (this.userDefaultModuleId) {
|
||||
this.selectEntranceModule = this.entranceModules.find(v => v.id === this.userDefaultModuleId)
|
||||
} else {
|
||||
this.selectEntranceModule = this.entranceModules[0]
|
||||
}
|
||||
this.openFirstMenu()
|
||||
} else {
|
||||
this.goSetAppCenter()
|
||||
}
|
||||
}
|
||||
},
|
||||
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).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)
|
||||
}
|
||||
},
|
||||
async enterEntranceModules(item) {
|
||||
window.sessionStorage.setItem('selectEntranceModule', JSON.stringify(item))
|
||||
this.selectEntranceModule = item
|
||||
await this.getFirstMenus(item.id)
|
||||
this.goHome()
|
||||
this.openFirstMenu()
|
||||
this.menuPopover = false
|
||||
},
|
||||
async getSecondMenus() {
|
||||
const resp = await $.get('/platform/sys/entranceModule/getSecondMenus')
|
||||
if (resp.code === 0) {
|
||||
this.secondMenus = resp.data
|
||||
}
|
||||
},
|
||||
async getFirstMenus(entranceModuleId) {
|
||||
const resp = await $.get('/platform/sys/entranceModule/getFirstMenus', {entranceModuleId})
|
||||
if (resp.code === 0) {
|
||||
this.firstMenus = resp.data
|
||||
this.setAttr()
|
||||
}
|
||||
},
|
||||
setAttr(afterFunc = () => {
|
||||
}) {
|
||||
this.$nextTick(() => {
|
||||
const aTags = document.querySelectorAll('.main-navigation a')
|
||||
aTags.forEach(v => {
|
||||
if (v.href === 'javascript:;') {
|
||||
v.removeAttribute("data-pjax")
|
||||
} else {
|
||||
v.setAttribute("data-pjax", "")
|
||||
}
|
||||
if (v.getAttribute('class') === 'active') {
|
||||
v.setAttribute('class', '')
|
||||
}
|
||||
})
|
||||
|
||||
const openLiTags = document.querySelectorAll('.main-navigation li.open')
|
||||
openLiTags.forEach(v => {
|
||||
v.setAttribute('class', '')
|
||||
const childNodes = v.childNodes
|
||||
childNodes.forEach(c => {
|
||||
if (c.nodeType === 1 && c.tagName && c.tagName.toUpperCase() === 'UL'.toUpperCase() && c.className === 'sub-menu') {
|
||||
c.style.display = 'none'
|
||||
}
|
||||
})
|
||||
})
|
||||
afterFunc()
|
||||
})
|
||||
this.$store.commit('setActiveMenuModuleId', item.id)
|
||||
},
|
||||
goHome() {
|
||||
$.pjax({
|
||||
@@ -549,8 +590,10 @@
|
||||
fragment: '#container',
|
||||
timeout: 8000
|
||||
});
|
||||
this.setAttr()
|
||||
this.closeAllMenu()
|
||||
this.$store.commit('setActiveMenuIndex', null)
|
||||
this.$store.commit("setOpenedMenus", [])
|
||||
|
||||
|
||||
},
|
||||
goSetAppCenter() {
|
||||
$.pjax({
|
||||
@@ -559,23 +602,6 @@
|
||||
fragment: '#container',
|
||||
timeout: 8000
|
||||
});
|
||||
this.setAttr()
|
||||
},
|
||||
closeAllMenu() {
|
||||
const subMenus = document.querySelectorAll('ul.sub-menu')
|
||||
subMenus.forEach(v => {
|
||||
v.style.display = 'none'
|
||||
})
|
||||
|
||||
const menus = document.querySelectorAll('.main-navigation li.open')
|
||||
menus.forEach(v => {
|
||||
v.setAttribute('class', '')
|
||||
})
|
||||
|
||||
const aTags = document.querySelectorAll('.main-navigation a.active')
|
||||
aTags.forEach(v => {
|
||||
v.setAttribute('class', '')
|
||||
})
|
||||
},
|
||||
async getUserDefaultEntranceModuleId() {
|
||||
const resp = await $.get('/platform/sys/entranceModule/getUserDefaultEntranceModuleId')
|
||||
@@ -611,37 +637,48 @@
|
||||
this.selectEntranceModule = JSON.parse(selectEntranceModuleStr)
|
||||
this.appModuleId = this.selectEntranceModule.id
|
||||
}
|
||||
await this.getEntranceModule()
|
||||
await this.getFirstMenus(this.selectEntranceModule.id)
|
||||
await this.getSecondMenus()
|
||||
this.setAttr()
|
||||
// let pjax_url = window.sessionStorage.getItem('pjax_url')
|
||||
// pjax_url = pjax_url.replace(window.location.origin, '')
|
||||
// $.pjax({
|
||||
// url: pjax_url,
|
||||
// container: '#container',
|
||||
// fragment: '#container',
|
||||
// timeout: 8000
|
||||
// });
|
||||
// const a_selector = '#leftMenu li a[href="' + pjax_url + '"]'
|
||||
// const a = document.querySelector(a_selector)
|
||||
// setTimeout(() => {
|
||||
// $(a).parent().parents("li").addClass("open")
|
||||
// $(a).parent().parents('ul.sub-menu').attr('style', 'display:block')
|
||||
// }, 100)
|
||||
},
|
||||
|
||||
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.$store.commit('setActiveMenuIndex', menuIndex)
|
||||
this.$store.commit("setOpenedMenus", menuIndexPath)
|
||||
leftMenuApp.assignmentMenu()
|
||||
} else {
|
||||
this.enterEntranceModules(JSON.parse(window.sessionStorage.getItem('moduleMenus'))[0])
|
||||
this.$store.commit('setActiveMenuIndex', null)
|
||||
this.$store.commit("setOpenedMenus", [])
|
||||
leftMenuApp.assignmentMenu()
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
watch: {},
|
||||
created() {
|
||||
this.init()
|
||||
console.log('init')
|
||||
}
|
||||
})
|
||||
// this.matchMenu()
|
||||
this.$store.dispatch('pjaxRoute', window.location)
|
||||
|
||||
new Vue({
|
||||
el: '#asideMenu',
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ const batchInsert = {
|
||||
const questions = [];
|
||||
// 遍历每个问题文本
|
||||
questionTexts.forEach((questionText, index) => {
|
||||
debugger
|
||||
// 提取问题编号和题干
|
||||
const match = questionText.trim().split('\n').slice(0, 1).join('').match(/^(?:\d+\.|\d+、)?\s*(.*?)\s*\[(.*题)\]\s*(?:\((\d+)分\)|\((\d+)分\))?$/);
|
||||
if (match) {
|
||||
|
||||
@@ -6,7 +6,7 @@ const appModule = {
|
||||
<div style="display: flex;gap: 20px;overflow-x: auto">
|
||||
<template v-for="item in entranceModules">
|
||||
<div :key="item.id" class="v-item-handle" @click="enterEntranceModules(item)"
|
||||
:class="item.id===id?'appModuleCard':''">
|
||||
:class="item.id===selectEntranceModuleId?'appModuleCard':''">
|
||||
<el-image :src="CREATE_PREVIEW_URL(item.icon[0].id)" style="height: 50px;width: 50px;border-radius: 50%"></el-image>
|
||||
<span class="v-item-handle-label">
|
||||
{{ item.moduleName }}
|
||||
@@ -17,29 +17,18 @@ const appModule = {
|
||||
</el-card>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
id: "",
|
||||
entranceModules: []
|
||||
store,
|
||||
computed: {
|
||||
entranceModules() {
|
||||
return this.$store.state.moduleMenus
|
||||
},
|
||||
selectEntranceModuleId(){
|
||||
return this.$store.state.activeMenuModuleId || null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async enterEntranceModules(item) {
|
||||
headerNavBarVueApp.appModuleId = item.id
|
||||
this.id = item.id
|
||||
headerNavBarVueApp.enterEntranceModules(item)
|
||||
},
|
||||
async getEntranceModule() {
|
||||
const resp = await $.get('/platform/sys/entranceModule/getEntranceModule')
|
||||
if (resp.code === 0) {
|
||||
this.entranceModules = resp.data
|
||||
}
|
||||
this.$store.commit('setActiveMenuModuleId', item.id)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getEntranceModule()
|
||||
setTimeout(() => {
|
||||
// this.id = headerNavBarVueApp.appModuleId
|
||||
}, 400)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user