调整 cool/components 为 cool/modules

This commit is contained in:
icssoa 2021-02-28 22:24:54 +08:00
parent b4b715ac3f
commit ca41e43c80
157 changed files with 155 additions and 1086 deletions

View File

@ -36,7 +36,7 @@ yarn
yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
```
## 安装扩展组件的依赖
## 安装 cool/modules 模块的依赖
安装 `cl-admin-cli` 脚手架:
@ -44,7 +44,7 @@ yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
npm install cl-admin-cli -g
```
安装扩展组件依赖:
安装模块依赖:
```shell
cl install

View File

@ -1,21 +0,0 @@
import Common from "./common";
import Open from "./open";
import SysUser from "./user";
import SysMenu from "./menu";
import SysRole from "./role";
import SysDept from "./dept";
import PluginInfo from "./plugin";
export default {
common: new Common(),
open: new Open(),
system: {
user: new SysUser(),
menu: new SysMenu(),
role: new SysRole(),
dept: new SysDept()
},
plugin: {
info: new PluginInfo()
}
};

View File

@ -1,33 +0,0 @@
export default {
state: {
info: {},
list: [],
modules: []
},
getters: {
// 组件信息
components: (state) => state.info,
// 组件列表
componentList: (state) => state.list,
// 组件模块
componentModules: (state) => state.modules
},
mutations: {
SET_COMPONENT(state, list) {
let d = {};
list.forEach((e) => {
d[e.name] = e;
});
state.list = list;
state.info = d;
},
SET_COMPONENT_MODULES(state, list) {
state.modules = list;
}
}
};

View File

@ -1,7 +0,0 @@
import Codemirror from "./components";
export default {
components: {
Codemirror
}
};

View File

@ -1,11 +0,0 @@
{
"name": "codemirror",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"codemirror": "^5.59.2",
"js-beautify": "^1.13.5",
"vue-codemirror": "^4.0.6"
}
}

View File

@ -1,10 +0,0 @@
{
"name": "copy",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"clipboard": "^2.0.6",
"tape": "^5.1.1"
}
}

View File

@ -1,7 +0,0 @@
import EditorQuill from "./components";
export default {
components: {
EditorQuill
}
};

View File

@ -1,9 +0,0 @@
{
"name": "editor-quill",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"quill": "^1.3.7"
}
}

View File

@ -1,4 +0,0 @@
import service from "./service";
import views from "./views";
export default { service, views };

View File

@ -1,7 +0,0 @@
import SysLog from "./log";
export default {
system: {
log: new SysLog()
}
};

View File

@ -1,8 +0,0 @@
export default [
{
moduleName: "sys.log",
label: "请求日志",
path: "/sys/log",
component: () => import("./log")
}
];

View File

@ -1,4 +0,0 @@
import service from "./service";
import views from './views'
export default { service, views };

View File

@ -1,7 +0,0 @@
import SysParam from "./param";
export default {
system: {
param: new SysParam()
}
};

View File

@ -1,8 +0,0 @@
export default [
{
moduleName: "sys.param",
label: "参数列表",
path: "/sys/param",
component: () => import("./param")
}
];

View File

@ -1,4 +0,0 @@
import service from "./service";
import views from './views'
export default { service, views };

View File

@ -1,7 +0,0 @@
import SysInfo from "./info";
export default {
system: {
info: new SysInfo()
}
};

View File

@ -1,8 +0,0 @@
export default [
{
moduleName: "sys.perf",
label: "状态监控",
path: "/sys/perf",
component: () => import("./perf")
}
];

View File

@ -1,7 +0,0 @@
import service from "./service";
import views from './views'
export default {
service,
views
};

View File

@ -1,9 +0,0 @@
{
"name": "task",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"vuedraggable": "^2.24.3"
}
}

View File

@ -1,7 +0,0 @@
import SysTask from "./task";
export default {
system: {
task: new SysTask()
}
};

View File

@ -1,8 +0,0 @@
export default [
{
moduleName: "sys.task",
label: "任务列表",
path: "/sys/task",
component: () => import("./task")
}
];

View File

@ -1,11 +0,0 @@
Promise.prototype.done = function (cb) {
let P = this.constructor;
return this.then(
(value) => P.resolve(cb()).then(() => value),
(reason) =>
P.resolve(cb()).then(() => {
throw reason;
})
);
};

View File

@ -1,12 +0,0 @@
import { BaseService, Service, Permission } from "./service";
import { SET_SERVICE, SET_ROUTER, SET_COMPONENT } from "./set";
import "./common";
async function bootstrap(options = {}) {
const { components } = options;
SET_ROUTER();
SET_SERVICE();
SET_COMPONENT({ events: components });
}
export { Service, Permission, BaseService, bootstrap };

View File

@ -1,118 +0,0 @@
import request from "@/service/request";
import { baseUrl } from "@/config/env";
export default class BaseService {
constructor() {
const crud = {
page: "page",
list: "list",
info: "info",
add: "add",
delete: "delete",
update: "update"
};
if (!this.permission) {
this.permission = {};
}
for (let i in crud) {
if (this.namespace) {
this.permission[i] = this.namespace.replace(/\//g, ":") + ":" + crud[i];
} else {
this.permission[i] = crud[i];
}
}
}
request(options = {}) {
if (!options.params) {
options.params = {};
}
let path = "";
if (process.env.NODE_ENV == "development") {
path = this.proxy || baseUrl;
} else {
if (this.proxy) {
path = this.url;
} else {
path = baseUrl;
}
}
if (this.namespace) {
path += "/" + this.namespace;
}
if (options.url.indexOf("http") !== 0) {
if (options.url[0] === "@") {
options.url = options.url.replace("@", "");
} else {
options.url = path + options.url;
}
}
return request(options);
}
list(params) {
return this.request({
url: "/list",
method: "POST",
data: {
...params
}
});
}
page(params) {
return this.request({
url: "/page",
method: "POST",
data: {
...params
}
});
}
info(params) {
return this.request({
url: "/info",
params: {
...params
}
});
}
update(params) {
return this.request({
url: "/update",
method: "POST",
data: {
...params
}
});
}
delete(params) {
return this.request({
url: "/delete",
method: "POST",
data: {
...params
}
});
}
add(params) {
return this.request({
url: "/add",
method: "POST",
data: {
...params
}
});
}
}

View File

@ -1,40 +0,0 @@
import { isObject } from "../utils";
export function Permission(value) {
return function (target, key, descriptor) {
if (!target.permission) {
target.permission = {};
}
setTimeout(() => {
target.permission[key] = (
(target.namespace ? target.namespace + "/" : "") + value
).replace(/\//g, ":");
}, 0);
return descriptor;
};
}
export function Service(value) {
const { devServer } = require("@/../vue.config.js");
return function (target) {
// 命名
if (typeof value == "string") {
target.prototype.namespace = value;
}
// 复杂项
if (isObject(value)) {
let { proxy, namespace, url } = value;
target.prototype.namespace = namespace;
if (proxy) {
target.prototype.proxy = proxy;
target.prototype.url = url || devServer.proxy[proxy].target;
}
}
};
}

View File

@ -1,4 +0,0 @@
import BaseService from "./base";
import { Service, Permission } from "./desorator";
export { BaseService, Service, Permission };

View File

@ -1,150 +0,0 @@
import Vue from "vue";
import Cool from "cool";
import store from '@/store'
import router from '@/router'
import { deepMerge, isFunction, isObject } from "../utils";
export default function (options = {}) {
if (!options.events) {
options.events = {};
}
// 组件模块
let componentModules = [];
// 组件列表
let components = [];
// 安装组件
function install(comp) {
let { store: _store, components, service, directives, filters, pages, views, name } = comp;
let { onInstall, onSuccess, onFail } = options.events[name] || {};
try {
const next = () => {
// 注册vuex模块
if (_store) {
for (let i in _store) {
store.registerModule(`${name}-${i}`, _store[i]);
}
}
// 注册组件
if (components) {
for (let i in components) {
Vue.component(components[i].name, components[i]);
}
}
// 注册请求服务
if (service) {
deepMerge(store.$service, service);
}
// 注册指令
if (directives) {
for (let i in directives) {
Vue.directive(i, directives[i]);
}
}
// 注册过滤器
if (filters) {
for (let i in filters) {
Vue.filter(i, filters[i]);
}
}
// 注册页面
if (pages) {
pages.forEach((e) => {
router.addRoute(e);
});
}
// 注册视图
if (views) {
views.forEach((e) => {
if (!e.meta) {
e.meta = {};
}
if (e.moduleName) {
componentModules.push(e);
} else {
e.meta.label = e.label;
if (e.path) {
router.$plugin.addViews([e], {
ignore404: true
});
} else {
console.error(`[${name}-views]path in null`);
}
}
});
}
// 包安装成功
if (onSuccess) onSuccess(comp);
};
// 安装前
if (onInstall) {
onInstall(comp, { next });
} else {
next();
}
} catch (e) {
console.error(e);
// 安装失败
if (onFail) onFail(comp, e);
}
}
// 解析组件
Cool.components.map((e) => {
if (!e) {
return null;
}
let comp = null;
if (isObject(e)) {
comp = e;
} else {
comp = {
name: e[0],
value: e[1],
options: e[2]
};
}
if (comp.value) {
if (isFunction(comp.value.install)) {
comp.value = comp.value.install(Vue, comp.options);
}
}
// 是否开启
if (comp.options && comp.options.enable === false) {
return null;
}
if (comp) {
comp = {
name: comp.name,
options: comp.options,
...comp.value
};
components.push(comp);
install(comp);
}
});
// 设置缓存
store.commit("SET_COMPONENT_MODULES", componentModules);
store.commit("SET_COMPONENT", components);
}

View File

@ -1,5 +0,0 @@
import SET_SERVICE from "./service";
import SET_ROUTER from "./router";
import SET_COMPONENT from "./component";
export { SET_SERVICE, SET_ROUTER, SET_COMPONENT };

View File

@ -1,116 +0,0 @@
import VueRouter from 'vue-router'
import { Message } from "element-ui";
import store from "@/store";
import router, { ignore } from '@/router'
import storage from '../utils/storage'
// Remove Navigating to current location (XXX) is not allowed
const routerPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return routerPush.call(this, location).catch((error) => error);
};
export default function () {
router.$plugin = {
addViews: (list, options) => {
if (!options) {
options = {};
}
// Parse route config
list.map((e) => {
if (!e.component) {
let url = e.viewPath;
if (url) {
if (
/^(http[s]?:\/\/)([0-9a-z.]+)(:[0-9]+)?([/0-9a-z.]+)?(\?[0-9a-z&=]+)?(#[0-9-a-z]+)?/i.test(
url
)
) {
e.meta.iframeUrl = url;
e.component = () => import(`cool/components/base/pages/iframe/index.vue`);
} else {
if (url.indexOf("views/") === 0) {
e.component = () => import(`@/${url}`);
} else {
console.error(url, "异常");
}
}
} else {
e.redirect = "/404";
}
}
});
// Batch add route
list.forEach((e) => {
router.addRoute("index", e);
});
// Add 404 rule
if (!options.ignore404) {
router.addRoute({
path: "*",
redirect: "/404"
});
}
},
to: (url) => {
if (router.path != url) {
router.push(url);
}
}
};
router.beforeEach((to, from, next) => {
const { token, browser } = store.getters
if (token) {
if (to.path.indexOf('/login') === 0) {
// 登录成功且 token 未过期,回到首页
if (!storage.isExpired('token')) {
return next('/')
}
} else {
// 添加路由进程
store.commit("ADD_PROCESS", {
label: (to.meta && to.meta.label) || to.name,
value: to.fullPath
});
}
} else {
if (!ignore.token.some((e) => to.path.indexOf(e) === 0)) {
return next("/login");
}
}
// H5 下关闭左侧菜单
if (browser.isMobile) {
store.commit("COLLAPSE_MENU", true);
}
next()
})
let lock = false;
router.onError((err) => {
if (!lock) {
lock = true;
if (err.code == "MODULE_NOT_FOUND") {
console.error(err.message.replace("Cannot find module ", ""), "路由组件不存在");
Message.error(`路由组件路径错误`);
} else {
console.error(err);
}
setTimeout(() => {
lock = false;
}, 0);
}
});
}

View File

@ -1,53 +0,0 @@
import Vue from "vue";
import path from "path";
import store from '@/store'
export default function () {
const files = require.context("@/service/", true, /\.js$/);
const ignore = ["./request.js"];
let modules = {};
files
.keys()
.filter((e) => !ignore.includes(e))
.map((e) => {
if (e.includes("--ignore")) {
return false;
}
let list = e.substr(2).split("/");
let parents = list.slice(0, list.length - 1);
let name = path.basename(e, ".js");
let curr = modules;
let prev = null;
let key = null;
parents.forEach((k) => {
if (!curr[k]) {
curr[k] = {};
}
prev = curr;
curr = curr[k];
key = k;
});
let ep = files(e);
if (ep.default) {
let service = new ep.default();
if (name == "index") {
prev[key] = service;
} else {
curr[name] = service;
}
} else {
console.error(`Service must export default [${e}]`);
}
});
Vue.prototype.$service = store.$service = modules;
}

View File

@ -1,256 +0,0 @@
import { routerMode } from "@/config/env";
export function getUrlParam(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
let r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURIComponent(r[2]);
return null;
}
export function isPc() {
const userAgentInfo = navigator.userAgent;
const Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
let flag = true;
for (let v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}
export const isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
export function getBrowser() {
let ua = navigator.userAgent.toLowerCase();
let btypeInfo = (ua.match(/firefox|chrome|safari|opera/g) || "other")[0];
if ((ua.match(/msie|trident/g) || [])[0]) {
btypeInfo = "msie";
}
let pc = "";
let prefix = "";
let plat = "";
let isTocuh =
"ontouchstart" in window || ua.indexOf("touch") !== -1 || ua.indexOf("mobile") !== -1;
if (isTocuh) {
if (ua.indexOf("ipad") !== -1) {
pc = "pad";
} else if (ua.indexOf("mobile") !== -1) {
pc = "mobile";
} else if (ua.indexOf("android") !== -1) {
pc = "androidPad";
} else {
pc = "pc";
}
} else {
pc = "pc";
}
switch (btypeInfo) {
case "chrome":
case "safari":
case "mobile":
prefix = "webkit";
break;
case "msie":
prefix = "ms";
break;
case "firefox":
prefix = "Moz";
break;
case "opera":
prefix = "O";
break;
default:
prefix = "webkit";
break;
}
plat = ua.indexOf("android") > 0 ? "android" : navigator.platform.toLowerCase();
return {
version: (ua.match(/[\s\S]+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
plat: plat,
type: btypeInfo,
pc: pc,
prefix: prefix,
isMobile: pc == "pc" ? false : true
};
}
export function href(path, newWindow) {
let { search, origin } = window.location;
let url = "";
if (routerMode == "history") {
url = origin + path;
} else {
url = origin + search + "#" + path;
}
if (newWindow) {
window.open(url);
} else {
window.location.href = url;
}
}
export function orderBy(list, key) {
return list.sort((a, b) => a[key] - b[key]);
}
export function deepTree(list) {
let newList = [];
let map = {};
list.forEach((e) => (map[e.id] = e));
list.forEach((e) => {
let parent = map[e.parentId];
if (parent) {
(parent.children || (parent.children = [])).push(e);
} else {
newList.push(e);
}
});
const fn = (list) => {
list.map((e) => {
if (e.children instanceof Array) {
e.children = orderBy(e.children, "orderNum");
fn(e.children);
}
});
};
fn(newList);
return orderBy(newList, "orderNum");
}
export function revDeepTree(list = []) {
let d = [];
let id = 0;
const deep = (list, parentId) => {
list.forEach((e) => {
e.id = id++;
e.parentId = parentId;
d.push(e);
if (e.children && isArray(e.children)) {
deep(e.children, e.id);
}
});
};
deep(list || [], null);
return d;
}
export function debounce(fn, delay) {
let timer = null;
return function () {
let args = arguments;
let context = this;
if (timer) {
clearTimeout(timer);
timer = setTimeout(function () {
fn.apply(context, args);
}, delay);
} else {
timer = setTimeout(function () {
fn.apply(context, args);
}, delay);
}
};
}
export function isArray(value) {
if (typeof Array.isArray === "function") {
return Array.isArray(value);
} else {
return Object.prototype.toString.call(value) === "[object Array]";
}
}
export function isObject(value) {
return Object.prototype.toString.call(value) === "[object Object]";
}
export function isNumber(value) {
return !isNaN(Number(value));
}
export function isFunction(value) {
return typeof value == "function";
}
export function isString(value) {
return typeof value == "string";
}
export function isEmpty(value) {
if (isArray(value)) {
return value.length === 0;
}
if (isObject(value)) {
return Object.keys(value).length === 0;
}
return value === "" || value === undefined || value === null;
}
export function last(data) {
if (isArray(data) || isString(data)) {
return data[data.length - 1];
}
}
export function cloneDeep(obj) {
let d = isArray(obj) ? obj : {};
if (isObject(obj)) {
for (let key in obj) {
if (obj.hasOwnProperty && obj.hasOwnProperty(key)) {
if (obj[key] && typeof obj[key] === "object") {
d[key] = cloneDeep(obj[key]);
} else {
d[key] = obj[key];
}
}
}
}
return d;
}
export function clone(obj) {
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
}
export function deepMerge(a, b) {
let k;
for (k in b) {
a[k] =
a[k] && a[k].toString() === "[object Object]" ? deepMerge(a[k], b[k]) : (a[k] = b[k]);
}
return a;
}
export function contains(parent, node) {
if (document.documentElement.contains) {
return parent !== node && parent.contains(node);
} else {
while (node && (node = node.parentNode)) if (node === parent) return true;
return false;
}
}

View File

@ -1,81 +0,0 @@
import store from 'store'
export default {
// 后缀标识
suffix: "_deadtime",
/**
* 获取
* @param {string} key 关键字
*/
get(key) {
return store.get(key)
},
/**
* 获取全部
*/
info() {
let d = {}
store.each(function (value, key) {
d[key] = value
})
return d
},
/**
* 设置
* @param {string} key 关键字
* @param {*} value
* @param {number} expires 过期时间
*/
set(key, value, expires) {
store.set(key, value);
if (expires) {
store.set(`${key}${this.suffix}`, Date.parse(new Date()) + expires * 1000);
}
},
/**
* 是否过期
* @param {string} key 关键字
*/
isExpired(key) {
return (this.getExpiration(key) || 0) - Date.parse(new Date()) <= 2000;
},
/**
* 获取到期时间
* @param {string} key 关键字
*/
getExpiration(key) {
return this.get(key + this.suffix)
},
/**
* 移除
* @param {string} key 关键字
*/
remove(key) {
store.remove(key)
this.removeExpiration(key)
},
/**
* 移除到期时间
* @param {string} key 关键字
*/
removeExpiration(key) {
store.remove(key + this.suffix)
},
/**
* 清理
*/
clearAll() {
store.clearAll()
}
};

View File

@ -1,20 +1,13 @@
import Base from "./components/base";
import Upload from "./components/upload";
import Chat from "./components/chat";
import Codemirror from "./components/codemirror";
import Copy from "./components/copy";
import Demo from "./components/demo";
import Distpicker from "./components/distpicker";
import EditorQuill from "./components/editor-quill";
import Log from "./components/log";
import Param from "./components/param";
import Perf from "./components/perf";
import Task from "./components/task";
import Base from "./modules/base";
import Upload from "./modules/upload";
import Copy from "./modules/copy";
import Demo from "./modules/demo";
import Distpicker from "./modules/distpicker";
import Crud from "cl-admin-crud";
import Export from "cl-admin-export";
export default {
components: [
modules: [
["base", Base],
[
"upload",
@ -41,15 +34,8 @@ export default {
}
],
["export", Export],
// ["chat", Chat],
["codemirror", Codemirror],
["copy", Copy],
["demo", Demo],
["distpicker", Distpicker],
["editor-quill", EditorQuill],
["log", Log],
["param", Param],
["perf", Perf],
["task", Task]
["demo", Demo]
]
};

View File

@ -14,6 +14,8 @@ import MenuPerms from "./menu/perms";
import MenuTree from "./menu/tree";
import RoleSelect from "./role/select";
import RolePerms from "./role/perms";
import EditorQuill from "./editor-quill";
import Codemirror from "./codemirror";
export default {
Avatar,
@ -31,5 +33,7 @@ export default {
MenuPerms,
MenuTree,
RoleSelect,
RolePerms
RolePerms,
EditorQuill,
Codemirror
};

View File

@ -25,7 +25,7 @@
@change="onModuleChange"
>
<el-option
v-for="(item, index) in componentModules"
v-for="(item, index) in moduleViews"
:key="index"
:label="item.label"
:value="item.moduleName"
@ -61,7 +61,7 @@ export default {
},
computed: {
...mapGetters(["componentModules"])
...mapGetters(["moduleViews"])
},
watch: {
@ -91,7 +91,7 @@ export default {
methods: {
async onModuleChange(val) {
const { label, keepAlive, icon, path, component } = this.componentModules.find(
const { label, keepAlive, icon, path, component } = this.moduleViews.find(
(e) => e.moduleName == val
);

View File

@ -29,7 +29,7 @@
</template>
<script>
import { iconList } from "cool/components/base";
import { iconList } from "cool/modules/base";
export default {
name: "cl-menu-icons",

View File

@ -11,7 +11,7 @@
<script>
import { mapMutations, mapGetters } from "vuex";
import { firstMenu } from "cool/components/base/utils";
import { firstMenu } from "cool/modules/base/utils";
export default {
name: "cl-menu-topbar",

View File

@ -0,0 +1,13 @@
{
"name": "base",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"vuedraggable": "^2.24.3",
"quill": "^1.3.7",
"codemirror": "^5.59.2",
"js-beautify": "^1.13.5",
"vue-codemirror": "^4.0.6"
}
}

View File

@ -0,0 +1,29 @@
import Common from "./common";
import Open from "./open";
import SysUser from "./system/user";
import SysMenu from "./system/menu";
import SysRole from "./system/role";
import SysDept from "./system/dept";
import SysTask from "./system/task";
import SysInfo from "./system/info";
import SysParam from "./system/param";
import SysLog from "./system/log";
import PluginInfo from "./plugin/info";
export default {
common: new Common(),
open: new Open(),
system: {
user: new SysUser(),
menu: new SysMenu(),
role: new SysRole(),
dept: new SysDept(),
task: new SysTask(),
info: new SysInfo(),
param: new SysParam(),
log: new SysLog()
},
plugin: {
info: new PluginInfo()
}
};

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -1,7 +1,7 @@
import user from "./user";
import app from "./app";
import process from "./process";
import component from "./component";
import module from "./module";
import menu from "./menu";
export default { user, app, process, component, menu };
export default { user, app, process, module, menu };

View File

@ -1,7 +1,7 @@
import store from "store";
import { Message } from "element-ui";
import { deepTree, revDeepTree, isArray, isEmpty } from "cl-admin/utils";
import { revisePath } from "cool/components/base/utils";
import { revisePath } from "cool/modules/base/utils";
import router from "@/router";
import { menuList } from "@/config/env";
@ -63,10 +63,8 @@ export default {
children: []
};
// 匹配存储的组件模块
let m = getters.componentModules.find(
(m) => m.moduleName === r.moduleName
);
// 匹配存储的模块视图
let m = getters.moduleViews.find((m) => m.moduleName === r.moduleName);
if (m) {
// 注册组件实例

View File

@ -0,0 +1,33 @@
export default {
state: {
info: {},
list: [],
views: []
},
getters: {
// 模块信息
modules: (state) => state.info,
// 模块列表
moduleList: (state) => state.list,
// 模块视图
moduleViews: (state) => state.moduleViews
},
mutations: {
SET_MODULE(state, list) {
let d = {};
list.forEach((e) => {
d[e.name] = e;
});
state.list = list;
state.info = d;
},
SET_MODULE_VIEWS(state, list) {
state.moduleViews = list;
}
}
};

View File

@ -44,7 +44,6 @@ export default {
// 用户移除
userRemove({ commit }) {
console.log(222);
commit("CLEAR_USER");
commit("CLEAR_TOKEN");
commit("RESET_PROCESS");

View File

@ -25,6 +25,30 @@ export default [
icon: "icon-common",
component: () => import("./role")
},
{
moduleName: "sys.task",
label: "任务列表",
path: "/sys/task",
component: () => import("./task")
},
{
moduleName: "sys.perf",
label: "状态监控",
path: "/sys/perf",
component: () => import("./perf")
},
{
moduleName: "sys.param",
label: "参数列表",
path: "/sys/param",
component: () => import("./param")
},
{
moduleName: "sys.log",
label: "请求日志",
path: "/sys/log",
component: () => import("./log")
},
{
moduleName: "plugin",
label: "插件列表",

Some files were not shown because too many files have changed in this diff Show More