From e0b93a88c205c2d6c1a8e511fdfd6ce126ead85c Mon Sep 17 00:00:00 2001 From: zhangtao <1176193409@qq.com> Date: Wed, 19 Oct 2022 11:42:47 +0800 Subject: [PATCH] init --- .env | 8 + .env.localhost | 14 + .eslintrc.js | 329 + .gitignore | 5 + .vscode/extensions.json | 3 + README.md | 7 + build/constant.js | 3 + build/script/build-cname.js | 14 + build/script/build-config.js | 29 + build/script/index.js | 16 + build/utils.js | 71 + build/vite/plugin/html.js | 31 + build/vite/plugin/index.js | 26 + build/vite/plugin/mock.js | 14 + build/vite/plugin/unocss.js | 9 + build/vite/proxy.js | 17 + index.html | 16 + mock/_create-prod-server.js | 14 + mock/_util.js | 10 + package-lock.json | 21189 ++++++++++++++++ package.json | 49 + public/favicon.ico | Bin 0 -> 4286 bytes src/App.vue | 42 + src/api/auth/index.js | 23 + src/api/common/upload.js | 45 + src/api/home/index.js | 9 + src/api/login/index.js | 47 + src/api/user/index.js | 32 + src/components/AreaCascader/index.vue | 53 + src/components/Bread/index.vue | 22 + src/components/CardModal/index.vue | 59 + src/components/DataTable/index.vue | 155 + src/components/DataTable/tools/Action.vue | 86 + src/components/DataTable/tools/Image.vue | 30 + src/components/DataTable/tools/Switch.vue | 44 + src/components/DataTable/tools/Tags.vue | 99 + src/components/DataTable/tools/props.js | 49 + src/components/DataTable/tools/toTree.js | 69 + .../DataTable/tools/useDataSource.js | 138 + .../DataTable/tools/usePagination.js | 40 + src/components/Dialog/index.vue | 54 + src/components/IconBoard/index.vue | 112 + src/components/IconBoard/tools/icon.js | 18 + src/components/ImgUpload/index.vue | 81 + src/components/JsonEditor/index.vue | 58 + src/components/LoadingBar/index.vue | 17 + src/components/Message/index.vue | 65 + src/components/Modal/index.vue | 101 + src/components/Search/index.vue | 141 + src/components/SvgIcon/index.vue | 73 + src/components/TinymceEditor/index.vue | 168 + src/components/VideoPlayer/index.vue | 176 + src/layout/components/Header/index.vue | 99 + .../Logout/components/UpdateModal.vue | 133 + src/layout/components/Logout/index.vue | 108 + src/layout/components/Menu/index.vue | 72 + src/layout/components/Sidebar/index.vue | 20 + src/layout/components/Tags/index.vue | 468 + src/layout/components/UpdatePsw/index.vue | 123 + src/layout/index.vue | 51 + src/main.js | 19 + src/router/guard/index.js | 9 + src/router/guard/page-loading-guard.js | 15 + src/router/guard/page-title-guard.js | 12 + src/router/guard/permission-guard.js | 47 + src/router/index.js | 24 + src/router/routes/index.js | 72 + src/router/routes/modules/system.js | 5 + src/setting/config.js | 25 + src/store/index.js | 8 + src/store/modules/app.js | 17 + src/store/modules/permission.js | 129 + src/store/modules/setting.js | 25 + src/store/modules/tagsMenu.js | 56 + src/store/modules/user.js | 72 + src/styles/index.scss | 3 + src/styles/layout.scss | 18 + src/styles/public.scss | 56 + src/styles/reset.scss | 40 + src/styles/variables.scss | 5 + src/utils/cache/index.js | 9 + src/utils/cache/web-storage.js | 55 + src/utils/dictionary.js | 30 + src/utils/handleData.js | 132 + src/utils/http/help.js | 13 + src/utils/http/index.js | 16 + src/utils/http/interceptors.js | 67 + src/utils/index.js | 86 + src/utils/is.js | 110 + src/utils/module.js | 17 + src/utils/tags.js | 18 + src/utils/token.js | 41 + src/utils/ui/theme.js | 12 + src/views/dashboard/index.vue | 25 + src/views/login/index.vue | 125 + src/views/redirect/index.vue | 20 + vite.config.js | 49 + 97 files changed, 26536 insertions(+) create mode 100644 .env create mode 100644 .env.localhost create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 README.md create mode 100644 build/constant.js create mode 100644 build/script/build-cname.js create mode 100644 build/script/build-config.js create mode 100644 build/script/index.js create mode 100644 build/utils.js create mode 100644 build/vite/plugin/html.js create mode 100644 build/vite/plugin/index.js create mode 100644 build/vite/plugin/mock.js create mode 100644 build/vite/plugin/unocss.js create mode 100644 build/vite/proxy.js create mode 100644 index.html create mode 100644 mock/_create-prod-server.js create mode 100644 mock/_util.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 public/favicon.ico create mode 100644 src/App.vue create mode 100644 src/api/auth/index.js create mode 100644 src/api/common/upload.js create mode 100644 src/api/home/index.js create mode 100644 src/api/login/index.js create mode 100644 src/api/user/index.js create mode 100644 src/components/AreaCascader/index.vue create mode 100644 src/components/Bread/index.vue create mode 100644 src/components/CardModal/index.vue create mode 100644 src/components/DataTable/index.vue create mode 100644 src/components/DataTable/tools/Action.vue create mode 100644 src/components/DataTable/tools/Image.vue create mode 100644 src/components/DataTable/tools/Switch.vue create mode 100644 src/components/DataTable/tools/Tags.vue create mode 100644 src/components/DataTable/tools/props.js create mode 100644 src/components/DataTable/tools/toTree.js create mode 100644 src/components/DataTable/tools/useDataSource.js create mode 100644 src/components/DataTable/tools/usePagination.js create mode 100644 src/components/Dialog/index.vue create mode 100644 src/components/IconBoard/index.vue create mode 100644 src/components/IconBoard/tools/icon.js create mode 100644 src/components/ImgUpload/index.vue create mode 100644 src/components/JsonEditor/index.vue create mode 100644 src/components/LoadingBar/index.vue create mode 100644 src/components/Message/index.vue create mode 100644 src/components/Modal/index.vue create mode 100644 src/components/Search/index.vue create mode 100644 src/components/SvgIcon/index.vue create mode 100644 src/components/TinymceEditor/index.vue create mode 100644 src/components/VideoPlayer/index.vue create mode 100644 src/layout/components/Header/index.vue create mode 100644 src/layout/components/Logout/components/UpdateModal.vue create mode 100644 src/layout/components/Logout/index.vue create mode 100644 src/layout/components/Menu/index.vue create mode 100644 src/layout/components/Sidebar/index.vue create mode 100644 src/layout/components/Tags/index.vue create mode 100644 src/layout/components/UpdatePsw/index.vue create mode 100644 src/layout/index.vue create mode 100644 src/main.js create mode 100644 src/router/guard/index.js create mode 100644 src/router/guard/page-loading-guard.js create mode 100644 src/router/guard/page-title-guard.js create mode 100644 src/router/guard/permission-guard.js create mode 100644 src/router/index.js create mode 100644 src/router/routes/index.js create mode 100644 src/router/routes/modules/system.js create mode 100644 src/setting/config.js create mode 100644 src/store/index.js create mode 100644 src/store/modules/app.js create mode 100644 src/store/modules/permission.js create mode 100644 src/store/modules/setting.js create mode 100644 src/store/modules/tagsMenu.js create mode 100644 src/store/modules/user.js create mode 100644 src/styles/index.scss create mode 100644 src/styles/layout.scss create mode 100644 src/styles/public.scss create mode 100644 src/styles/reset.scss create mode 100644 src/styles/variables.scss create mode 100644 src/utils/cache/index.js create mode 100644 src/utils/cache/web-storage.js create mode 100644 src/utils/dictionary.js create mode 100644 src/utils/handleData.js create mode 100644 src/utils/http/help.js create mode 100644 src/utils/http/index.js create mode 100644 src/utils/http/interceptors.js create mode 100644 src/utils/index.js create mode 100644 src/utils/is.js create mode 100644 src/utils/module.js create mode 100644 src/utils/tags.js create mode 100644 src/utils/token.js create mode 100644 src/utils/ui/theme.js create mode 100644 src/views/dashboard/index.vue create mode 100644 src/views/login/index.vue create mode 100644 src/views/redirect/index.vue create mode 100644 vite.config.js diff --git a/.env b/.env new file mode 100644 index 0000000..7fd5a20 --- /dev/null +++ b/.env @@ -0,0 +1,8 @@ +# title +VITE_APP_TITLE = '智飞' + +# 端口号 +VITE_PORT = 3050 + + +VITE_SERVER = "/pilot/admin" \ No newline at end of file diff --git a/.env.localhost b/.env.localhost new file mode 100644 index 0000000..929507d --- /dev/null +++ b/.env.localhost @@ -0,0 +1,14 @@ +# 资源公共路径,需要以 /开头和结尾 +VITE_PUBLIC_PATH = '/' + +# 是否启用MOCK +VITE_APP_USE_MOCK = false + +# proxy +VITE_PROXY = [["/api-local","http://127.0.0.1:8002"],["/api-mock","http://127.0.0.1:8003"]] + +# base api +VITE_APP_GLOB_BASE_API = '/api-local' + +# mock base api +VITE_APP_GLOB_BASE_API_MOCK = '/api-mock' \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..36b2749 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,329 @@ +module.exports = { + root: true, + env: { + browser: true, + node: true, + es6: true + }, + extends: [ + 'plugin:vue/vue3-recommended', + 'eslint:recommended' + ], + parserOptions: { + parser: 'babel-eslint' + }, + rules: { + /* 强制每行的最大属性 */ + 'vue/max-attributes-per-line': [2, { + /* 当开始标签位于单行时,每行的最大属性数 */ + 'singleline': 10, + /* 当开始标签位于多行时,每行的最大属性数 */ + 'multiline': { + 'max': 1 + } + }], + /* 在单行元素的内容之前和之后需要换行符 */ + 'vue/singleline-html-element-content-newline': 'off', + /* 在单行元素的内容之前和之后需要换行符 */ + 'vue/multiline-html-element-content-newline': 'off', + /* 组件名称驼峰 */ + 'vue/component-definition-name-casing': ['error', 'PascalCase'], + /* 禁止使用 v-html */ + 'vue/no-v-html': 'off', + /* 格式化箭头函数的箭头前后空格 */ + 'arrow-spacing': [2, { + 'before': true, + 'after': true + }], + /* 强制缩进 */ + 'block-spacing': [2, 'always'], + /* 强制执行一个真正的大括号风格 */ + 'brace-style': [2, '1tbs', { + /* 允许一个块打开和关闭括号在同一行上 */ + 'allowSingleLine': true + }], + /* 为属性名称强制执行 camelcase 样式 */ + 'camelcase': [0, { + 'properties': 'always' + }], + /* 不允许对象和数组尾随逗号 */ + 'comma-dangle': [2, 'never'], + /* 对象逗号前后允许空格 */ + 'comma-spacing': [2, { + 'before': false, + 'after': true + }], + /* 在数组元素、对象属性或变量声明之后和同一行上需要逗号 */ + 'comma-style': [2, 'last'], + /* 检查是否存在有效的super()调用 */ + 'constructor-super': 2, + /* 以允许支柱少单行if,else if,else,for,while,或do,同时还规定使用其他实例花括号 */ + 'curly': [2, 'multi-line'], + /* 成员表达式中的点应与属性部分位于同一行 */ + 'dot-location': [2, 'property'], + /* 在非空文件的末尾至少执行一个换行符 */ + 'eol-last': 2, + /* 强制使用===和!== */ + 'eqeqeq': ['error', 'always'], + /* 强化*发生器功能的间距 */ + 'generator-star-spacing': [2, { + 'before': true, + 'after': true + }], + /* 使用回调模式时会处理这个错误 */ + 'handle-callback-err': [2, '^(err|error)$'], + /* 强制执行一致的缩进样式 */ + 'indent': [2, 2, { + /* 强制缩进级别case的条款switch声明 */ + 'SwitchCase': 1 + }], + /* 一致使用单引号 */ + 'jsx-quotes': [2, 'prefer-single'], + /* 强制在对象字面量属性中的键和值之间保持一致的间距 */ + 'key-spacing': [2, { + /* 不允许在对象文字中的键和冒号之间使用空格 */ + 'beforeColon': false, + /* 需要在冒号和对象文字中的值之间至少有一个空格 */ + 'afterColon': true + }], + /* 强制执行围绕关键字和关键字标记的一致空格 */ + 'keyword-spacing': [2, { + 'before': true, + 'after': true + }], + /* 要求构造函数名以大写字母开头 */ + 'new-cap': [2, { + /* 要求new使用大写启动函数调用所有操作符 */ + 'newIsCap': true, + /* 允许在没有new操作符的情况下调用大写启动的函数 */ + 'capIsNew': false + }], + /* 在使用new关键字调用不带参数的构造函数时需要括号,以便提高代码清晰度 */ + 'new-parens': 2, + /* 不允许使用Array构造函数 */ + 'no-array-constructor': 2, + /* 阻止使用已弃用和次优代码 */ + 'no-caller': 2, + /* 禁止调用console对象的方法 */ + 'no-console': 'off', + /* 标记修改类声明的变量 */ + 'no-class-assign': 2, + /* 不允许在试验条件不明确赋值运算符if,for,while,和do...while语句 */ + 'no-cond-assign': 2, + /* 标记修改使用const关键字声明的变量 */ + 'no-const-assign': 2, + /* 不允许正则表达式中的控制字符 */ + 'no-control-regex': 0, + /* 不允许在变量上使用delete操作符 */ + 'no-delete-var': 2, + /* 不允许在函数声明或表达式中使用重复的参数名称 */ + 'no-dupe-args': 2, + /* 标记在级别成员中使用重复名称 */ + 'no-dupe-class-members': 2, + /* 不允许在对象文字中使用重复键 */ + 'no-dupe-keys': 2, + /* 不允许在switch语句的case子句中使用重复的测试表达式 */ + 'no-duplicate-case': 2, + /* 不允许在正则表达式中使用空字符类 */ + 'no-empty-character-class': 2, + /* 不允许空的解构模式 */ + 'no-empty-pattern': 2, + /* 禁止使用eval()函数来防止潜在的危险 */ + 'no-eval': 2, + /* 禁止对 catch 子句中的异常重新赋值 */ + 'no-ex-assign': 2, + /* 不允许直接修改内建对象的原型 */ + 'no-extend-native': 2, + /* 避免不必要的使用 */ + 'no-extra-bind': 2, + /* 禁止不必要的布尔转换 */ + 'no-extra-boolean-cast': 2, + /* 仅在函数表达式附近禁止不必要的括号 */ + 'no-extra-parens': [2, 'functions'], + /* 消除一个案件无意中掉到另一个案件 */ + 'no-fallthrough': 2, + /* 消除浮点小数点,并在数值有小数点但在其之前或之后缺少数字时发出警告 */ + 'no-floating-decimal': 2, + /* 不允许重新分配function声明 */ + 'no-func-assign': 2, + /* 消除隐含eval()通过使用setTimeout(),setInterval()或execScript() */ + 'no-implied-eval': 2, + /* 不允许function嵌套块中的声明 */ + 'no-inner-declarations': [2, 'functions'], + /* 不允许RegExp构造函数中的无效正则表达式字符串 */ + 'no-invalid-regexp': 2, + /* 捕获不是正常制表符和空格的无效空格 */ + 'no-irregular-whitespace': 2, + /* 防止因使用 __iterator__属性而出现的错误 */ + 'no-iterator': 2, + /* 禁用与变量同名的标签 */ + 'no-label-var': 2, + /* 禁用标签语句 */ + 'no-labels': [2, { + 'allowLoop': false, + 'allowSwitch': false + }], + /* 禁用不必要的嵌套块 */ + 'no-lone-blocks': 2, + /* 禁止混用tab和space */ + 'no-mixed-spaces-and-tabs': 2, + /* 禁止出现多个空格 */ + 'no-multi-spaces': 2, + /* 禁止多行字符串 */ + 'no-multi-str': 2, + /* 强制最大连续空行数1 */ + 'no-multiple-empty-lines': [2, { + 'max': 1 + }], + /* 不允许修改只读全局变量 */ + 'no-global-assign': 2, + /* 不允许使用Object构造函数 */ + 'no-new-object': 2, + /* 消除new require表达的使用 */ + 'no-new-require': 2, + /* 防止Symbol与new操作员的意外呼叫 */ + 'no-new-symbol': 2, + /* 杜绝使用String,Number以及Boolean与new操作 */ + 'no-new-wrappers': 2, + /* 不允许调用Math,JSON和Reflect对象作为功能 */ + 'no-obj-calls': 2, + /* 不允许使用八进制文字 */ + 'no-octal': 2, + /* 不允许字符串文字中的八进制转义序列 */ + 'no-octal-escape': 2, + /* 防止 Node.js 中的目录路径字符串连接 */ + 'no-path-concat': 2, + /* 当一个对象被__proto__创建时被设置为该对象的构造函数的原始原型属性。getPrototypeOf是获得“原型”的首选方法 */ + 'no-proto': 2, + /* 消除在同一范围内具有多个声明的变量 */ + 'no-redeclare': 2, + /* 在正则表达式文字中不允许有多个空格 */ + 'no-regex-spaces': 2, + /* return陈述中的任务,除非用圆括号括起来,否则不允许赋值 */ + 'no-return-assign': [2, 'except-parens'], + /* 消除自我分配 */ + 'no-self-assign': 2, + /* 禁止自身比较 */ + 'no-self-compare': 2, + /* 不允许使用逗号操作符 */ + 'no-sequences': 2, + /* 关键字不能被遮蔽 */ + 'no-shadow-restricted-names': 2, + /* 不允许功能标识符与其应用程序之间的间距 */ + 'no-spaced-func': 2, + /* 禁用稀疏数组 */ + 'no-sparse-arrays': 2, + /* 在构造函数中禁止在调用super()之前使用this或super。 */ + 'no-this-before-super': 2, + /* 限制可以被抛出的异常 */ + 'no-throw-literal': 2, + /* 禁用行尾空白 */ + 'no-trailing-spaces': 2, + /* 禁用未声明的变量 */ + 'no-undef': 2, + /* 禁用未声明的变量 */ + 'no-undef-init': 2, + /* 禁止使用令人困惑的多行表达式 */ + 'no-unexpected-multiline': 2, + /* 禁用一成不变的循环条件 */ + 'no-unmodified-loop-condition': 2, + /* 禁止可以表达为更简单结构的三元操作符 */ + 'no-unneeded-ternary': [2, { + /* 禁止条件表达式作为默认的赋值模式 */ + 'defaultAssignment': false + }], + /* 禁止在 return、throw、continue 和 break 语句后出现不可达代码 */ + 'no-unreachable': 2, + /* 禁止在 finally 语句块中出现控制流语句 */ + 'no-unsafe-finally': 2, + /* 禁止未使用过的变量 */ + 'no-unused-vars': [2, { + 'vars': 'all', + 'args': 'none' + }], + /* 禁用不必要的 .call() 和 .apply() */ + 'no-useless-call': 2, + /* 禁止在对象中使用不必要的计算属性 */ + 'no-useless-computed-key': 2, + /* 禁用不必要的构造函数 */ + 'no-useless-constructor': 2, + /* 在不改变代码行为的情况下可以安全移除的转义 */ + 'no-useless-escape': 0, + /* 禁止属性前有空白 */ + 'no-whitespace-before-property': 2, + /* 禁用 with 语句 */ + 'no-with': 2, + /* 强制函数中的变量在一起声明或分开声明 */ + 'one-var': [2, { + /* 要求每个作用域的初始化的变量有多个变量声明 */ + 'initialized': 'never' + }], + /* 强制操作符使用一致的换行符风格 */ + 'operator-linebreak': [2, 'after', { + /* 覆盖对指定的操作的全局设置 */ + 'overrides': { + '?': 'before', + ':': 'before' + } + }], + /* 要求或禁止块内填充 */ + 'padded-blocks': [2, 'never'], + /* 强制使用一致的反勾号、双引号或单引号 */ + 'quotes': [2, 'single', { + /* 允许字符串使用单引号或双引号,只要字符串中包含了一个其它引号,否则需要转义 */ + 'avoidEscape': true, + /* 允许字符串使用反勾号 */ + 'allowTemplateLiterals': true + }], + /* 要求或禁止使用分号代替 ASI */ + 'semi': [2, 'never'], + /* 强制分号前后有空格 */ + 'semi-spacing': [2, { + 'before': false, + 'after': true + }], + /* 要求或禁止语句块之前的空格 */ + 'space-before-blocks': [2, 'always'], + /* 要求或禁止函数圆括号之前有一个空格 */ + 'space-before-function-paren': [2, 'never'], + /* 禁止或强制圆括号内的空格 */ + 'space-in-parens': [2, 'never'], + /* 要求中缀操作符周围有空格 */ + 'space-infix-ops': 2, + /* 要求或禁止在一元操作符之前或之后存在空格 */ + 'space-unary-ops': [2, { + /* 适用于单词类一元操作符,例如:new、delete、typeof、void、yield */ + 'words': true, + /* 适用于这些一元操作符: -、+、--、++、!、!! */ + 'nonwords': false + }], + /* 要求或禁止在注释前有空白 */ + 'spaced-comment': [2, 'always', { + 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] + }], + /* 强制模板字符串中空格的使用 禁止花括号内出现空格 */ + 'template-curly-spacing': [2, 'never'], + /* 要求调用 isNaN()检查 NaN */ + 'use-isnan': 2, + /* 强制 typeof 表达式与有效的字符串进行比较 */ + 'valid-typeof': 2, + /* 需要把立即执行的函数包裹起来 */ + 'wrap-iife': [2, 'any'], + /* 强制在 yield* 表达式中 * 周围使用空格 */ + 'yield-star-spacing': [2, 'both'], + /* 要求或者禁止Yoda条件 */ + 'yoda': [2, 'never'], + /* 建议使用const */ + 'prefer-const': 2, + /* 禁用 debugger */ + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, + /* 强制在花括号中使用一致的空格 */ + 'object-curly-spacing': [2, 'always', { + /* 禁止以对象元素开始或结尾的对象的花括号中有空格 */ + objectsInObjects: false + }], + /* 禁止或强制在括号内使用空格 */ + 'array-bracket-spacing': [2, 'never'] + } +} + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..53f7466 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules +.DS_Store +dist +dist-ssr +*.local \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..3dc5b08 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["johnsoncodehk.volar"] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..c0793a8 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Vue 3 + Vite + +This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 ` + +
+ + + +