commit 26d4c7c56894cf2031b3a7cce08d53c37f4a49e3 Author: chenkl <321200875@qq.com> Date: Mon Dec 14 17:32:37 2020 +0800 feat: 🎸 初始化项目 diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..214388f --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,3 @@ +> 1% +last 2 versions +not dead diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..b62a328 --- /dev/null +++ b/.env.development @@ -0,0 +1,2 @@ +NODE_ENV = 'development' +VUE_APP_CURENV = 'dev' diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..5633a92 --- /dev/null +++ b/.env.production @@ -0,0 +1,2 @@ +NODE_ENV = 'production' +VUE_APP_CURENV = 'pro' diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..b4ee37a --- /dev/null +++ b/.env.test @@ -0,0 +1,2 @@ +NODE_ENV = 'test' +VUE_APP_CURENV = 'test' diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..9968b5d --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,364 @@ +module.exports = { + root: true, + // parser: 'vue-eslint-parser', + // parserOptions: { + // parser: '@typescript-eslint/parser', + // ecmaVersion: 2020, + // sourceType: 'module', + // ecmaFeatures: { + // jsx: true, + // }, + // }, + + env: { + browser: true, + node: true, + es6: true + }, + + extends: [ + 'plugin:vue/vue3-recommended', + '@vue/typescript/recommended', + 'eslint: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/custom-event-name-casing': 'off', + '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', + 'vue/max-attributes-per-line': [ + 2, + { + singleline: 10, + multiline: { + max: 1, + allowFirstLine: false + } + } + ], + 'vue/singleline-html-element-content-newline': 'off', + 'vue/multiline-html-element-content-newline': 'off', + 'vue/name-property-casing': [ + 'error', + 'PascalCase' + ], + 'vue/no-v-html': 'off', + 'accessor-pairs': 2, + 'arrow-spacing': [ + 2, + { + before: true, + after: true + } + ], + 'block-spacing': [ + 2, + 'always' + ], + 'brace-style': [ + 2, + '1tbs', + { + allowSingleLine: true + } + ], + camelcase: [ + 0, + { + properties: 'always' + } + ], + 'comma-dangle': [ + 2, + 'never' + ], + 'comma-spacing': [ + 2, + { + before: false, + after: true + } + ], + 'comma-style': [ + 2, + 'last' + ], + 'constructor-super': 2, + curly: [ + 2, + 'multi-line' + ], + 'dot-location': [ + 2, + 'property' + ], + 'eol-last': 2, + eqeqeq: [ + 'error', + 'always', + { + null: 'ignore' + } + ], + 'generator-star-spacing': [ + 2, + { + before: true, + after: true + } + ], + 'handle-callback-err': [ + 2, + '^(err|error)$' + ], + indent: [ + 2, + 2 + ], + 'jsx-quotes': [ + 2, + 'prefer-single' + ], + 'key-spacing': [ + 2, + { + beforeColon: false, + afterColon: true + } + ], + 'keyword-spacing': [ + 2, + { + before: true, + after: true + } + ], + 'new-cap': [ + 2, + { + newIsCap: true, + capIsNew: false + } + ], + 'new-parens': 2, + 'no-array-constructor': 2, + 'no-caller': 2, + 'no-console': 'off', + 'no-class-assign': 2, + 'no-cond-assign': 2, + 'no-const-assign': 2, + 'no-control-regex': 0, + 'no-delete-var': 2, + 'no-dupe-args': 2, + 'no-dupe-class-members': 2, + 'no-dupe-keys': 2, + 'no-duplicate-case': 2, + 'no-empty-character-class': 2, + 'no-empty-pattern': 2, + 'no-eval': 2, + '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, + 'no-func-assign': 2, + 'no-implied-eval': 2, + 'no-inner-declarations': [ + 2, + 'functions' + ], + 'no-invalid-regexp': 2, + 'no-irregular-whitespace': 2, + 'no-iterator': 2, + 'no-label-var': 2, + 'no-labels': [ + 2, + { + allowLoop: false, + allowSwitch: false + } + ], + 'no-lone-blocks': 2, + 'no-mixed-spaces-and-tabs': 2, + 'no-multi-spaces': 2, + 'no-multi-str': 2, + 'no-multiple-empty-lines': [ + 2, + { + max: 1 + } + ], + 'no-native-reassign': 2, + 'no-negated-in-lhs': 2, + 'no-new-object': 2, + 'no-new-require': 2, + 'no-new-symbol': 2, + 'no-new-wrappers': 2, + 'no-obj-calls': 2, + 'no-octal': 2, + 'no-octal-escape': 2, + 'no-path-concat': 2, + 'no-proto': 2, + 'no-redeclare': 2, + 'no-regex-spaces': 2, + '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, + 'no-this-before-super': 2, + 'no-throw-literal': 2, + 'no-trailing-spaces': 2, + 'no-undef': 0, + 'no-undef-init': 2, + 'no-unexpected-multiline': 2, + 'no-unmodified-loop-condition': 2, + 'no-unneeded-ternary': [ + 2, + { + defaultAssignment: false + } + ], + 'no-unreachable': 2, + 'no-unsafe-finally': 2, + 'no-unused-vars': [ + 1, + { + vars: 'all', + args: 'none' + } + ], + 'no-useless-call': 0, + 'no-useless-computed-key': 2, + 'no-useless-constructor': 2, + 'no-useless-escape': 0, + 'no-whitespace-before-property': 2, + '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 + } + ], + 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, + { + words: true, + nonwords: false + } + ], + 'spaced-comment': [ + 2, + 'always', + { + markers: [ + 'global', + 'globals', + 'eslint', + 'eslint-disable', + '*package', + '!', + ',' + ] + } + ], + 'template-curly-spacing': [ + 2, + 'never' + ], + 'use-isnan': 2, + 'valid-typeof': 2, + 'wrap-iife': [ + 2, + 'any' + ], + 'yield-star-spacing': [ + 2, + 'both' + ], + yoda: [ + 2, + 'never' + ], + 'prefer-const': 2, + 'no-debugger': 0, + 'object-curly-spacing': [ + 2, + 'always', + { + objectsInObjects: false + } + ], + 'array-bracket-spacing': [ + 2, + 'never' + ], + 'vue/no-use-v-if-with-v-for': 'off', + 'vue/no-v-model-argument': 'off' + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b20ebd4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.DS_Store +node_modules +/dist +/dist* + + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/README.md b/README.md new file mode 100644 index 0000000..949520e --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# demo + +## Project setup +``` +yarn install +``` + +### Compiles and hot-reloads for development +``` +yarn serve +``` + +### Compiles and minifies for production +``` +yarn build +``` + +### Lints and fixes files +``` +yarn lint +``` + +### Customize configuration +See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..1e556ec --- /dev/null +++ b/babel.config.js @@ -0,0 +1,23 @@ +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset', [ + '@babel/preset-env', { + modules: false + } + ] + ], + plugins: [ + [ + 'component', + { + 'libraryName': 'element-plus', + 'styleLibraryName': 'theme-chalk' + } + ] + ], + 'env': { + 'development': { + 'plugins': ['dynamic-import-node'] + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..49f4259 --- /dev/null +++ b/package.json @@ -0,0 +1,81 @@ +{ + "name": "vue-antdv-admin-webpack", + "version": "0.1.0", + "private": true, + "scripts": { + "serve": "vue-cli-service serve", + "lint": "vue-cli-service lint", + "build-dev:index": "cross-env PROJECT_NAME=index vue-cli-service build --mode development", + "build-pro:index": "cross-env PROJECT_NAME=index vue-cli-service build", + "build-test:index": "cross-env PROJECT_NAME=index vue-cli-service build --mode test", + "build:all": "npm run build:dev && npm run build:pro && npm run build:test", + "build:dev": "vue-cli-service build --mode development", + "build:pro": "vue-cli-service build", + "build:test": "vue-cli-service build --mode test", + "serve:index": "cross-env PROJECT_NAME=index vue-cli-service serve" + }, + "dependencies": { + "axios": "^0.20.0", + "clipboard": "^2.0.6", + "core-js": "^3.6.5", + "echarts": "^4.9.0", + "element-plus": "^1.0.1-beta.8", + "highlight.js": "^10.4.0", + "lodash-es": "^4.17.15", + "mockjs": "^1.1.0", + "normalize.css": "^8.0.1", + "nprogress": "^0.2.0", + "path-to-regexp": "^6.2.0", + "qs": "^6.9.4", + "resize-observer-polyfill": "^1.5.1", + "screenfull": "^5.0.2", + "vditor": "^3.7.0", + "vue": "3.0.4", + "vue-router": "4.0.0-rc.6", + "vuex": "4.0.0-rc.2", + "wangeditor": "^4.5.2", + "web-storage-cache": "^1.1.1" + }, + "devDependencies": { + "@types/clipboard": "^2.0.1", + "@types/echarts": "^4.9.1", + "@types/lodash-es": "^4.17.3", + "@types/mockjs": "^1.0.3", + "@types/nprogress": "^0.2.0", + "@typescript-eslint/eslint-plugin": "^4.5.0", + "@typescript-eslint/parser": "^4.5.0", + "@vue/cli-plugin-babel": "^4.5.9", + "@vue/cli-plugin-eslint": "~4.5.0", + "@vue/cli-plugin-router": "~4.5.0", + "@vue/cli-plugin-typescript": "~4.5.0", + "@vue/cli-plugin-vuex": "~4.5.0", + "@vue/cli-service": "~4.5.0", + "@vue/compiler-sfc": "^3.0.3", + "@vue/eslint-config-typescript": "^5.0.2", + "babel-eslint": "^10.1.0", + "babel-plugin-component": "^1.1.1", + "babel-plugin-import": "^1.13.1", + "body-parser": "^1.19.0", + "chalk": "^4.1.0", + "chokidar": "^3.4.3", + "compression-webpack-plugin": "^6.0.3", + "cross-env": "^7.0.2", + "eslint": "^6.7.2", + "eslint-config-prettier": "^6.14.0", + "eslint-plugin-prettier": "^3.1.4", + "eslint-plugin-vue": "^7.0.0-0", + "image-webpack-loader": "^7.0.1", + "less": "^3.0.4", + "less-loader": "^5.0.0", + "path": "^0.12.7", + "prettier": "^2.1.2", + "script-ext-html-webpack-plugin": "^2.1.4", + "style-resources-loader": "^1.3.3", + "svg-sprite-loader": "^5.0.0", + "terser-webpack-plugin": "4.1.0", + "typescript": "~3.9.3", + "uglifyjs-webpack-plugin": "^2.2.0", + "vue-cli-plugin-element-plus": "^0.0.8", + "vuex-module-decorators": "^1.0.1" + } +} diff --git a/pages.config.js b/pages.config.js new file mode 100644 index 0000000..fe4c7a7 --- /dev/null +++ b/pages.config.js @@ -0,0 +1,12 @@ +/** + * 多页应用配置,只需要配置基础路径即可。 + */ + +const pagesConfig = { + index: { + template: 'public/index.html', + title: 'vue-element-admin-webpack' + } +} + +module.exports = pagesConfig diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..df36fcf Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..4123528 --- /dev/null +++ b/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + +
+ + + diff --git a/src/assets/icons/index.ts b/src/assets/icons/index.ts new file mode 100644 index 0000000..3ff73ed --- /dev/null +++ b/src/assets/icons/index.ts @@ -0,0 +1,12 @@ +import type { App } from 'vue' +import SvgIcon from '@/components/SvgIcon/index.vue'// svg组件 + +const req: any = require.context('./svg', false, /\.svg$/) +const requireAll: any = (requireContext: any) => { + requireContext.keys().map(requireContext) +} +requireAll(req) + +export function setupSvgIcon(app: App): void { + app.component('SvgIcon', SvgIcon) +} diff --git a/src/assets/icons/svg/404.svg b/src/assets/icons/svg/404.svg new file mode 100644 index 0000000..6df5019 --- /dev/null +++ b/src/assets/icons/svg/404.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/UI.svg b/src/assets/icons/svg/UI.svg new file mode 100644 index 0000000..1ef8a22 --- /dev/null +++ b/src/assets/icons/svg/UI.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/bottom.svg b/src/assets/icons/svg/bottom.svg new file mode 100644 index 0000000..378df09 --- /dev/null +++ b/src/assets/icons/svg/bottom.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/bug.svg b/src/assets/icons/svg/bug.svg new file mode 100644 index 0000000..05a150d --- /dev/null +++ b/src/assets/icons/svg/bug.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/chart.svg b/src/assets/icons/svg/chart.svg new file mode 100644 index 0000000..27728fb --- /dev/null +++ b/src/assets/icons/svg/chart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/clipboard.svg b/src/assets/icons/svg/clipboard.svg new file mode 100644 index 0000000..90923ff --- /dev/null +++ b/src/assets/icons/svg/clipboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/close.svg b/src/assets/icons/svg/close.svg new file mode 100644 index 0000000..621a7ae --- /dev/null +++ b/src/assets/icons/svg/close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/component.svg b/src/assets/icons/svg/component.svg new file mode 100644 index 0000000..207ada3 --- /dev/null +++ b/src/assets/icons/svg/component.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/dashboard.svg b/src/assets/icons/svg/dashboard.svg new file mode 100644 index 0000000..5317d37 --- /dev/null +++ b/src/assets/icons/svg/dashboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/documentation.svg b/src/assets/icons/svg/documentation.svg new file mode 100644 index 0000000..7043122 --- /dev/null +++ b/src/assets/icons/svg/documentation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/drag.svg b/src/assets/icons/svg/drag.svg new file mode 100644 index 0000000..4185d3c --- /dev/null +++ b/src/assets/icons/svg/drag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/edit.svg b/src/assets/icons/svg/edit.svg new file mode 100644 index 0000000..d26101f --- /dev/null +++ b/src/assets/icons/svg/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/email.svg b/src/assets/icons/svg/email.svg new file mode 100644 index 0000000..74d25e2 --- /dev/null +++ b/src/assets/icons/svg/email.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/example.svg b/src/assets/icons/svg/example.svg new file mode 100644 index 0000000..46f42b5 --- /dev/null +++ b/src/assets/icons/svg/example.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/excel.svg b/src/assets/icons/svg/excel.svg new file mode 100644 index 0000000..74d97b8 --- /dev/null +++ b/src/assets/icons/svg/excel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/exit-fullscreen.svg b/src/assets/icons/svg/exit-fullscreen.svg new file mode 100644 index 0000000..485c128 --- /dev/null +++ b/src/assets/icons/svg/exit-fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/eye-open.svg b/src/assets/icons/svg/eye-open.svg new file mode 100644 index 0000000..88dcc98 --- /dev/null +++ b/src/assets/icons/svg/eye-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/eye.svg b/src/assets/icons/svg/eye.svg new file mode 100644 index 0000000..16ed2d8 --- /dev/null +++ b/src/assets/icons/svg/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/form.svg b/src/assets/icons/svg/form.svg new file mode 100644 index 0000000..dcbaa18 --- /dev/null +++ b/src/assets/icons/svg/form.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/fullscreen.svg b/src/assets/icons/svg/fullscreen.svg new file mode 100644 index 0000000..0e86b6f --- /dev/null +++ b/src/assets/icons/svg/fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/guide.svg b/src/assets/icons/svg/guide.svg new file mode 100644 index 0000000..b271001 --- /dev/null +++ b/src/assets/icons/svg/guide.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/icon.svg b/src/assets/icons/svg/icon.svg new file mode 100644 index 0000000..82be8ee --- /dev/null +++ b/src/assets/icons/svg/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/international.svg b/src/assets/icons/svg/international.svg new file mode 100644 index 0000000..e9b56ee --- /dev/null +++ b/src/assets/icons/svg/international.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/language.svg b/src/assets/icons/svg/language.svg new file mode 100644 index 0000000..0082b57 --- /dev/null +++ b/src/assets/icons/svg/language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/left.svg b/src/assets/icons/svg/left.svg new file mode 100644 index 0000000..84c57d3 --- /dev/null +++ b/src/assets/icons/svg/left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/link.svg b/src/assets/icons/svg/link.svg new file mode 100644 index 0000000..48197ba --- /dev/null +++ b/src/assets/icons/svg/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/list.svg b/src/assets/icons/svg/list.svg new file mode 100644 index 0000000..20259ed --- /dev/null +++ b/src/assets/icons/svg/list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/lock.svg b/src/assets/icons/svg/lock.svg new file mode 100644 index 0000000..74fee54 --- /dev/null +++ b/src/assets/icons/svg/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/magnify.svg b/src/assets/icons/svg/magnify.svg new file mode 100644 index 0000000..a1ffa02 --- /dev/null +++ b/src/assets/icons/svg/magnify.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/message.svg b/src/assets/icons/svg/message.svg new file mode 100644 index 0000000..14ca817 --- /dev/null +++ b/src/assets/icons/svg/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/money.svg b/src/assets/icons/svg/money.svg new file mode 100644 index 0000000..c1580de --- /dev/null +++ b/src/assets/icons/svg/money.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/nested.svg b/src/assets/icons/svg/nested.svg new file mode 100644 index 0000000..06713a8 --- /dev/null +++ b/src/assets/icons/svg/nested.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/password.svg b/src/assets/icons/svg/password.svg new file mode 100644 index 0000000..e291d85 --- /dev/null +++ b/src/assets/icons/svg/password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/pdf.svg b/src/assets/icons/svg/pdf.svg new file mode 100644 index 0000000..957aa0c --- /dev/null +++ b/src/assets/icons/svg/pdf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/people.svg b/src/assets/icons/svg/people.svg new file mode 100644 index 0000000..2bd54ae --- /dev/null +++ b/src/assets/icons/svg/people.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/peoples.svg b/src/assets/icons/svg/peoples.svg new file mode 100644 index 0000000..aab852e --- /dev/null +++ b/src/assets/icons/svg/peoples.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/qq.svg b/src/assets/icons/svg/qq.svg new file mode 100644 index 0000000..ee13d4e --- /dev/null +++ b/src/assets/icons/svg/qq.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/resume.svg b/src/assets/icons/svg/resume.svg new file mode 100644 index 0000000..f37a076 --- /dev/null +++ b/src/assets/icons/svg/resume.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/right.svg b/src/assets/icons/svg/right.svg new file mode 100644 index 0000000..71f7dd0 --- /dev/null +++ b/src/assets/icons/svg/right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/rotate.svg b/src/assets/icons/svg/rotate.svg new file mode 100644 index 0000000..d44b4b5 --- /dev/null +++ b/src/assets/icons/svg/rotate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/scale.svg b/src/assets/icons/svg/scale.svg new file mode 100644 index 0000000..bcb2dd9 --- /dev/null +++ b/src/assets/icons/svg/scale.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/scaleX.svg b/src/assets/icons/svg/scaleX.svg new file mode 100644 index 0000000..b6d8ce0 --- /dev/null +++ b/src/assets/icons/svg/scaleX.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/scaleY.svg b/src/assets/icons/svg/scaleY.svg new file mode 100644 index 0000000..260700e --- /dev/null +++ b/src/assets/icons/svg/scaleY.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/search.svg b/src/assets/icons/svg/search.svg new file mode 100644 index 0000000..84233dd --- /dev/null +++ b/src/assets/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/shopping.svg b/src/assets/icons/svg/shopping.svg new file mode 100644 index 0000000..87513e7 --- /dev/null +++ b/src/assets/icons/svg/shopping.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/shrink.svg b/src/assets/icons/svg/shrink.svg new file mode 100644 index 0000000..94933db --- /dev/null +++ b/src/assets/icons/svg/shrink.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/size.svg b/src/assets/icons/svg/size.svg new file mode 100644 index 0000000..ddb25b8 --- /dev/null +++ b/src/assets/icons/svg/size.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/star.svg b/src/assets/icons/svg/star.svg new file mode 100644 index 0000000..6cf86e6 --- /dev/null +++ b/src/assets/icons/svg/star.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/sure.svg b/src/assets/icons/svg/sure.svg new file mode 100644 index 0000000..164038e --- /dev/null +++ b/src/assets/icons/svg/sure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tab.svg b/src/assets/icons/svg/tab.svg new file mode 100644 index 0000000..b4b48e4 --- /dev/null +++ b/src/assets/icons/svg/tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/table.svg b/src/assets/icons/svg/table.svg new file mode 100644 index 0000000..0e3dc9d --- /dev/null +++ b/src/assets/icons/svg/table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/theme.svg b/src/assets/icons/svg/theme.svg new file mode 100644 index 0000000..5982a2f --- /dev/null +++ b/src/assets/icons/svg/theme.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/top.svg b/src/assets/icons/svg/top.svg new file mode 100644 index 0000000..1b86be5 --- /dev/null +++ b/src/assets/icons/svg/top.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/tree.svg b/src/assets/icons/svg/tree.svg new file mode 100644 index 0000000..dd4b7dd --- /dev/null +++ b/src/assets/icons/svg/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/unrotate.svg b/src/assets/icons/svg/unrotate.svg new file mode 100644 index 0000000..ba18bfa --- /dev/null +++ b/src/assets/icons/svg/unrotate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/unscale.svg b/src/assets/icons/svg/unscale.svg new file mode 100644 index 0000000..2d84de0 --- /dev/null +++ b/src/assets/icons/svg/unscale.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/user.svg b/src/assets/icons/svg/user.svg new file mode 100644 index 0000000..0ba0716 --- /dev/null +++ b/src/assets/icons/svg/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/wechat.svg b/src/assets/icons/svg/wechat.svg new file mode 100644 index 0000000..c586e55 --- /dev/null +++ b/src/assets/icons/svg/wechat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svg/zip.svg b/src/assets/icons/svg/zip.svg new file mode 100644 index 0000000..f806fc4 --- /dev/null +++ b/src/assets/icons/svg/zip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/svgo.yml b/src/assets/icons/svgo.yml new file mode 100644 index 0000000..d11906a --- /dev/null +++ b/src/assets/icons/svgo.yml @@ -0,0 +1,22 @@ +# replace default config + +# multipass: true +# full: true + +plugins: + + # - name + # + # or: + # - name: false + # - name: true + # + # or: + # - name: + # param1: 1 + # param2: 2 + +- removeAttrs: + attrs: + - 'fill' + - 'fill-rule' diff --git a/src/assets/img/404.png b/src/assets/img/404.png new file mode 100644 index 0000000..3d8e230 Binary files /dev/null and b/src/assets/img/404.png differ diff --git a/src/assets/img/404_cloud.png b/src/assets/img/404_cloud.png new file mode 100644 index 0000000..c6281d0 Binary files /dev/null and b/src/assets/img/404_cloud.png differ diff --git a/src/assets/img/avatar.gif b/src/assets/img/avatar.gif new file mode 100644 index 0000000..fdbd32c Binary files /dev/null and b/src/assets/img/avatar.gif differ diff --git a/src/assets/img/login-bg.jpg b/src/assets/img/login-bg.jpg new file mode 100644 index 0000000..94b8f51 Binary files /dev/null and b/src/assets/img/login-bg.jpg differ diff --git a/src/assets/img/logo.png b/src/assets/img/logo.png new file mode 100644 index 0000000..9838306 Binary files /dev/null and b/src/assets/img/logo.png differ diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000..f3d2503 Binary files /dev/null and b/src/assets/logo.png differ diff --git a/src/cache/index.ts b/src/cache/index.ts new file mode 100644 index 0000000..cbd0c5c --- /dev/null +++ b/src/cache/index.ts @@ -0,0 +1,11 @@ +/** + * 配置浏览器本地存储的方式,可直接存储对象数组。 + */ + +import WebStorageCache from 'web-storage-cache' + +const wsCache: WebStorageCache = new WebStorageCache({ + storage: 'sessionStorage' +}) + +export default wsCache diff --git a/src/components/Breadcrumb/Breadcrumb.vue b/src/components/Breadcrumb/Breadcrumb.vue new file mode 100644 index 0000000..780c20c --- /dev/null +++ b/src/components/Breadcrumb/Breadcrumb.vue @@ -0,0 +1,96 @@ + + + + diff --git a/src/components/Breadcrumb/BreadcrumbItem.vue b/src/components/Breadcrumb/BreadcrumbItem.vue new file mode 100644 index 0000000..0c85339 --- /dev/null +++ b/src/components/Breadcrumb/BreadcrumbItem.vue @@ -0,0 +1,51 @@ + + + diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue new file mode 100644 index 0000000..fad6f50 --- /dev/null +++ b/src/components/Breadcrumb/index.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/src/components/Button/index.vue b/src/components/Button/index.vue new file mode 100644 index 0000000..f4b3ff2 --- /dev/null +++ b/src/components/Button/index.vue @@ -0,0 +1,73 @@ + + diff --git a/src/components/CountTo/index.vue b/src/components/CountTo/index.vue new file mode 100644 index 0000000..b455754 --- /dev/null +++ b/src/components/CountTo/index.vue @@ -0,0 +1,160 @@ + + diff --git a/src/components/CountTo/props.ts b/src/components/CountTo/props.ts new file mode 100644 index 0000000..793c608 --- /dev/null +++ b/src/components/CountTo/props.ts @@ -0,0 +1,62 @@ +import { PropType } from 'vue' +export const countToProps = { + startVal: { + type: Number as PropType, + required: false, + default: 0 + }, + endVal: { + type: Number as PropType, + required: false, + default: 2017 + }, + duration: { + type: Number as PropType, + required: false, + default: 3000 + }, + autoplay: { + type: Boolean as PropType, + required: false, + default: true + }, + decimals: { + type: Number as PropType, + required: false, + default: 0, + validator(value: number) { + return value >= 0 + } + }, + decimal: { + type: String as PropType, + required: false, + default: '.' + }, + separator: { + type: String as PropType, + required: false, + default: ',' + }, + prefix: { + type: String as PropType, + required: false, + default: '' + }, + suffix: { + type: String as PropType, + required: false, + default: '' + }, + useEasing: { + type: Boolean as PropType, + required: false, + default: true + }, + easingFn: { + type: Function as PropType<(t: number, b: number, c: number, d: number) => number>, + default(t: number, b: number, c: number, d: number) { + return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b + } + } +} diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue new file mode 100644 index 0000000..90dc22f --- /dev/null +++ b/src/components/Echart/index.vue @@ -0,0 +1,109 @@ + + + + + diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json new file mode 100644 index 0000000..73a6ea8 --- /dev/null +++ b/src/components/Echart/theme.json @@ -0,0 +1,490 @@ +{ + "color": [ + "#2d8cf0", + "#19be6b", + "#ff9900", + "#E46CBB", + "#9A66E4", + "#ed3f14" + ], + "backgroundColor": "rgba(0,0,0,0)", + "textStyle": {}, + "title": { + "textStyle": { + "color": "#516b91" + }, + "subtextStyle": { + "color": "#93b7e3" + } + }, + "line": { + "itemStyle": { + "normal": { + "borderWidth": "2" + } + }, + "lineStyle": { + "normal": { + "width": "2" + } + }, + "symbolSize": "6", + "symbol": "emptyCircle", + "smooth": true + }, + "radar": { + "itemStyle": { + "normal": { + "borderWidth": "2" + } + }, + "lineStyle": { + "normal": { + "width": "2" + } + }, + "symbolSize": "6", + "symbol": "emptyCircle", + "smooth": true + }, + "bar": { + "itemStyle": { + "normal": { + "barBorderWidth": 0, + "barBorderColor": "#ccc" + }, + "emphasis": { + "barBorderWidth": 0, + "barBorderColor": "#ccc" + } + } + }, + "pie": { + "itemStyle": { + "normal": { + "borderWidth": 0, + "borderColor": "#ccc" + }, + "emphasis": { + "borderWidth": 0, + "borderColor": "#ccc" + } + } + }, + "scatter": { + "itemStyle": { + "normal": { + "borderWidth": 0, + "borderColor": "#ccc" + }, + "emphasis": { + "borderWidth": 0, + "borderColor": "#ccc" + } + } + }, + "boxplot": { + "itemStyle": { + "normal": { + "borderWidth": 0, + "borderColor": "#ccc" + }, + "emphasis": { + "borderWidth": 0, + "borderColor": "#ccc" + } + } + }, + "parallel": { + "itemStyle": { + "normal": { + "borderWidth": 0, + "borderColor": "#ccc" + }, + "emphasis": { + "borderWidth": 0, + "borderColor": "#ccc" + } + } + }, + "sankey": { + "itemStyle": { + "normal": { + "borderWidth": 0, + "borderColor": "#ccc" + }, + "emphasis": { + "borderWidth": 0, + "borderColor": "#ccc" + } + } + }, + "funnel": { + "itemStyle": { + "normal": { + "borderWidth": 0, + "borderColor": "#ccc" + }, + "emphasis": { + "borderWidth": 0, + "borderColor": "#ccc" + } + } + }, + "gauge": { + "itemStyle": { + "normal": { + "borderWidth": 0, + "borderColor": "#ccc" + }, + "emphasis": { + "borderWidth": 0, + "borderColor": "#ccc" + } + } + }, + "candlestick": { + "itemStyle": { + "normal": { + "color": "#edafda", + "color0": "transparent", + "borderColor": "#d680bc", + "borderColor0": "#8fd3e8", + "borderWidth": "2" + } + } + }, + "graph": { + "itemStyle": { + "normal": { + "borderWidth": 0, + "borderColor": "#ccc" + } + }, + "lineStyle": { + "normal": { + "width": 1, + "color": "#aaa" + } + }, + "symbolSize": "6", + "symbol": "emptyCircle", + "smooth": true, + "color": [ + "#2d8cf0", + "#19be6b", + "#f5ae4a", + "#9189d5", + "#56cae2", + "#cbb0e3" + ], + "label": { + "normal": { + "textStyle": { + "color": "#eee" + } + } + } + }, + "map": { + "itemStyle": { + "normal": { + "areaColor": "#f3f3f3", + "borderColor": "#516b91", + "borderWidth": 0.5 + }, + "emphasis": { + "areaColor": "rgba(165,231,240,1)", + "borderColor": "#516b91", + "borderWidth": 1 + } + }, + "label": { + "normal": { + "textStyle": { + "color": "#000" + } + }, + "emphasis": { + "textStyle": { + "color": "rgb(81,107,145)" + } + } + } + }, + "geo": { + "itemStyle": { + "normal": { + "areaColor": "#f3f3f3", + "borderColor": "#516b91", + "borderWidth": 0.5 + }, + "emphasis": { + "areaColor": "rgba(165,231,240,1)", + "borderColor": "#516b91", + "borderWidth": 1 + } + }, + "label": { + "normal": { + "textStyle": { + "color": "#000" + } + }, + "emphasis": { + "textStyle": { + "color": "rgb(81,107,145)" + } + } + } + }, + "categoryAxis": { + "axisLine": { + "show": true, + "lineStyle": { + "color": "#cccccc" + } + }, + "axisTick": { + "show": false, + "lineStyle": { + "color": "#333" + } + }, + "axisLabel": { + "show": true, + "textStyle": { + "color": "#999999" + } + }, + "splitLine": { + "show": true, + "lineStyle": { + "color": [ + "#eeeeee" + ] + } + }, + "splitArea": { + "show": false, + "areaStyle": { + "color": [ + "rgba(250,250,250,0.05)", + "rgba(200,200,200,0.02)" + ] + } + } + }, + "valueAxis": { + "axisLine": { + "show": true, + "lineStyle": { + "color": "#cccccc" + } + }, + "axisTick": { + "show": false, + "lineStyle": { + "color": "#333" + } + }, + "axisLabel": { + "show": true, + "textStyle": { + "color": "#999999" + } + }, + "splitLine": { + "show": true, + "lineStyle": { + "color": [ + "#eeeeee" + ] + } + }, + "splitArea": { + "show": false, + "areaStyle": { + "color": [ + "rgba(250,250,250,0.05)", + "rgba(200,200,200,0.02)" + ] + } + } + }, + "logAxis": { + "axisLine": { + "show": true, + "lineStyle": { + "color": "#cccccc" + } + }, + "axisTick": { + "show": false, + "lineStyle": { + "color": "#333" + } + }, + "axisLabel": { + "show": true, + "textStyle": { + "color": "#999999" + } + }, + "splitLine": { + "show": true, + "lineStyle": { + "color": [ + "#eeeeee" + ] + } + }, + "splitArea": { + "show": false, + "areaStyle": { + "color": [ + "rgba(250,250,250,0.05)", + "rgba(200,200,200,0.02)" + ] + } + } + }, + "timeAxis": { + "axisLine": { + "show": true, + "lineStyle": { + "color": "#cccccc" + } + }, + "axisTick": { + "show": false, + "lineStyle": { + "color": "#333" + } + }, + "axisLabel": { + "show": true, + "textStyle": { + "color": "#999999" + } + }, + "splitLine": { + "show": true, + "lineStyle": { + "color": [ + "#eeeeee" + ] + } + }, + "splitArea": { + "show": false, + "areaStyle": { + "color": [ + "rgba(250,250,250,0.05)", + "rgba(200,200,200,0.02)" + ] + } + } + }, + "toolbox": { + "iconStyle": { + "normal": { + "borderColor": "#999" + }, + "emphasis": { + "borderColor": "#666" + } + } + }, + "legend": { + "textStyle": { + "color": "#999999" + } + }, + "tooltip": { + "axisPointer": { + "lineStyle": { + "color": "#ccc", + "width": 1 + }, + "crossStyle": { + "color": "#ccc", + "width": 1 + } + } + }, + "timeline": { + "lineStyle": { + "color": "#8fd3e8", + "width": 1 + }, + "itemStyle": { + "normal": { + "color": "#8fd3e8", + "borderWidth": 1 + }, + "emphasis": { + "color": "#8fd3e8" + } + }, + "controlStyle": { + "normal": { + "color": "#8fd3e8", + "borderColor": "#8fd3e8", + "borderWidth": 0.5 + }, + "emphasis": { + "color": "#8fd3e8", + "borderColor": "#8fd3e8", + "borderWidth": 0.5 + } + }, + "checkpointStyle": { + "color": "#8fd3e8", + "borderColor": "rgba(138,124,168,0.37)" + }, + "label": { + "normal": { + "textStyle": { + "color": "#8fd3e8" + } + }, + "emphasis": { + "textStyle": { + "color": "#8fd3e8" + } + } + } + }, + "visualMap": { + "color": [ + "#516b91", + "#59c4e6", + "#a5e7f0" + ] + }, + "dataZoom": { + "backgroundColor": "rgba(0,0,0,0)", + "dataBackgroundColor": "rgba(255,255,255,0.3)", + "fillerColor": "rgba(167,183,204,0.4)", + "handleColor": "#a7b7cc", + "handleSize": "100%", + "textStyle": { + "color": "#333" + } + }, + "markPoint": { + "label": { + "normal": { + "textStyle": { + "color": "#eee" + } + }, + "emphasis": { + "textStyle": { + "color": "#eee" + } + } + } + } +} diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue new file mode 100644 index 0000000..45de15d --- /dev/null +++ b/src/components/Editor/index.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/src/components/Editor/props.ts b/src/components/Editor/props.ts new file mode 100644 index 0000000..0a697b9 --- /dev/null +++ b/src/components/Editor/props.ts @@ -0,0 +1,101 @@ +import { PropType } from 'vue' +import { message } from 'ant-design-vue' +import { oneOf } from '@/utils' + +import { Config } from './types' + +export const editorProps = { + // 基础配置 + config: { + type: Object as PropType, + default: () => { + return { + height: 500, + zIndex: 500, + placeholder: '请输入文本', + focus: false, + onchangeTimeout: 500, + customAlert: (s: string, t: string) => { + switch (t) { + case 'success': + message.success(s) + break + case 'info': + message.info(s) + break + case 'warning': + message.warning(s) + break + case 'error': + message.error(s) + break + default: + message.info(s) + break + } + }, + menus: [ + 'head', + 'bold', + 'fontSize', + 'fontName', + 'italic', + 'underline', + 'strikeThrough', + 'indent', + 'lineHeight', + 'foreColor', + 'backColor', + 'link', + 'list', + 'justify', + 'quote', + 'emoticon', + 'image', + 'video', + 'table', + 'code', + 'splitLine', + 'undo', + 'redo' + ], + colors: [ + '#000000', + '#eeece0', + '#1c487f', + '#4d80bf' + ], + fontNames: [ + '黑体', + '仿宋', + '楷体', + '标楷体', + '华文仿宋', + '华文楷体', + '宋体', + '微软雅黑', + 'Arial', + 'Tahoma', + 'Verdana', + 'Times New Roman', + 'Courier New' + ], + lineHeights: ['1', '1.15', '1.6', '2', '2.5', '3'], + showFullScreen: true + } + } + }, + // 绑定的值的类型, enum: ['html', 'text'] + valueType: { + type: String as PropType, + default: 'html', + validator: (val: string) => { + return oneOf(val, ['html', 'text']) + } + }, + // 文本内容 + value: { + type: String as PropType, + default: '' + } +} diff --git a/src/components/Editor/types.ts b/src/components/Editor/types.ts new file mode 100644 index 0000000..803de18 --- /dev/null +++ b/src/components/Editor/types.ts @@ -0,0 +1,13 @@ +export interface Config { + height: number + zIndex: number + placeholder: string + focus: boolean + customAlert: () => any + menus: string[] + colors: string[] + fontNames: string[] + lineHeights: string[] + showFullScreen: boolean + onchangeTimeout: number +} diff --git a/src/components/Error/404.vue b/src/components/Error/404.vue new file mode 100644 index 0000000..ae0d301 --- /dev/null +++ b/src/components/Error/404.vue @@ -0,0 +1,234 @@ + + + + + diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue new file mode 100644 index 0000000..b97fbc2 --- /dev/null +++ b/src/components/Hamburger/index.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/src/components/Image/index.vue b/src/components/Image/index.vue new file mode 100644 index 0000000..a28a9e9 --- /dev/null +++ b/src/components/Image/index.vue @@ -0,0 +1,243 @@ + + + + + diff --git a/src/components/Logo/index.vue b/src/components/Logo/index.vue new file mode 100644 index 0000000..14d8d76 --- /dev/null +++ b/src/components/Logo/index.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/src/components/Markdown/index.vue b/src/components/Markdown/index.vue new file mode 100644 index 0000000..ff9bba5 --- /dev/null +++ b/src/components/Markdown/index.vue @@ -0,0 +1,81 @@ + + diff --git a/src/components/Markdown/types.ts b/src/components/Markdown/types.ts new file mode 100644 index 0000000..6cea79f --- /dev/null +++ b/src/components/Markdown/types.ts @@ -0,0 +1,4 @@ +import Vditor from 'vditor' +export interface MarkDownActionType { + getVditor: () => Vditor +} diff --git a/src/components/ParentView/index.vue b/src/components/ParentView/index.vue new file mode 100644 index 0000000..7bf24ca --- /dev/null +++ b/src/components/ParentView/index.vue @@ -0,0 +1,26 @@ + + diff --git a/src/components/ParentView/useCache.ts b/src/components/ParentView/useCache.ts new file mode 100644 index 0000000..4d02a7c --- /dev/null +++ b/src/components/ParentView/useCache.ts @@ -0,0 +1,54 @@ +import { computed, ref, unref, ComponentInternalInstance, getCurrentInstance } from 'vue' + +import { tagsViewStore, PAGE_LAYOUT_KEY } from '_p/index/store/modules/tagsView' + +import { useRouter } from 'vue-router' + +function tryTsxEmit( + fn: (_instance: T) => Promise | void +) { + const instance = getCurrentInstance() as any + instance && fn.call(null, instance) +} + +const ParentLayoutName = 'ParentLayout' +export function useCache(isPage: boolean) { + const name = ref('') + const { currentRoute } = useRouter() + + tryTsxEmit((instance) => { + const routeName = instance.type.name + if (routeName && ![ParentLayoutName].includes(routeName)) { + name.value = routeName + } else { + const matched = currentRoute.value.matched + const len = matched.length + if (len < 2) return + name.value = matched[len - 2].name as string + } + }) + + const getCaches = computed((): string[] => { + const cached = tagsViewStore.cachedViews + + if (isPage) { + // page Layout + // not parent layout + return (cached as any).get(PAGE_LAYOUT_KEY) || [] + } + const cacheSet = new Set() + cacheSet.add(unref(name)) + + const list = (cached as any).get(unref(name)) + + if (!list) { + return Array.from(cacheSet) + } + (list as string[]).forEach((item: string) => { + cacheSet.add(item) + }) + + return Array.from(cacheSet) + }) + return { getCaches } +} diff --git a/src/components/Preview/functional.ts b/src/components/Preview/functional.ts new file mode 100644 index 0000000..c9a4dad --- /dev/null +++ b/src/components/Preview/functional.ts @@ -0,0 +1,26 @@ +import ImgPreview from './index.vue' +import { isClient } from '@/utils/is' + +import type { Options, Props } from './types' + +import { createVNode, render } from 'vue' + +let instance: any = null + +export function createImgPreview(options: Options) { + if (!isClient) return + const { imageList, show = true, index = 0, onSelect = null, onClose = null, zIndex = 500 } = options + + const propsData: Partial = {} + const container = document.createElement('div') + propsData.imageList = imageList + propsData.show = show + propsData.index = index + propsData.zIndex = zIndex + propsData.onSelect = onSelect + propsData.onClose = onClose + + instance = createVNode(ImgPreview, propsData) + render(instance, container) + document.body.appendChild(container) +} diff --git a/src/components/Preview/index.vue b/src/components/Preview/index.vue new file mode 100644 index 0000000..50ecd6b --- /dev/null +++ b/src/components/Preview/index.vue @@ -0,0 +1,442 @@ + + + + + diff --git a/src/components/Preview/props.ts b/src/components/Preview/props.ts new file mode 100644 index 0000000..0a2bb67 --- /dev/null +++ b/src/components/Preview/props.ts @@ -0,0 +1,28 @@ +import { PropType } from 'vue' + +export const previewProps = { + index: { + type: Number as PropType, + default: 0 + }, + zIndex: { + type: Number as PropType, + default: 100 + }, + show: { + type: Boolean as PropType, + default: false + }, + imageList: { + type: [Array] as PropType, + default: [] + }, + onClose: { + type: Function as PropType, + default: null + }, + onSelect: { + type: Function as PropType, + default: null + } +} diff --git a/src/components/Preview/types.ts b/src/components/Preview/types.ts new file mode 100644 index 0000000..891d712 --- /dev/null +++ b/src/components/Preview/types.ts @@ -0,0 +1,18 @@ +export interface Options { + show?: boolean + imageList: string[] + index?: number + zIndex?: number + onSelect?: Function | null + onClose?: Function | null +} + +export interface Props { + show: boolean + instance: Props + imageList: string[] + index: number + zIndex: number + onSelect: Function | null + onClose: Function | null +} diff --git a/src/components/Redirect/index.vue b/src/components/Redirect/index.vue new file mode 100644 index 0000000..f521a30 --- /dev/null +++ b/src/components/Redirect/index.vue @@ -0,0 +1,21 @@ + + + diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue new file mode 100644 index 0000000..e28a597 --- /dev/null +++ b/src/components/Screenfull/index.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/src/components/ScrollPane/index.vue b/src/components/ScrollPane/index.vue new file mode 100644 index 0000000..731d4a1 --- /dev/null +++ b/src/components/ScrollPane/index.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/src/components/Scrollbar/Bar.vue b/src/components/Scrollbar/Bar.vue new file mode 100644 index 0000000..ad2c993 --- /dev/null +++ b/src/components/Scrollbar/Bar.vue @@ -0,0 +1,128 @@ + + + + + diff --git a/src/components/Scrollbar/index.vue b/src/components/Scrollbar/index.vue new file mode 100644 index 0000000..612df97 --- /dev/null +++ b/src/components/Scrollbar/index.vue @@ -0,0 +1,254 @@ + + + + + diff --git a/src/components/Scrollbar/types.ts b/src/components/Scrollbar/types.ts new file mode 100644 index 0000000..c998234 --- /dev/null +++ b/src/components/Scrollbar/types.ts @@ -0,0 +1,14 @@ +export interface BarMapItem { + offset: string + scroll: string + scrollSize: string + size: string + key: string + axis: string + client: string + direction: string +} +export interface BarMap { + vertical: BarMapItem + horizontal: BarMapItem +} diff --git a/src/components/Scrollbar/util.ts b/src/components/Scrollbar/util.ts new file mode 100644 index 0000000..43472a5 --- /dev/null +++ b/src/components/Scrollbar/util.ts @@ -0,0 +1,49 @@ +import type { BarMap } from './types' +export const BAR_MAP: BarMap = { + vertical: { + offset: 'offsetHeight', + scroll: 'scrollTop', + scrollSize: 'scrollHeight', + size: 'height', + key: 'vertical', + axis: 'Y', + client: 'clientY', + direction: 'top' + }, + horizontal: { + offset: 'offsetWidth', + scroll: 'scrollLeft', + scrollSize: 'scrollWidth', + size: 'width', + key: 'horizontal', + axis: 'X', + client: 'clientX', + direction: 'left' + } +} + +export function renderThumbStyle({ move, size, bar }: any) { + const style = {} as any + const translate = `translate${bar.axis}(${move}%)` + + style[bar.size] = size + style.transform = translate + style.msTransform = translate + style.webkitTransform = translate + + return style +} + +function extend(to: T, _from: K): T & K { + return Object.assign(to, _from) +} + +export function toObject(arr: Array): Record { + const res = {} + for (let i = 0; i < arr.length; i++) { + if (arr[i]) { + extend(res, arr[i]) + } + } + return res +} diff --git a/src/components/Search/index.vue b/src/components/Search/index.vue new file mode 100644 index 0000000..8b5af9d --- /dev/null +++ b/src/components/Search/index.vue @@ -0,0 +1,387 @@ + + + + + diff --git a/src/components/Sider/SiderItem.vue b/src/components/Sider/SiderItem.vue new file mode 100644 index 0000000..4201901 --- /dev/null +++ b/src/components/Sider/SiderItem.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/src/components/Sider/index.vue b/src/components/Sider/index.vue new file mode 100644 index 0000000..b2fe396 --- /dev/null +++ b/src/components/Sider/index.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue new file mode 100644 index 0000000..9f740c2 --- /dev/null +++ b/src/components/SvgIcon/index.vue @@ -0,0 +1,53 @@ + + + + + diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx new file mode 100644 index 0000000..f2b5d30 --- /dev/null +++ b/src/components/Table/Table.tsx @@ -0,0 +1,94 @@ +import { defineComponent, PropType, computed } from 'vue' +import { Table } from 'ant-design-vue' + +export default defineComponent({ + name: 'ComTable', + props: { + columns: { + type: Array as PropType, + default: () => [] + } + }, + setup(props, { attrs, slots }) { + const getBindValue = computed((): any => { + const bindValue = { ...attrs, ...props } + delete bindValue.columns + return bindValue + }) + + function renderTabelItem(columns: any[]) { + return columns.map((v: any) => { + const vSlots: any = v.slots || {} + if (v.children) { + const slotData = { + title: () => vSlots.title && slots[vSlots.title] && slots[vSlots.title]!(), + default: () => {renderTabelItem(v.children)} + } + if (!vSlots.title) { + delete slotData.title + } + return ( + + + ) + } else { + const slotData = { + title: () => vSlots.title && slots[vSlots.title] && slots[vSlots.title]!(), + default: ({ text, record, index, column }: any) => { + if (vSlots.customRender) { + return slots[vSlots.customRender] && slots[vSlots.customRender]!({ text, record, index, column }) + } else { + return text + } + }, + filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, column }: any) => vSlots.filterDropdown && slots[vSlots.filterDropdown] && slots[vSlots.filterDropdown]!({ setSelectedKeys, selectedKeys, confirm, clearFilters, column }), + filterIcon: (filtered: any) => vSlots.filterIcon && slots[vSlots.filterIcon] && slots[vSlots.filterIcon]!(filtered) + } + if (!vSlots.title) { + delete slotData.title + } + if (!vSlots.filterDropdown) { + delete slotData.filterDropdown + } + if (!vSlots.filterIcon) { + delete slotData.filterIcon + } + return ( + + + ) + } + }) + } + + return () => { + const tableSlot = { + title: (currentPageData: any) => slots.title && slots.title(currentPageData), + footer: (currentPageData: any) => slots.footer && slots.footer(currentPageData), + expandedRowRender: ({ record, index, indent, expanded }: any) => slots.expandedRowRender && slots.expandedRowRender({ record, index, indent, expanded }), + } + if (!slots.title) { + delete tableSlot.title + } + if (!slots.footer) { + delete tableSlot.footer + } + if (!slots.expandedRowRender) { + delete tableSlot.expandedRowRender + } + return ( + + {renderTabelItem(props.columns)} +
+ ) + } + } +}) diff --git a/src/components/Table/TableItem.vue b/src/components/Table/TableItem.vue new file mode 100644 index 0000000..33b76ba --- /dev/null +++ b/src/components/Table/TableItem.vue @@ -0,0 +1,53 @@ +