模块结构调整

This commit is contained in:
icssoa 2021-03-09 18:10:43 +08:00
parent ea6a475bc7
commit 7670b07db6
170 changed files with 1816 additions and 1026 deletions

11
.editorconfig Normal file
View File

@ -0,0 +1,11 @@
# 🎨 editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

View File

@ -3,6 +3,4 @@
/node_modules/
/src/icons/svg/
/mock/
/cool/
/src/cool/
vue.config.js

View File

@ -1,43 +0,0 @@
import Base from "./modules/base";
import Task from "./modules/task";
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 {
modules: [
["base", Base],
["task", Task],
[
"upload",
Upload,
{
icon: "el-icon-picture",
text: "选择图片",
limitSize: 1,
rename: true
}
],
[
"crud",
Crud,
{
crud: {
dict: {
sort: {
prop: "order",
order: "sort"
}
}
}
}
],
["export", Export],
["copy", Copy],
["distpicker", Distpicker],
["demo", Demo]
]
};

View File

@ -1,145 +0,0 @@
<template>
<div class="cl-menu-file">
<el-row :gutter="10">
<el-col :span="16">
<el-select
v-model="newValue"
allow-create
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="(item, index) in list"
:key="index"
:label="item.value"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
<el-col :span="8">
<div class="cl-menu-file__module">
<span class="label">模块</span>
<el-select
v-model="form.moduleName"
placeholder="选择模块"
clearable
filterable
@change="onModuleChange"
>
<el-option
v-for="(item, index) in moduleViews"
:key="index"
:label="item.label"
:value="item.moduleName"
>
</el-option>
</el-select>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import { mapGetters } from "vuex";
import { isEmpty } from "cl-admin/utils";
const files = require.context("@/", true, /^.\/views.*(vue|js)/).keys();
export default {
name: "cl-menu-file",
props: {
value: [String]
},
inject: ["form"],
data() {
return {
newValue: "",
list: []
};
},
computed: {
...mapGetters(["moduleViews"])
},
watch: {
value: {
immediate: true,
handler(val) {
this.newValue = val || "";
}
},
newValue(val) {
this.$emit("input", val);
}
},
created() {
this.list = files
.filter((e) => {
return !e.includes("components");
})
.map((e) => {
return {
value: e.substr(2)
};
});
},
methods: {
async onModuleChange(val) {
const { label, keepAlive, icon, path, component } = this.moduleViews.find(
(e) => e.moduleName == val
);
if (label) {
this.form.name = label;
}
if (path) {
this.form.router = path;
}
if (icon) {
this.form.icon = icon;
}
if (component) {
let c = await component();
this.form.viewPath = c.default.__file;
}
this.form.keepAlive = isEmpty(keepAlive) ? true : keepAlive;
}
}
};
</script>
<style lang="scss" scoped>
.cl-menu-file {
width: 100%;
/deep/ .el-select {
width: 100%;
}
&__module {
display: inline-flex;
.label {
width: 40px;
text-align: right;
margin-right: 10px;
}
}
}
</style>

View File

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

View File

@ -1,126 +0,0 @@
// customize style
.scroller1 {
overflow: hidden auto;
position: relative;
z-index: 9;
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background-color: rgba(144, 147, 153, 0.3);
border-radius: 6px;
}
&::-webkit-scrollbar {
height: 6px;
width: 6px;
}
}
// Element-ui theme
.el-input-number {
.el-input-number__decrease,
.el-input-number__increase {
border: 0 !important;
background-color: transparent;
}
}
.el-dialog {
.el-dialog__header {
padding: 10px;
text-align: center;
border-bottom: 1px solid #f7f7f7;
.el-dialog__title {
font-size: 15px;
letter-spacing: 0.5px;
}
.el-dialog__headerbtn {
top: 13px;
.el-dialog__close {
font-size: 18px;
}
}
}
.el-dialog__body {
padding: 20px;
}
.el-dialog__footer {
padding-bottom: 15px;
}
}
.el-message {
&.el-message--success,
&.el-message--error,
&.el-message--info,
&.el-message--warning {
min-width: auto;
background-color: #fff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
border: 0;
padding: 12px 20px 12px 15px;
.el-message__icon {
font-size: 16px;
}
.el-message__content {
color: #999;
}
}
}
.el-table {
&__header {
th {
padding: 0 !important;
background-color: #ebeef5 !important;
height: 36px;
line-height: 36px;
}
.cell {
color: $color-main;
font-weight: normal;
}
}
&__body {
&-wrapper {
@media only screen and (max-width: 768px) {
&::-webkit-scrollbar {
height: 6px;
width: 6px;
}
}
}
}
&__column {
&-filter-trigger {
margin-left: 5px;
}
}
&-column--selection {
.cell {
padding: 0 14px !important;
}
}
}
.el-table-filter {
margin-top: 5px !important;
.el-checkbox__label {
font-size: 12px;
}
}

View File

@ -1,33 +0,0 @@
export default {
state: {
info: {},
list: [],
views: []
},
getters: {
// 模块信息
modules: (state) => state.info,
// 模块列表
moduleList: (state) => state.list,
// 模块视图
moduleViews: (state) => state.views
},
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.views = list;
}
}
};

View File

@ -1,31 +0,0 @@
export const revisePath = (path) => {
if (!path) {
return "";
}
if (path[0] == "/") {
return path;
} else {
return `/${path}`;
}
};
export function firstMenu(list) {
let path = "";
const fn = (arr) => {
arr.forEach((e) => {
if (e.type == 1) {
if (!path) {
path = e.path;
}
} else {
fn(e.children);
}
});
};
fn(list);
return path || "/404";
}

View File

