From f106305bb99173663cab7f8266da2f041d7738ad Mon Sep 17 00:00:00 2001
From: yangzhiwen <1163139003@qq.com>
Date: Sat, 16 Dec 2023 21:17:20 +0800
Subject: [PATCH] =?UTF-8?q?build:=20:package:=20=E6=8C=89=E9=9C=80?=
=?UTF-8?q?=E5=8A=A0=E8=BD=BDecharts=E3=80=81=E4=BB=A3=E7=A0=81=E9=87=8D?=
=?UTF-8?q?=E6=96=B0=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=A4=84=E7=90=86=E3=80=81?=
=?UTF-8?q?=E6=89=93=E5=8C=85=E6=97=B6=E5=88=86=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
.eslintrc.cjs | 120 +-
.prettierrc.cjs | 30 +-
.stylelintrc.cjs | 48 +-
.vscode/settings.json | 8 +-
commitlint.config.cjs | 86 +-
index.html | 20 +-
mock/article.ts | 154 +-
mock/dept.ts | 30 +-
mock/dict.ts | 40 +-
mock/role.ts | 138 +-
mock/router.ts | 532 ++--
mock/user.ts | 214 +-
package.json | 10 +-
src/App.vue | 4 +-
src/api/article.ts | 104 +-
src/api/auth/index.ts | 38 +-
src/api/auth/types.ts | 20 +-
src/api/dept/index.ts | 48 +-
src/api/dept/types.ts | 30 +-
src/api/dict/index.ts | 86 +-
src/api/dict/types.ts | 52 +-
src/api/file/index.ts | 28 +-
src/api/file/types.ts | 4 +-
src/api/menu/index.ts | 54 +-
src/api/menu/types.ts | 56 +-
src/api/role/index.ts | 64 +-
src/api/role/types.ts | 30 +-
src/api/user/index.ts | 86 +-
src/api/user/types.ts | 64 +-
src/components/Breadcrumb/index.vue | 66 +-
src/components/Dictionary/index.vue | 46 +-
src/components/Hamburger/index.vue | 10 +-
src/components/IconSelect/index.vue | 46 +-
src/components/LangSelect/index.vue | 18 +-
src/components/Pagination/index.vue | 42 +-
src/components/RightPanel/index.vue | 44 +-
src/components/SizeSelect/index.vue | 16 +-
src/components/SvgIcon/index.vue | 14 +-
src/components/Upload/MultiUpload.vue | 66 +-
src/components/Upload/SingleUpload.vue | 24 +-
src/components/WangEditor/index.vue | 50 +-
src/directive/index.ts | 6 +-
src/directive/permission/index.ts | 44 +-
src/enums/MenuTypeEnum.ts | 8 +-
src/lang/index.ts | 26 +-
src/lang/package/en.ts | 24 +-
src/lang/package/zh-cn.ts | 24 +-
src/layout/components/AppMain.vue | 4 +-
src/layout/components/NavBar/NavRight.vue | 48 +-
src/layout/components/NavBar/index.vue | 6 +-
src/layout/components/Settings/index.vue | 82 +-
src/layout/components/Sidebar/Item.vue | 10 +-
src/layout/components/Sidebar/LeftMenu.vue | 40 +-
src/layout/components/Sidebar/Link.vue | 28 +-
src/layout/components/Sidebar/Logo.vue | 14 +-
src/layout/components/Sidebar/SidebarItem.vue | 48 +-
src/layout/components/Sidebar/TopMenu.vue | 46 +-
src/layout/components/Sidebar/index.vue | 34 +-
src/layout/components/TagsView/ScrollPane.vue | 74 +-
src/layout/components/TagsView/index.vue | 242 +-
src/layout/components/index.ts | 8 +-
src/layout/index.vue | 74 +-
src/layout/main.vue | 42 +-
src/main.ts | 30 +-
src/permission.ts | 62 +-
src/router/index.ts | 68 +-
src/settings.ts | 20 +-
src/store/index.ts | 10 +-
src/store/modules/app.ts | 70 +-
src/store/modules/permission.ts | 82 +-
src/store/modules/settings.ts | 50 +-
src/store/modules/tagsView.ts | 162 +-
src/store/modules/user.ts | 82 +-
src/styles/index.scss | 8 +-
src/styles/reset.scss | 4 +-
src/typings/auto-imports.d.ts | 2392 ++++++++---------
src/typings/components.d.ts | 208 +-
src/typings/env.d.ts | 16 +-
src/typings/global.d.ts | 60 +-
src/typings/router.d.ts | 18 +-
src/typings/shims-vue.d.ts | 2 +-
src/utils/_echarts.ts | 50 +
src/utils/i18n.ts | 10 +-
src/utils/index.ts | 12 +-
src/utils/request.ts | 56 +-
src/utils/scroll-to.ts | 56 +-
src/views/dashboard/components/BarChart.vue | 169 +-
.../dashboard/components/FunnelChart.vue | 99 +-
src/views/dashboard/components/PieChart.vue | 75 +-
src/views/dashboard/components/RadarChart.vue | 91 +-
src/views/dashboard/index.vue | 62 +-
src/views/demo/dict.vue | 4 +-
src/views/demo/icon-selector.vue | 2 +-
src/views/demo/icons.vue | 104 +-
.../permission/components/SwitchRoles.vue | 18 +-
src/views/demo/permission/page.vue | 14 +-
src/views/demo/signature.vue | 142 +-
src/views/demo/table/Export2Excel.js | 224 +-
src/views/demo/table/drag-table.vue | 90 +-
.../dynamic-table/components/FixedThead.vue | 36 +-
.../dynamic-table/components/UnfixedThead.vue | 22 +-
src/views/demo/table/dynamic-table/index.vue | 10 +-
src/views/demo/upload.vue | 20 +-
src/views/demo/wang-editor.vue | 4 +-
src/views/demo/websocket.vue | 116 +-
src/views/error-page/401.vue | 22 +-
src/views/error-page/404.vue | 6 +-
src/views/login/index.vue | 162 +-
src/views/redirect/index.vue | 12 +-
src/views/system/dept/index.vue | 146 +-
.../system/dict/components/dict-item.vue | 154 +-
src/views/system/dict/index.vue | 150 +-
src/views/system/menu/index.vue | 176 +-
src/views/system/role/index.vue | 196 +-
.../system/user/components/dept-tree.vue | 38 +-
src/views/system/user/index.vue | 328 +--
uno.config.ts | 22 +-
vite.config.ts | 254 +-
119 files changed, 5039 insertions(+), 5031 deletions(-)
create mode 100644 src/utils/_echarts.ts
diff --git a/.env.development b/.env.development
index daa0fc6d..f4a99ec2 100644
--- a/.env.development
+++ b/.env.development
@@ -6,7 +6,7 @@ NODE_ENV='development'
VITE_APP_PORT = 3000
# API请求前缀
-VITE_APP_BASE_API = '/dev-api'
+VITE_APP_BASE_API = '/' # Mock需要去掉/api
# proxy代理配置
VITE_APP_API_URL = 'http://vapi.youlai.tech' # 线上接口
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 8ae169a9..364aafad 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -3,86 +3,86 @@ module.exports = {
env: {
browser: true,
es2021: true,
- node: true,
+ node: true
},
- parser: "vue-eslint-parser",
+ parser: 'vue-eslint-parser',
extends: [
// https://eslint.vuejs.org/user-guide/#usage
- "plugin:vue/vue3-recommended",
- "./.eslintrc-auto-import.json",
- "prettier",
- "plugin:@typescript-eslint/recommended",
- "plugin:prettier/recommended",
+ 'plugin:vue/vue3-recommended',
+ './.eslintrc-auto-import.json',
+ 'prettier',
+ 'plugin:@typescript-eslint/recommended',
+ 'plugin:prettier/recommended'
],
parserOptions: {
- ecmaVersion: "latest",
- sourceType: "module",
- parser: "@typescript-eslint/parser",
- project: "./tsconfig.*?.json",
+ ecmaVersion: 'latest',
+ sourceType: 'module',
+ parser: '@typescript-eslint/parser',
+ project: './tsconfig.*?.json',
createDefaultProgram: false,
- extraFileExtensions: [".vue"],
+ extraFileExtensions: ['.vue']
},
- plugins: ["vue", "@typescript-eslint"],
+ plugins: ['vue', '@typescript-eslint'],
rules: {
// https://eslint.vuejs.org/rules/#priority-a-essential-error-prevention
- "vue/multi-word-component-names": "off",
- "vue/no-v-model-argument": "off",
- "vue/script-setup-uses-vars": "error",
- "vue/no-reserved-component-names": "off",
- "vue/custom-event-name-casing": "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/require-default-prop": "off",
- "vue/require-explicit-emits": "off",
- "vue/html-self-closing": [
- "error",
+ 'vue/multi-word-component-names': 'off',
+ 'vue/no-v-model-argument': 'off',
+ 'vue/script-setup-uses-vars': 'error',
+ 'vue/no-reserved-component-names': 'off',
+ 'vue/custom-event-name-casing': '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/require-default-prop': 'off',
+ 'vue/require-explicit-emits': 'off',
+ 'vue/html-self-closing': [
+ 'error',
{
html: {
- void: "always",
- normal: "never",
- component: "always",
+ void: 'always',
+ normal: 'never',
+ component: 'always'
},
- svg: "always",
- math: "always",
- },
+ svg: 'always',
+ math: 'always'
+ }
],
- "@typescript-eslint/no-empty-function": "off", // 关闭空方法检查
- "@typescript-eslint/no-explicit-any": "off", // 关闭any类型的警告
- "@typescript-eslint/no-non-null-assertion": "off",
- "@typescript-eslint/ban-ts-ignore": "off",
- "@typescript-eslint/ban-ts-comment": "off",
- "@typescript-eslint/ban-types": "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",
- "@typescript-eslint/no-use-before-define": "off",
- "@typescript-eslint/no-non-null-assertion": "off",
- "@typescript-eslint/explicit-module-boundary-types": "off",
- "@typescript-eslint/no-unused-vars": "off",
+ '@typescript-eslint/no-empty-function': 'off', // 关闭空方法检查
+ '@typescript-eslint/no-explicit-any': 'off', // 关闭any类型的警告
+ '@typescript-eslint/no-non-null-assertion': 'off',
+ '@typescript-eslint/ban-ts-ignore': 'off',
+ '@typescript-eslint/ban-ts-comment': 'off',
+ '@typescript-eslint/ban-types': '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',
+ '@typescript-eslint/no-use-before-define': 'off',
+ '@typescript-eslint/no-non-null-assertion': 'off',
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
+ '@typescript-eslint/no-unused-vars': 'off',
- "prettier/prettier": [
- "error",
+ 'prettier/prettier': [
+ 'error',
{
- useTabs: false, // 不使用制表符
- },
- ],
+ useTabs: false // 不使用制表符
+ }
+ ]
},
// eslint不能对html文件生效
overrides: [
{
- files: ["*.html"],
- processor: "vue/.vue",
- },
+ files: ['*.html'],
+ processor: 'vue/.vue'
+ }
],
// https://eslint.org/docs/latest/use/configure/language-options#specifying-globals
globals: {
- OptionType: "readonly",
- },
-};
+ OptionType: 'readonly'
+ }
+}
diff --git a/.prettierrc.cjs b/.prettierrc.cjs
index 347fb32e..e478c663 100644
--- a/.prettierrc.cjs
+++ b/.prettierrc.cjs
@@ -1,14 +1,14 @@
module.exports = {
// (x)=>{},单个参数箭头函数是否显示小括号。(always:始终显示;avoid:省略括号。默认:always)
- arrowParens: "always",
+ arrowParens: 'always',
// 开始标签的右尖括号是否跟随在最后一行属性末尾,默认false
bracketSameLine: false,
// 对象字面量的括号之间打印空格 (true - Example: { foo: bar } ; false - Example: {foo:bar})
bracketSpacing: true,
// 是否格式化一些文件中被嵌入的代码片段的风格(auto|off;默认auto)
- embeddedLanguageFormatting: "auto",
+ embeddedLanguageFormatting: 'auto',
// 指定 HTML 文件的空格敏感度 (css|strict|ignore;默认css)
- htmlWhitespaceSensitivity: "css",
+ htmlWhitespaceSensitivity: 'css',
// 当文件已经被 Prettier 格式化之后,是否会在文件顶部插入一个特殊的 @format 标记,默认false
insertPragma: false,
// 在 JSX 中使用单引号替代双引号,默认false
@@ -16,31 +16,31 @@ module.exports = {
// 每行最多字符数量,超出换行(默认80)
printWidth: 80,
// 超出打印宽度 (always | never | preserve )
- proseWrap: "preserve",
+ proseWrap: 'preserve',
// 对象属性是否使用引号(as-needed | consistent | preserve;默认as-needed:对象的属性需要加引号才添加;)
- quoteProps: "as-needed",
+ quoteProps: 'as-needed',
// 是否只格式化在文件顶部包含特定注释(@prettier| @format)的文件,默认false
requirePragma: false,
// 结尾添加分号
- semi: true,
+ semi: false,
// 使用单引号 (true:单引号;false:双引号)
- singleQuote: false,
+ singleQuote: true,
// 缩进空格数,默认2个空格
tabWidth: 2,
// 元素末尾是否加逗号,默认es5: ES5中的 objects, arrays 等会添加逗号,TypeScript 中的 type 后不加逗号
- trailingComma: "es5",
+ trailingComma: 'none',
// 指定缩进方式,空格或tab,默认false,即使用空格
useTabs: false,
// vue 文件中是否缩进
diff --git a/src/directive/index.ts b/src/directive/index.ts
index 9c22eb69..f50e66d7 100644
--- a/src/directive/index.ts
+++ b/src/directive/index.ts
@@ -1,9 +1,9 @@
-import type { App } from "vue";
+import type { App } from 'vue'
-import { hasPerm } from "./permission";
+import { hasPerm } from './permission'
// 全局注册 directive
export function setupDirective(app: App) {
// 使 v-hasPerm 在所有组件中都可用
- app.directive("hasPerm", hasPerm);
+ app.directive('hasPerm', hasPerm)
}
diff --git a/src/directive/permission/index.ts b/src/directive/permission/index.ts
index 2bd2c705..155e69d3 100644
--- a/src/directive/permission/index.ts
+++ b/src/directive/permission/index.ts
@@ -1,5 +1,5 @@
-import { useUserStoreHook } from "@/store/modules/user";
-import { Directive, DirectiveBinding } from "vue";
+import { useUserStoreHook } from '@/store/modules/user'
+import { Directive, DirectiveBinding } from 'vue'
/**
* 按钮权限
@@ -7,49 +7,49 @@ import { Directive, DirectiveBinding } from "vue";
export const hasPerm: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
// 「超级管理员」拥有所有的按钮权限
- const { roles, perms } = useUserStoreHook().user;
- if (roles.includes("ROOT")) {
- return true;
+ const { roles, perms } = useUserStoreHook().user
+ if (roles.includes('ROOT')) {
+ return true
}
// 「其他角色」按钮权限校验
- const { value } = binding;
+ const { value } = binding
if (value) {
- const requiredPerms = value; // DOM绑定需要的按钮权限标识
+ const requiredPerms = value // DOM绑定需要的按钮权限标识
const hasPerm = perms?.some((perm) => {
- return requiredPerms.includes(perm);
- });
+ return requiredPerms.includes(perm)
+ })
if (!hasPerm) {
- el.parentNode && el.parentNode.removeChild(el);
+ el.parentNode && el.parentNode.removeChild(el)
}
} else {
throw new Error(
"need perms! Like v-has-perm=\"['sys:user:add','sys:user:edit']\""
- );
+ )
}
- },
-};
+ }
+}
/**
* 角色权限
*/
export const hasRole: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
- const { value } = binding;
+ const { value } = binding
if (value) {
- const requiredRoles = value; // DOM绑定需要的角色编码
- const { roles } = useUserStoreHook().user;
+ const requiredRoles = value // DOM绑定需要的角色编码
+ const { roles } = useUserStoreHook().user
const hasRole = roles.some((perm) => {
- return requiredRoles.includes(perm);
- });
+ return requiredRoles.includes(perm)
+ })
if (!hasRole) {
- el.parentNode && el.parentNode.removeChild(el);
+ el.parentNode && el.parentNode.removeChild(el)
}
} else {
- throw new Error("need roles! Like v-has-role=\"['admin','test']\"");
+ throw new Error("need roles! Like v-has-role=\"['admin','test']\"")
}
- },
-};
+ }
+}
diff --git a/src/enums/MenuTypeEnum.ts b/src/enums/MenuTypeEnum.ts
index 65e591db..96c612e4 100644
--- a/src/enums/MenuTypeEnum.ts
+++ b/src/enums/MenuTypeEnum.ts
@@ -2,18 +2,18 @@ export enum MenuTypeEnum {
/**
* 目录
*/
- CATALOG = "CATALOG",
+ CATALOG = 'CATALOG',
/**
* 菜单
*/
- MENU = "MENU",
+ MENU = 'MENU',
/**
* 按钮
*/
- BUTTON = "BUTTON",
+ BUTTON = 'BUTTON',
/**
* 外链
*/
- EXTLINK = "EXTLINK",
+ EXTLINK = 'EXTLINK'
}
diff --git a/src/lang/index.ts b/src/lang/index.ts
index 18c02316..7a0318a9 100644
--- a/src/lang/index.ts
+++ b/src/lang/index.ts
@@ -1,25 +1,25 @@
-import { createI18n } from "vue-i18n";
-import { useAppStore } from "@/store/modules/app";
+import { createI18n } from 'vue-i18n'
+import { useAppStore } from '@/store/modules/app'
// 本地语言包
-import enLocale from "./package/en";
-import zhCnLocale from "./package/zh-cn";
+import enLocale from './package/en'
+import zhCnLocale from './package/zh-cn'
-const appStore = useAppStore();
+const appStore = useAppStore()
const messages = {
- "zh-cn": {
- ...zhCnLocale,
+ 'zh-cn': {
+ ...zhCnLocale
},
en: {
- ...enLocale,
- },
-};
+ ...enLocale
+ }
+}
const i18n = createI18n({
legacy: false,
locale: appStore.language,
messages: messages,
- globalInjection: true,
-});
+ globalInjection: true
+})
-export default i18n;
+export default i18n
diff --git a/src/lang/package/en.ts b/src/lang/package/en.ts
index e7bbb53c..26c6bc90 100644
--- a/src/lang/package/en.ts
+++ b/src/lang/package/en.ts
@@ -1,21 +1,21 @@
export default {
// 路由国际化
route: {
- dashboard: "Dashboard",
- document: "Document",
+ dashboard: 'Dashboard',
+ document: 'Document'
},
// 登录页面国际化
login: {
- username: "Username",
- password: "Password",
- login: "Login",
- captchaCode: "Verify Code",
+ username: 'Username',
+ password: 'Password',
+ login: 'Login',
+ captchaCode: 'Verify Code'
},
// 导航栏国际化
navbar: {
- dashboard: "Dashboard",
- logout: "Logout",
- document: "Document",
- gitee: "Gitee",
- },
-};
+ dashboard: 'Dashboard',
+ logout: 'Logout',
+ document: 'Document',
+ gitee: 'Gitee'
+ }
+}
diff --git a/src/lang/package/zh-cn.ts b/src/lang/package/zh-cn.ts
index ed901433..7f27c307 100644
--- a/src/lang/package/zh-cn.ts
+++ b/src/lang/package/zh-cn.ts
@@ -1,21 +1,21 @@
export default {
// 路由国际化
route: {
- dashboard: "首页",
- document: "项目文档",
+ dashboard: '首页',
+ document: '项目文档'
},
// 登录页面国际化
login: {
- username: "用户名",
- password: "密码",
- login: "登 录",
- captchaCode: "验证码",
+ username: '用户名',
+ password: '密码',
+ login: '登 录',
+ captchaCode: '验证码'
},
// 导航栏国际化
navbar: {
- dashboard: "首页",
- logout: "注销",
- document: "项目文档",
- gitee: "码云",
- },
-};
+ dashboard: '首页',
+ logout: '注销',
+ document: '项目文档',
+ gitee: '码云'
+ }
+}
diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue
index 4d24b3ff..61dcee7c 100644
--- a/src/layout/components/AppMain.vue
+++ b/src/layout/components/AppMain.vue
@@ -1,7 +1,7 @@
diff --git a/src/layout/components/NavBar/NavRight.vue b/src/layout/components/NavBar/NavRight.vue
index 904f0182..171e6d23 100644
--- a/src/layout/components/NavBar/NavRight.vue
+++ b/src/layout/components/NavBar/NavRight.vue
@@ -20,7 +20,7 @@
- {{ $t("navbar.dashboard") }}
+ {{ $t('navbar.dashboard') }}
Github
- {{ $t("navbar.gitee") }}
+ {{ $t('navbar.gitee') }}
- {{ $t("navbar.document") }}
+ {{ $t('navbar.document') }}
- {{ $t("navbar.logout") }}
+ {{ $t('navbar.logout') }}