From a6b3e9118efc2307de14602752b4c69a1a98cabd Mon Sep 17 00:00:00 2001 From: icssoa <2570063477@qq.com> Date: Wed, 31 Mar 2021 16:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20lint=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=20/@/=20=E6=89=BE=E4=B8=8D=E5=88=B0=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 76 ++ .prettierrc | 9 + .vscode/crud.code-snippets | 4 +- .vscode/settings.json | 3 + package.json | 11 +- src/assets/css/index.scss | 4 +- src/config/env.ts | 9 +- src/cool/index.ts | 18 +- src/cool/modules/base/common/resize.ts | 2 +- src/cool/modules/base/common/theme.ts | 6 +- .../modules/base/components/avatar/index.vue | 12 +- .../base/components/codemirror/index.vue | 36 +- .../modules/base/components/dept/check.vue | 14 +- .../modules/base/components/dept/tree.vue | 113 +-- .../base/components/editor-quill/index.vue | 40 +- .../base/components/icon-svg/index.vue | 22 +- .../modules/base/components/menu/file.vue | 21 +- .../modules/base/components/menu/icons.vue | 8 +- .../modules/base/components/menu/perms.vue | 23 +- .../modules/base/components/menu/topbar.vue | 20 +- .../modules/base/components/menu/tree.vue | 11 +- .../modules/base/components/process/index.vue | 8 +- .../modules/base/components/role/perms.vue | 13 +- .../modules/base/components/role/select.vue | 7 +- .../base/components/route-nav/index.vue | 22 +- .../modules/base/pages/error-page/404.vue | 2 +- .../modules/base/pages/error-page/500.vue | 2 +- .../modules/base/pages/error-page/502.vue | 2 +- .../error-page/components/error-page.vue | 2 +- src/cool/modules/base/pages/iframe/index.vue | 2 +- .../base/pages/login/components/captcha.vue | 4 +- src/cool/modules/base/pages/login/index.vue | 33 +- src/cool/modules/base/store/menu.ts | 16 +- src/cool/modules/base/store/user.ts | 2 +- src/cool/modules/base/utils/index.ts | 5 +- src/cool/modules/base/views/info.vue | 26 +- src/cool/modules/base/views/log.vue | 14 +- src/cool/modules/base/views/menu.vue | 20 +- src/cool/modules/base/views/param.vue | 24 +- src/cool/modules/base/views/plugin.vue | 72 +- src/cool/modules/base/views/role.vue | 4 +- src/cool/modules/base/views/user.vue | 185 ++-- src/cool/modules/chat/components/chat.vue | 12 +- src/cool/modules/chat/components/emoji.vue | 6 +- .../modules/chat/components/icon-voice.vue | 2 +- src/cool/modules/chat/components/input.vue | 54 +- src/cool/modules/chat/components/message.vue | 85 +- src/cool/modules/chat/components/notice.vue | 8 +- src/cool/modules/chat/components/session.vue | 8 +- src/cool/modules/copy/directives/index.ts | 4 +- .../demo/components/crud/adv-search.vue | 6 +- .../demo/components/crud/context-menu.vue | 2 - .../modules/demo/components/crud/dialog.vue | 4 +- .../modules/demo/components/crud/form.vue | 6 +- .../modules/demo/components/crud/query.vue | 4 +- .../modules/demo/components/crud/table.vue | 4 +- .../modules/demo/components/crud/test.vue | 2 - .../modules/demo/components/crud/upsert.vue | 4 +- .../demo/components/demo/b-icon-svg.vue | 4 +- .../modules/demo/components/demo/b-v-copy.vue | 2 +- src/cool/modules/demo/utils/service.ts | 8 +- src/cool/modules/demo/views/crud.vue | 34 +- src/cool/modules/demo/views/demo.vue | 19 +- src/cool/modules/demo/views/editor-quill.vue | 2 +- src/cool/modules/demo/views/upload.vue | 14 +- src/cool/modules/task/components/cron/cn.ts | 2 +- .../modules/task/components/cron/cron.vue | 356 +++----- src/cool/modules/task/views/task.vue | 52 +- src/cool/modules/theme/components/theme.vue | 74 +- src/cool/modules/upload/components/index.vue | 90 +- .../upload/components/space/category.vue | 16 +- .../upload/components/space/file-item.vue | 10 +- .../modules/upload/components/space/index.vue | 90 +- src/core/utils/index.ts | 39 +- src/crud/assets/index.scss | 3 +- .../components/context-menu/context-menu.tsx | 6 +- src/crud/components/dialog/index.tsx | 2 +- src/crud/components/form-tabs.tsx | 4 +- src/crud/components/form/index.tsx | 2 +- src/crud/components/query.tsx | 4 +- src/crud/components/table/index.tsx | 4 +- src/crud/components/upsert/helper.tsx | 2 +- src/crud/components/upsert/index.tsx | 2 +- src/crud/utils/vnode.tsx | 42 +- src/pages/layout/index.vue | 6 +- src/pages/layout/slider.vue | 2 +- src/pages/layout/topbar.vue | 24 +- src/router/index.ts | 14 +- src/service/request.ts | 14 +- src/views/home/components/category-ratio.vue | 2 +- src/views/home/components/count-effect.vue | 2 +- src/views/home/components/count-paid.vue | 2 +- src/views/home/components/count-views.vue | 2 +- src/views/home/components/hot-search.vue | 80 +- src/views/home/components/sales-rank.vue | 3 +- src/views/home/components/tab-chart.vue | 8 +- src/views/home/index.vue | 20 +- tsconfig.json | 6 +- vite.config.ts | 68 +- yarn-error.log | 855 +++++++++++++++++- yarn.lock | 853 ++++++++++++++++- 101 files changed, 2701 insertions(+), 1281 deletions(-) create mode 100644 .eslintrc.js create mode 100644 .prettierrc create mode 100644 .vscode/settings.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..3233db8 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,76 @@ +module.exports = { + root: true, + env: { + browser: true, + node: true, + es6: true, + }, + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + ecmaVersion: 2020, + sourceType: 'module', + jsxPragma: 'React', + ecmaFeatures: { + jsx: true, + tsx: true, + }, + }, + extends: [ + 'plugin:vue/vue3-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', + 'plugin:prettier/recommended', + ], + rules: { + '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-empty-function': 'off', + 'vue/component-name-in-template-casing': ["error", "kebab-case"], + 'vue/component-definition-name-casing': ["error", "kebab-case"], + 'no-use-before-define': 'off', + '@typescript-eslint/no-use-before-define': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^h$', + varsIgnorePattern: '^h$', + }, + ], + 'no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^h$', + varsIgnorePattern: '^h$', + }, + ], + 'space-before-function-paren': 'off', + 'vue/attributes-order': 'off', + 'vue/one-component-per-file': 'off', + 'vue/html-closing-bracket-newline': 'off', + 'vue/max-attributes-per-line': 'off', + 'vue/multiline-html-element-content-newline': 'off', + 'vue/singleline-html-element-content-newline': 'off', + 'vue/attribute-hyphenation': 'off', + // 'vue/html-self-closing': 'off', + 'vue/require-default-prop': 'off', + 'vue/html-self-closing': [ + 'error', + { + html: { + void: 'always', + normal: 'never', + component: 'always', + }, + svg: 'always', + math: 'always', + }, + ], + }, +}; diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..b82b0c6 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,9 @@ +{ + "tabWidth": 4, + "useTabs": true, + "semi": true, + "jsxBracketSameLine": true, + "singleQuote": false, + "printWidth": 100, + "trailingComma": "none" +} diff --git a/.vscode/crud.code-snippets b/.vscode/crud.code-snippets index 02b0de6..e085492 100644 --- a/.vscode/crud.code-snippets +++ b/.vscode/crud.code-snippets @@ -34,8 +34,8 @@ "", " diff --git a/src/cool/modules/base/components/codemirror/index.vue b/src/cool/modules/base/components/codemirror/index.vue index 717a134..f18371f 100644 --- a/src/cool/modules/base/components/codemirror/index.vue +++ b/src/cool/modules/base/components/codemirror/index.vue @@ -1,11 +1,6 @@ @@ -27,7 +22,7 @@ export default defineComponent({ modelValue: null, height: String, width: String, - options: Object, + options: Object }, emits: ["update:modelValue", "load"], @@ -64,18 +59,15 @@ export default defineComponent({ onMounted(function () { nextTick(() => { // 实例化 - editor = CodeMirror.fromTextArea( - editorRef.value.querySelector("#editor"), - { - mode: "javascript", - theme: "ambiance", - styleActiveLine: true, - lineNumbers: true, - lineWrapping: true, - indentUnit: 4, - ...props.options, - } - ); + editor = CodeMirror.fromTextArea(editorRef.value.querySelector("#editor"), { + mode: "javascript", + theme: "ambiance", + styleActiveLine: true, + lineNumbers: true, + lineWrapping: true, + indentUnit: 4, + ...props.options + }); // 输入监听 editor.on("change", (e: any) => { @@ -105,9 +97,9 @@ export default defineComponent({ }); return { - editorRef, + editorRef }; - }, + } }); diff --git a/src/cool/modules/base/components/dept/check.vue b/src/cool/modules/base/components/dept/check.vue index 44aec61..77e0504 100644 --- a/src/cool/modules/base/components/dept/check.vue +++ b/src/cool/modules/base/components/dept/check.vue @@ -1,19 +1,18 @@ diff --git a/src/cool/modules/base/components/dept/tree.vue b/src/cool/modules/base/components/dept/tree.vue index ea20a73..9bbd7a8 100644 --- a/src/cool/modules/base/components/dept/tree.vue +++ b/src/cool/modules/base/components/dept/tree.vue @@ -12,50 +12,41 @@
  • - +
  • -
  • - 保存 - 取消 +
  • + 保存 + 取消
  • @@ -82,14 +73,16 @@ export default defineComponent({ props: { drag: { type: Boolean, - default: true, + default: true }, level: { type: Number, - default: 99, - }, + default: 99 + } }, + emits: ["list-change", "row-click", "user-add"], + setup(props, { emit }) { const { refs, setRefs } = useRefs(); @@ -134,9 +127,7 @@ export default defineComponent({ // 获取 ids function rowClick(e: any) { ContextMenu.close(); - const ids = e.children - ? revDeepTree(e.children).map((e) => e.id) - : []; + const ids = e.children ? revDeepTree(e.children).map((e) => e.id) : []; ids.unshift(e.id); emit("row-click", { item: e, ids }); } @@ -149,7 +140,7 @@ export default defineComponent({ title: "编辑部门", width: "550px", props: { - labelWidth: "100px", + labelWidth: "100px" }, items: [ { @@ -159,13 +150,13 @@ export default defineComponent({ component: { name: "el-input", props: { - placeholder: "请填写部门名称", - }, + placeholder: "请填写部门名称" + } }, rules: { required: true, - message: "部门名称不能为空", - }, + message: "部门名称不能为空" + } }, { label: "上级部门", @@ -174,9 +165,9 @@ export default defineComponent({ component: { name: "el-input", props: { - disabled: true, - }, - }, + disabled: true + } + } }, { label: "排序", @@ -187,10 +178,10 @@ export default defineComponent({ props: { "controls-position": "right", min: 0, - max: 100, - }, - }, - }, + max: 100 + } + } + } ], on: { submit: (data: any, { done, close }: any) => { @@ -198,7 +189,7 @@ export default defineComponent({ id: e.id, parentId: e.parentId, name: data.name, - orderNum: data.orderNum, + orderNum: data.orderNum }) .then(() => { ElMessage.success(`新增部门${data.name}成功`); @@ -209,8 +200,8 @@ export default defineComponent({ ElMessage.error(err); done(); }); - }, - }, + } + } }); } @@ -220,7 +211,7 @@ export default defineComponent({ $service.system.dept .delete({ ids: [e.id], - deleteUser: f, + deleteUser: f }) .then(() => { if (f) { @@ -237,16 +228,12 @@ export default defineComponent({ }); }; - ElMessageBox.confirm( - `该操作会删除 “${e.name}” 部门的所有用户,是否确认?`, - "提示", - { - type: "warning", - confirmButtonText: "直接删除", - cancelButtonText: "保留用户", - distinguishCancelAndClose: true, - } - ) + ElMessageBox.confirm(`该操作会删除 “${e.name}” 部门的所有用户,是否确认?`, "提示", { + type: "warning", + confirmButtonText: "直接删除", + cancelButtonText: "保留用户", + distinguishCancelAndClose: true + }) .then(() => { del(true); }) @@ -261,7 +248,7 @@ export default defineComponent({ function treeOrder(f: boolean) { if (f) { ElMessageBox.confirm("部门架构已发生改变,是否保存?", "提示", { - type: "warning", + type: "warning" }) .then(() => { const ids: any[] = []; @@ -285,7 +272,7 @@ export default defineComponent({ return { id: e.id, parentId: e.parentId, - orderNum: i, + orderNum: i }; }) ) @@ -322,10 +309,10 @@ export default defineComponent({ rowEdit({ name: "", parentName: d.name, - parentId: d.id, + parentId: d.id }); done(); - }, + } }, { label: "编辑", @@ -333,7 +320,7 @@ export default defineComponent({ callback: (_: any, done: Function) => { rowEdit(d); done(); - }, + } }, { label: "删除", @@ -342,7 +329,7 @@ export default defineComponent({ callback: (_: any, done: Function) => { rowDel(d); done(); - }, + } }, { label: "新增成员", @@ -350,9 +337,9 @@ export default defineComponent({ callback: (_: any, done: Function) => { emit("user-add", d); done(); - }, - }, - ], + } + } + ] }); } @@ -374,9 +361,9 @@ export default defineComponent({ rowClick, rowEdit, rowDel, - treeOrder, + treeOrder }; - }, + } }); diff --git a/src/cool/modules/base/components/editor-quill/index.vue b/src/cool/modules/base/components/editor-quill/index.vue index 4a2fd3b..1246d97 100644 --- a/src/cool/modules/base/components/editor-quill/index.vue +++ b/src/cool/modules/base/components/editor-quill/index.vue @@ -7,8 +7,7 @@ detail-data :show-button="false" @confirm="onUploadSpaceConfirm" - > - + />
    @@ -26,7 +25,7 @@ export default defineComponent({ options: Object, modelValue: null, height: [String, Number], - width: [String, Number], + width: [String, Number] }, emits: ["update:modelValue", "load"], @@ -60,12 +59,7 @@ export default defineComponent({ files.forEach((file, i) => { const [type] = file.type.split("/"); - quill.insertEmbed( - cursorIndex.value + i, - type, - file.url, - Quill.sources.USER - ); + quill.insertEmbed(cursorIndex.value + i, type, file.url, Quill.sources.USER); }); // 移动光标到图片后一位 @@ -80,16 +74,12 @@ export default defineComponent({ // 编辑框样式 const style = computed(() => { - const height = isNumber(props.height) - ? props.height + "px" - : props.height; - const width = isNumber(props.width) - ? props.width + "px" - : props.width; + const height = isNumber(props.height) ? props.height + "px" : props.height; + const width = isNumber(props.width) ? props.width + "px" : props.width; return { height, - width, + width }; }); @@ -127,10 +117,10 @@ export default defineComponent({ [{ font: [] }], [{ align: [] }], ["clean"], - ["link", "image"], - ], + ["link", "image"] + ] }, - ...props.options, + ...props.options }); // 添加图片工具 @@ -157,9 +147,9 @@ export default defineComponent({ style, setRefs, setContent, - onUploadSpaceConfirm, + onUploadSpaceConfirm }; - }, + } }); @@ -259,12 +249,8 @@ export default defineComponent({ content: "衬线字体"; } - .ql-snow - .ql-picker.ql-font - .ql-picker-label[data-value="monospace"]::before, - .ql-snow - .ql-picker.ql-font - .ql-picker-item[data-value="monospace"]::before { + .ql-snow .ql-picker.ql-font .ql-picker-label[data-value="monospace"]::before, + .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="monospace"]::before { content: "等宽字体"; } } diff --git a/src/cool/modules/base/components/icon-svg/index.vue b/src/cool/modules/base/components/icon-svg/index.vue index 1a377fa..75ee084 100644 --- a/src/cool/modules/base/components/icon-svg/index.vue +++ b/src/cool/modules/base/components/icon-svg/index.vue @@ -1,6 +1,6 @@ @@ -13,36 +13,32 @@ export default defineComponent({ props: { name: { - type: String, + type: String }, className: { - type: String, + type: String }, size: { - type: [String, Number], - }, + type: [String, Number] + } }, setup(props) { const style = ref({ - fontSize: isNumber(props.size) ? props.size + "px" : props.size, + fontSize: isNumber(props.size) ? props.size + "px" : props.size }); const iconName = computed(() => `#icon-${props.name}`); const svgClass = computed>(() => { - return [ - "icon-svg", - `icon-svg__${props.name}`, - String(props.className || ""), - ]; + return ["icon-svg", `icon-svg__${props.name}`, String(props.className || "")]; }); return { style, iconName, - svgClass, + svgClass }; - }, + } }); diff --git a/src/cool/modules/base/components/menu/file.vue b/src/cool/modules/base/components/menu/file.vue index 5204cb5..e79ac2d 100644 --- a/src/cool/modules/base/components/menu/file.vue +++ b/src/cool/modules/base/components/menu/file.vue @@ -1,19 +1,12 @@ @@ -29,7 +22,7 @@ function findFiles() { for (const i in files) { if (!i.includes("components")) { list.push({ - value: i.substr(5), + value: i.substr(5) }); } } @@ -43,8 +36,8 @@ export default defineComponent({ props: { modelValue: { type: String, - default: "", - }, + default: "" + } }, emits: ["update:modelValue"], @@ -69,9 +62,9 @@ export default defineComponent({ return { path, - list, + list }; - }, + } }); diff --git a/src/cool/modules/base/components/menu/icons.vue b/src/cool/modules/base/components/menu/icons.vue index f04509c..6885e7b 100644 --- a/src/cool/modules/base/components/menu/icons.vue +++ b/src/cool/modules/base/components/menu/icons.vue @@ -8,13 +8,13 @@ popper-class="popper-menu-icon" > - + - + @@ -26,7 +26,7 @@ clearable @click="open" @input="onChange" - > + /> @@ -60,7 +60,7 @@ export default defineComponent({ watch( () => props.modelValue, - val => { + (val) => { name.value = val; } ); diff --git a/src/cool/modules/base/components/menu/perms.vue b/src/cool/modules/base/components/menu/perms.vue index 989bb5d..7d617d7 100644 --- a/src/cool/modules/base/components/menu/perms.vue +++ b/src/cool/modules/base/components/menu/perms.vue @@ -8,7 +8,7 @@ :options="options" :props="{ multiple: true }" @change="onChange" - > + /> @@ -21,8 +21,8 @@ export default defineComponent({ props: { modelValue: { type: String, - default: "", - }, + default: "" + } }, emits: ["update:modelValue"], @@ -38,10 +38,7 @@ export default defineComponent({ // 监听改变 function onChange(row: any) { - emit( - "update:modelValue", - row.map((e: any) => e.join(":")).join(",") - ); + emit("update:modelValue", row.map((e: any) => e.join(":")).join(",")); } // 解析权限 @@ -80,7 +77,7 @@ export default defineComponent({ d.push({ label: key, value: key, - children: isLast ? null : [], + children: isLast ? null : [] }); if (!isLast) { @@ -99,21 +96,19 @@ export default defineComponent({ watch( () => props.modelValue, (val: string) => { - value.value = val - ? val.split(",").map((e: string) => e.split(":")) - : []; + value.value = val ? val.split(",").map((e: string) => e.split(":")) : []; }, { - immediate: true, + immediate: true } ); return { value, options, - onChange, + onChange }; - }, + } }); diff --git a/src/cool/modules/base/components/menu/topbar.vue b/src/cool/modules/base/components/menu/topbar.vue index 8f3fc99..9e8e6cf 100644 --- a/src/cool/modules/base/components/menu/topbar.vue +++ b/src/cool/modules/base/components/menu/topbar.vue @@ -6,16 +6,8 @@ background-color="transparent" @select="onSelect" > - - + + {{ item.name }} @@ -45,9 +37,7 @@ export default defineComponent({ const index = ref("0"); // 菜单列表 - const list = computed(() => - store.getters.menuGroup.filter((e: any) => e.isShow) - ); + const list = computed(() => store.getters.menuGroup.filter((e: any) => e.isShow)); // 选择导航 function onSelect(index: number) { @@ -87,9 +77,9 @@ export default defineComponent({ return { index, list, - onSelect, + onSelect }; - }, + } }); diff --git a/src/cool/modules/base/components/menu/tree.vue b/src/cool/modules/base/components/menu/tree.vue index 6facc8b..99d37bf 100644 --- a/src/cool/modules/base/components/menu/tree.vue +++ b/src/cool/modules/base/components/menu/tree.vue @@ -6,7 +6,7 @@ width="500px" popper-class="popper-menu-tree" > - + @@ -25,11 +25,10 @@ :default-expanded-keys="expandedKeys" :filter-node-method="filterNode" @current-change="onCurrentChange" - > - + /> @@ -91,7 +90,7 @@ export default defineComponent({ // 节点名称 const name = computed(() => { - const item = list.value.find(e => e.id == props.modelValue); + const item = list.value.find((e) => e.id == props.modelValue); return item ? item.name : "一级菜单"; }); @@ -103,7 +102,7 @@ export default defineComponent({ treeRef.value.filter(val); }); - onMounted(function() { + onMounted(function () { refresh(); }); diff --git a/src/cool/modules/base/components/process/index.vue b/src/cool/modules/base/components/process/index.vue index 47ad6f1..48c9f9b 100644 --- a/src/cool/modules/base/components/process/index.vue +++ b/src/cool/modules/base/components/process/index.vue @@ -4,19 +4,19 @@ -
    +
    {{ item.label }} - +
    @@ -138,7 +138,7 @@ export default { watch( () => route.path, - function(val) { + function (val) { adScroll(list.value.findIndex((e: any) => e.value === val) || 0); } ); diff --git a/src/cool/modules/base/components/role/perms.vue b/src/cool/modules/base/components/role/perms.vue index ad33bb1..3dbb699 100644 --- a/src/cool/modules/base/components/role/perms.vue +++ b/src/cool/modules/base/components/role/perms.vue @@ -1,8 +1,8 @@ @@ -40,6 +39,8 @@ export default defineComponent({ title: String }, + emits: ["update:modelValue"], + setup(props, { emit }) { const $service = inject("service"); @@ -68,7 +69,7 @@ export default defineComponent({ // 处理半选状态 const fn = (list: any[]) => { - list.forEach(e => { + list.forEach((e) => { if (e.children) { fn(e.children); } else { @@ -79,7 +80,7 @@ export default defineComponent({ fn(list.value); - checked.value = ids.filter(id => (val || []).includes(id)); + checked.value = ids.filter((id) => (val || []).includes(id)); } // 刷新列表 diff --git a/src/cool/modules/base/components/role/select.vue b/src/cool/modules/base/components/role/select.vue index 0e9be45..f1ee714 100644 --- a/src/cool/modules/base/components/role/select.vue +++ b/src/cool/modules/base/components/role/select.vue @@ -1,11 +1,6 @@ diff --git a/src/cool/modules/base/components/route-nav/index.vue b/src/cool/modules/base/components/route-nav/index.vue index b1e6efc..833e12d 100644 --- a/src/cool/modules/base/components/route-nav/index.vue +++ b/src/cool/modules/base/components/route-nav/index.vue @@ -1,21 +1,15 @@ @@ -143,7 +128,7 @@ export default defineComponent({ // 选择项 const selects = reactive({ dept: {}, - ids: [], + ids: [] }); // 部门列表 @@ -154,53 +139,53 @@ export default defineComponent({ props: { "default-sort": { prop: "createTime", - order: "descending", - }, + order: "descending" + } }, columns: [ { type: "selection", - width: 60, + width: 60 }, { prop: "headImg", - label: "头像", + label: "头像" }, { prop: "name", label: "姓名", - minWidth: 150, + minWidth: 150 }, { prop: "username", label: "用户名", - minWidth: 150, + minWidth: 150 }, { prop: "nickName", label: "昵称", - minWidth: 150, + minWidth: 150 }, { prop: "departmentName", label: "部门名称", - minWidth: 150, + minWidth: 150 }, { prop: "roleName", label: "角色", headerAlign: "center", - minWidth: 200, + minWidth: 200 }, { prop: "phone", label: "手机号码", - minWidth: 150, + minWidth: 150 }, { prop: "remark", label: "备注", - minWidth: 150, + minWidth: 150 }, { prop: "status", @@ -210,27 +195,27 @@ export default defineComponent({ { label: "启用", value: 1, - type: "success", + type: "success" }, { label: "禁用", value: 0, - type: "danger", - }, - ], + type: "danger" + } + ] }, { prop: "createTime", label: "创建时间", sortable: "custom", - minWidth: 150, + minWidth: 150 }, { type: "op", buttons: ["slot-move-btn", "edit", "delete"], - width: 160, - }, - ], + width: 160 + } + ] }); // 新增、编辑配置 @@ -244,9 +229,9 @@ export default defineComponent({ name: "cl-upload", props: { text: "选择头像", - icon: "el-icon-picture", - }, - }, + icon: "el-icon-picture" + } + } }, { prop: "name", @@ -255,13 +240,13 @@ export default defineComponent({ component: { name: "el-input", props: { - placeholder: "请填写姓名", - }, + placeholder: "请填写姓名" + } }, rules: { required: true, - message: "姓名不能为空", - }, + message: "姓名不能为空" + } }, { prop: "nickName", @@ -270,13 +255,13 @@ export default defineComponent({ component: { name: "el-input", props: { - placeholder: "请填写昵称", - }, + placeholder: "请填写昵称" + } }, rules: { required: true, - message: "昵称不能为空", - }, + message: "昵称不能为空" + } }, { prop: "username", @@ -285,15 +270,15 @@ export default defineComponent({ component: { name: "el-input", props: { - placeholder: "请填写用户名", - }, + placeholder: "请填写用户名" + } }, rules: [ { required: true, - message: "用户名不能为空", - }, - ], + message: "用户名不能为空" + } + ] }, { prop: "password", @@ -304,16 +289,16 @@ export default defineComponent({ name: "el-input", props: { placeholder: "请填写密码", - type: "password", - }, + type: "password" + } }, rules: [ { min: 6, max: 16, - message: "密码长度在 6 到 16 个字符", - }, - ], + message: "密码长度在 6 到 16 个字符" + } + ] }, { prop: "roleIdList", @@ -324,14 +309,14 @@ export default defineComponent({ name: "cl-role-select", props: { props: { - "multiple-limit": 3, - }, - }, + "multiple-limit": 3 + } + } }, rules: { required: true, - message: "角色不能为空", - }, + message: "角色不能为空" + } }, { prop: "phone", @@ -340,9 +325,9 @@ export default defineComponent({ component: { name: "el-input", props: { - placeholder: "请填写手机号码", - }, - }, + placeholder: "请填写手机号码" + } + } }, { prop: "email", @@ -351,9 +336,9 @@ export default defineComponent({ component: { name: "el-input", props: { - placeholder: "请填写邮箱", - }, - }, + placeholder: "请填写邮箱" + } + } }, { prop: "remark", @@ -364,9 +349,9 @@ export default defineComponent({ props: { placeholder: "请填写备注", type: "textarea", - rows: 4, - }, - }, + rows: 4 + } + } }, { prop: "status", @@ -377,23 +362,23 @@ export default defineComponent({ options: [ { label: "开启", - value: 1, + value: 1 }, { label: "关闭", - value: 0, - }, - ], - }, + value: 0 + } + ] + } }, { prop: "tips", hidden: ":isEdit", component: { - name: "slot-tips", - }, - }, - ], + name: "slot-tips" + } + } + ] }); // 浏览器信息 @@ -406,7 +391,7 @@ export default defineComponent({ isExpand.value = !val; }, { - immediate: true, + immediate: true } ); @@ -450,7 +435,7 @@ export default defineComponent({ next({ ...data, - departmentId, + departmentId }); } @@ -465,7 +450,7 @@ export default defineComponent({ refresh({ page: 1, - departmentIds: ids, + departmentIds: ids }); // 收起 @@ -477,7 +462,7 @@ export default defineComponent({ // 部门下新增成员 function onDeptUserAdd(item: any) { refs.value.crud.rowAppend({ - departmentId: item.id, + departmentId: item.id }); } @@ -522,9 +507,9 @@ export default defineComponent({ onDeptUserAdd, onDeptListChange, deptExpand, - toMove, + toMove }; - }, + } }); diff --git a/src/cool/modules/chat/components/chat.vue b/src/cool/modules/chat/components/chat.vue index 127fe8a..74acb92 100644 --- a/src/cool/modules/chat/components/chat.vue +++ b/src/cool/modules/chat/components/chat.vue @@ -31,8 +31,8 @@ @@ -40,8 +40,8 @@
    @@ -82,6 +82,8 @@ export default defineComponent({ } }, + emits: ["message"], + setup(_, { emit }) { const store = useStore(); const { refs, setRefs } = useRefs(); @@ -223,7 +225,7 @@ export default defineComponent({ } // 加载 socket - (function() { + (function () { // socket = io(`${socketUrl}?isAdmin=true&token=${store.getters.token}`); // socket.on("connect", () => { // console.log("socket connect"); @@ -246,7 +248,7 @@ export default defineComponent({ }); // 销毁 - onUnmounted(function() { + onUnmounted(function () { if (socket) { socket.close(); } diff --git a/src/cool/modules/chat/components/emoji.vue b/src/cool/modules/chat/components/emoji.vue index 288c200..1c2bbba 100644 --- a/src/cool/modules/chat/components/emoji.vue +++ b/src/cool/modules/chat/components/emoji.vue @@ -10,9 +10,9 @@
    @@ -127,6 +127,8 @@ const emoji = { }; export default defineComponent({ + emits: ["select"], + setup(_, { emit }) { const store = useStore(); @@ -134,7 +136,7 @@ export default defineComponent({ const visible = ref(false); // 表情列表 - const list = ref(emoji.list.map(e => emoji.url + e)); + const list = ref(emoji.list.map((e) => emoji.url + e)); // 弹窗宽度 const popoverWidth = computed(() => { diff --git a/src/cool/modules/chat/components/icon-voice.vue b/src/cool/modules/chat/components/icon-voice.vue index f08a09d..f540eb1 100644 --- a/src/cool/modules/chat/components/icon-voice.vue +++ b/src/cool/modules/chat/components/icon-voice.vue @@ -1,6 +1,6 @@ diff --git a/src/cool/modules/chat/components/input.vue b/src/cool/modules/chat/components/input.vue index 6816388..334e7db 100644 --- a/src/cool/modules/chat/components/input.vue +++ b/src/cool/modules/chat/components/input.vue @@ -59,13 +59,9 @@ resize="none" :rows="5" @keyup.enter="onTextSend" - > + /> - 发送
    @@ -79,7 +75,7 @@ import Emoji from "./emoji.vue"; export default defineComponent({ components: { - Emoji, + Emoji }, setup() { @@ -92,7 +88,7 @@ export default defineComponent({ // 表情 const emoji = reactive({ - visible: false, + visible: false }); // 追加消息 @@ -116,7 +112,7 @@ export default defineComponent({ contentType: data.contentType, type: 0, content: data.content, - sessionId: id, + sessionId: id }); } @@ -131,14 +127,14 @@ export default defineComponent({ function next(options = {}) { const data = { content: { - [`${key}Url`]: "", + [`${key}Url`]: "" }, type: 0, uid: file.uid, loading: true, progress: "0%", contentType: chat.modes.indexOf(key), - ...options, + ...options }; append(data); @@ -163,12 +159,12 @@ export default defineComponent({ next({ content: { - imageUrl, + imageUrl }, style: { height: height + "px", - width: width + "px", - }, + width: width + "px" + } }); }; @@ -186,8 +182,8 @@ export default defineComponent({ store.commit("UPDATE_MESSAGE", { file, data: { - progress: e.percent + "%", - }, + progress: e.percent + "%" + } }); } @@ -198,10 +194,10 @@ export default defineComponent({ data: { loading: false, content: { - [`${key}Url`]: res.data, - }, + [`${key}Url`]: res.data + } }, - callback: send, + callback: send }); } @@ -213,8 +209,8 @@ export default defineComponent({ type: 0, contentType: 0, content: { - text: text.value, - }, + text: text.value + } }; send(data, true); @@ -231,10 +227,10 @@ export default defineComponent({ send( { content: { - imageUrl: res.data, + imageUrl: res.data }, type: 0, - contentType: 1, + contentType: 1 }, true ); @@ -246,10 +242,10 @@ export default defineComponent({ send( { content: { - imageUrl: url, + imageUrl: url }, type: 0, - contentType: 2, + contentType: 2 }, true ); @@ -260,10 +256,10 @@ export default defineComponent({ send( { content: { - videoUrl: url, + videoUrl: url }, type: 0, - contentType: 4, + contentType: 4 }, true ); @@ -279,9 +275,9 @@ export default defineComponent({ onTextSend, onImageSelect, onEmojiSelect, - onVideoSelect, + onVideoSelect }; - }, + } }); diff --git a/src/cool/modules/chat/components/message.vue b/src/cool/modules/chat/components/message.vue index cf1df79..1ccb578 100644 --- a/src/cool/modules/chat/components/message.vue +++ b/src/cool/modules/chat/components/message.vue @@ -1,23 +1,15 @@ diff --git a/src/cool/modules/chat/components/notice.vue b/src/cool/modules/chat/components/notice.vue index 926fc90..cd7a3a7 100644 --- a/src/cool/modules/chat/components/notice.vue +++ b/src/cool/modules/chat/components/notice.vue @@ -5,7 +5,7 @@ - +
    @@ -16,7 +16,7 @@ export default { data() { return { visible: false, - number: 0, + number: 0 }; }, @@ -38,8 +38,8 @@ export default { openChatBox() { this.$refs["chat"].open(); this.number = 0; - }, - }, + } + } }; diff --git a/src/cool/modules/chat/components/session.vue b/src/cool/modules/chat/components/session.vue index d3f32f3..55157b3 100644 --- a/src/cool/modules/chat/components/session.vue +++ b/src/cool/modules/chat/components/session.vue @@ -16,15 +16,15 @@ clearable @clear="onSearch" @keyup.enter="onSearch" - > + />
    -
      +
      • { + clipboard.on("success", (e) => { ElMessage.success("复制成功"); e.clearSelection(); }); - clipboard.on("error", err => { + clipboard.on("error", (err) => { console.error(err); ElMessage.success("复制失败"); }); diff --git a/src/cool/modules/demo/components/crud/adv-search.vue b/src/cool/modules/demo/components/crud/adv-search.vue index f25c84e..195b564 100644 --- a/src/cool/modules/demo/components/crud/adv-search.vue +++ b/src/cool/modules/demo/components/crud/adv-search.vue @@ -1,7 +1,7 @@ @@ -10,8 +10,6 @@ import { AdvSearchItem } from "/@/crud/types"; import { defineComponent, ref } from "vue"; export default defineComponent({ - name: "demo-adv-search", - setup() { const items = ref([ { diff --git a/src/cool/modules/demo/components/crud/context-menu.vue b/src/cool/modules/demo/components/crud/context-menu.vue index bf56d50..6c48b1e 100644 --- a/src/cool/modules/demo/components/crud/context-menu.vue +++ b/src/cool/modules/demo/components/crud/context-menu.vue @@ -10,8 +10,6 @@ import { ElMessage } from "element-plus"; import { defineComponent } from "vue"; export default defineComponent({ - name: "demo__context-menu", - setup() { function open(event: any) { ContextMenu.open(event, { diff --git a/src/cool/modules/demo/components/crud/dialog.vue b/src/cool/modules/demo/components/crud/dialog.vue index bb27e60..bf1b548 100644 --- a/src/cool/modules/demo/components/crud/dialog.vue +++ b/src/cool/modules/demo/components/crud/dialog.vue @@ -9,7 +9,7 @@ @opened="onOpened" @closed="onClosed" > - +
    @@ -18,8 +18,6 @@ import { defineComponent, ref } from "vue"; export default defineComponent({ - name: "demo__dialog", - setup() { const visible = ref(false); diff --git a/src/cool/modules/demo/components/crud/form.vue b/src/cool/modules/demo/components/crud/form.vue index 7ac5ecb..1a91e39 100644 --- a/src/cool/modules/demo/components/crud/form.vue +++ b/src/cool/modules/demo/components/crud/form.vue @@ -27,7 +27,7 @@ prop: 'createTime' } ]" - > + /> @@ -39,7 +39,7 @@ :prop="'vads.' + index + '.val'" :rules="{ required: true, message: '请输入' }" > - + 添加行 @@ -55,8 +55,6 @@ import { TestService } from "../../utils/service"; import { CrudLoad, FormItem, FormRef } from "/@/crud/types"; export default defineComponent({ - name: "demo-form", - setup() { const formRef = ref(); diff --git a/src/cool/modules/demo/components/crud/query.vue b/src/cool/modules/demo/components/crud/query.vue index 15b48e4..8a64c2f 100644 --- a/src/cool/modules/demo/components/crud/query.vue +++ b/src/cool/modules/demo/components/crud/query.vue @@ -1,5 +1,5 @@ diff --git a/src/cool/modules/demo/views/demo.vue b/src/cool/modules/demo/views/demo.vue index d53550b..ef923c8 100644 --- a/src/cool/modules/demo/views/demo.vue +++ b/src/cool/modules/demo/views/demo.vue @@ -1,15 +1,8 @@