feat:菜单权限及综合搜索蒙版

1. 修改n-modal库 新增showMask的props
2. 修复登录后用户没有首页的菜单权限仍可跳转到首页的问题
pull/8/head
刘释隆 2 years ago
commit b5a5357e6e

@ -27,6 +27,29 @@ index 3aacec9..a63ab54 100644
key: "controlled-success",
class: `${mergedClsPrefix}-form-item-feedback ${mergedClsPrefix}-form-item-feedback--success`
}, feedbackNodes) : h("div", {
diff --git a/node_modules/naive-ui/es/modal/src/Modal.mjs b/node_modules/naive-ui/es/modal/src/Modal.mjs
index 9508b72..63f417b 100644
--- a/node_modules/naive-ui/es/modal/src/Modal.mjs
+++ b/node_modules/naive-ui/es/modal/src/Modal.mjs
@@ -13,6 +13,10 @@ import { modalInjectionKey, modalProviderInjectionKey } from "./interface.mjs";
import style from "./styles/index.cssr.mjs";
export const modalProps = Object.assign(Object.assign(Object.assign(Object.assign({}, useTheme.props), {
show: Boolean,
+ showMask: {
+ type: Boolean,
+ default: true
+ },
unstableShowMask: {
type: Boolean,
default: true
@@ -309,6 +313,7 @@ export default defineComponent({
"aria-hidden": true,
ref: "containerRef",
class: `${mergedClsPrefix}-modal-mask`,
+ style: this.showMask ? '' : {background:'none'},
onClick: this.handleClickoutside
}) : null;
}
diff --git a/node_modules/naive-ui/es/pagination/src/Pagination.mjs b/node_modules/naive-ui/es/pagination/src/Pagination.mjs
index 5bd975b..e1c6ebc 100644
--- a/node_modules/naive-ui/es/pagination/src/Pagination.mjs
@ -161,3 +184,71 @@ index 4f47aad..6dae078 100644
});
}
}))) : null));
diff --git a/node_modules/naive-ui/lib/modal/src/Modal.js b/node_modules/naive-ui/lib/modal/src/Modal.js
index 47f6ac2..801e8e7 100644
--- a/node_modules/naive-ui/lib/modal/src/Modal.js
+++ b/node_modules/naive-ui/lib/modal/src/Modal.js
@@ -17,7 +17,11 @@ const presetProps_1 = require("./presetProps");
const BodyWrapper_1 = __importDefault(require("./BodyWrapper"));
const interface_1 = require("./interface");
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
-exports.modalProps = Object.assign(Object.assign(Object.assign(Object.assign({}, _mixins_1.useTheme.props), { show: Boolean, unstableShowMask: {
+exports.modalProps = Object.assign(Object.assign(Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
+ show: Boolean, showMask: {
+ type: Boolean,
+ default: true,
+ }, unstableShowMask: {
type: Boolean,
default: true
}, maskClosable: {
@@ -38,7 +42,8 @@ exports.modalProps = Object.assign(Object.assign(Object.assign(Object.assign({},
}, closeOnEsc: {
type: Boolean,
default: true
- }, blockScroll: { type: Boolean, default: true } }), presetProps_1.presetProps), {
+ }, blockScroll: { type: Boolean, default: true }
+}), presetProps_1.presetProps), {
// events
onEsc: Function, 'onUpdate:show': [Function, Array], onUpdateShow: [Function, Array], onAfterEnter: Function, onBeforeLeave: Function, onAfterLeave: Function, onClose: Function, onPositiveClick: Function, onNegativeClick: Function, onMaskClick: Function,
// private
@@ -47,7 +52,8 @@ exports.modalProps = Object.assign(Object.assign(Object.assign(Object.assign({},
default: undefined
},
// deprecated
- overlayStyle: [String, Object], onBeforeHide: Function, onAfterHide: Function, onHide: Function });
+ overlayStyle: [String, Object], onBeforeHide: Function, onAfterHide: Function, onHide: Function
+});
exports.default = (0, vue_1.defineComponent)({
name: 'Modal',
inheritAttrs: false,
@@ -226,21 +232,25 @@ exports.default = (0, vue_1.defineComponent)({
var _a;
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
const { unstableShowMask } = this;
- return (0, vue_1.withDirectives)((0, vue_1.h)("div", { role: "none", ref: "containerRef", class: [
+ return (0, vue_1.withDirectives)((0, vue_1.h)("div", {
+ role: "none", ref: "containerRef", class: [
`${mergedClsPrefix}-modal-container`,
this.themeClass,
this.namespace
- ], style: this.cssVars },
- (0, vue_1.h)(BodyWrapper_1.default, Object.assign({ style: this.overlayStyle }, this.$attrs, { ref: "bodyWrapper", displayDirective: this.displayDirective, show: this.show, preset: this.preset, autoFocus: this.autoFocus, trapFocus: this.trapFocus, blockScroll: this.blockScroll }, this.presetProps, { onEsc: this.handleEsc, onClose: this.handleCloseClick, onNegativeClick: this.handleNegativeClick, onPositiveClick: this.handlePositiveClick, onBeforeLeave: this.handleBeforeLeave, onAfterEnter: this.onAfterEnter, onAfterLeave: this.handleAfterLeave, onClickoutside: unstableShowMask ? undefined : this.handleClickoutside, renderMask: unstableShowMask
+ ], style: this.cssVars
+ },
+ (0, vue_1.h)(BodyWrapper_1.default, Object.assign({ style: this.overlayStyle }, this.$attrs, { ref: "bodyWrapper", displayDirective: this.displayDirective, show: this.show, preset: this.preset, autoFocus: this.autoFocus, trapFocus: this.trapFocus, blockScroll: this.blockScroll }, this.presetProps, {
+ onEsc: this.handleEsc, onClose: this.handleCloseClick, onNegativeClick: this.handleNegativeClick, onPositiveClick: this.handlePositiveClick, onBeforeLeave: this.handleBeforeLeave, onAfterEnter: this.onAfterEnter, onAfterLeave: this.handleAfterLeave, onClickoutside: unstableShowMask ? undefined : this.handleClickoutside, renderMask: unstableShowMask
? () => {
var _a;
return ((0, vue_1.h)(vue_1.Transition, { name: "fade-in-transition", key: "mask", appear: (_a = this.internalAppear) !== null && _a !== void 0 ? _a : this.isMounted }, {
default: () => {
- return this.show ? ((0, vue_1.h)("div", { "aria-hidden": true, ref: "containerRef", class: `${mergedClsPrefix}-modal-mask`, onClick: this.handleClickoutside })) : null;
+ return this.show ? ((0, vue_1.h)("div", { "aria-hidden": true, ref: "containerRef", class: `${mergedClsPrefix}-modal-mask` ,style:this.showMask ? '' : {background:'none'}, onClick: this.handleClickoutside })) : null;
}
}));
}
- : undefined }), this.$slots)), [
+ : undefined
+ }), this.$slots)), [
[
vdirs_1.zindexable,
{

@ -115,7 +115,7 @@ function highlightText(text, query) {
<div class="list_title">
历史搜索
</div>
<div class="history-list flex">
<div class="flex history-list">
<div class="tag-wrap">
<div v-for="(item, index) of historyList" :key="index" class="tag" @click="handlerHistory(item.historyname)">
{{ item.historyname }}

@ -14,7 +14,7 @@ defineExpose({
<template>
<div>
<n-modal v-model:show="show" :mask="false" transform-origin="center">
<n-modal v-model:show="show" :mask="false" :showMask="false" transform-origin="center">
<Search @close="show = false" />
</n-modal>
</div>

@ -54,16 +54,16 @@ export default defineComponent({
: "",
icon: undefined,
key: item.resKey,
label: item.name,
label: item.description,
meta: {
title: item.name,
title: item.description,
permissions: [item.resKey],
},
path: item.resUrl,
name: item.resKey,
svgname: item.icon,
svgsize: 32,
title: item.name,
svgsize: item.resUrl == "/home" ? 60 : 22,
title: item.description,
};
return v;
});

@ -152,7 +152,6 @@ const rules = {
function handleSubmit(e) {
e.preventDefault();
console.log(formRef.value,'formRef')
loginSuccess.value = true;
formRef.value.validate(async (errors) => {
if (!errors) {
@ -165,7 +164,6 @@ function handleSubmit(e) {
codetoken: userStore.getCapToken,
agentcode: enterprisecode,
};
try {
const { code, message: msg } = await userStore.login(params);
loginRejectMessge.value = msg;
@ -177,11 +175,14 @@ function handleSubmit(e) {
localStorage.removeItem("LOGIN_FORM_PASS");
}
loginSuccess.value = true;
await userStore.getInformation();
const { data: userInfo } = await userStore.getInformation();
message.destroyAll();
const toPath = decodeURIComponent((route.query?.redirect || "/") as string);
message.success("登录成功,即将进入系统");
if (route.name === LOGIN_NAME) router.replace("/");
if (route.name === LOGIN_NAME)
router.replace(
userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/"
);
else router.replace(toPath);
} else {
loginSuccess.value = false;
@ -245,11 +246,14 @@ function handleSmsSubmit(e) {
loginSuccess.value = true;
// const { code, message: msg } = await userStore.login(params)
await userStore.setStorageToken(res.data);
await userStore.getInformation();
const { data: userInfo } = await userStore.getInformation();
message.destroyAll();
const toPath = decodeURIComponent((route.query?.redirect || "/") as string);
message.success("登录成功,即将进入系统");
if (route.name === LOGIN_NAME) router.replace("/");
if (route.name === LOGIN_NAME)
router.replace(
userInfo.frontmenuTList ? userInfo.frontmenuTList[0]["resUrl"] : "/"
);
else router.replace(toPath);
} else {
message.destroyAll();

Loading…
Cancel
Save