From 1613c0012b9c83ad9d65146268aa4b6707b90c3e Mon Sep 17 00:00:00 2001
From: songjianhua <13361328784@163.com>
Date: Thu, 9 May 2024 18:02:02 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.editorconfig | 15 +
.env.development | 16 +
.env.production | 6 +
.eslintignore | 14 +
.eslintrc-auto-import.json | 284 ++
.eslintrc.cjs | 88 +
.prettierignore | 11 +
.prettierrc.cjs | 46 +
auto-imports.d.ts | 6 +-
components.d.ts | 37 -
index.html | 44 +-
package-lock.json | 5525 ++++++++++++++++++++++++++
package.json | 117 +-
src/App.vue | 14 +-
src/api/index.ts | 26 +-
src/components/countup.vue | 49 +-
src/components/header.vue | 280 +-
src/components/menu.ts | 432 +-
src/components/sidebar.vue | 136 +-
src/components/table-custom.vue | 387 +-
src/components/table-detail.vue | 25 +-
src/components/table-edit.vue | 205 +-
src/components/table-search.vue | 114 +-
src/components/tabs.vue | 203 +-
src/main.ts | 32 +-
src/router/index.ts | 591 +--
src/store/permiss.ts | 110 +-
src/store/sidebar.ts | 46 +-
src/store/tabs.ts | 96 +-
src/store/theme.ts | 115 +-
src/types/form-option.ts | 33 +-
src/types/menu.ts | 16 +-
src/types/role.ts | 13 +-
src/types/table.ts | 16 +-
src/types/user.ts | 23 +-
src/utils/china.ts | 783 +++-
src/utils/index.ts | 30 +-
src/utils/request.ts | 44 +-
src/views/chart/echarts.vue | 149 +-
src/views/chart/options.ts | 612 +--
src/views/chart/schart.vue | 224 +-
src/views/dashboard.vue | 542 +--
src/views/element/calendar.vue | 84 +-
src/views/element/carousel.vue | 86 +-
src/views/element/form.vue | 340 +-
src/views/element/statistic.vue | 565 +--
src/views/element/steps.vue | 93 +-
src/views/element/tabs.vue | 199 +-
src/views/element/tour.vue | 60 +-
src/views/element/upload.vue | 65 +-
src/views/element/watermark.vue | 134 +-
src/views/home.vue | 78 +-
src/views/pages/403.vue | 76 +-
src/views/pages/404.vue | 76 +-
src/views/pages/editor.vue | 60 +-
src/views/pages/icon.vue | 451 ++-
src/views/pages/login.vue | 239 +-
src/views/pages/markdown.vue | 29 +-
src/views/pages/register.vue | 200 +-
src/views/pages/reset-pwd.vue | 142 +-
src/views/pages/theme.vue | 347 +-
src/views/pages/ucenter.vue | 365 +-
src/views/system/menu.vue | 246 +-
src/views/system/role-permission.vue | 78 +-
src/views/system/role.vue | 268 +-
src/views/system/user.vue | 227 +-
src/views/table/basetable.vue | 375 +-
src/views/table/export.vue | 125 +-
src/views/table/import.vue | 165 +-
src/views/table/table-editor.vue | 138 +-
src/vite-env.d.ts | 12 +-
tsconfig.json | 43 +-
tsconfig.node.json | 9 -
vite.config.ts | 82 +-
yarn.lock | 4462 ++++++++++++++-------
75 files changed, 15180 insertions(+), 6294 deletions(-)
create mode 100644 .editorconfig
create mode 100644 .env.development
create mode 100644 .env.production
create mode 100644 .eslintignore
create mode 100644 .eslintrc-auto-import.json
create mode 100644 .eslintrc.cjs
create mode 100644 .prettierignore
create mode 100644 .prettierrc.cjs
create mode 100644 package-lock.json
delete mode 100644 tsconfig.node.json
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..00ee2de46
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+# http://editorconfig.org
+root = true
+
+# 表示所有文件适用
+[*]
+charset = utf-8 # 设置文件字符集为 utf-8
+end_of_line = lf # 控制换行类型(lf | cr | crlf)
+indent_style = space # 缩进风格(tab | space)
+indent_size = 2 # 缩进大小
+insert_final_newline = true # 始终在文件末尾插入一个新行
+
+# 表示仅 md 文件适用以下规则
+[*.md]
+max_line_length = off # 关闭最大行长度限制
+trim_trailing_whitespace = false # 关闭末尾空格修剪
diff --git a/.env.development b/.env.development
new file mode 100644
index 000000000..c4e44761b
--- /dev/null
+++ b/.env.development
@@ -0,0 +1,16 @@
+## 开发环境
+NODE_ENV='development'
+
+# 应用端口
+VITE_APP_PORT = 3000
+
+# 代理前缀
+VITE_APP_BASE_API = '/dev-api'
+
+# 线上接口地址
+VITE_APP_API_URL = http://vapi.youlai.tech
+# 开发接口地址
+# VITE_APP_API_URL = http://localhost:8989
+
+# 是否启用 Mock 服务
+VITE_MOCK_DEV_SERVER = false
diff --git a/.env.production b/.env.production
new file mode 100644
index 000000000..a2d828cb2
--- /dev/null
+++ b/.env.production
@@ -0,0 +1,6 @@
+## 生产环境
+NODE_ENV='production'
+
+# 代理前缀
+VITE_APP_BASE_API = '/prod-api'
+
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 000000000..43af40f40
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,14 @@
+dist
+node_modules
+public
+.husky
+.vscode
+.idea
+*.sh
+*.md
+
+src/assets
+
+.eslintrc.cjs
+.prettierrc.cjs
+.stylelintrc.cjs
diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json
new file mode 100644
index 000000000..f4738bfcc
--- /dev/null
+++ b/.eslintrc-auto-import.json
@@ -0,0 +1,284 @@
+{
+ "globals": {
+ "Component": true,
+ "ComponentPublicInstance": true,
+ "ComputedRef": true,
+ "EffectScope": true,
+ "ElMessage": true,
+ "ElMessageBox": true,
+ "ElNotification": true,
+ "InjectionKey": true,
+ "PropType": true,
+ "Ref": true,
+ "VNode": true,
+ "asyncComputed": true,
+ "autoResetRef": true,
+ "computed": true,
+ "computedAsync": true,
+ "computedEager": true,
+ "computedInject": true,
+ "computedWithControl": true,
+ "controlledComputed": true,
+ "controlledRef": true,
+ "createApp": true,
+ "createEventHook": true,
+ "createGlobalState": true,
+ "createInjectionState": true,
+ "createReactiveFn": true,
+ "createReusableTemplate": true,
+ "createSharedComposable": true,
+ "createTemplatePromise": true,
+ "createUnrefFn": true,
+ "customRef": true,
+ "debouncedRef": true,
+ "debouncedWatch": true,
+ "defineAsyncComponent": true,
+ "defineComponent": true,
+ "eagerComputed": true,
+ "effectScope": true,
+ "extendRef": true,
+ "getCurrentInstance": true,
+ "getCurrentScope": true,
+ "h": true,
+ "ignorableWatch": true,
+ "inject": true,
+ "isDefined": true,
+ "isProxy": true,
+ "isReactive": true,
+ "isReadonly": true,
+ "isRef": true,
+ "makeDestructurable": true,
+ "markRaw": true,
+ "nextTick": true,
+ "onActivated": true,
+ "onBeforeMount": true,
+ "onBeforeUnmount": true,
+ "onBeforeUpdate": true,
+ "onClickOutside": true,
+ "onDeactivated": true,
+ "onErrorCaptured": true,
+ "onKeyStroke": true,
+ "onLongPress": true,
+ "onMounted": true,
+ "onRenderTracked": true,
+ "onRenderTriggered": true,
+ "onScopeDispose": true,
+ "onServerPrefetch": true,
+ "onStartTyping": true,
+ "onUnmounted": true,
+ "onUpdated": true,
+ "pausableWatch": true,
+ "provide": true,
+ "reactify": true,
+ "reactifyObject": true,
+ "reactive": true,
+ "reactiveComputed": true,
+ "reactiveOmit": true,
+ "reactivePick": true,
+ "readonly": true,
+ "ref": true,
+ "refAutoReset": true,
+ "refDebounced": true,
+ "refDefault": true,
+ "refThrottled": true,
+ "refWithControl": true,
+ "resolveComponent": true,
+ "resolveRef": true,
+ "resolveUnref": true,
+ "shallowReactive": true,
+ "shallowReadonly": true,
+ "shallowRef": true,
+ "syncRef": true,
+ "syncRefs": true,
+ "templateRef": true,
+ "throttledRef": true,
+ "throttledWatch": true,
+ "toRaw": true,
+ "toReactive": true,
+ "toRef": true,
+ "toRefs": true,
+ "toValue": true,
+ "triggerRef": true,
+ "tryOnBeforeMount": true,
+ "tryOnBeforeUnmount": true,
+ "tryOnMounted": true,
+ "tryOnScopeDispose": true,
+ "tryOnUnmounted": true,
+ "unref": true,
+ "unrefElement": true,
+ "until": true,
+ "useActiveElement": true,
+ "useAnimate": true,
+ "useArrayDifference": true,
+ "useArrayEvery": true,
+ "useArrayFilter": true,
+ "useArrayFind": true,
+ "useArrayFindIndex": true,
+ "useArrayFindLast": true,
+ "useArrayIncludes": true,
+ "useArrayJoin": true,
+ "useArrayMap": true,
+ "useArrayReduce": true,
+ "useArraySome": true,
+ "useArrayUnique": true,
+ "useAsyncQueue": true,
+ "useAsyncState": true,
+ "useAttrs": true,
+ "useBase64": true,
+ "useBattery": true,
+ "useBluetooth": true,
+ "useBreakpoints": true,
+ "useBroadcastChannel": true,
+ "useBrowserLocation": true,
+ "useCached": true,
+ "useClipboard": true,
+ "useCloned": true,
+ "useColorMode": true,
+ "useConfirmDialog": true,
+ "useCounter": true,
+ "useCssModule": true,
+ "useCssVar": true,
+ "useCssVars": true,
+ "useCurrentElement": true,
+ "useCycleList": true,
+ "useDark": true,
+ "useDateFormat": true,
+ "useDebounce": true,
+ "useDebounceFn": true,
+ "useDebouncedRefHistory": true,
+ "useDeviceMotion": true,
+ "useDeviceOrientation": true,
+ "useDevicePixelRatio": true,
+ "useDevicesList": true,
+ "useDisplayMedia": true,
+ "useDocumentVisibility": true,
+ "useDraggable": true,
+ "useDropZone": true,
+ "useElementBounding": true,
+ "useElementByPoint": true,
+ "useElementHover": true,
+ "useElementSize": true,
+ "useElementVisibility": true,
+ "useEventBus": true,
+ "useEventListener": true,
+ "useEventSource": true,
+ "useEyeDropper": true,
+ "useFavicon": true,
+ "useFetch": true,
+ "useFileDialog": true,
+ "useFileSystemAccess": true,
+ "useFocus": true,
+ "useFocusWithin": true,
+ "useFps": true,
+ "useFullscreen": true,
+ "useGamepad": true,
+ "useGeolocation": true,
+ "useIdle": true,
+ "useImage": true,
+ "useInfiniteScroll": true,
+ "useIntersectionObserver": true,
+ "useInterval": true,
+ "useIntervalFn": true,
+ "useKeyModifier": true,
+ "useLastChanged": true,
+ "useLocalStorage": true,
+ "useMagicKeys": true,
+ "useManualRefHistory": true,
+ "useMediaControls": true,
+ "useMediaQuery": true,
+ "useMemoize": true,
+ "useMemory": true,
+ "useMounted": true,
+ "useMouse": true,
+ "useMouseInElement": true,
+ "useMousePressed": true,
+ "useMutationObserver": true,
+ "useNavigatorLanguage": true,
+ "useNetwork": true,
+ "useNow": true,
+ "useObjectUrl": true,
+ "useOffsetPagination": true,
+ "useOnline": true,
+ "usePageLeave": true,
+ "useParallax": true,
+ "useParentElement": true,
+ "usePerformanceObserver": true,
+ "usePermission": true,
+ "usePointer": true,
+ "usePointerLock": true,
+ "usePointerSwipe": true,
+ "usePreferredColorScheme": true,
+ "usePreferredContrast": true,
+ "usePreferredDark": true,
+ "usePreferredLanguages": true,
+ "usePreferredReducedMotion": true,
+ "usePrevious": true,
+ "useRafFn": true,
+ "useRefHistory": true,
+ "useResizeObserver": true,
+ "useScreenOrientation": true,
+ "useScreenSafeArea": true,
+ "useScriptTag": true,
+ "useScroll": true,
+ "useScrollLock": true,
+ "useSessionStorage": true,
+ "useShare": true,
+ "useSlots": true,
+ "useSorted": true,
+ "useSpeechRecognition": true,
+ "useSpeechSynthesis": true,
+ "useStepper": true,
+ "useStorage": true,
+ "useStorageAsync": true,
+ "useStyleTag": true,
+ "useSupported": true,
+ "useSwipe": true,
+ "useTemplateRefsList": true,
+ "useTextDirection": true,
+ "useTextSelection": true,
+ "useTextareaAutosize": true,
+ "useThrottle": true,
+ "useThrottleFn": true,
+ "useThrottledRefHistory": true,
+ "useTimeAgo": true,
+ "useTimeout": true,
+ "useTimeoutFn": true,
+ "useTimeoutPoll": true,
+ "useTimestamp": true,
+ "useTitle": true,
+ "useToNumber": true,
+ "useToString": true,
+ "useToggle": true,
+ "useTransition": true,
+ "useUrlSearchParams": true,
+ "useUserMedia": true,
+ "useVModel": true,
+ "useVModels": true,
+ "useVibrate": true,
+ "useVirtualList": true,
+ "useWakeLock": true,
+ "useWebNotification": true,
+ "useWebSocket": true,
+ "useWebWorker": true,
+ "useWebWorkerFn": true,
+ "useWindowFocus": true,
+ "useWindowScroll": true,
+ "useWindowSize": true,
+ "watch": true,
+ "watchArray": true,
+ "watchAtMost": true,
+ "watchDebounced": true,
+ "watchDeep": true,
+ "watchEffect": true,
+ "watchIgnorable": true,
+ "watchImmediate": true,
+ "watchOnce": true,
+ "watchPausable": true,
+ "watchPostEffect": true,
+ "watchSyncEffect": true,
+ "watchThrottled": true,
+ "watchTriggerable": true,
+ "watchWithFilter": true,
+ "whenever": true
+ }
+}
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
new file mode 100644
index 000000000..8ae169a99
--- /dev/null
+++ b/.eslintrc.cjs
@@ -0,0 +1,88 @@
+module.exports = {
+ root: true,
+ env: {
+ browser: true,
+ es2021: true,
+ node: true,
+ },
+ 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",
+ ],
+ parserOptions: {
+ ecmaVersion: "latest",
+ sourceType: "module",
+ parser: "@typescript-eslint/parser",
+ project: "./tsconfig.*?.json",
+ createDefaultProgram: false,
+ extraFileExtensions: [".vue"],
+ },
+ 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",
+ {
+ html: {
+ void: "always",
+ normal: "never",
+ component: "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",
+
+ "prettier/prettier": [
+ "error",
+ {
+ useTabs: false, // 不使用制表符
+ },
+ ],
+ },
+ // eslint不能对html文件生效
+ overrides: [
+ {
+ files: ["*.html"],
+ processor: "vue/.vue",
+ },
+ ],
+ // https://eslint.org/docs/latest/use/configure/language-options#specifying-globals
+ globals: {
+ OptionType: "readonly",
+ },
+};
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 000000000..f3e9850f4
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,11 @@
+dist
+node_modules
+public
+.husky
+.vscode
+.idea
+*.sh
+*.md
+
+src/assets
+stats.html
diff --git a/.prettierrc.cjs b/.prettierrc.cjs
new file mode 100644
index 000000000..347fb32e9
--- /dev/null
+++ b/.prettierrc.cjs
@@ -0,0 +1,46 @@
+module.exports = {
+ // (x)=>{},单个参数箭头函数是否显示小括号。(always:始终显示;avoid:省略括号。默认:always)
+ arrowParens: "always",
+ // 开始标签的右尖括号是否跟随在最后一行属性末尾,默认false
+ bracketSameLine: false,
+ // 对象字面量的括号之间打印空格 (true - Example: { foo: bar } ; false - Example: {foo:bar})
+ bracketSpacing: true,
+ // 是否格式化一些文件中被嵌入的代码片段的风格(auto|off;默认auto)
+ embeddedLanguageFormatting: "auto",
+ // 指定 HTML 文件的空格敏感度 (css|strict|ignore;默认css)
+ htmlWhitespaceSensitivity: "css",
+ // 当文件已经被 Prettier 格式化之后,是否会在文件顶部插入一个特殊的 @format 标记,默认false
+ insertPragma: false,
+ // 在 JSX 中使用单引号替代双引号,默认false
+ jsxSingleQuote: false,
+ // 每行最多字符数量,超出换行(默认80)
+ printWidth: 80,
+ // 超出打印宽度 (always | never | preserve )
+ proseWrap: "preserve",
+ // 对象属性是否使用引号(as-needed | consistent | preserve;默认as-needed:对象的属性需要加引号才添加;)
+ quoteProps: "as-needed",
+ // 是否只格式化在文件顶部包含特定注释(@prettier| @format)的文件,默认false
+ requirePragma: false,
+ // 结尾添加分号
+ semi: true,
+ // 使用单引号 (true:单引号;false:双引号)
+ singleQuote: false,
+ // 缩进空格数,默认2个空格
+ tabWidth: 2,
+ // 元素末尾是否加逗号,默认es5: ES5中的 objects, arrays 等会添加逗号,TypeScript 中的 type 后不加逗号
+ trailingComma: "es5",
+ // 指定缩进方式,空格或tab,默认false,即使用空格
+ useTabs: false,
+ // vue 文件中是否缩进
diff --git a/src/api/index.ts b/src/api/index.ts
index 2814587b7..f4d94c81e 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -1,22 +1,22 @@
-import request from '../utils/request';
+import request from "../utils/request";
export const fetchData = () => {
- return request({
- url: './mock/table.json',
- method: 'get'
- });
+ return request({
+ url: "./mock/table.json",
+ method: "get",
+ });
};
export const fetchUserData = () => {
- return request({
- url: './mock/user.json',
- method: 'get'
- });
+ return request({
+ url: "./mock/user.json",
+ method: "get",
+ });
};
export const fetchRoleData = () => {
- return request({
- url: './mock/role.json',
- method: 'get'
- });
+ return request({
+ url: "./mock/role.json",
+ method: "get",
+ });
};
diff --git a/src/components/countup.vue b/src/components/countup.vue
index 4e08b0efc..e3369490c 100644
--- a/src/components/countup.vue
+++ b/src/components/countup.vue
@@ -1,39 +1,40 @@
-
+
\ No newline at end of file
+ }
+);
+
diff --git a/src/components/header.vue b/src/components/header.vue
index 8549ebbd9..189ad07be 100644
--- a/src/components/header.vue
+++ b/src/components/header.vue
@@ -1,204 +1,212 @@
-