@ -1,56 +0,0 @@
export default [
{
label: "个人中心",
path: "/my/info",
component: () => import("./info")
},
{
moduleName: "sys-user",
label: "用户列表",
path: "/sys/user",
icon: "icon-user",
component: () => import("./user")
},
{
moduleName: "sys-menu",
label: "菜单列表",
path: "/sys/menu",
icon: "icon-menu",
component: () => import("./menu")
},
{
moduleName: "sys-role",
label: "角色列表",
path: "/sys/role",
icon: "icon-common",
component: () => import("./role")
},
{
moduleName: "sys.perf",
label: "状态监控",
path: "/sys/perf",
icon: "icon-warn",
component: () => import("./perf")
},
{
moduleName: "sys.param",
label: "参数列表",
path: "/sys/param",
icon: "icon-menu",
component: () => import("./param")
},
{
moduleName: "sys.log",
label: "请求日志",
path: "/sys/log",
icon: "icon-log",
component: () => import("./log")
},
{
moduleName: "plugin",
label: "插件列表",
path: "/plugin",
icon: "icon-menu",
component: () => import("./plugin")
}
];

View File

@ -1,4 +0,0 @@
import ChatBox from "./box";
import Notice from "./notice";
export default { ChatBox, Notice };

View File

@ -1,10 +0,0 @@
{
"name": "chat",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"dayjs": "^1.10.4",
"socket.io-client": "^3.1.1"
}
}

View File

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

View File

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

View File

@ -1,9 +0,0 @@
{
"name": "demo",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"dayjs": "^1.10.4"
}
}

View File

@ -1,106 +0,0 @@
import dayjs from 'dayjs'
let id = 10
export const UserList = [
{
id: 1,
name: "刘一",
createTime: "2019年09月02日",
price: 75.99,
status: 1
},
{
id: 2,
name: "陈二",
createTime: "2019年09月05日",
price: 242.1,
status: 1
},
{
id: 3,
name: "张三",
createTime: "2019年09月12日",
price: 74.11,
status: 0
},
{
id: 4,
name: "李四",
createTime: "2019年09月13日",
price: 276.64,
status: 0
},
{
id: 5,
name: "王五",
createTime: "2019年09月18日",
price: 160.23,
status: 1
}
];
export const TestService = {
page: (p) => {
console.log("GET[page]", p);
let total = 0
let list = UserList.filter((e, i) => {
if (p.name) {
return e.name.includes(p.name)
}
if (![undefined, null, ''].includes(p.status)) {
return e.status === p.status
}
total++
if (i >= (p.page - 1) * p.size && i < p.page * p.size) {
return true
} else {
return false
}
})
return Promise.resolve({
list,
pagination: {
page: p.page,
size: p.size,
total
}
});
},
info: (d) => {
console.log("GET[info]", d);
return new Promise((resolve) => {
resolve(UserList.find(e.id == d.id));
});
},
add: (d) => {
console.log("POST[add]", d);
UserList.push({
...d,
id: id++,
createTime: dayjs().format('YYYY年MM月DD日')
})
return Promise.resolve();
},
delete: (d) => {
console.log("POST[delete]", d);
let ids = d.ids.split(',')
ids.forEach(id => {
const index = UserList.findIndex(e => e.id == id)
UserList.splice(index, 1)
})
return Promise.resolve();
},
update: (d) => {
console.log("POST[update]", d);
let item = UserList.find(e => e.id == d.id)
Object.assign(item, d)
return Promise.resolve();
}
};

View File

@ -1,26 +0,0 @@
export default [
{
moduleName: "crud",
label: "crud 示例",
path: "/crud",
component: () => import("./crud")
},
{
moduleName: "editor-quill",
label: "quill 富文本编辑器",
path: "/editor-quill",
component: () => import("./editor-quill")
},
{
moduleName: "upload",
label: "文件上传",
path: "/upload",
component: () => import("./upload")
},
{
moduleName: "demo",
label: "组件预览",
path: "/demo",
component: () => import("./demo")
}
];

View File

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

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 Info from './info'
export default {
task: {
info: new Info()
}
}

View File

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

View File

@ -1,7 +1,6 @@
{
"name": "cool-admin-vue",
"version": "3.0.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
@ -10,12 +9,12 @@
},
"dependencies": {
"axios": "^0.21.1",
"cl-admin": "^1.2.0",
"cl-admin-crud": "^1.3.4",
"cl-admin": "^1.3.0",
"cl-admin-crud": "^1.4.0",
"cl-admin-export": "^1.0.5",
"clipboard": "^2.0.7",
"codemirror": "^5.59.4",
"core-js": "^3.9.0",
"core-js": "^3.6.5",
"dayjs": "^1.10.4",
"echarts": "^4.5.0",
"element-ui": "^2.15.1",
@ -26,36 +25,37 @@
"socket.io-client": "^3.1.2",
"store": "^2.0.12",
"uuid": "^8.3.2",
"vue": "^2.6.10",
"vue": "^2.6.11",
"vue-codemirror": "^4.0.6",
"vue-echarts": "^5.0.0-beta.0",
"vue-router": "^3.5.1",
"vue-router": "^3.2.0",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2"
"vuex": "^3.4.0"
},
"devDependencies": {
"@typescript-eslint/parser": "^3.0.0",
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
"@vue/babel-preset-jsx": "^1.1.2",
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.0.3",
"babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1",
"babel-plugin-jsx-v-model": "^2.0.3",
"clean-webpack-plugin": "^3.0.0",
"eslint": "^7.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^4.13.0",
"prettier": "^2.0.5",
"sass-loader": "^8.0.0",
"hard-source-webpack-plugin": "^0.13.1",
"node-sass": "^4.12.0",
"prettier": "^1.19.1",
"sass-loader": "^8.0.2",
"svg-sprite-loader": "^5.0.0",
"typescript": "^3.9.3",
"vue-template-compiler": "^2.6.10",
"vue-template-compiler": "^2.6.11",
"webpack-cli": "^3.3.12"
}
}

View File

@ -1,14 +1,6 @@
$color-main: #2f3447;
$color-main: var(--color-main, #2f3447);
$color-danger: #f56c6c;
$color-primary: #4165d7;
$color-success: #67c23a;
$color-info: #909399;
$color-warning: #e6a23c;
@mixin text_ellipsis($line: 1) {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: $line;
}

View File

@ -2,16 +2,19 @@ import store from "store";
import { getUrlParam } from "cl-admin/utils";
// 路由模式
const routerMode = "history";
export const routerMode = "history";
// 开发模式
const isDev = process.env.NODE_ENV == "development";
export const isDev = process.env.NODE_ENV == "development";
// Host
const host = "https://show.cool-admin.com";
export const host = "https://show.cool-admin.com";
// Socket
export const socketUrl = (isDev ? `${host}` : "") + "/socket";
// 请求地址
const baseUrl = (function () {
export const baseUrl = (function() {
let proxy = getUrlParam("proxy");
if (proxy) {
@ -20,24 +23,14 @@ const baseUrl = (function () {
proxy = store.get("proxy") || "dev";
}
switch (process.env.NODE_ENV) {
case "development":
return `/${proxy}/admin`;
case "production":
return `/api/admin`;
default:
return "";
}
return isDev ? `/${proxy}/admin` : `/api/admin`;
})();
// Socket
const socketUrl = (isDev ? `${host}` : "") + "/socket";
// 阿里字体图标库 https://at.alicdn.com/t/**.css
const iconfontUrl = ``;
export const iconfontUrl = ``;
// 程序配置参数
const app = {
export const app = {
name: "cool-admin",
conf: {
@ -53,6 +46,4 @@ const app = {
};
// 自定义菜单列表
const menuList = [];
export { routerMode, baseUrl, socketUrl, iconfontUrl, app, isDev, menuList };
export const menuList = [];

41
src/cool/index.js Normal file
View File

@ -0,0 +1,41 @@
import Crud from "cl-admin-crud";
import Export from "cl-admin-export";
export default {
modules: [
"base",
"task",
{
name: "upload",
options: {
icon: "el-icon-picture",
text: "选择图片",
limitSize: 1,
rename: true
}
},
{
name: "crud",
value: Crud,
options: {
crud: {
dict: {
sort: {
prop: "order",
order: "sort"
}
}
}
}
},
{
name: "export",
value: Export
},
"copy",
"distpicker",
"demo",
"theme"
]
};

View File

@ -8,7 +8,7 @@ if (iconfontUrl) {
document.getElementsByTagName("head")[0].appendChild(link);
}
const requireAll = (requireContext) => requireContext.keys().map(requireContext);
const requireAll = requireContext => requireContext.keys().map(requireContext);
const req = require.context("@/icons/svg/", false, /\.svg$/);
requireAll(req);
@ -16,7 +16,7 @@ export function iconList() {
return req
.keys()
.map(req)
.map((e) => e.default.id)
.filter((e) => e.includes("icon"))
.map(e => e.default.id)
.filter(e => e.includes("icon"))
.sort();
}

View File

@ -69,7 +69,7 @@ export default {
},
mounted() {
this.$el.onkeydown = (e) => {
this.$el.onkeydown = e => {
let keyCode = e.keyCode || e.which || e.charCode;
let altKey = e.altKey || e.metaKey;
let shiftKey = e.shiftKey || e.metaKey;

View File

@ -80,11 +80,11 @@ export default {
refresh() {
this.$service.system.dept
.list()
.then((res) => {
.then(res => {
this.list = deepTree(res);
this.refreshTree(this.value);
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
});
},

View File

@ -79,12 +79,12 @@ export default {
departmentId: id,
userIds: ids
})
.then((res) => {
.then(res => {
this.$message.success("转移成功");
this.$emit("success", res);
close();
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
this.$emit("error", err);
done();

View File

@ -158,7 +158,7 @@ export default {
this.$service.system.dept
.list()
.then((res) => {
.then(res => {
this.list = deepTree(res);
this.$emit("list-change", this.list);
})
@ -169,7 +169,7 @@ export default {
rowClick(e) {
ContextMenu.close();
let ids = e.children ? revDeepTree(e.children).map((e) => e.id) : [];
let ids = e.children ? revDeepTree(e.children).map(e => e.id) : [];
ids.unshift(e.id);
this.$emit("row-click", { item: e, ids });
},
@ -237,7 +237,7 @@ export default {
close();
this.refresh();
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
done();
});
@ -247,7 +247,7 @@ export default {
},
rowDel(e) {
const del = (f) => {
const del = f => {
this.$service.system.dept
.delete({
ids: e.id,
@ -274,7 +274,7 @@ export default {
.then(() => {
del(true);
})
.catch((action) => {
.catch(action => {
if (action == "cancel") {
del(false);
}
@ -288,7 +288,7 @@ export default {
})
.then(() => {
const deep = (list, pid) => {
list.forEach((e) => {
list.forEach(e => {
e.parentId = pid;
ids.push(e);
@ -315,7 +315,7 @@ export default {
.then(() => {
this.$message.success("更新排序成功");
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
})
.done(() => {

View File

@ -0,0 +1,77 @@
<template>
<div class="cl-menu-file">
<el-select v-model="newValue" allow-create filterable clearable placeholder="请选择">
<el-option
v-for="(item, index) in list"
:key="index"
:label="item.value"
:value="item.value"
>
</el-option>
</el-select>
</div>
</template>
<script>
const files = require
.context("@/", true, /views\/(?!(components)|(.*\/components)|(index\.js)).*.(js|vue)/)
.keys();
export default {
name: "cl-menu-file",
props: {
value: [String]
},
inject: ["form"],
data() {
return {
newValue: "",
list: []
};
},
watch: {
value: {
immediate: true,
handler(val) {
this.newValue = val || "";
}
},
newValue(val) {
this.$emit("input", val);
}
},
created() {
this.list = files.map(e => {
return {
value: e.substr(2)
};
});
}
};
</script>
<style lang="scss" scoped>
.cl-menu-file {
width: 100%;
/deep/ .el-select {
width: 100%;
}
&__module {
display: inline-flex;
.label {
width: 40px;
text-align: right;
margin-right: 10px;
}
}
}
</style>

View File

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

View File

@ -35,7 +35,7 @@ export default {
let options = [];
let list = [];
const flat = (obj) => {
const flat = obj => {
for (let i in obj) {
let { permission } = obj[i];
@ -49,13 +49,13 @@ export default {
flat(this.$service);
list.filter((e) => e.includes(":"))
.map((e) => e.split(":"))
.forEach((arr) => {
list.filter(e => e.includes(":"))
.map(e => e.split(":"))
.forEach(arr => {
const col = (i, d) => {
let key = arr[i];
let index = d.findIndex((e) => e.label == key);
let index = d.findIndex(e => e.label == key);
if (index >= 0) {
col(i + 1, d[index].children);
@ -86,11 +86,11 @@ export default {
methods: {
parse() {
this.newValue = this.value ? this.value.split(",").map((e) => e.split(":")) : [];
this.newValue = this.value ? this.value.split(",").map(e => e.split(":")) : [];
},
onChange(row) {
this.$emit("input", row.map((e) => e.join(":")).join(","));
this.$emit("input", row.map(e => e.join(":")).join(","));
}
}
};

View File

@ -11,16 +11,15 @@ export default {
},
computed: {
...mapGetters(["menuList", "menuCollapse", "browser"])
...mapGetters(["menuList", "menuCollapse", "browser", "conf"])
},
watch: {
menuList() {
this.visible = false;
setTimeout(() => {
this.visible = true;
}, 0);
this.refresh();
},
"conf.showAMenu"() {
this.$store.commit("SET_MENU_LIST");
}
},
@ -29,14 +28,22 @@ export default {
if (url != this.$route.path) {
this.$router.push(url);
}
},
refresh() {
this.visible = false;
setTimeout(() => {
this.visible = true;
}, 0);
}
},
render() {
const fn = (list) => {
const fn = list => {
return list
.filter((e) => e.isShow)
.map((e) => {
.filter(e => e.isShow)
.map(e => {
let html = null;
if (e.type == 0) {
@ -69,6 +76,7 @@ export default {
<div class="cl-slider-menu">
<el-menu
default-active={this.$route.path}
background-color="transparent"
collapse-transition={false}
collapse={this.browser.isMobile ? false : this.menuCollapse}
on-select={this.toView}>

View File

@ -9,29 +9,13 @@
.el-menu {
border-right: 0;
background-color: $color-main;
&-item {
&.is-active {
background-color: $color-primary;
color: #fff;
}
}
.el-submenu__title,
.el-menu-item {
&-item {
&.is-active,
&:hover {
background-color: $color-primary;
}
}
.el-submenu {
&.is-opened {
background-color: #2b3043;
.el-menu {
background-color: #2b3043;
}
background-color: $color-primary !important;
color: #fff;
}
}

View File

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

View File

@ -57,7 +57,7 @@ export default {
computed: {
name() {
const item = this.list.find((e) => e.id == this.value);
const item = this.list.find(e => e.id == this.value);
return item ? item.name : "一级菜单";
},
@ -76,8 +76,8 @@ export default {
},
menuList() {
this.$service.system.menu.list().then((res) => {
let list = res.filter((e) => e.type != 2);
this.$service.system.menu.list().then(res => {
let list = res.filter(e => e.type != 2);
list.unshift({
name: "一级菜单",

View File

@ -142,7 +142,7 @@ export default {
this.toMysql(res, item.mysql);
this.toRedis(res, item.redis);
this.toCPU(res, item.server.cpu);
this.toDisk(item.server.disk.filter((e) => e.size));
this.toDisk(item.server.disk.filter(e => e.size));
this.toMem(item.server.mem);
this.toLB();
},
@ -173,7 +173,7 @@ export default {
toDisk(disk) {
this.disk.all = disk.reduce((a, b) => a + b.size, 0);
this.disk.list = disk.map((e) => {
this.disk.list = disk.map(e => {
e.use = e.use.toFixed(2);
return e;
@ -188,7 +188,7 @@ export default {
let free = 0;
let used = 0;
item.mysqlSize.forEach((e) => {
item.mysqlSize.forEach(e => {
free += parseFloat(e.data_free);
used += parseFloat(e.data_size);
});

View File

@ -80,7 +80,7 @@ export default {
this.chartOptions = this.onChart(
time,
data.map((e) => e.mysql.mysqlConn[3].Threads_running)
data.map(e => e.mysql.mysqlConn[3].Threads_running)
);
},
@ -99,7 +99,7 @@ export default {
color: "rgb(15, 75, 111)"
},
extraCssText: "box-shadow: 0 0 5px rgba(0, 0, 0, 0.3)",
formatter: (arr) => {
formatter: arr => {
return `线程数:${arr[0].data}`;
}
},

View File

@ -64,7 +64,7 @@ export default {
color: "#7588E4"
},
extraCssText: "box-shadow: 0 0 5px rgba(0, 0, 0, 0.3)",
formatter: (arr) => {
formatter: arr => {
return arr
.map((e, i) => (i == 0 ? "上行:" : "下载:") + this.conByte(e.value))
.join("<br>");
@ -134,7 +134,7 @@ export default {
textStyle: {
fontSize: 14
},
formatter: (value) => {
formatter: value => {
return this.conByte(value);
}
}
@ -243,7 +243,7 @@ export default {
this.rx_bytes = 0;
this.tx_bytes = 0;
network.forEach((e) => {
network.forEach(e => {
this.rx_bytes += e.rx_bytes;
this.tx_bytes += e.tx_bytes;
});
@ -253,12 +253,12 @@ export default {
this.chartOptions.xAxis.data = time;
this.chartOptions.series[0].name = "上行";
this.chartOptions.series[0].data = data.map((e) =>
this.chartOptions.series[0].data = data.map(e =>
e.server.network.reduce((a, b) => a + b.tx_sec, 0)
);
this.chartOptions.series[1].name = "下载";
this.chartOptions.series[1].data = data.map((e) =>
this.chartOptions.series[1].data = data.map(e =>
e.server.network.reduce((a, b) => a + b.rx_sec, 0)
);
}

View File

@ -94,7 +94,7 @@ export default {
this.chartOptions = this.onChart(
time,
data.map((e) => e.redis.Stats.instantaneous_ops_per_sec),
data.map(e => e.redis.Stats.instantaneous_ops_per_sec),
{
color: "204, 32, 20",
smooth: false
@ -119,7 +119,7 @@ export default {
color: "#F56C6C"
},
extraCssText: "box-shadow: 0 0 5px rgba(0, 0, 0, 0.3)",
formatter: (arr) => {
formatter: arr => {
return `${arr[0].data} / S每秒操作数`;
}
},

View File

@ -12,7 +12,7 @@
:class="{ active: item.active }"
:data-index="index"
@mousedown="
(e) => {
e => {
onTap(e, item);
}
"
@ -66,7 +66,7 @@ export default {
},
mounted() {
this.$el.oncontextmenu = (e) => {
this.$el.oncontextmenu = e => {
e.returnValue = false;
};
@ -108,17 +108,17 @@ export default {
switch (cmd) {
case "current":
this.onDel(this.processList.findIndex((e) => e.value == current.value));
this.onDel(this.processList.findIndex(e => e.value == current.value));
break;
case "other":
this.SET_PROCESS(
this.processList.filter((e) => e.value == current.value || e.value == "/")
this.processList.filter(e => e.value == current.value || e.value == "/")
);
break;
case "all":
this.SET_PROCESS(this.processList.filter((e) => e.value == "/"));
this.SET_PROCESS(this.processList.filter(e => e.value == "/"));
break;
}
@ -126,7 +126,7 @@ export default {
},
toPath() {
const active = this.processList.find((e) => e.active);
const active = this.processList.find(e => e.active);
if (!active) {
const next = this.processList[this.processList.length - 1];

View File

@ -68,8 +68,8 @@ export default {
let ids = [];
//
let fn = (list) => {
list.forEach((e) => {
let fn = list => {
list.forEach(e => {
if (e.children) {
fn(e.children);
} else {
@ -80,18 +80,18 @@ export default {
fn(this.list);
this.checked = ids.filter((id) => (val || []).includes(id));
this.checked = ids.filter(id => (val || []).includes(id));
},
refresh() {
this.$service.system.menu
.list()
.then((res) => {
.then(res => {
this.list = deepTree(res);
this.refreshTree(this.value);
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
});
},

View File

@ -30,7 +30,7 @@ export default {
$route: {
immediate: true,
handler(route) {
const deep = (item) => {
const deep = item => {
if (route.path === "/") {
return false;
}
@ -52,7 +52,11 @@ export default {
}
};
this.list = _(this.menuGroup).map(deep).filter(Boolean).flattenDeep().value();
this.list = _(this.menuGroup)
.map(deep)
.filter(Boolean)
.flattenDeep()
.value();
if (this.list.length === 0) {
this.list.push(route);

View File

@ -8,7 +8,7 @@ function parse(value) {
const permission = store.getters.permission;
if (typeof value == "string") {
return value ? permission.some((e) => e.includes(value.replace(/\s/g, ""))) : false;
return value ? permission.some(e => e.includes(value.replace(/\s/g, ""))) : false;
} else {
return Boolean(value);
}
@ -23,7 +23,7 @@ export default {
update: change
};
export const checkPerm = (value) => {
export const checkPerm = value => {
if (!value) {
return false;
}
@ -34,7 +34,7 @@ export const checkPerm = (value) => {
}
if (value.and) {
return value.and.some((e) => !parse(e)) ? false : true;
return value.and.some(e => !parse(e)) ? false : true;
}
}

View File

@ -1,22 +1,22 @@
export default [
{
path: '/403',
path: "/403",
component: () => import("./error-page/403")
},
{
path: '/404',
path: "/404",
component: () => import("./error-page/404")
},
{
path: '/500',
path: "/500",
component: () => import("./error-page/500")
},
{
path: '/502',
path: "/502",
component: () => import("./error-page/502")
},
{
path: '/login',
path: "/login",
component: () => import("./login")
}
]
];

View File

@ -40,7 +40,7 @@ export default {
captchaId
});
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
});
}

View File

@ -0,0 +1,50 @@
// customize style
.scroller1 {
overflow: hidden auto;
position: relative;
z-index: 9;
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background-color: rgba(144, 147, 153, 0.3);
border-radius: 6px;
}
&::-webkit-scrollbar {
height: 6px;
width: 6px;
}
}
// Element-ui theme
.el-input-number {
.el-input-number__decrease,
.el-input-number__increase {
border: 0 !important;
background-color: transparent;
}
}
.el-message {
&.el-message--success,
&.el-message--error,
&.el-message--info,
&.el-message--warning {
min-width: auto;
background-color: #fff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
border: 0;
padding: 12px 20px 12px 15px;
.el-message__icon {
font-size: 16px;
}
.el-message__content {
color: #999;
}
}
}

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,5 +1,5 @@
import { app } from "@/config/env";
import { getBrowser } from "cl-admin/utils";
import { deepMerge, getBrowser } from "cl-admin/utils";
export default {
state: {
@ -19,15 +19,15 @@ export default {
},
getters: {
// 应用信息
appInfo: (state) => state.info,
appInfo: state => state.info,
// 应用配置
conf: (state) => state.conf,
conf: state => state.conf,
// 浏览器信息
browser: (state) => state.browser,
browser: state => state.browser,
// 左侧菜单是否收起
menuCollapse: (state) => state.collapse,
menuCollapse: state => state.collapse,
// 上传配置
upload: (state) => state.upload
upload: state => state.upload
},
actions: {
appLoad({ getters, dispatch }) {
@ -41,7 +41,7 @@ export default {
}
},
setUpload({ state }) {
this.$service.common.uploadMode().then((res) => {
this.$service.common.uploadMode().then(res => {
state.upload = res;
});
}
@ -53,6 +53,9 @@ export default {
COLLAPSE_MENU(state, val = false) {
state.collapse = val;
},
UPDATE_CONF(state, val) {
deepMerge(state.conf, val);
}
}
};

View File

@ -1,9 +1,9 @@
import store from "store";
import { Message } from "element-ui";
import { deepTree, revDeepTree, isArray, isEmpty } from "cl-admin/utils";
import { revisePath } from "../utils";
import router from "@/router";
import { menuList } from "@/config/env";
import store from "store";
export default {
state: {
@ -20,19 +20,19 @@ export default {
},
getters: {
// 树形菜单列表
menuGroup: (state) => state.group,
menuGroup: state => state.group,
// 左侧菜单
menuList: (state) => state.menu,
menuList: state => state.menu,
// 视图路由
routes: (state) => state.routes,
routes: state => state.routes,
// 权限列表
permission: (state) => state.permission
permission: state => state.permission
},
actions: {
// 设置菜单、权限
permMenu({ commit, state, getters }) {
return new Promise((resolve, reject) => {
const next = (res) => {
const next = res => {
if (!isArray(res.menus)) {
res.menus = [];
}
@ -42,9 +42,9 @@ export default {
}
const routes = res.menus
.filter((e) => e.type != 2)
.map((e) => {
let r = {
.filter(e => e.type != 2 && e.isShow)
.map(e => {
return {
moduleName: e.moduleName,
id: e.id,
parentId: e.parentId,
@ -61,16 +61,6 @@ export default {
},
children: []
};
// 匹配存储的模块视图
let m = getters.moduleViews.find((m) => m.moduleName === r.moduleName);
if (m) {
// 注册组件实例
r.component = m.component;
}
return r;
});
// 转成树形菜单
@ -83,7 +73,7 @@ export default {
// 设置视图路由
commit(
"SET_VIEW_ROUTES",
routes.filter((e) => e.type == 1)
routes.filter(e => e.type == 1)
);
// 设置菜单
commit("SET_MENU_LIST", state.index);
@ -95,10 +85,10 @@ export default {
if (!getters.conf.customMenu) {
this.$service.common
.permMenu()
.then((res) => {
.then(res => {
next(res);
})
.catch((err) => {
.catch(err => {
Message.error("菜单加载异常");
console.error(err);
reject(err);
@ -130,6 +120,10 @@ export default {
SET_MENU_LIST(state, index) {
const { showAMenu } = this.getters.conf;
if (isEmpty(index)) {
index = state.index;
}
if (showAMenu) {
const { children = [] } = state.group[index] || {};

View File

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

View File

@ -10,15 +10,15 @@ export default {
},
getters: {
// 窗口列表
processList: (state) => state.list
processList: state => state.list
},
mutations: {
ADD_PROCESS(state, item) {
const index = state.list.findIndex(
(e) => e.value.split("?")[0] === item.value.split("?")[0]
e => e.value.split("?")[0] === item.value.split("?")[0]
);
state.list.map((e) => {
state.list.map(e => {
e.active = e.value == item.value;
});

View File

@ -11,13 +11,13 @@ export default {
info
},
getters: {
userInfo: (state) => state.info,
token: (state) => state.token
userInfo: state => state.info,
token: state => state.token
},
actions: {
// 用户登录
userLogin({ commit }, form) {
return this.$service.open.userLogin(form).then((res) => {
return this.$service.open.userLogin(form).then(res => {
commit("SET_TOKEN", res);
return res;
});
@ -25,7 +25,7 @@ export default {
// 用户退出
userLogout({ dispatch }) {
return new Promise((resolve) => {
return new Promise(resolve => {
this.$service.common.userLogout().done(() => {
dispatch("userRemove").then(() => {
resolve();
@ -36,7 +36,7 @@ export default {
// 用户信息
userInfo({ commit }) {
return this.$service.common.userInfo().then((res) => {
return this.$service.common.userInfo().then(res => {
commit("SET_USERINFO", res);
return res;
});
@ -57,11 +57,11 @@ export default {
return new Promise((resolve, reject) => {
this.$service.open
.refreshToken(storage.get("refreshToken"))
.then((res) => {
.then(res => {
commit("SET_TOKEN", res);
resolve(res.token);
})
.catch((err) => {
.catch(err => {
dispatch("userRemove");
href("/login");
reject(err);

View File

@ -0,0 +1,31 @@
export const revisePath = path => {
if (!path) {
return "";
}
if (path[0] == "/") {
return path;
} else {
return `/${path}`;
}
};
export function firstMenu(list) {
let path = "";
const fn = arr => {
arr.forEach(e => {
if (e.type == 1) {
if (!path) {
path = e.path;
}
} else {
fn(e.children);
}
});
};
fn(list);
return path || "/404";
}

View File

@ -0,0 +1,10 @@
export default [
{
path: "/my/info",
component: () => import("./info"),
meta: {
label: "个人中心",
keepAlive: true
}
}
];

View File

@ -58,7 +58,7 @@ export default {
this.$message.success("修改成功");
this.$store.dispatch("userInfo");
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
})
.done(() => {

View File

@ -32,6 +32,7 @@
</el-row>
<el-row type="flex">
<cl-flex1></cl-flex1>
<cl-pagination></cl-pagination>
</el-row>
</cl-crud>
@ -52,6 +53,7 @@ export default {
}
},
"context-menu": [
"refresh",
{
label: "清空",
callback: (_, done) => {
@ -121,7 +123,7 @@ export default {
},
created() {
this.$service.system.log.getKeep().then((res) => {
this.$service.system.log.getKeep().then(res => {
this.day = res;
});
},
@ -149,7 +151,7 @@ export default {
this.$message.success("清空成功");
this.$refs["crud"].refresh();
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
});
})

View File

@ -6,64 +6,73 @@
<cl-add-btn />
</el-row>
<cl-table ref="table" v-bind="table" @row-click="onRowClick">
<!-- 名称 -->
<template #column-name="{ scope }">
<span>{{ scope.row.name }}</span>
<el-tag
size="mini"
effect="dark"
type="danger"
v-if="!scope.row.isShow"
style="margin-left: 10px"
>隐藏</el-tag
>
</template>
<!-- 图标 -->
<template #column-icon="{ scope }">
<icon-svg :name="scope.row.icon" size="16px" style="margin-top: 5px"></icon-svg>
</template>
<!-- 权限 -->
<template #column-perms="{ scope }">
<el-tag
v-for="(item, index) in scope.row.permList"
:key="index"
size="mini"
effect="dark"
style="margin: 2px; letter-spacing: 0.5px"
>{{ item }}</el-tag
>
</template>
<!-- 路由 -->
<template #column-router="{ scope }">
<el-link type="primary" :href="scope.row.router" v-if="scope.row.type == 1">{{
scope.row.router
}}</el-link>
<span v-else>{{ scope.row.router }}</span>
</template>
<!-- 路由缓存 -->
<template #column-keepAlive="{ scope }">
<template v-if="scope.row.type == 1">
<i class="el-icon-check" v-if="scope.row.keepAlive"></i>
<i class="el-icon-close" v-else></i>
<el-row>
<cl-table ref="table" v-bind="table" @row-click="onRowClick">
<!-- 名称 -->
<template #column-name="{ scope }">
<span>{{ scope.row.name }}</span>
<el-tag
size="mini"
effect="dark"
type="danger"
v-if="!scope.row.isShow"
style="margin-left: 10px"
>隐藏</el-tag
>
</template>
</template>
<!-- 行新增 -->
<template #slot-add="{ scope }">
<el-button
type="text"
size="mini"
@click="upsertAppend(scope.row)"
v-if="scope.row.type != 2"
>新增</el-button
>
</template>
</cl-table>
<!-- 图标 -->
<template #column-icon="{ scope }">
<icon-svg
:name="scope.row.icon"
size="16px"
style="margin-top: 5px"
></icon-svg>
</template>
<!-- 权限 -->
<template #column-perms="{ scope }">
<el-tag
v-for="(item, index) in scope.row.permList"
:key="index"
size="mini"
effect="dark"
style="margin: 2px; letter-spacing: 0.5px"
>{{ item }}</el-tag
>
</template>
<!-- 路由 -->
<template #column-router="{ scope }">
<el-link
type="primary"
:href="scope.row.router"
v-if="scope.row.type == 1"
>{{ scope.row.router }}</el-link
>
<span v-else>{{ scope.row.router }}</span>
</template>
<!-- 路由缓存 -->
<template #column-keepAlive="{ scope }">
<template v-if="scope.row.type == 1">
<i class="el-icon-check" v-if="scope.row.keepAlive"></i>
<i class="el-icon-close" v-else></i>
</template>
</template>
<!-- 行新增 -->
<template #slot-add="{ scope }">
<el-button
type="text"
size="mini"
@click="upsertAppend(scope.row)"
v-if="scope.row.type != 2"
>新增</el-button
>
</template>
</cl-table>
</el-row>
<!-- 编辑 -->
<cl-upsert ref="upsert" v-bind="upsert" @open="onUpsertOpen"></cl-upsert>
@ -82,7 +91,7 @@ export default {
"row-key": "id"
},
"context-menu": [
(row) => {
row => {
return {
label: "新增",
hidden: row.type == 2,
@ -94,7 +103,7 @@ export default {
},
"update",
"delete",
(row) => {
row => {
return {
label: "权限",
hidden: row.type != 1,
@ -212,7 +221,7 @@ export default {
}
],
on: {
change: (index) => {
change: index => {
this.changeType(index);
}
}
@ -340,8 +349,8 @@ export default {
},
onRefresh(params, { render }) {
this.$service.system.menu.list().then((list) => {
list.map((e) => {
this.$service.system.menu.list().then(list => {
list.map(e => {
e.permList = e.perms ? e.perms.split(",") : [];
});

View File

@ -52,7 +52,7 @@ export default {
methods: {
refresh() {
this.$service.system.info.record().then((res) => {
this.$service.system.info.record().then(res => {
const { network, ct, redis, mysql } = this.$refs;
if (network) {

View File

@ -39,7 +39,7 @@
</template>
<script>
import { checkPerm } from "cool/modules/base";
import { checkPerm } from "@/cool/modules/base";
export default {
data() {
@ -65,7 +65,8 @@ export default {
}
},
"context-menu": [
(scope) => {
"refresh",
scope => {
return {
label: "配置",
hidden: !perms.edit,
@ -83,31 +84,38 @@ export default {
},
{
label: "作者",
prop: "author"
prop: "author",
width: 150
},
{
label: "联系方式",
prop: "contact"
prop: "contact",
"show-overflow-tooltip": true
},
{
label: "功能描述",
prop: "description"
prop: "description",
"show-overflow-tooltip": true
},
{
label: "版本号",
prop: "version"
prop: "version",
width: 120
},
{
label: "是否启用",
prop: "enable"
prop: "enable",
width: 120
},
{
label: "命名空间",
prop: "namespace"
prop: "namespace",
width: 150
},
{
label: "状态",
prop: "status",
width: 150,
dict: [
{
label: "缺少配置",
@ -173,7 +181,7 @@ export default {
app.refresh();
},
onRefresh(params, { next, render }) {
next(params).then((res) => {
next(params).then(res => {
render(res, {
total: res.length
});
@ -188,7 +196,7 @@ export default {
.then(() => {
this.$message.success(val ? "开启成功" : "关闭成功");
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
});
},
@ -221,7 +229,7 @@ export default {
this.$message.success("保存成功");
close();
})
.catch((err) => {
.catch(err => {
this.$message.error(err);
done();
});

View File

@ -390,7 +390,7 @@ export default {
async onRefresh(params, { next, render }) {
let { list } = await next(params);
list.map((e) => {
list.map(e => {
if (e.roleName) {
this.$set(e, "roleNameList", e.roleName.split(","));
}
@ -424,7 +424,7 @@ export default {
},
onSelectionChange(selection) {
this.selects.ids = selection.map((e) => e.id);
this.selects.ids = selection.map(e => e.id);
},
onDeptRowClick({ item, ids }) {

View File

@ -108,7 +108,7 @@
accept="video/*"
list-type
:before-upload="
(f) => {
f => {
onBeforeUpload(f, 'video');
}
"
@ -222,7 +222,7 @@ export default {
sessionList() {
return this.session.list
.map((e) => {
.map(e => {
let { _text } = parseContent(e);
e.lastMessage = _text;
return e;
@ -240,11 +240,11 @@ export default {
console.log("socket connect");
});
this.socket.on("admin", (msg) => {
this.socket.on("admin", msg => {
this.onMessage(msg);
});
this.socket.on("error", (err) => {
this.socket.on("error", err => {
console.log(err);
});
@ -261,7 +261,7 @@ export default {
open() {
this.visible = true;
this.refreshSession().then((res) => {
this.refreshSession().then(res => {
this.sessionDetail(res.list[0]);
});
},
@ -288,7 +288,7 @@ export default {
//
onUploadProgress(e, file) {
let item = this.message.list.find((e) => e.uid == file.uid);
let item = this.message.list.find(e => e.uid == file.uid);
if (item) {
item.progress = e.percent + "%";
@ -297,7 +297,7 @@ export default {
//
onUploadSuccess(res, file, key) {
let item = this.message.list.find((e) => e.uid == file.uid);
let item = this.message.list.find(e => e.uid == file.uid);
if (item) {
item.loading = false;
@ -342,7 +342,7 @@ export default {
order: "updateTime",
sort: "desc"
})
.then(async (res) => {
.then(async res => {
this.session.list = res.list;
this.session.pagination = res.pagination;
@ -386,7 +386,7 @@ export default {
order: "createTime",
sort: "desc"
})
.then((res) => {
.then(res => {
this.message.pagination = res.pagination;
this.prepend.apply(this, res.list);
});
@ -408,7 +408,7 @@ export default {
},
//
scrollToBottom: debounce(function () {
scrollToBottom: debounce(function() {
this.$nextTick(() => {
if (this.$refs["scroller"]) {
this.$refs["scroller"].scrollTo(0, 999999);
@ -514,7 +514,7 @@ export default {
}
//
let item = this.session.list.find((e) => e.userId == fromId);
let item = this.session.list.find(e => e.userId == fromId);
if (item) {
if (!same) {
@ -555,7 +555,7 @@ export default {
const NotificationInstance = Notification || window.Notification;
if (!!NotificationInstance) {
if (NotificationInstance.permission !== "denied") {
NotificationInstance.requestPermission((status) => {
NotificationInstance.requestPermission(status => {
let n = new Notification("COOL-MALL", {
body: _text,
icon: "/favicon.ico"
@ -627,7 +627,7 @@ export default {
//
prepend(...data) {
data.map(this.handleMessage).forEach((e) => {
data.map(this.handleMessage).forEach(e => {
this.message.list.unshift(e);
});
},
@ -722,7 +722,11 @@ export default {
.name,
.content {
@include text_ellipsis(1);
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}
}

View File

@ -103,7 +103,7 @@ let emoji = {
]
};
emoji.list = emoji.list.map((e) => emoji.url + e);
emoji.list = emoji.list.map(e => emoji.url + e);
export default {
data() {

View File

@ -0,0 +1,3 @@
import Notice from "./notice";
export default { Notice };

View File

@ -107,7 +107,7 @@ export default {
destroyed() {
clearTimeout(this.voice.timer);
this.list.map((e) => {
this.list.map(e => {
e.isPlay = false;
});
},
@ -116,7 +116,7 @@ export default {
flist() {
let date = "";
return this.list.map((e) => {
return this.list.map(e => {
e._date = date
? dayjs(e.createTime).isBefore(dayjs(date).add(1, "minute"))
? ""
@ -133,7 +133,7 @@ export default {
methods: {
tapItem(item) {
if (item.mode == "voice") {
this.list.map((e) => {
this.list.map(e => {
this.$set(e, "isPlay", e.id == item.id ? e.isPlay : false);
});

View File

@ -1,12 +1,12 @@
<template>
<li class="app-tools-notice" @click="openChatBox">
<div class="cl-chat-notice" @click="openChatBox">
<el-badge :value="number" :hidden="number === 0">
<i class="el-icon-message-solid"></i>
</el-badge>
<!-- 聊天盒子 -->
<cl-chat ref="chat" @message="updateNum"></cl-chat>
</li>
</div>
</template>
<script>
@ -26,7 +26,7 @@ export default {
methods: {
refresh() {
this.$service.im.session.unreadCount().then((res) => {
this.$service.im.session.unreadCount().then(res => {
this.number = Number(res);
});
},
@ -44,7 +44,7 @@ export default {
</script>
<style lang="scss" scoped>
.app-tools-notice {
.cl-chat-notice {
position: relative;
.el-icon-message-solid {

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