Compare commits
48 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
de3b29b5f3 | ||
|
54acf1e0d5 | ||
|
de08e49f19 | ||
|
2472107768 | ||
|
d18902dfee | ||
|
9ba2648689 | ||
|
1d0b26cec8 | ||
|
ea7e139696 | ||
|
deac95da1b | ||
|
2b51b987be | ||
|
45fef9b431 | ||
|
83e56488d8 | ||
|
f3bfaa0f2b | ||
|
e261fbcbfb | ||
|
471c297f13 | ||
|
093475ee50 | ||
|
cb3578e5c3 | ||
|
fe25c4d96b | ||
|
7fef8568c2 | ||
|
0dfa56c73e | ||
|
642d48e372 | ||
|
021c147b31 | ||
|
04d9b849dd | ||
|
2e74f0d782 | ||
|
dc162093cc | ||
|
8fd786c4ed | ||
|
54e7ce2b76 | ||
|
f5563b4eed | ||
|
0c80fba84c | ||
|
4d3bbae183 | ||
|
b6d97f1806 | ||
|
a68413cb8f | ||
|
f9aaaa9091 | ||
|
85492f148f | ||
|
b7ca786751 | ||
|
c32bd73b42 | ||
|
3aacd3cccd | ||
|
e7f626f015 | ||
|
b53d0945ab | ||
|
ca75f7bcbc | ||
|
b7939165d1 | ||
|
ebc2ac08b7 | ||
|
a9d2978c31 | ||
|
a4597887ac | ||
|
44b180a7b3 | ||
|
acebaeae0c | ||
|
d09923ff4f | ||
|
fc1a13d10b |
8
.babelrc
8
.babelrc
@@ -1,10 +1,12 @@
|
|||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
["env", {
|
["env", {
|
||||||
"modules": false
|
"modules": false,
|
||||||
|
"targets": {
|
||||||
|
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
"stage-2"
|
"stage-2"
|
||||||
],
|
],
|
||||||
"plugins": ["transform-runtime"],
|
"plugins": ["transform-vue-jsx", "transform-runtime"]
|
||||||
"comments": false
|
|
||||||
}
|
}
|
||||||
|
337
.eslintrc.js
337
.eslintrc.js
@@ -1,144 +1,199 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
parser: 'babel-eslint',
|
parser: 'babel-eslint',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: 'module'
|
sourceType: 'module'
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
node: true,
|
node: true,
|
||||||
es6: true,
|
es6: true,
|
||||||
},
|
},
|
||||||
extends: 'eslint:recommended',
|
extends: 'eslint:recommended',
|
||||||
// required to lint *.vue files
|
// required to lint *.vue files
|
||||||
plugins: [
|
plugins: [
|
||||||
'html'
|
'html'
|
||||||
],
|
],
|
||||||
// check if imports actually resolve
|
// check if imports actually resolve
|
||||||
'settings': {
|
'settings': {
|
||||||
'import/resolver': {
|
'import/resolver': {
|
||||||
'webpack': {
|
'webpack': {
|
||||||
'config': 'build/webpack.base.conf.js'
|
'config': 'build/webpack.base.conf.js'
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
// add your custom rules here
|
|
||||||
//it is base on https://github.com/vuejs/eslint-config-vue
|
|
||||||
'rules': {
|
|
||||||
'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': [2, 'allow-null'],
|
|
||||||
'generator-star-spacing': [2, { 'before': true, 'after': true }],
|
|
||||||
'handle-callback-err': [2, '^(err|error)$' ],
|
|
||||||
'indent': [2, 2, { 'SwitchCase': 1 }],
|
|
||||||
'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': 2,
|
|
||||||
'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': [2, { 'vars': 'all', 'args': 'none' }],
|
|
||||||
'no-useless-call': 2,
|
|
||||||
'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': process.env.NODE_ENV === 'production' ? 2 : 0,
|
|
||||||
'object-curly-spacing': [2, 'always', { objectsInObjects: false }],
|
|
||||||
'array-bracket-spacing': [2, 'never']
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// add your custom rules here
|
||||||
|
//it is base on https://github.com/vuejs/eslint-config-vue
|
||||||
|
'rules': {
|
||||||
|
'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': [2, 'allow-null'],
|
||||||
|
'generator-star-spacing': [2, {
|
||||||
|
'before': true,
|
||||||
|
'after': true
|
||||||
|
}],
|
||||||
|
'handle-callback-err': [2, '^(err|error)$'],
|
||||||
|
'indent': [2, 2, {
|
||||||
|
'SwitchCase': 1
|
||||||
|
}],
|
||||||
|
'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': 2,
|
||||||
|
'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': [2, {
|
||||||
|
'vars': 'all',
|
||||||
|
'args': 'none'
|
||||||
|
}],
|
||||||
|
'no-useless-call': 2,
|
||||||
|
'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': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||||
|
'object-curly-spacing': [2, 'always', {
|
||||||
|
objectsInObjects: false
|
||||||
|
}],
|
||||||
|
'array-bracket-spacing': [2, 'never']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
.gitignore
vendored
13
.gitignore
vendored
@@ -2,9 +2,20 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
gifs/
|
gifs/
|
||||||
npm-debug.log
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
test/unit/coverage
|
test/unit/coverage
|
||||||
test/e2e/reports
|
test/e2e/reports
|
||||||
selenium-debug.log
|
selenium-debug.log
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
.idea
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"plugins": {
|
"plugins": {
|
||||||
|
"postcss-import": {},
|
||||||
|
"postcss-url": {},
|
||||||
// to edit target browsers: use "browserslist" field in package.json
|
// to edit target browsers: use "browserslist" field in package.json
|
||||||
"autoprefixer": {}
|
"autoprefixer": {}
|
||||||
}
|
}
|
||||||
|
5
.travis.yml
Executable file
5
.travis.yml
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js: stable
|
||||||
|
script: npm run test
|
||||||
|
notifications:
|
||||||
|
email: false
|
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2017 PanJiaChen
|
Copyright (c) 2017-present PanJiaChen
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
177
README-en.md
177
README-en.md
@@ -1,177 +0,0 @@
|
|||||||
[](https://github.com/vuejs/vue)
|
|
||||||
[](https://github.com/ElemeFE/element)
|
|
||||||
[](https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE)
|
|
||||||
[]()
|
|
||||||
|
|
||||||
## Intro
|
|
||||||
|
|
||||||
> In the past half year, I have been building a backend for management dashboard using Vue. Though the backend has contained greater than 70 pages and over 10 permissions, it still takes insignificant effort to maintain the project. So I decide to make it open source so as to share my development experience and progress on backend. The tech stack is mainly [Vue.js](https://github.com/vuejs/vue)+[Element](https://github.com/ElemeFE/element)+[axios](https://github.com/mzabriskie/axios). Since it's a personal project, all data requests are simulated with [Mock.js](https://github.com/nuysoft/Mock). **Note:** if anyone wants to modify or develop based on this project, please remove the mock files.
|
|
||||||
|
|
||||||
**Live demo:** http://panjiachen.github.io/vue-element-admin
|
|
||||||
|
|
||||||
**Note: element-ui@1.4.2 is used in the project, so vue 2.3.0+ is required.**
|
|
||||||
|
|
||||||
- vueAdmin-template: [vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template)
|
|
||||||
- electron-vue-admin: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
|
|
||||||
- Donate:[donate](https://github.com/PanJiaChen/vue-element-admin/blob/master/README-en.md#donate)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Login/Logout
|
|
||||||
- Permission authentication
|
|
||||||
- Sidebar
|
|
||||||
- Breadcrumb
|
|
||||||
- Rich text editor
|
|
||||||
- Markdown editor
|
|
||||||
- JSON editor
|
|
||||||
- Drag & drop list
|
|
||||||
- SplitPane
|
|
||||||
- Dropzone
|
|
||||||
- Sticky
|
|
||||||
- CountTo
|
|
||||||
- ECharts
|
|
||||||
- 401, 404 error page
|
|
||||||
- Error log
|
|
||||||
- Export Excel
|
|
||||||
- Upload Excel
|
|
||||||
- Export Zip
|
|
||||||
- Table example
|
|
||||||
- Interactive table example
|
|
||||||
- Drag & drop table example
|
|
||||||
- Form example
|
|
||||||
- Multi-environments distribution
|
|
||||||
- Dashboard
|
|
||||||
- Two-factor authentication
|
|
||||||
- Collapsing sidebar (support nested routes)
|
|
||||||
- Mock data
|
|
||||||
- cache tabs example
|
|
||||||
- screenfull
|
|
||||||
- markdown2html
|
|
||||||
- views-tab
|
|
||||||
- clipboard
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Clone project
|
|
||||||
git clone https://github.com/PanJiaChen/vue-element-admin.git
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
npm install
|
|
||||||
|
|
||||||
# Or (not recommended for cnpm due to unknown bugs, use taobao mirror instead)
|
|
||||||
npm install --registry=https://registry.npm.taobao.org
|
|
||||||
|
|
||||||
# Run local dev server
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Visit in browser: http://localhost:9527
|
|
||||||
|
|
||||||
## Distribution
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build staged environment with webpack-bundle-analyzer
|
|
||||||
npm run build:sit-preview
|
|
||||||
|
|
||||||
# Build production environment
|
|
||||||
npm run build:prod
|
|
||||||
```
|
|
||||||
|
|
||||||
## Directory structure
|
|
||||||
|
|
||||||
```
|
|
||||||
├── build // build
|
|
||||||
├── config // config
|
|
||||||
├── src // source code
|
|
||||||
│ ├── api // all requests
|
|
||||||
│ ├── assets // static resource like themes, fonts
|
|
||||||
│ ├── components // global public components
|
|
||||||
│ ├── directive // global directive
|
|
||||||
│ ├── filters // global filters
|
|
||||||
│ ├── mock // mock data
|
|
||||||
│ ├── router // router
|
|
||||||
│ ├── store // global status management
|
|
||||||
│ ├── styles // global styles
|
|
||||||
│ ├── utils // global public functions
|
|
||||||
│ ├── view // view
|
|
||||||
│ ├── App.vue // entry view
|
|
||||||
│ └── main.js // entry for loading components, initialization
|
|
||||||
├── static // third-party libraries not packed with Webpack
|
|
||||||
│ └── Tinymce // rich text
|
|
||||||
├── .babelrc // babel-loader config
|
|
||||||
├── eslintrc.js // eslint config
|
|
||||||
├── .gitignore // gitignore
|
|
||||||
├── favicon.ico // favicon
|
|
||||||
├── index.html // html template
|
|
||||||
└── package.json // package.json
|
|
||||||
```
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
Detailed changes for each release are documented in the [release notes](https://github.com/PanJiaChen/vue-element-admin/releases).
|
|
||||||
|
|
||||||
## Donate
|
|
||||||
If you find this project useful, you can buy me a cup of coffee
|
|
||||||

|
|
||||||
|
|
||||||
## State Management
|
|
||||||
|
|
||||||
Only status of user and app configuration is managed by Vuex. Other data are managed by their own business pages.
|
|
||||||
|
|
||||||
## Demo
|
|
||||||
|
|
||||||
#### Two-factor authentication, supporting WeChat and QQ
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Realtime switching themes
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### tabs
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
#### Collapsing sidebar
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Drag & drop table
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Interactive table
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Uploading cropped avatar
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Error log
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Rich text (integrated with Qiniu, watermark and customization)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Packaging table component
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Charts
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### Exporting to Excel
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### More
|
|
||||||
|
|
||||||
http://panjiachen.github.io/vue-element-admin
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT
|
|
213
README.md
213
README.md
@@ -2,164 +2,151 @@
|
|||||||
<img width="320" src="https://wpimg.wallstcn.com/ecc53a42-d79b-42e2-8852-5126b810a4c8.svg">
|
<img width="320" src="https://wpimg.wallstcn.com/ecc53a42-d79b-42e2-8852-5126b810a4c8.svg">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
# vue-element-admin
|
<p align="center">
|
||||||
|
<a href="https://github.com/vuejs/vue">
|
||||||
|
<img src="https://img.shields.io/badge/vue-2.5.10-brightgreen.svg" alt="vue">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/ElemeFE/element">
|
||||||
|
<img src="https://img.shields.io/badge/element--ui-2.0.8-brightgreen.svg" alt="element-ui">
|
||||||
|
</a>
|
||||||
|
<a href="https://travis-ci.org/PanJiaChen/vue-element-admin" rel="nofollow">
|
||||||
|
<img src="https://travis-ci.org/PanJiaChen/vue-element-admin.svg?branch=master" alt="Build Status">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE">
|
||||||
|
<img src="https://img.shields.io/github/license/mashape/apistatus.svg" alt="license">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/PanJiaChen/vue-element-admin/releases">
|
||||||
|
<img src="https://img.shields.io/github/release/PanJiaChen/vue-element-admin.svg" alt="GitHub release">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
[](https://github.com/vuejs/vue)
|
English | [简体中文](./README.zh-CN.md)
|
||||||
[](https://github.com/ElemeFE/element)
|
|
||||||
[](https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE)
|
|
||||||
[]()
|
|
||||||
|
|
||||||
**A magical vue admin.**
|
## Introduction
|
||||||
|
|
||||||
- [线上地址](http://panjiachen.github.io/vue-element-admin)
|
`vue-element-admin` is a production-ready solution for admin interfaces. Based on [Vue.js](https://github.com/vuejs/vue) and use the UI Toolkit -- [element](https://github.com/ElemeFE/element). `vue-element-admin` is a magical vue admin, it based on the newest development stack of vue, built-in i18n solution, typical templates for enterprise applications, lots of awesome features. It helps you build a large complex Single-Page Applications. I believe whatever your needs are, this project will help you.
|
||||||
|
|
||||||
- [使用文档](https://panjiachen.github.io/vue-element-admin-site/#/)
|
- [Preview](http://panjiachen.github.io/vue-element-admin)
|
||||||
|
|
||||||
- [English Document](https://github.com/PanJiaChen/vue-element-admin/blob/master/README-en.md)
|
- [Documentation](https://panjiachen.github.io/vue-element-admin-site/#/)
|
||||||
|
|
||||||
- [wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
|
- [wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
|
||||||
|
|
||||||
- [donate](https://panjiachen.github.io/vue-element-admin-site/#/donate)
|
- [donate](https://panjiachen.github.io/vue-element-admin-site/#/donate)
|
||||||
|
|
||||||
**本项目的定位是后台集成方案,不适合当基础模板来开发。**
|
**vue-element-admin is a admin interfaces integration solution, which is not suitable for secondary development as a base template.**
|
||||||
- 模板建议使用: [vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template)
|
|
||||||
- 桌面端: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
|
|
||||||
|
|
||||||
|
- Base template recommends using: [vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template)
|
||||||
|
- Desktop: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
|
||||||
|
|
||||||
**注意:该项目目前使用element-ui@2.0.5版本,所以最低兼容 Vue 2.5.0**
|
**Note: This project uses element-ui@2.0.0+ version, so the minimum compatible vue@2.5.0**
|
||||||
|
|
||||||
楼主这里有一份调查[问卷](https://www.wjx.cn/m/16866569.aspx) 有空请填写一下,以表对本项目的支持~ps:不是给这个调查问卷网站做广告,所以填完问卷不用点上面抽奖有的没的那些东西
|
## Preparation
|
||||||
|
|
||||||
## 前序准备
|
You need to install [node](http://nodejs.org/) and [git](https://git-scm.com/) locally. The project is based on [ES2015+](http://es6.ruanyifeng.com/)、[vue](https://cn.vuejs.org/index.html)、[vuex](https://vuex.vuejs.org/zh-cn/)、[vue-router](https://router.vuejs.org/zh-cn/) 和 [element-ui](https://github.com/ElemeFE/element). All data requests for this project are simulated using [Mock.js](https://github.com/nuysoft/Mock). It would be helpful if you have pre-existing knowledge on those.
|
||||||
|
|
||||||
你的本地环境需要安装 [node](http://nodejs.org/) 和 [git](https://git-scm.com/)。我们的技术栈基于 [ES2015+](http://es6.ruanyifeng.com/)、[vue](https://cn.vuejs.org/index.html)、[vuex](https://vuex.vuejs.org/zh-cn/)、[vue-router](https://router.vuejs.org/zh-cn/) 和 [element-ui](https://github.com/ElemeFE/element),提前了解和学习这些知识会对使用本项目有很大的帮助。
|
**This project is not a scaffolding and is more of an integrated solution.**
|
||||||
|
|
||||||
同时配套一个系列的教程文章,如何从零构建后一个完整的后台项目,建议大家先看完这些文章再来实践本项目
|
**This project does not support low version browsers (e.g. IE). Please add polyfill yourself if you need them.**
|
||||||
- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2)
|
|
||||||
- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac)
|
|
||||||
- [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35)
|
|
||||||
- [手摸手,带你用 vue 撸后台 系列四(vueAdmin 一个极简的后台基础模板)](https://juejin.im/post/595b4d776fb9a06bbe7dba56)
|
|
||||||
- [手摸手,带你封装一个 vue component](https://segmentfault.com/a/1190000009090836)
|
|
||||||
- [手摸手,带你优雅的使用 icon](https://juejin.im/post/59bb864b5188257e7a427c09)
|
|
||||||
|
|
||||||
相应需求,开了一个qq群 `591724180` 方便大家交流
|
<p align="center">
|
||||||
|
<img width="900" src="https://wpimg.wallstcn.com/a5894c1b-f6af-456e-82df-1151da0839bf.png">
|
||||||
|
</p>
|
||||||
|
|
||||||
或者可以加入该 **[圈子](https://jianshiapp.com/circles/1209)** 讨论问题
|
## Features
|
||||||
|
```
|
||||||
**如有问题请先看上述使用文档和文章,若不能满足,欢迎 issue 和 pr**
|
- Login / Logout
|
||||||
|
- Permission authentication
|
||||||
**本项目并不是一个脚手架,更倾向于是一个集成解决方案**
|
- Multi-environment build
|
||||||
|
- Dynamic sidebar (supports multi-level routing)
|
||||||
**该项目不支持低版本游览器(如ie),有需求请自行添加polyfill [详情](https://github.com/PanJiaChen/vue-element-admin/wiki#babel-polyfill)**
|
- Dynamic breadcrumb
|
||||||
|
- I18n
|
||||||
|
- Customizable theme
|
||||||
## 功能
|
- Tags-view(Tab page Support right-click operation)
|
||||||
- 登录/注销
|
- Rich text editor
|
||||||
- 权限验证
|
- Markdown editor
|
||||||
- 多环境发布
|
- JSON editor
|
||||||
- 动态侧边栏(支持多级路由)
|
- Screenfull
|
||||||
- 动态面包屑
|
- Drag and drop list
|
||||||
- 国际化多语言
|
- Svg Sprite
|
||||||
- 多种动态换肤
|
|
||||||
- 快捷导航(标签页)
|
|
||||||
- 富文本编辑器
|
|
||||||
- Markdown编辑器
|
|
||||||
- JSON编辑器
|
|
||||||
- Screenfull全屏
|
|
||||||
- 列表拖拽
|
|
||||||
- Svg Sprite 图标
|
|
||||||
- Dashboard
|
- Dashboard
|
||||||
- 本地mock数据
|
- Mock data
|
||||||
- Echarts 图表
|
- Echarts
|
||||||
- Clipboard(剪贴复制)
|
- Clipboard
|
||||||
- 401/404错误页面
|
- 401/404 error page
|
||||||
- 错误日志
|
- Error log
|
||||||
- 导出excel
|
- Export excel
|
||||||
- 导出zip
|
- Export zip
|
||||||
- 前端可视化excel
|
- Front-end visualization excel
|
||||||
- Table example
|
- Table example
|
||||||
- 动态table example
|
- Dynamictable example
|
||||||
- 拖拽table example
|
- Drag and drop table example
|
||||||
- 内联编辑table example
|
- Inline edit table example
|
||||||
- Form example
|
- Form example
|
||||||
- 二步登录
|
- Two-step login
|
||||||
- SplitPane
|
- SplitPane
|
||||||
- Dropzone
|
- Dropzone
|
||||||
- Sticky
|
- Sticky
|
||||||
- CountTo
|
- CountTo
|
||||||
- Markdown2html
|
- Markdown to html
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
## 开发
|
|
||||||
```bash
|
```bash
|
||||||
# 克隆项目
|
# clone the projice
|
||||||
git clone https://github.com/PanJiaChen/vue-element-admin.git
|
git clone https://github.com/PanJiaChen/vue-element-admin.git
|
||||||
|
|
||||||
# 安装依赖
|
# install dependency
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
//or # 建议不要用cnpm 安装有各种诡异的bug 可以通过如下操作解决npm速度慢的问题
|
|
||||||
npm install --registry=https://registry.npm.taobao.org
|
|
||||||
|
|
||||||
# 本地开发 开启服务
|
# develop
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
浏览器访问 http://localhost:9527
|
|
||||||
|
|
||||||
## 发布
|
This will automatically open http://localhost:9527.
|
||||||
|
|
||||||
|
## Build
|
||||||
```bash
|
```bash
|
||||||
# 发布测试环境 带webpack ananalyzer
|
# build for test environment
|
||||||
npm run build:sit-preview
|
npm run build:sit
|
||||||
|
|
||||||
# 构建生成环境
|
# build for production environment
|
||||||
npm run build:prod
|
npm run build:prod
|
||||||
```
|
```
|
||||||
|
|
||||||
更多信息请参考 [使用文档](https://panjiachen.github.io/vue-element-admin-site/#/)
|
## Advanced
|
||||||
|
```bash
|
||||||
|
# --report to build with bundle size analytics
|
||||||
|
npm run build:prod --report
|
||||||
|
|
||||||
## 目录结构
|
# --preview to start a server in local to preview
|
||||||
```shell
|
npm run build:prod --preview
|
||||||
├── build // 构建相关
|
|
||||||
├── config // 配置相关
|
|
||||||
├── src // 源代码
|
|
||||||
│ ├── api // 所有请求
|
|
||||||
│ ├── assets // 主题 字体等静态资源
|
|
||||||
│ ├── components // 全局公用组件
|
|
||||||
│ ├── directive // 全局指令
|
|
||||||
│ ├── filtres // 全局 filter
|
|
||||||
│ ├── icons // 项目所有 svg icons
|
|
||||||
│ ├── lang // 国际化 language
|
|
||||||
│ ├── mock // 项目mock 模拟数据
|
|
||||||
│ ├── router // 路由
|
|
||||||
│ ├── store // 全局 store管理
|
|
||||||
│ ├── styles // 全局样式
|
|
||||||
│ ├── utils // 全局公用方法
|
|
||||||
│ ├── vendor // 公用vendor
|
|
||||||
│ ├── views // view
|
|
||||||
│ ├── App.vue // 入口页面
|
|
||||||
│ ├── main.js // 入口 加载组件 初始化等
|
|
||||||
│ └── permission.js // 权限管理
|
|
||||||
├── static // 第三方不打包资源
|
|
||||||
│ └── Tinymce // 富文本
|
|
||||||
├── .babelrc // babel-loader 配置
|
|
||||||
├── eslintrc.js // eslint 配置项
|
|
||||||
├── .gitignore // git 忽略项
|
|
||||||
├── favicon.ico // favicon图标
|
|
||||||
├── index.html // html模板
|
|
||||||
└── package.json // package.json
|
|
||||||
|
|
||||||
|
# lint code
|
||||||
|
npm run lint
|
||||||
|
|
||||||
|
# auto fix
|
||||||
|
npm run lint -- --fix
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/#/deploy) for more information
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
Detailed changes for each release are documented in the [release notes](https://github.com/PanJiaChen/vue-element-admin/releases).
|
Detailed changes for each release are documented in the [release notes](https://github.com/PanJiaChen/vue-element-admin/releases).
|
||||||
|
|
||||||
## [查看更多demo](http://panjiachen.github.io/vue-element-admin)
|
## Online Demo
|
||||||

|
[Preview](http://panjiachen.github.io/vue-element-admin)
|
||||||
|
|
||||||
## Donate
|
## Donate
|
||||||
If you find this project useful, you can buy me a cup of coffee
|
If you find this project useful, you can buy author a glass of juice :tropical_drink:
|
||||||

|
|
||||||
|

|
||||||
|
|
||||||
|
[Paypal Me](https://www.paypal.me/panfree23)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
[MIT](https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE)
|
||||||
|
|
||||||
|
Copyright (c) 2017-present PanJiaChen
|
||||||
|
165
README.zh-CN.md
Normal file
165
README.zh-CN.md
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<p align="center">
|
||||||
|
<img width="320" src="https://wpimg.wallstcn.com/ecc53a42-d79b-42e2-8852-5126b810a4c8.svg">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/vuejs/vue">
|
||||||
|
<img src="https://img.shields.io/badge/vue-2.5.10-brightgreen.svg" alt="vue">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/ElemeFE/element">
|
||||||
|
<img src="https://img.shields.io/badge/element--ui-2.0.8-brightgreen.svg" alt="element-ui">
|
||||||
|
</a>
|
||||||
|
<a href="https://travis-ci.org/PanJiaChen/vue-element-admin" rel="nofollow">
|
||||||
|
<img src="https://travis-ci.org/PanJiaChen/vue-element-admin.svg?branch=master" alt="Build Status">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE">
|
||||||
|
<img src="https://img.shields.io/github/license/mashape/apistatus.svg" alt="license">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/PanJiaChen/vue-element-admin/releases">
|
||||||
|
<img src="https://img.shields.io/github/release/PanJiaChen/vue-element-admin.svg" alt="GitHub release">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
简体中文 | [English](./README.md)
|
||||||
|
|
||||||
|
## 简介
|
||||||
|
|
||||||
|
`vue-element-admin` 是一个后台集成解决方案,它基于 [Vue.js](https://github.com/vuejs/vue) 和 [element](https://github.com/ElemeFE/element)。它使用了最新的前端技术栈,内置了i18国际化解决方案,动态路由,权限验证等很多功能特性,相信不管你的需求是什么,本项目都能帮助到你。
|
||||||
|
|
||||||
|
- [在线访问](http://panjiachen.github.io/vue-element-admin)
|
||||||
|
|
||||||
|
- [使用文档](https://panjiachen.github.io/vue-element-admin-site/#/)
|
||||||
|
|
||||||
|
- [wiki](https://github.com/PanJiaChen/vue-element-admin/wiki)
|
||||||
|
|
||||||
|
- [donate](https://panjiachen.github.io/vue-element-admin-site/#/donate)
|
||||||
|
|
||||||
|
**本项目的定位是后台集成方案,不适合当基础模板来开发。**
|
||||||
|
- 模板建议使用: [vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template)
|
||||||
|
- 桌面端: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
|
||||||
|
|
||||||
|
**注意:该项目使用 element-ui@2.0.0+ 版本,所以最低兼容 vue@2.5.0**
|
||||||
|
|
||||||
|
## 前序准备
|
||||||
|
|
||||||
|
你的本地环境需要安装 [node](http://nodejs.org/) 和 [git](https://git-scm.com/)。我们的技术栈基于 [ES2015+](http://es6.ruanyifeng.com/)、[vue](https://cn.vuejs.org/index.html)、[vuex](https://vuex.vuejs.org/zh-cn/)、[vue-router](https://router.vuejs.org/zh-cn/) and [element-ui](https://github.com/ElemeFE/element),所有的请求数据都使用[Mock.js](https://github.com/nuysoft/Mock)模拟,提前了解和学习这些知识会对使用本项目有很大的帮助。
|
||||||
|
|
||||||
|
同时配套一个系列的教程文章,如何从零构建后一个完整的后台项目,建议大家先看完这些文章再来实践本项目
|
||||||
|
- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2)
|
||||||
|
- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac)
|
||||||
|
- [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35)
|
||||||
|
- [手摸手,带你用 vue 撸后台 系列四(vueAdmin 一个极简的后台基础模板)](https://juejin.im/post/595b4d776fb9a06bbe7dba56)
|
||||||
|
- [手摸手,带你封装一个 vue component](https://segmentfault.com/a/1190000009090836)
|
||||||
|
- [手摸手,带你优雅的使用 icon](https://juejin.im/post/59bb864b5188257e7a427c09)
|
||||||
|
|
||||||
|
响应需求,开了一个qq群 `591724180` 方便大家交流
|
||||||
|
|
||||||
|
或者加入该群主 **[圈子](https://jianshiapp.com/circles/1209)** 楼主会经常分享一些技术相关的东西
|
||||||
|
|
||||||
|
**如有问题请先看上述使用文档和文章,若不能满足,欢迎 issue 和 pr**
|
||||||
|
|
||||||
|
**本项目并不是一个脚手架,更倾向于是一个集成解决方案**
|
||||||
|
|
||||||
|
**该项目不支持低版本浏览器(如ie),有需求请自行添加polyfill [详情](https://github.com/PanJiaChen/vue-element-admin/wiki#babel-polyfill)**
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="900" src="https://wpimg.wallstcn.com/a5894c1b-f6af-456e-82df-1151da0839bf.png">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## 功能
|
||||||
|
```
|
||||||
|
- 登录/注销
|
||||||
|
- 权限验证
|
||||||
|
- 多环境发布
|
||||||
|
- 动态侧边栏(支持多级路由)
|
||||||
|
- 动态面包屑
|
||||||
|
- 国际化多语言
|
||||||
|
- 多种动态换肤
|
||||||
|
- 快捷导航(标签页)
|
||||||
|
- 富文本编辑器
|
||||||
|
- Markdown编辑器
|
||||||
|
- JSON编辑器
|
||||||
|
- Screenfull全屏
|
||||||
|
- 列表拖拽
|
||||||
|
- Svg Sprite 图标
|
||||||
|
- Dashboard
|
||||||
|
- 本地mock数据
|
||||||
|
- Echarts 图表
|
||||||
|
- Clipboard(剪贴复制)
|
||||||
|
- 401/404错误页面
|
||||||
|
- 错误日志
|
||||||
|
- 导出excel
|
||||||
|
- 导出zip
|
||||||
|
- 前端可视化excel
|
||||||
|
- Table example
|
||||||
|
- 动态table example
|
||||||
|
- 拖拽table example
|
||||||
|
- 内联编辑table example
|
||||||
|
- Form example
|
||||||
|
- 二步登录
|
||||||
|
- SplitPane
|
||||||
|
- Dropzone
|
||||||
|
- Sticky
|
||||||
|
- CountTo
|
||||||
|
- Markdown2html
|
||||||
|
```
|
||||||
|
|
||||||
|
## 开发
|
||||||
|
```bash
|
||||||
|
# 克隆项目
|
||||||
|
git clone https://github.com/PanJiaChen/vue-element-admin.git
|
||||||
|
|
||||||
|
# 安装依赖
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# 建议不要用cnpm安装 会有各种诡异的bug 可以通过如下操作解决 npm 下载速度慢的问题
|
||||||
|
npm install --registry=https://registry.npm.taobao.org
|
||||||
|
|
||||||
|
# 启动服务
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
浏览器访问 http://localhost:9527
|
||||||
|
|
||||||
|
## 发布
|
||||||
|
```bash
|
||||||
|
# 构建测试环境
|
||||||
|
npm run build:sit
|
||||||
|
|
||||||
|
# 构建生成环境
|
||||||
|
npm run build:prod
|
||||||
|
```
|
||||||
|
|
||||||
|
## 其它
|
||||||
|
```bash
|
||||||
|
# --report to build with bundle size analytics
|
||||||
|
npm run build:prod --report
|
||||||
|
|
||||||
|
# --preview to start a server in local to preview
|
||||||
|
npm run build:prod --preview
|
||||||
|
|
||||||
|
# lint code
|
||||||
|
npm run lint
|
||||||
|
|
||||||
|
# auto fix
|
||||||
|
npm run lint -- --fix
|
||||||
|
```
|
||||||
|
|
||||||
|
更多信息请参考 [使用文档](https://panjiachen.github.io/vue-element-admin-site/#/deploy)
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
Detailed changes for each release are documented in the [release notes](https://github.com/PanJiaChen/vue-element-admin/releases).
|
||||||
|
|
||||||
|
## Online Demo
|
||||||
|
[在线 Demo](http://panjiachen.github.io/vue-element-admin)
|
||||||
|
|
||||||
|
## Donate
|
||||||
|
如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :tropical_drink:
|
||||||
|

|
||||||
|
|
||||||
|
[Paypal Me](https://www.paypal.me/panfree23)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](https://github.com/PanJiaChen/vue-element-admin/blob/master/LICENSE)
|
||||||
|
|
||||||
|
Copyright (c) 2017-present PanJiaChen
|
@@ -1,39 +1,48 @@
|
|||||||
require('./check-versions')();
|
'use strict'
|
||||||
var server = require('pushstate-server');
|
require('./check-versions')()
|
||||||
var opn = require('opn')
|
|
||||||
var ora = require('ora')
|
|
||||||
var rm = require('rimraf')
|
|
||||||
var path = require('path')
|
|
||||||
var chalk = require('chalk')
|
|
||||||
var webpack = require('webpack');
|
|
||||||
var config = require('../config');
|
|
||||||
var webpackConfig = require('./webpack.prod.conf');
|
|
||||||
|
|
||||||
var spinner = ora('building for ' + process.env.NODE_ENV + ' of ' + process.env.env_config+ ' mode...' )
|
const ora = require('ora')
|
||||||
|
const rm = require('rimraf')
|
||||||
|
const path = require('path')
|
||||||
|
const chalk = require('chalk')
|
||||||
|
const webpack = require('webpack')
|
||||||
|
const config = require('../config')
|
||||||
|
const webpackConfig = require('./webpack.prod.conf')
|
||||||
|
const server = require('pushstate-server')
|
||||||
|
|
||||||
|
var spinner = ora('building for '+ process.env.env_config+ ' environment...' )
|
||||||
spinner.start()
|
spinner.start()
|
||||||
|
|
||||||
|
|
||||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
||||||
|
if (err) throw err
|
||||||
|
webpack(webpackConfig, (err, stats) => {
|
||||||
|
spinner.stop()
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
webpack(webpackConfig, function (err, stats) {
|
process.stdout.write(stats.toString({
|
||||||
spinner.stop()
|
colors: true,
|
||||||
if (err) throw err
|
modules: false,
|
||||||
process.stdout.write(stats.toString({
|
children: false,
|
||||||
colors: true,
|
chunks: false,
|
||||||
modules: false,
|
chunkModules: false
|
||||||
children: false,
|
}) + '\n\n')
|
||||||
chunks: false,
|
|
||||||
chunkModules: false
|
|
||||||
}) + '\n\n')
|
|
||||||
|
|
||||||
console.log(chalk.cyan(' Build complete.\n'))
|
if (stats.hasErrors()) {
|
||||||
if(process.env.npm_config_preview){
|
console.log(chalk.red(' Build failed with errors.\n'))
|
||||||
server.start({
|
process.exit(1)
|
||||||
port: 9528,
|
}
|
||||||
directory: './dist',
|
|
||||||
file: '/index.html'
|
console.log(chalk.cyan(' Build complete.\n'))
|
||||||
});
|
console.log(chalk.yellow(
|
||||||
console.log('> Listening at ' + 'http://localhost:9528' + '\n')
|
' Tip: built files are meant to be served over an HTTP server.\n' +
|
||||||
}
|
' Opening index.html over file:// won\'t work.\n'
|
||||||
})
|
))
|
||||||
|
if(process.env.npm_config_preview){
|
||||||
|
server.start({
|
||||||
|
port: 9526,
|
||||||
|
directory: './dist',
|
||||||
|
file: '/index.html'
|
||||||
|
});
|
||||||
|
console.log('> Listening at ' + 'http://localhost:9526' + '\n')
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@@ -1,45 +1,54 @@
|
|||||||
var chalk = require('chalk')
|
'use strict'
|
||||||
var semver = require('semver')
|
const chalk = require('chalk')
|
||||||
var packageConfig = require('../package.json')
|
const semver = require('semver')
|
||||||
|
const packageConfig = require('../package.json')
|
||||||
|
const shell = require('shelljs')
|
||||||
|
|
||||||
function exec(cmd) {
|
function exec (cmd) {
|
||||||
return require('child_process').execSync(cmd).toString().trim()
|
return require('child_process').execSync(cmd).toString().trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
var versionRequirements = [
|
const versionRequirements = [
|
||||||
{
|
{
|
||||||
name: 'node',
|
name: 'node',
|
||||||
currentVersion: semver.clean(process.version),
|
currentVersion: semver.clean(process.version),
|
||||||
versionRequirement: packageConfig.engines.node
|
versionRequirement: packageConfig.engines.node
|
||||||
},
|
}
|
||||||
{
|
|
||||||
name: 'npm',
|
|
||||||
currentVersion: exec('npm --version'),
|
|
||||||
versionRequirement: packageConfig.engines.npm
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if (shell.which('npm')) {
|
||||||
|
versionRequirements.push({
|
||||||
|
name: 'npm',
|
||||||
|
currentVersion: exec('npm --version'),
|
||||||
|
versionRequirement: packageConfig.engines.npm
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
var warnings = []
|
const warnings = []
|
||||||
for (var i = 0; i < versionRequirements.length; i++) {
|
|
||||||
var mod = versionRequirements[i]
|
for (let i = 0; i < versionRequirements.length; i++) {
|
||||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
const mod = versionRequirements[i]
|
||||||
warnings.push(mod.name + ': ' +
|
|
||||||
chalk.red(mod.currentVersion) + ' should be ' +
|
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
||||||
chalk.green(mod.versionRequirement)
|
warnings.push(mod.name + ': ' +
|
||||||
)
|
chalk.red(mod.currentVersion) + ' should be ' +
|
||||||
}
|
chalk.green(mod.versionRequirement)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warnings.length) {
|
||||||
|
console.log('')
|
||||||
|
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
||||||
|
console.log()
|
||||||
|
|
||||||
|
for (let i = 0; i < warnings.length; i++) {
|
||||||
|
const warning = warnings[i]
|
||||||
|
console.log(' ' + warning)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (warnings.length) {
|
console.log()
|
||||||
console.log('')
|
process.exit(1)
|
||||||
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
}
|
||||||
console.log()
|
|
||||||
for (var i = 0; i < warnings.length; i++) {
|
|
||||||
var warning = warnings[i]
|
|
||||||
console.log(' ' + warning)
|
|
||||||
}
|
|
||||||
console.log()
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
require('eventsource-polyfill')
|
|
||||||
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
|
|
||||||
|
|
||||||
hotClient.subscribe(function (event) {
|
|
||||||
if (event.action === 'reload') {
|
|
||||||
window.location.reload()
|
|
||||||
}
|
|
||||||
})
|
|
@@ -1,93 +0,0 @@
|
|||||||
require('./check-versions')(); // 检查 Node 和 npm 版本
|
|
||||||
|
|
||||||
var config = require('../config');
|
|
||||||
if (!process.env.NODE_ENV) {
|
|
||||||
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
|
|
||||||
}
|
|
||||||
|
|
||||||
var opn = require('opn')
|
|
||||||
var path = require('path');
|
|
||||||
var express = require('express');
|
|
||||||
var webpack = require('webpack');
|
|
||||||
var proxyMiddleware = require('http-proxy-middleware');
|
|
||||||
var webpackConfig = require('./webpack.dev.conf');
|
|
||||||
|
|
||||||
// default port where dev server listens for incoming traffic
|
|
||||||
var port = process.env.PORT || config.dev.port;
|
|
||||||
// automatically open browser, if not set will be false
|
|
||||||
var autoOpenBrowser = !!config.dev.autoOpenBrowser;
|
|
||||||
// Define HTTP proxies to your custom API backend
|
|
||||||
// https://github.com/chimurai/http-proxy-middleware
|
|
||||||
var proxyTable = config.dev.proxyTable;
|
|
||||||
|
|
||||||
var app = express();
|
|
||||||
var compiler = webpack(webpackConfig);
|
|
||||||
|
|
||||||
var devMiddleware = require('webpack-dev-middleware')(compiler, {
|
|
||||||
publicPath: webpackConfig.output.publicPath,
|
|
||||||
quiet: true
|
|
||||||
});
|
|
||||||
|
|
||||||
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
|
|
||||||
log: false,
|
|
||||||
heartbeat: 2000
|
|
||||||
});
|
|
||||||
|
|
||||||
// force page reload when html-webpack-plugin template changes
|
|
||||||
// currently disabled until this is resolved:
|
|
||||||
// https://github.com/jantimon/html-webpack-plugin/issues/680
|
|
||||||
// compiler.plugin('compilation', function (compilation) {
|
|
||||||
// compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
|
|
||||||
// hotMiddleware.publish({ action: 'reload' })
|
|
||||||
// cb()
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
// proxy api requests
|
|
||||||
Object.keys(proxyTable).forEach(function (context) {
|
|
||||||
var options = proxyTable[context]
|
|
||||||
if (typeof options === 'string') {
|
|
||||||
options = {target: options}
|
|
||||||
}
|
|
||||||
app.use(proxyMiddleware(options.filter || context, options))
|
|
||||||
});
|
|
||||||
|
|
||||||
// handle fallback for HTML5 history API
|
|
||||||
app.use(require('connect-history-api-fallback')());
|
|
||||||
|
|
||||||
// serve webpack bundle output
|
|
||||||
app.use(devMiddleware);
|
|
||||||
|
|
||||||
// enable hot-reload and state-preserving
|
|
||||||
// compilation error display
|
|
||||||
app.use(hotMiddleware);
|
|
||||||
|
|
||||||
// serve pure static assets
|
|
||||||
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory);
|
|
||||||
app.use(staticPath, express.static('./static'));
|
|
||||||
|
|
||||||
var uri = 'http://localhost:' + port
|
|
||||||
|
|
||||||
var _resolve
|
|
||||||
var readyPromise = new Promise(resolve => {
|
|
||||||
_resolve = resolve
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log('> Starting dev server...')
|
|
||||||
devMiddleware.waitUntilValid(() => {
|
|
||||||
console.log('> Listening at ' + uri + '\n')
|
|
||||||
// when env is testing, don't need open it
|
|
||||||
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
|
|
||||||
opn(uri)
|
|
||||||
}
|
|
||||||
_resolve()
|
|
||||||
})
|
|
||||||
|
|
||||||
var server = app.listen(port)
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
ready: readyPromise,
|
|
||||||
close: () => {
|
|
||||||
server.close()
|
|
||||||
}
|
|
||||||
}
|
|
BIN
build/logo.png
Normal file
BIN
build/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
@@ -1,35 +1,38 @@
|
|||||||
var path = require('path')
|
'use strict'
|
||||||
var config = require('../config')
|
const path = require('path')
|
||||||
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
const config = require('../config')
|
||||||
|
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
|
const packageConfig = require('../package.json')
|
||||||
|
|
||||||
exports.assetsPath = function (_path) {
|
exports.assetsPath = function (_path) {
|
||||||
var assetsSubDirectory = process.env.NODE_ENV === 'production'
|
const assetsSubDirectory = process.env.NODE_ENV === 'production'
|
||||||
? config.build.assetsSubDirectory
|
? config.build.assetsSubDirectory
|
||||||
: config.dev.assetsSubDirectory
|
: config.dev.assetsSubDirectory
|
||||||
|
|
||||||
return path.posix.join(assetsSubDirectory, _path)
|
return path.posix.join(assetsSubDirectory, _path)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.cssLoaders = function (options) {
|
exports.cssLoaders = function (options) {
|
||||||
options = options || {}
|
options = options || {}
|
||||||
|
|
||||||
var cssLoader = {
|
const cssLoader = {
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
options: {
|
options: {
|
||||||
minimize: process.env.NODE_ENV === 'production',
|
|
||||||
sourceMap: options.sourceMap
|
sourceMap: options.sourceMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var postcssLoader = {
|
const postcssLoader = {
|
||||||
loader: 'postcss-loader',
|
loader: 'postcss-loader',
|
||||||
options: {
|
options: {
|
||||||
sourceMap: true
|
sourceMap: options.sourceMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate loader string to be used with extract text plugin
|
// generate loader string to be used with extract text plugin
|
||||||
function generateLoaders (loader, loaderOptions) {
|
function generateLoaders (loader, loaderOptions) {
|
||||||
var loaders = options.usePostCSS !== false ? [cssLoader, postcssLoader] : [cssLoader]
|
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
|
||||||
|
|
||||||
if (loader) {
|
if (loader) {
|
||||||
loaders.push({
|
loaders.push({
|
||||||
loader: loader + '-loader',
|
loader: loader + '-loader',
|
||||||
@@ -65,14 +68,34 @@ exports.cssLoaders = function (options) {
|
|||||||
|
|
||||||
// Generate loaders for standalone style files (outside of .vue)
|
// Generate loaders for standalone style files (outside of .vue)
|
||||||
exports.styleLoaders = function (options) {
|
exports.styleLoaders = function (options) {
|
||||||
var output = []
|
const output = []
|
||||||
var loaders = exports.cssLoaders(options)
|
const loaders = exports.cssLoaders(options)
|
||||||
for (var extension in loaders) {
|
|
||||||
var loader = loaders[extension]
|
for (const extension in loaders) {
|
||||||
|
const loader = loaders[extension]
|
||||||
output.push({
|
output.push({
|
||||||
test: new RegExp('\\.' + extension + '$'),
|
test: new RegExp('\\.' + extension + '$'),
|
||||||
use: loader
|
use: loader
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.createNotifierCallback = () => {
|
||||||
|
const notifier = require('node-notifier')
|
||||||
|
|
||||||
|
return (severity, errors) => {
|
||||||
|
if (severity !== 'error') return
|
||||||
|
|
||||||
|
const error = errors[0]
|
||||||
|
const filename = error.file && error.file.split('!').pop()
|
||||||
|
|
||||||
|
notifier.notify({
|
||||||
|
title: packageConfig.name,
|
||||||
|
message: severity + ': ' + error.name,
|
||||||
|
subtitle: filename || '',
|
||||||
|
icon: path.join(__dirname, 'logo.png')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,12 +1,22 @@
|
|||||||
var utils = require('./utils')
|
'use strict'
|
||||||
var config = require('../config')
|
const utils = require('./utils')
|
||||||
var isProduction = process.env.NODE_ENV === 'production'
|
const config = require('../config')
|
||||||
|
const isProduction = process.env.NODE_ENV === 'production'
|
||||||
|
const sourceMapEnabled = isProduction
|
||||||
|
? config.build.productionSourceMap
|
||||||
|
: config.dev.cssSourceMap
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
loaders: utils.cssLoaders({
|
loaders: utils.cssLoaders({
|
||||||
sourceMap: isProduction
|
sourceMap: sourceMapEnabled,
|
||||||
? config.build.productionSourceMap
|
extract: isProduction
|
||||||
: config.dev.cssSourceMap,
|
}),
|
||||||
extract: isProduction
|
cssSourceMap: sourceMapEnabled,
|
||||||
})
|
cacheBusting: config.dev.cacheBusting,
|
||||||
|
transformToRequire: {
|
||||||
|
video: ['src', 'poster'],
|
||||||
|
source: 'src',
|
||||||
|
img: 'src',
|
||||||
|
image: 'xlink:href'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,51 +1,46 @@
|
|||||||
var path = require('path')
|
'use strict'
|
||||||
var utils = require('./utils')
|
const path = require('path')
|
||||||
var config = require('../config')
|
const utils = require('./utils')
|
||||||
var vueLoaderConfig = require('./vue-loader.conf')
|
const config = require('../config')
|
||||||
|
const vueLoaderConfig = require('./vue-loader.conf')
|
||||||
|
|
||||||
function resolve(dir) {
|
function resolve (dir) {
|
||||||
return path.join(__dirname, '..', dir)
|
return path.join(__dirname, '..', dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const createLintingRule = () => ({
|
||||||
|
test: /\.(js|vue)$/,
|
||||||
|
loader: 'eslint-loader',
|
||||||
|
enforce: 'pre',
|
||||||
|
include: [resolve('src'), resolve('test')],
|
||||||
|
options: {
|
||||||
|
formatter: require('eslint-friendly-formatter'),
|
||||||
|
emitWarning: !config.dev.showEslintErrorsInOverlay
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
context: path.resolve(__dirname, '../'),
|
||||||
entry: {
|
entry: {
|
||||||
app: './src/main.js'
|
app: './src/main.js'
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: config.build.assetsRoot,
|
path: config.build.assetsRoot,
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath
|
publicPath: process.env.NODE_ENV === 'production'
|
||||||
|
? config.build.assetsPublicPath
|
||||||
|
: config.dev.assetsPublicPath
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.vue', '.json'],
|
extensions: ['.js', '.vue', '.json'],
|
||||||
alias: {
|
alias: {
|
||||||
'vue$': 'vue/dist/vue.esm.js',
|
'vue$': 'vue/dist/vue.esm.js',
|
||||||
'@': resolve('src'),
|
'@': resolve('src'),
|
||||||
'src': path.resolve(__dirname, '../src'),
|
|
||||||
'assets': path.resolve(__dirname, '../src/assets'),
|
|
||||||
'components': path.resolve(__dirname, '../src/components'),
|
|
||||||
'views': path.resolve(__dirname, '../src/views'),
|
|
||||||
'styles': path.resolve(__dirname, '../src/styles'),
|
|
||||||
'api': path.resolve(__dirname, '../src/api'),
|
|
||||||
'utils': path.resolve(__dirname, '../src/utils'),
|
|
||||||
'store': path.resolve(__dirname, '../src/store'),
|
|
||||||
'router': path.resolve(__dirname, '../src/router'),
|
|
||||||
'mock': path.resolve(__dirname, '../src/mock'),
|
|
||||||
'vendor': path.resolve(__dirname, '../src/vendor'),
|
|
||||||
'static': path.resolve(__dirname, '../static')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
...(config.dev.useEslint ? [createLintingRule()] : []),
|
||||||
test: /\.(js|vue)$/,
|
|
||||||
loader: 'eslint-loader',
|
|
||||||
enforce: "pre",
|
|
||||||
include: [resolve('src'), resolve('test')],
|
|
||||||
options: {
|
|
||||||
formatter: require('eslint-friendly-formatter')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
test: /\.vue$/,
|
test: /\.vue$/,
|
||||||
loader: 'vue-loader',
|
loader: 'vue-loader',
|
||||||
@@ -54,7 +49,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
loader: 'babel-loader?cacheDirectory',
|
loader: 'babel-loader?cacheDirectory',
|
||||||
include: [resolve('src'), resolve('test')]
|
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.svg$/,
|
test: /\.svg$/,
|
||||||
@@ -73,6 +68,14 @@ module.exports = {
|
|||||||
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||||
loader: 'url-loader',
|
loader: 'url-loader',
|
||||||
@@ -83,10 +86,16 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
//注入全局mixin
|
node: {
|
||||||
// sassResources: path.join(__dirname, '../src/styles/mixin.scss'),
|
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
||||||
// sassLoader: {
|
// source contains it (although only uses it if it's native).
|
||||||
// data: path.join(__dirname, '../src/styles/index.scss')
|
setImmediate: false,
|
||||||
// },
|
// prevent webpack from injecting mocks to Node native modules
|
||||||
|
// that does not make sense for the client
|
||||||
|
dgram: 'empty',
|
||||||
|
fs: 'empty',
|
||||||
|
net: 'empty',
|
||||||
|
tls: 'empty',
|
||||||
|
child_process: 'empty'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,44 +1,88 @@
|
|||||||
var utils = require('./utils')
|
'use strict'
|
||||||
var path = require('path')
|
const path = require('path')
|
||||||
var webpack = require('webpack')
|
const utils = require('./utils')
|
||||||
var config = require('../config')
|
const webpack = require('webpack')
|
||||||
var merge = require('webpack-merge')
|
const config = require('../config')
|
||||||
var baseWebpackConfig = require('./webpack.base.conf')
|
const merge = require('webpack-merge')
|
||||||
var HtmlWebpackPlugin = require('html-webpack-plugin')
|
const baseWebpackConfig = require('./webpack.base.conf')
|
||||||
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
|
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
||||||
|
const portfinder = require('portfinder')
|
||||||
|
|
||||||
// add hot-reload related code to entry chunks
|
function resolve (dir) {
|
||||||
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
|
return path.join(__dirname, '..', dir)
|
||||||
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
|
|
||||||
})
|
|
||||||
|
|
||||||
function resolveApp(relativePath) {
|
|
||||||
return path.resolve(relativePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = merge(baseWebpackConfig, {
|
const HOST = process.env.HOST
|
||||||
|
const PORT = process.env.PORT && Number(process.env.PORT)
|
||||||
|
|
||||||
|
const devWebpackConfig = merge(baseWebpackConfig, {
|
||||||
module: {
|
module: {
|
||||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
|
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
|
||||||
},
|
},
|
||||||
// cheap-source-map is faster for development
|
// cheap-module-eval-source-map is faster for development
|
||||||
devtool: '#cheap-source-map',
|
devtool: config.dev.devtool,
|
||||||
cache: true,
|
|
||||||
|
// these devServer options should be customized in /config/index.js
|
||||||
|
devServer: {
|
||||||
|
clientLogLevel: 'warning',
|
||||||
|
historyApiFallback: true,
|
||||||
|
hot: true,
|
||||||
|
compress: true,
|
||||||
|
host: HOST || config.dev.host,
|
||||||
|
port: PORT || config.dev.port,
|
||||||
|
open: config.dev.autoOpenBrowser,
|
||||||
|
overlay: config.dev.errorOverlay
|
||||||
|
? { warnings: false, errors: true }
|
||||||
|
: false,
|
||||||
|
publicPath: config.dev.assetsPublicPath,
|
||||||
|
proxy: config.dev.proxyTable,
|
||||||
|
quiet: true, // necessary for FriendlyErrorsPlugin
|
||||||
|
watchOptions: {
|
||||||
|
poll: config.dev.poll,
|
||||||
|
}
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': config.dev.env
|
'process.env': require('../config/dev.env')
|
||||||
}),
|
}),
|
||||||
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
|
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
|
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
// https://github.com/ampedandwired/html-webpack-plugin
|
// https://github.com/ampedandwired/html-webpack-plugin
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
template: 'index.html',
|
template: 'index.html',
|
||||||
favicon: resolveApp('favicon.ico'),
|
|
||||||
inject: true,
|
inject: true,
|
||||||
|
favicon: resolve('favicon.ico'),
|
||||||
|
title: 'vue-element-admin',
|
||||||
path: config.dev.assetsPublicPath + config.dev.assetsSubDirectory
|
path: config.dev.assetsPublicPath + config.dev.assetsSubDirectory
|
||||||
}),
|
}),
|
||||||
new FriendlyErrorsPlugin()
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
module.exports = new Promise((resolve, reject) => {
|
||||||
|
portfinder.basePort = process.env.PORT || config.dev.port
|
||||||
|
portfinder.getPort((err, port) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err)
|
||||||
|
} else {
|
||||||
|
// publish the new Port, necessary for e2e tests
|
||||||
|
process.env.PORT = port
|
||||||
|
// add port to devServer config
|
||||||
|
devWebpackConfig.devServer.port = port
|
||||||
|
|
||||||
|
// Add FriendlyErrorsPlugin
|
||||||
|
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
||||||
|
compilationSuccessInfo: {
|
||||||
|
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
|
||||||
|
},
|
||||||
|
onErrors: config.dev.notifyOnErrors
|
||||||
|
? utils.createNotifierCallback()
|
||||||
|
: undefined
|
||||||
|
}))
|
||||||
|
|
||||||
|
resolve(devWebpackConfig)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
@@ -1,21 +1,23 @@
|
|||||||
var path = require('path')
|
'use strict'
|
||||||
var utils = require('./utils')
|
const path = require('path')
|
||||||
var webpack = require('webpack')
|
const utils = require('./utils')
|
||||||
var config = require('../config')
|
const webpack = require('webpack')
|
||||||
var merge = require('webpack-merge')
|
const config = require('../config')
|
||||||
var baseWebpackConfig = require('./webpack.base.conf')
|
const merge = require('webpack-merge')
|
||||||
var CopyWebpackPlugin = require('copy-webpack-plugin')
|
const baseWebpackConfig = require('./webpack.base.conf')
|
||||||
var HtmlWebpackPlugin = require('html-webpack-plugin')
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
|
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||||
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||||
|
|
||||||
var env = config.build[process.env.env_config+'Env']
|
function resolve (dir) {
|
||||||
|
return path.join(__dirname, '..', dir)
|
||||||
function resolveApp(relativePath) {
|
|
||||||
return path.resolve(relativePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var webpackConfig = merge(baseWebpackConfig, {
|
const env = require('../config/'+process.env.env_config+'.env')
|
||||||
|
|
||||||
|
const webpackConfig = merge(baseWebpackConfig, {
|
||||||
module: {
|
module: {
|
||||||
rules: utils.styleLoaders({
|
rules: utils.styleLoaders({
|
||||||
sourceMap: config.build.productionSourceMap,
|
sourceMap: config.build.productionSourceMap,
|
||||||
@@ -23,64 +25,69 @@ var webpackConfig = merge(baseWebpackConfig, {
|
|||||||
usePostCSS: true
|
usePostCSS: true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
devtool: config.build.productionSourceMap ? '#source-map' : false,
|
devtool: config.build.productionSourceMap ? config.build.devtool : false,
|
||||||
output: {
|
output: {
|
||||||
path: config.build.assetsRoot,
|
path: config.build.assetsRoot,
|
||||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
||||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js'),
|
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
||||||
publicPath: config.build.assetsPublicPath
|
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': env
|
'process.env': env
|
||||||
}),
|
}),
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new UglifyJsPlugin({
|
||||||
compress: {
|
uglifyOptions: {
|
||||||
warnings: false
|
compress: {
|
||||||
|
warnings: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sourceMap: true,
|
sourceMap: config.build.productionSourceMap,
|
||||||
parallel: true
|
parallel: true
|
||||||
}),
|
}),
|
||||||
// extract css into its own file
|
// extract css into its own file
|
||||||
new ExtractTextPlugin({
|
new ExtractTextPlugin({
|
||||||
filename: utils.assetsPath('css/[name].[contenthash].css')
|
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
||||||
|
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
||||||
|
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||||
|
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||||
|
allChunks: false,
|
||||||
}),
|
}),
|
||||||
// Compress extracted CSS. We are using this plugin so that possible
|
// Compress extracted CSS. We are using this plugin so that possible
|
||||||
// duplicated CSS from different components can be deduped.
|
// duplicated CSS from different components can be deduped.
|
||||||
new OptimizeCSSPlugin(),
|
new OptimizeCSSPlugin({
|
||||||
|
cssProcessorOptions: config.build.productionSourceMap
|
||||||
|
? { safe: true, map: { inline: false } }
|
||||||
|
: { safe: true }
|
||||||
|
}),
|
||||||
// generate dist index.html with correct asset hash for caching.
|
// generate dist index.html with correct asset hash for caching.
|
||||||
// you can customize output by editing /index.html
|
// you can customize output by editing /index.html
|
||||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
// see https://github.com/ampedandwired/html-webpack-plugin
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
filename: 'index.html',
|
filename: config.build.index,
|
||||||
template: 'index.html',
|
template: 'index.html',
|
||||||
inject: true,
|
inject: true,
|
||||||
favicon: resolveApp('favicon.ico'),
|
favicon: resolve('favicon.ico'),
|
||||||
|
title: 'vue-element-admin',
|
||||||
|
path: config.build.assetsPublicPath + config.build.assetsSubDirectory,
|
||||||
minify: {
|
minify: {
|
||||||
removeComments: true,
|
removeComments: true,
|
||||||
collapseWhitespace: true,
|
collapseWhitespace: true,
|
||||||
removeRedundantAttributes: true,
|
removeAttributeQuotes: true
|
||||||
useShortDoctype: true,
|
// more options:
|
||||||
removeEmptyAttributes: true,
|
// https://github.com/kangax/html-minifier#options-quick-reference
|
||||||
removeStyleLinkTypeAttributes: true,
|
|
||||||
keepClosingSlash: true,
|
|
||||||
minifyJS: true,
|
|
||||||
minifyCSS: true,
|
|
||||||
minifyURLs: true
|
|
||||||
},
|
},
|
||||||
path: config.build.assetsPublicPath + config.build.assetsSubDirectory,
|
|
||||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
||||||
chunksSortMode: 'dependency'
|
chunksSortMode: 'dependency'
|
||||||
}),
|
}),
|
||||||
// cache Module Identifiers
|
// keep module.id stable when vender modules does not change
|
||||||
new webpack.HashedModuleIdsPlugin(),
|
new webpack.HashedModuleIdsPlugin(),
|
||||||
// enable scope hoisting
|
// enable scope hoisting
|
||||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||||
// split vendor js into its own file
|
// split vendor js into its own file
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
name: 'vendor',
|
name: 'vendor',
|
||||||
minChunks: function (module) {
|
minChunks (module) {
|
||||||
// any required modules inside node_modules are extracted to vendor
|
// any required modules inside node_modules are extracted to vendor
|
||||||
return (
|
return (
|
||||||
module.resource &&
|
module.resource &&
|
||||||
@@ -97,6 +104,15 @@ var webpackConfig = merge(baseWebpackConfig, {
|
|||||||
name: 'manifest',
|
name: 'manifest',
|
||||||
minChunks: Infinity
|
minChunks: Infinity
|
||||||
}),
|
}),
|
||||||
|
// This instance extracts shared chunks from code splitted chunks and bundles them
|
||||||
|
// in a separate chunk, similar to the vendor chunk
|
||||||
|
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
||||||
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
|
name: 'app',
|
||||||
|
async: 'vendor-async',
|
||||||
|
children: true,
|
||||||
|
minChunks: 3
|
||||||
|
}),
|
||||||
// split echarts into its own file
|
// split echarts into its own file
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
async: 'echarts',
|
async: 'echarts',
|
||||||
@@ -113,29 +129,47 @@ var webpackConfig = merge(baseWebpackConfig, {
|
|||||||
return context && (context.indexOf('xlsx') >= 0);
|
return context && (context.indexOf('xlsx') >= 0);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
// split codemirror into its own file
|
||||||
// in a separate chunk, similar to the vendor chunk
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
async: 'codemirror',
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
minChunks(module) {
|
||||||
name: 'app',
|
var context = module.context;
|
||||||
async: 'vendor-async',
|
return context && (context.indexOf('codemirror') >= 0);
|
||||||
children: true,
|
}
|
||||||
minChunks: 3
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// copy custom static assets
|
// copy custom static assets
|
||||||
new CopyWebpackPlugin([{
|
new CopyWebpackPlugin([
|
||||||
from: path.resolve(__dirname, '../static'),
|
{
|
||||||
to: config.build.assetsSubDirectory,
|
from: path.resolve(__dirname, '../static'),
|
||||||
ignore: ['.*']
|
to: config.build.assetsSubDirectory,
|
||||||
}])
|
ignore: ['.*']
|
||||||
|
}
|
||||||
|
])
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (config.build.productionGzip) {
|
||||||
|
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||||
|
|
||||||
|
webpackConfig.plugins.push(
|
||||||
|
new CompressionWebpackPlugin({
|
||||||
|
asset: '[path].gz[query]',
|
||||||
|
algorithm: 'gzip',
|
||||||
|
test: new RegExp(
|
||||||
|
'\\.(' +
|
||||||
|
config.build.productionGzipExtensions.join('|') +
|
||||||
|
')$'
|
||||||
|
),
|
||||||
|
threshold: 10240,
|
||||||
|
minRatio: 0.8
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (config.build.bundleAnalyzerReport) {
|
if (config.build.bundleAnalyzerReport) {
|
||||||
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = webpackConfig
|
module.exports = webpackConfig
|
||||||
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
NODE_ENV: '"development"',
|
NODE_ENV: '"development"',
|
||||||
ENV_CONFIG: '"dev"',
|
ENV_CONFIG: '"dev"',
|
||||||
BASE_API: '"https://api-dev"',
|
BASE_API: '"https://api-dev"'
|
||||||
APP_ORIGIN: '"https://wallstreetcn.com"'
|
|
||||||
}
|
}
|
||||||
|
114
config/index.js
114
config/index.js
@@ -1,39 +1,83 @@
|
|||||||
|
'use strict'
|
||||||
|
// Template version: 1.2.6
|
||||||
// see http://vuejs-templates.github.io/webpack for documentation.
|
// see http://vuejs-templates.github.io/webpack for documentation.
|
||||||
var path = require('path')
|
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
build: {
|
dev: {
|
||||||
sitEnv: require('./sit.env'),
|
|
||||||
prodEnv: require('./prod.env'),
|
// Paths
|
||||||
index: path.resolve(__dirname, '../dist/index.html'),
|
assetsSubDirectory: 'static',
|
||||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
assetsPublicPath: '/',
|
||||||
assetsSubDirectory: 'static',
|
proxyTable: {},
|
||||||
assetsPublicPath: './', //请根据自己路径配置更改
|
|
||||||
productionSourceMap: false,
|
// Various Dev Server settings
|
||||||
// Gzip off by default as many popular static hosts such as
|
host: 'localhost', // can be overwritten by process.env.HOST
|
||||||
// Surge or Netlify already gzip all static assets for you.
|
port: 9527, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||||
// Before setting to `true`, make sure to:
|
autoOpenBrowser: true,
|
||||||
// npm install --save-dev compression-webpack-plugin
|
errorOverlay: true,
|
||||||
productionGzip: false,
|
notifyOnErrors: false,
|
||||||
productionGzipExtensions: ['js', 'css'],
|
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||||
// Run the build command with an extra argument to
|
|
||||||
// View the bundle analyzer report after build finishes:
|
// Use Eslint Loader?
|
||||||
// `npm run build --report`
|
// If true, your code will be linted during bundling and
|
||||||
// Set to `true` or `false` to always turn it on or off
|
// linting errors and warnings will be shown in the console.
|
||||||
bundleAnalyzerReport: process.env.npm_config_report
|
useEslint: true,
|
||||||
},
|
// If true, eslint errors and warnings will also be shown in the error overlay
|
||||||
dev: {
|
// in the browser.
|
||||||
env: require('./dev.env'),
|
showEslintErrorsInOverlay: false,
|
||||||
port: 9527,
|
|
||||||
autoOpenBrowser: true,
|
/**
|
||||||
assetsSubDirectory: 'static',
|
* Source Maps
|
||||||
assetsPublicPath: '/',
|
*/
|
||||||
proxyTable: {},
|
|
||||||
// CSS Sourcemaps off by default because relative paths are "buggy"
|
// https://webpack.js.org/configuration/devtool/#development
|
||||||
// with this option, according to the CSS-Loader README
|
devtool: 'eval-source-map',
|
||||||
// (https://github.com/webpack/css-loader#sourcemaps)
|
|
||||||
// In our experience, they generally work as expected,
|
// If you have problems debugging vue-files in devtools,
|
||||||
// just be aware of this issue when enabling this option.
|
// set this to false - it *may* help
|
||||||
cssSourceMap: false
|
// https://vue-loader.vuejs.org/en/options.html#cachebusting
|
||||||
}
|
cacheBusting: true,
|
||||||
|
|
||||||
|
// CSS Sourcemaps off by default because relative paths are "buggy"
|
||||||
|
// with this option, according to the CSS-Loader README
|
||||||
|
// (https://github.com/webpack/css-loader#sourcemaps)
|
||||||
|
// In our experience, they generally work as expected,
|
||||||
|
// just be aware of this issue when enabling this option.
|
||||||
|
cssSourceMap: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
build: {
|
||||||
|
// Template for index.html
|
||||||
|
index: path.resolve(__dirname, '../dist/index.html'),
|
||||||
|
|
||||||
|
// Paths
|
||||||
|
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||||
|
assetsSubDirectory: 'static',
|
||||||
|
|
||||||
|
// you can set by youself according to actual condition
|
||||||
|
assetsPublicPath: './',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Source Maps
|
||||||
|
*/
|
||||||
|
|
||||||
|
productionSourceMap: false,
|
||||||
|
// https://webpack.js.org/configuration/devtool/#production
|
||||||
|
devtool: '#source-map',
|
||||||
|
|
||||||
|
// Gzip off by default as many popular static hosts such as
|
||||||
|
// Surge or Netlify already gzip all static assets for you.
|
||||||
|
// Before setting to `true`, make sure to:
|
||||||
|
// npm install --save-dev compression-webpack-plugin
|
||||||
|
productionGzip: false,
|
||||||
|
productionGzipExtensions: ['js', 'css'],
|
||||||
|
|
||||||
|
// Run the build command with an extra argument to
|
||||||
|
// View the bundle analyzer report after build finishes:
|
||||||
|
// `npm run build --report`
|
||||||
|
// Set to `true` or `false` to always turn it on or off
|
||||||
|
bundleAnalyzerReport: process.env.npm_config_report
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
NODE_ENV: '"production"',
|
NODE_ENV: '"production"',
|
||||||
ENV_CONFIG: '"prod"',
|
ENV_CONFIG: '"prod"',
|
||||||
BASE_API: '"https://api-prod"',
|
BASE_API: '"https://api-prod"'
|
||||||
APP_ORIGIN: '"https://wallstreetcn.com"'
|
}
|
||||||
};
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
NODE_ENV: '"production"',
|
NODE_ENV: '"production"',
|
||||||
ENV_CONFIG: '"sit"',
|
ENV_CONFIG: '"sit"',
|
||||||
BASE_API: '"https://api-sit"',
|
BASE_API: '"https://api-sit"'
|
||||||
APP_ORIGIN: '"https://wallstreetcn.com"'
|
}
|
||||||
};
|
|
||||||
|
88
package.json
88
package.json
@@ -1,95 +1,93 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-element-admin",
|
"name": "vue-element-admin",
|
||||||
"version": "3.0.0",
|
"version": "3.5.1",
|
||||||
"description": "A Vue.js admin",
|
"description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features",
|
||||||
"author": "Pan <panfree23@gmail.com>",
|
"author": "Pan <panfree23@gmail.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node build/dev-server.js",
|
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
|
||||||
"build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js",
|
"build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js",
|
||||||
"build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js",
|
"build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js",
|
||||||
"build:sit-preview": "cross-env NODE_ENV=production env_config=sit npm_config_preview=true npm_config_report=true node build/build.js",
|
"lint": "eslint --ext .js,.vue src",
|
||||||
"lint": "eslint --ext .js,.vue src"
|
"test": "npm run lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "0.17.1",
|
"axios": "0.17.1",
|
||||||
"clipboard": "1.7.1",
|
"clipboard": "1.7.1",
|
||||||
"codemirror": "5.31.0",
|
"codemirror": "5.32.0",
|
||||||
"dropzone": "5.2.0",
|
"dropzone": "5.2.0",
|
||||||
"echarts": "3.8.5",
|
"echarts": "3.8.5",
|
||||||
"element-ui": "2.0.7",
|
"element-ui": "2.0.8",
|
||||||
"file-saver": "1.3.3",
|
"file-saver": "1.3.3",
|
||||||
"font-awesome": "4.7.0",
|
"font-awesome": "4.7.0",
|
||||||
"js-cookie": "2.2.0",
|
"js-cookie": "2.2.0",
|
||||||
"jsonlint": "1.6.2",
|
"jsonlint": "1.6.2",
|
||||||
"jszip": "3.1.4",
|
"jszip": "3.1.5",
|
||||||
"mockjs": "1.0.1-beta3",
|
"mockjs": "1.0.1-beta3",
|
||||||
"normalize.css": "7.0.0",
|
"normalize.css": "7.0.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"screenfull": "3.3.2",
|
"screenfull": "3.3.2",
|
||||||
"showdown": "1.8.2",
|
"showdown": "1.8.5",
|
||||||
"simplemde": "1.11.2",
|
"simplemde": "1.11.2",
|
||||||
"sortablejs": "1.6.1",
|
"sortablejs": "1.7.0",
|
||||||
"vue": "2.5.9",
|
"vue": "2.5.10",
|
||||||
"vue-count-to": "1.0.10",
|
"vue-count-to": "1.0.13",
|
||||||
"vue-i18n": "7.3.2",
|
"vue-i18n": "7.3.2",
|
||||||
"vue-multiselect": "2.0.6",
|
"vue-multiselect": "2.0.8",
|
||||||
"vue-router": "3.0.1",
|
"vue-router": "3.0.1",
|
||||||
"vue-splitpane": "1.0.0",
|
"vue-splitpane": "1.0.2",
|
||||||
"vuedraggable": "2.15.0",
|
"vuedraggable": "2.15.0",
|
||||||
"vuex": "3.0.1",
|
"vuex": "3.0.1",
|
||||||
"xlsx": "^0.11.7"
|
"xlsx": "^0.11.16"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "7.1.6",
|
"autoprefixer": "7.2.3",
|
||||||
"babel-core": "6.26.0",
|
"babel-core": "6.26.0",
|
||||||
"babel-eslint": "8.0.2",
|
"babel-eslint": "8.0.3",
|
||||||
|
"babel-helper-vue-jsx-merge-props": "2.0.3",
|
||||||
"babel-loader": "7.1.2",
|
"babel-loader": "7.1.2",
|
||||||
|
"babel-plugin-syntax-jsx": "6.18.0",
|
||||||
"babel-plugin-transform-runtime": "6.23.0",
|
"babel-plugin-transform-runtime": "6.23.0",
|
||||||
|
"babel-plugin-transform-vue-jsx": "3.5.0",
|
||||||
"babel-preset-env": "1.6.1",
|
"babel-preset-env": "1.6.1",
|
||||||
"babel-preset-stage-2": "6.24.1",
|
"babel-preset-stage-2": "6.24.1",
|
||||||
"babel-register": "6.26.0",
|
|
||||||
"chalk": "2.3.0",
|
"chalk": "2.3.0",
|
||||||
"connect-history-api-fallback": "1.4.0",
|
"copy-webpack-plugin": "4.3.0",
|
||||||
"copy-webpack-plugin": "4.2.0",
|
|
||||||
"cross-env": "5.1.1",
|
"cross-env": "5.1.1",
|
||||||
"css-loader": "0.28.7",
|
"css-loader": "0.28.7",
|
||||||
"eslint": "4.11.0",
|
"eslint": "4.13.1",
|
||||||
"eslint-friendly-formatter": "3.0.0",
|
"eslint-friendly-formatter": "3.0.0",
|
||||||
"eslint-import-resolver-webpack": "0.8.3",
|
|
||||||
"eslint-loader": "1.9.0",
|
"eslint-loader": "1.9.0",
|
||||||
"eslint-plugin-html": "3.2.2",
|
"eslint-plugin-html": "4.0.1",
|
||||||
"eslint-plugin-import": "2.8.0",
|
|
||||||
"eventsource-polyfill": "0.9.6",
|
|
||||||
"express": "4.16.2",
|
|
||||||
"extract-text-webpack-plugin": "3.0.2",
|
"extract-text-webpack-plugin": "3.0.2",
|
||||||
"file-loader": "0.11.2",
|
"file-loader": "1.1.5",
|
||||||
"friendly-errors-webpack-plugin": "1.6.1",
|
"friendly-errors-webpack-plugin": "1.6.1",
|
||||||
"function-bind": "1.1.0",
|
"html-webpack-plugin": "2.30.1",
|
||||||
"html-webpack-plugin": "2.30.0",
|
"node-notifier": "5.1.2",
|
||||||
"http-proxy-middleware": "0.17.4",
|
"node-sass": "^4.7.2",
|
||||||
"node-sass": "^4.5.0",
|
|
||||||
"opn": "4.0.2",
|
|
||||||
"optimize-css-assets-webpack-plugin": "3.2.0",
|
"optimize-css-assets-webpack-plugin": "3.2.0",
|
||||||
"ora": "1.1.0",
|
"ora": "1.3.0",
|
||||||
"postcss-loader": "^2.0.8",
|
"portfinder": "1.0.13",
|
||||||
"pushstate-server": "2.1.0",
|
"postcss-import": "11.0.0",
|
||||||
"rimraf": "2.6.0",
|
"postcss-loader": "2.0.9",
|
||||||
|
"postcss-url": "7.3.0",
|
||||||
|
"pushstate-server": "3.0.1",
|
||||||
|
"rimraf": "2.6.2",
|
||||||
"sass-loader": "6.0.6",
|
"sass-loader": "6.0.6",
|
||||||
"script-loader": "0.7.2",
|
"script-loader": "0.7.2",
|
||||||
"semver": "5.3.0",
|
"semver": "5.4.1",
|
||||||
"style-loader": "0.19.0",
|
"shelljs": "0.7.8",
|
||||||
"svg-sprite-loader": "3.4.1",
|
"svg-sprite-loader": "3.5.2",
|
||||||
|
"uglifyjs-webpack-plugin": "1.1.3",
|
||||||
"url-loader": "0.6.2",
|
"url-loader": "0.6.2",
|
||||||
"vue-loader": "13.5.0",
|
"vue-loader": "13.5.0",
|
||||||
"vue-style-loader": "3.0.3",
|
"vue-style-loader": "3.0.3",
|
||||||
"vue-template-compiler": "2.5.9",
|
"vue-template-compiler": "2.5.10",
|
||||||
"webpack": "3.8.1",
|
"webpack": "3.10.0",
|
||||||
"webpack-bundle-analyzer": "2.9.0",
|
"webpack-bundle-analyzer": "2.9.1",
|
||||||
"webpack-dev-middleware": "1.12.0",
|
"webpack-dev-server": "2.9.7",
|
||||||
"webpack-hot-middleware": "2.20.0",
|
"webpack-merge": "4.1.1"
|
||||||
"webpack-merge": "4.1.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 4.0.0",
|
"node": ">= 4.0.0",
|
||||||
|
@@ -9,8 +9,3 @@
|
|||||||
name: 'APP'
|
name: 'APP'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
@import '~normalize.css/normalize.css'; // normalize.css 样式格式化
|
|
||||||
@import './styles/index.scss'; // 全局自定义样式
|
|
||||||
</style>
|
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { generateTitle } from '@/utils/i18n'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
this.getBreadcrumb()
|
this.getBreadcrumb()
|
||||||
@@ -25,6 +27,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
generateTitle,
|
||||||
getBreadcrumb() {
|
getBreadcrumb() {
|
||||||
let matched = this.$route.matched.filter(item => item.name)
|
let matched = this.$route.matched.filter(item => item.name)
|
||||||
const first = matched[0]
|
const first = matched[0]
|
||||||
@@ -32,9 +35,6 @@ export default {
|
|||||||
matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched)
|
matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched)
|
||||||
}
|
}
|
||||||
this.levelList = matched
|
this.levelList = matched
|
||||||
},
|
|
||||||
generateTitle(title) {
|
|
||||||
return this.$t('route.' + title)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,13 +46,14 @@ export default {
|
|||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
backgroundColor: '#394056',
|
backgroundColor: '#394056',
|
||||||
title: {
|
title: {
|
||||||
text: '请求数',
|
top: 20,
|
||||||
|
text: 'Requests',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontWeight: 'normal',
|
fontWeight: 'normal',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: '#F1F1F3'
|
color: '#F1F1F3'
|
||||||
},
|
},
|
||||||
left: '6%'
|
left: '1%'
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@@ -63,11 +64,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
|
top: 20,
|
||||||
icon: 'rect',
|
icon: 'rect',
|
||||||
itemWidth: 14,
|
itemWidth: 14,
|
||||||
itemHeight: 5,
|
itemHeight: 5,
|
||||||
itemGap: 13,
|
itemGap: 13,
|
||||||
data: ['移动', '电信', '联通'],
|
data: ['CMCC', 'CTCC', 'CUCC'],
|
||||||
right: '4%',
|
right: '4%',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@@ -75,9 +77,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
|
top: 100,
|
||||||
left: '3%',
|
left: '3%',
|
||||||
right: '4%',
|
right: '4%',
|
||||||
bottom: '3%',
|
bottom: '2%',
|
||||||
containLabel: true
|
containLabel: true
|
||||||
},
|
},
|
||||||
xAxis: [{
|
xAxis: [{
|
||||||
@@ -92,7 +95,7 @@ export default {
|
|||||||
}],
|
}],
|
||||||
yAxis: [{
|
yAxis: [{
|
||||||
type: 'value',
|
type: 'value',
|
||||||
name: '单位(%)',
|
name: '(%)',
|
||||||
axisTick: {
|
axisTick: {
|
||||||
show: false
|
show: false
|
||||||
},
|
},
|
||||||
@@ -114,7 +117,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
series: [{
|
series: [{
|
||||||
name: '移动',
|
name: 'CMCC',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
symbol: 'circle',
|
symbol: 'circle',
|
||||||
@@ -148,7 +151,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data: [220, 182, 191, 134, 150, 120, 110, 125, 145, 122, 165, 122]
|
data: [220, 182, 191, 134, 150, 120, 110, 125, 145, 122, 165, 122]
|
||||||
}, {
|
}, {
|
||||||
name: '电信',
|
name: 'CTCC',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
symbol: 'circle',
|
symbol: 'circle',
|
||||||
@@ -182,7 +185,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data: [120, 110, 125, 145, 122, 165, 122, 220, 182, 191, 134, 150]
|
data: [120, 110, 125, 145, 122, 165, 122, 220, 182, 191, 134, 150]
|
||||||
}, {
|
}, {
|
||||||
name: '联通',
|
name: 'CUCC',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
symbol: 'circle',
|
symbol: 'circle',
|
||||||
|
@@ -46,15 +46,16 @@ export default {
|
|||||||
const xData = (function() {
|
const xData = (function() {
|
||||||
const data = []
|
const data = []
|
||||||
for (let i = 1; i < 13; i++) {
|
for (let i = 1; i < 13; i++) {
|
||||||
data.push(i + '月份')
|
data.push(i + 'month')
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
}())
|
}())
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
backgroundColor: '#344b58',
|
backgroundColor: '#344b58',
|
||||||
title: {
|
title: {
|
||||||
text: '统计',
|
text: 'statistics',
|
||||||
x: '4%',
|
x: '20',
|
||||||
|
top: '20',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
fontSize: '22'
|
fontSize: '22'
|
||||||
@@ -81,12 +82,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
x: '15%',
|
x: '5%',
|
||||||
top: '10%',
|
top: '10%',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#90979c'
|
color: '#90979c'
|
||||||
},
|
},
|
||||||
data: ['女', '男', '平均']
|
data: ['female', 'male', 'average']
|
||||||
},
|
},
|
||||||
calculable: true,
|
calculable: true,
|
||||||
xAxis: [{
|
xAxis: [{
|
||||||
@@ -158,9 +159,9 @@ export default {
|
|||||||
end: 35
|
end: 35
|
||||||
}],
|
}],
|
||||||
series: [{
|
series: [{
|
||||||
name: '女',
|
name: 'female',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
stack: '总量',
|
stack: 'total',
|
||||||
barMaxWidth: 35,
|
barMaxWidth: 35,
|
||||||
barGap: '10%',
|
barGap: '10%',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
@@ -195,9 +196,9 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: '男',
|
name: 'male',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
stack: '总量',
|
stack: 'total',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
color: 'rgba(0,191,183,1)',
|
color: 'rgba(0,191,183,1)',
|
||||||
@@ -226,9 +227,9 @@ export default {
|
|||||||
220
|
220
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
name: '平均',
|
name: 'average',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
stack: '总量',
|
stack: 'total',
|
||||||
symbolSize: 10,
|
symbolSize: 10,
|
||||||
symbol: 'circle',
|
symbol: 'circle',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
|
@@ -1,56 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<el-badge :is-dot="true" style="line-height: 30px;" @click.native="dialogTableVisible=true">
|
|
||||||
<el-button size="small" type="primary">
|
|
||||||
<svg t="1492682037685" class="bug-svg" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1863"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64">
|
|
||||||
<path d="M969.142857 548.571429q0 14.848-10.861714 25.709714t-25.709714 10.861714l-128 0q0 97.718857-38.290286 165.705143l118.857143 119.442286q10.861714 10.861714 10.861714 25.709714t-10.861714 25.709714q-10.276571 10.861714-25.709714 10.861714t-25.709714-10.861714l-113.152-112.566857q-2.852571 2.852571-8.557714 7.424t-23.990857 16.274286-37.156571 20.845714-46.848 16.566857-55.442286 7.424l0-512-73.142857 0 0 512q-29.147429 0-58.002286-7.716571t-49.700571-18.870857-37.705143-22.272-24.868571-18.578286l-8.557714-8.009143-104.557714 118.272q-11.446857 11.995429-27.428571 11.995429-13.714286 0-24.576-9.142857-10.861714-10.276571-11.702857-25.417143t8.850286-26.587429l115.419429-129.718857q-33.133714-65.133714-33.133714-156.562286l-128 0q-14.848 0-25.709714-10.861714t-10.861714-25.709714 10.861714-25.709714 25.709714-10.861714l128 0 0-168.009143-98.852571-98.852571q-10.861714-10.861714-10.861714-25.709714t10.861714-25.709714 25.709714-10.861714 25.709714 10.861714l98.852571 98.852571 482.304 0 98.852571-98.852571q10.861714-10.861714 25.709714-10.861714t25.709714 10.861714 10.861714 25.709714-10.861714 25.709714l-98.852571 98.852571 0 168.009143 128 0q14.848 0 25.709714 10.861714t10.861714 25.709714zM694.857143 219.428571l-365.714286 0q0-75.995429 53.430857-129.426286t129.426286-53.430857 129.426286 53.430857 53.430857 129.426286z"
|
|
||||||
p-id="1864"></path>
|
|
||||||
</svg>
|
|
||||||
</el-button>
|
|
||||||
</el-badge>
|
|
||||||
<el-dialog title="bug日志" :visible.sync="dialogTableVisible">
|
|
||||||
<el-table :data="logsList">
|
|
||||||
<el-table-column label="message">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<div>msg:{{ scope.row.err.message }}</div>
|
|
||||||
<br/>
|
|
||||||
<div>url: {{scope.row.url}}</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="stack">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{{ scope.row.err.stack}}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
</el-table>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'errLog',
|
|
||||||
props: {
|
|
||||||
logsList: {
|
|
||||||
type: Array
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
dialogTableVisible: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.bug-svg {
|
|
||||||
width: 1em;
|
|
||||||
height: 1em;
|
|
||||||
vertical-align: -0.15em;
|
|
||||||
fill: currentColor;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
77
src/components/ErrorLog/index.vue
Normal file
77
src/components/ErrorLog/index.vue
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="errorLogs.length>0">
|
||||||
|
<el-badge :is-dot="true" style="line-height: 30px;" @click.native="dialogTableVisible=true">
|
||||||
|
<el-button size="small" type="danger" class="bug-btn">
|
||||||
|
<svg t="1492682037685" class="bug-svg" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1863"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128">
|
||||||
|
<path d="M969.142857 548.571429q0 14.848-10.861714 25.709714t-25.709714 10.861714l-128 0q0 97.718857-38.290286 165.705143l118.857143 119.442286q10.861714 10.861714 10.861714 25.709714t-10.861714 25.709714q-10.276571 10.861714-25.709714 10.861714t-25.709714-10.861714l-113.152-112.566857q-2.852571 2.852571-8.557714 7.424t-23.990857 16.274286-37.156571 20.845714-46.848 16.566857-55.442286 7.424l0-512-73.142857 0 0 512q-29.147429 0-58.002286-7.716571t-49.700571-18.870857-37.705143-22.272-24.868571-18.578286l-8.557714-8.009143-104.557714 118.272q-11.446857 11.995429-27.428571 11.995429-13.714286 0-24.576-9.142857-10.861714-10.276571-11.702857-25.417143t8.850286-26.587429l115.419429-129.718857q-33.133714-65.133714-33.133714-156.562286l-128 0q-14.848 0-25.709714-10.861714t-10.861714-25.709714 10.861714-25.709714 25.709714-10.861714l128 0 0-168.009143-98.852571-98.852571q-10.861714-10.861714-10.861714-25.709714t10.861714-25.709714 25.709714-10.861714 25.709714 10.861714l98.852571 98.852571 482.304 0 98.852571-98.852571q10.861714-10.861714 25.709714-10.861714t25.709714 10.861714 10.861714 25.709714-10.861714 25.709714l-98.852571 98.852571 0 168.009143 128 0q14.848 0 25.709714 10.861714t10.861714 25.709714zM694.857143 219.428571l-365.714286 0q0-75.995429 53.430857-129.426286t129.426286-53.430857 129.426286 53.430857 53.430857 129.426286z"
|
||||||
|
p-id="1864"></path>
|
||||||
|
</svg>
|
||||||
|
</el-button>
|
||||||
|
</el-badge>
|
||||||
|
|
||||||
|
<el-dialog title="Error Log" :visible.sync="dialogTableVisible" width="80%">
|
||||||
|
<el-table :data="errorLogs" border>
|
||||||
|
<el-table-column label="Message">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>
|
||||||
|
<span class="message-title">Msg:</span>
|
||||||
|
<el-tag type="danger">{{ scope.row.err.message }}</el-tag>
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<div>
|
||||||
|
<span class="message-title" style="padding-right: 10px;">Info: </span>
|
||||||
|
<el-tag type="warning">{{scope.row.vm.$vnode.tag}} error in {{scope.row.info}}</el-tag>
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<div>
|
||||||
|
<span class="message-title" style="padding-right: 16px;">Url: </span>
|
||||||
|
<el-tag type="success">{{scope.row.url}}</el-tag>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="Stack">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.err.stack}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'errorLog',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogTableVisible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
errorLogs() {
|
||||||
|
return this.$store.getters.errorLogs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.bug-btn.el-button--small {
|
||||||
|
padding: 9px 10px;
|
||||||
|
}
|
||||||
|
.bug-svg {
|
||||||
|
width: 1em;
|
||||||
|
height: 1em;
|
||||||
|
vertical-align: -0.15em;
|
||||||
|
fill: currentColor;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.message-title {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
@@ -105,7 +105,7 @@
|
|||||||
<script>
|
<script>
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import {effectRipple, data2blob} from './utils';
|
import {effectRipple, data2blob} from './utils';
|
||||||
import request from 'utils/request';
|
import request from '@/utils/request';
|
||||||
import langBag from './lang';
|
import langBag from './lang';
|
||||||
const mimes = {
|
const mimes = {
|
||||||
'jpg': 'image/jpeg',
|
'jpg': 'image/jpeg',
|
||||||
|
41
src/components/LangSelect/index.vue
Normal file
41
src/components/LangSelect/index.vue
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<template>
|
||||||
|
<el-dropdown trigger="click" class='international' @command="handleSetLanguage">
|
||||||
|
<div>
|
||||||
|
<svg-icon class-name='international-icon' icon-class="language" />
|
||||||
|
</div>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item command="zh" :disabled="language==='zh'">中文</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="en" :disabled="language==='en'">English</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
computed: {
|
||||||
|
language() {
|
||||||
|
return this.$store.getters.language
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSetLanguage(lang) {
|
||||||
|
this.$i18n.locale = lang
|
||||||
|
this.$store.dispatch('setLanguage', lang)
|
||||||
|
this.$message({
|
||||||
|
message: 'switch language success',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.international-icon {
|
||||||
|
font-size: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
vertical-align: -5px!important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="scroll-container" ref="scrollContainer" @mousewheel="handleScroll">
|
<div class="scroll-container" ref="scrollContainer" @wheel.prevent="handleScroll" >
|
||||||
<div class="scroll-wrapper" ref="scrollWrapper" :style="{top: top + 'px'}">
|
<div class="scroll-wrapper" ref="scrollWrapper" :style="{top: top + 'px'}">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const delta = 15
|
const delta = 15
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'scrollBar',
|
name: 'scrollBar',
|
||||||
data() {
|
data() {
|
||||||
@@ -17,19 +18,19 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleScroll(e) {
|
handleScroll(e) {
|
||||||
e.preventDefault()
|
const eventDelta = e.wheelDelta || -e.deltaY * 3
|
||||||
const $container = this.$refs.scrollContainer
|
const $container = this.$refs.scrollContainer
|
||||||
const $containerHeight = $container.offsetHeight
|
const $containerHeight = $container.offsetHeight
|
||||||
const $wrapper = this.$refs.scrollWrapper
|
const $wrapper = this.$refs.scrollWrapper
|
||||||
const $wrapperHeight = $wrapper.offsetHeight
|
const $wrapperHeight = $wrapper.offsetHeight
|
||||||
if (e.wheelDelta > 0) {
|
if (eventDelta > 0) {
|
||||||
this.top = Math.min(0, this.top + e.wheelDelta)
|
this.top = Math.min(0, this.top + eventDelta)
|
||||||
} else {
|
} else {
|
||||||
if ($containerHeight - delta < $wrapperHeight) {
|
if ($containerHeight - delta < $wrapperHeight) {
|
||||||
if (this.top < -($wrapperHeight - $containerHeight + delta)) {
|
if (this.top < -($wrapperHeight - $containerHeight + delta)) {
|
||||||
this.top = this.top
|
this.top = this.top
|
||||||
} else {
|
} else {
|
||||||
this.top = Math.max(this.top + e.wheelDelta, $containerHeight - $wrapperHeight - delta)
|
this.top = Math.max(this.top + eventDelta, $containerHeight - $wrapperHeight - delta)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.top = 0
|
this.top = 0
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="scroll-container" ref="scrollContainer" @mousewheel="handleScroll">
|
<div class="scroll-container" ref="scrollContainer" @wheel.prevent="handleScroll">
|
||||||
<div class="scroll-wrapper" ref="scrollWrapper" :style="{left: left + 'px'}">
|
<div class="scroll-wrapper" ref="scrollWrapper" :style="{left: left + 'px'}">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
@@ -18,20 +18,20 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleScroll(e) {
|
handleScroll(e) {
|
||||||
e.preventDefault()
|
const eventDelta = e.wheelDelta || -e.deltaY * 3
|
||||||
const $container = this.$refs.scrollContainer
|
const $container = this.$refs.scrollContainer
|
||||||
const $containerWidth = $container.offsetWidth
|
const $containerWidth = $container.offsetWidth
|
||||||
const $wrapper = this.$refs.scrollWrapper
|
const $wrapper = this.$refs.scrollWrapper
|
||||||
const $wrapperWidth = $wrapper.offsetWidth
|
const $wrapperWidth = $wrapper.offsetWidth
|
||||||
|
|
||||||
if (e.wheelDelta > 0) {
|
if (eventDelta > 0) {
|
||||||
this.left = Math.min(0, this.left + e.wheelDelta)
|
this.left = Math.min(0, this.left + eventDelta)
|
||||||
} else {
|
} else {
|
||||||
if ($containerWidth - padding < $wrapperWidth) {
|
if ($containerWidth - padding < $wrapperWidth) {
|
||||||
if (this.left < -($wrapperWidth - $containerWidth + padding)) {
|
if (this.left < -($wrapperWidth - $containerWidth + padding)) {
|
||||||
this.left = this.left
|
this.left = this.left
|
||||||
} else {
|
} else {
|
||||||
this.left = Math.max(this.left + e.wheelDelta, $containerWidth - $wrapperWidth - padding)
|
this.left = Math.max(this.left + eventDelta, $containerWidth - $wrapperWidth - padding)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.left = 0
|
this.left = 0
|
||||||
@@ -64,6 +64,7 @@ export default {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
width: 100%;
|
||||||
.scroll-wrapper {
|
.scroll-wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
@@ -6,9 +6,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getVersion } from '@/utils/index.js'
|
|
||||||
|
|
||||||
const version = getVersion('element-ui') // element-ui version from package.json
|
const version = require('element-ui/package.json').version // element-ui version from node_modules
|
||||||
const ORIGINAL_THEME = '#409EFF' // default color
|
const ORIGINAL_THEME = '#409EFF' // default color
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
</el-upload>
|
</el-upload>
|
||||||
<div class="image-preview image-app-preview">
|
<div class="image-preview image-app-preview">
|
||||||
<div class="image-preview-wrapper" v-show="imageUrl.length>1">
|
<div class="image-preview-wrapper" v-show="imageUrl.length>1">
|
||||||
<div class='app-fake-conver'>  全球 付费节目单 最热 经济</div>
|
|
||||||
<img :src="imageUrl">
|
<img :src="imageUrl">
|
||||||
<div class="image-preview-action">
|
<div class="image-preview-action">
|
||||||
<i @click="rmImage" class="el-icon-delete"></i>
|
<i @click="rmImage" class="el-icon-delete"></i>
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-button :loading="loading" type="primary" @click="handleUpload">select excel file</el-button>
|
|
||||||
<input id="excel-upload-input" type="file" accept=".xlsx, .xls" class="c-hide" @change="handkeFileChange">
|
<input id="excel-upload-input" type="file" accept=".xlsx, .xls" class="c-hide" @change="handkeFileChange">
|
||||||
|
<div id="drop" @drop="handleDrop" @dragover="handleDragover" @dragenter="handleDragover">
|
||||||
|
Drop excel file here or
|
||||||
|
<el-button style="margin-left:16px;" size="mini" type="primary" @click="handleUpload">browse</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -22,16 +25,35 @@ export default {
|
|||||||
generateDate({ header, results }) {
|
generateDate({ header, results }) {
|
||||||
this.excelData.header = header
|
this.excelData.header = header
|
||||||
this.excelData.results = results
|
this.excelData.results = results
|
||||||
this.loading = false
|
|
||||||
this.$emit('on-selected-file', this.excelData)
|
this.$emit('on-selected-file', this.excelData)
|
||||||
},
|
},
|
||||||
|
handleDrop(e) {
|
||||||
|
e.stopPropagation()
|
||||||
|
e.preventDefault()
|
||||||
|
const files = e.dataTransfer.files
|
||||||
|
if (files.length !== 1) {
|
||||||
|
this.$message.error('Only support uploading one file!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const itemFile = files[0] // only use files[0]
|
||||||
|
this.readerData(itemFile)
|
||||||
|
e.stopPropagation()
|
||||||
|
e.preventDefault()
|
||||||
|
},
|
||||||
|
handleDragover(e) {
|
||||||
|
e.stopPropagation()
|
||||||
|
e.preventDefault()
|
||||||
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
|
},
|
||||||
handleUpload() {
|
handleUpload() {
|
||||||
document.getElementById('excel-upload-input').click()
|
document.getElementById('excel-upload-input').click()
|
||||||
},
|
},
|
||||||
handkeFileChange(e) {
|
handkeFileChange(e) {
|
||||||
this.loading = true
|
|
||||||
const files = e.target.files
|
const files = e.target.files
|
||||||
const itemFile = files[0] // only use files[0]
|
const itemFile = files[0] // only use files[0]
|
||||||
|
this.readerData(itemFile)
|
||||||
|
},
|
||||||
|
readerData(itemFile) {
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = e => {
|
reader.onload = e => {
|
||||||
const data = e.target.result
|
const data = e.target.result
|
||||||
@@ -75,4 +97,16 @@ export default {
|
|||||||
display: none;
|
display: none;
|
||||||
z-index: -9999;
|
z-index: -9999;
|
||||||
}
|
}
|
||||||
|
#drop{
|
||||||
|
border: 2px dashed #bbb;
|
||||||
|
width: 600px;
|
||||||
|
height: 160px;
|
||||||
|
line-height: 160px;
|
||||||
|
margin: 0 auto;
|
||||||
|
font-size: 24px;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-align: center;
|
||||||
|
color: #bbb;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -1,14 +1,21 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import errLog from '@/store/errLog'
|
import store from './store'
|
||||||
|
|
||||||
// 生产环境错误日志
|
// you can set only in production env show the error-log
|
||||||
if (process.env.NODE_ENV === 'production') {
|
// if (process.env.NODE_ENV === 'production') {
|
||||||
Vue.config.errorHandler = function(err, vm) {
|
|
||||||
console.log(err, window.location.href)
|
Vue.config.errorHandler = function(err, vm, info, a) {
|
||||||
errLog.pushLog({
|
// Don't ask me why I use Vue.nextTick, it just a hack.
|
||||||
|
// detail see https://forum.vuejs.org/t/dispatch-in-vue-config-errorhandler-has-some-problem/23500
|
||||||
|
Vue.nextTick(() => {
|
||||||
|
store.dispatch('addErrorLog', {
|
||||||
err,
|
err,
|
||||||
url: window.location.href,
|
vm,
|
||||||
vm
|
info,
|
||||||
|
url: window.location.href
|
||||||
})
|
})
|
||||||
}
|
console.error(err, info)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// }
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1503994155726" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8554" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><defs><style type="text/css"></style></defs><path d="M44.521739 0h44.521739v979.478261H44.521739zM267.130435 534.26087h44.521739v445.217391H267.130435zM489.73913 311.652174h44.52174v667.826087h-44.52174zM712.347826 712.347826h44.521739v267.130435h-44.521739zM934.956522 445.217391h44.521739v534.26087h-44.521739z" fill="" p-id="8555"></path></svg>
|
|
Before Width: | Height: | Size: 678 B |
@@ -1 +0,0 @@
|
|||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1503994177895" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8894" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><defs><style type="text/css"></style></defs><path d="M712.347826 0h44.521739v979.478261h-44.521739zM267.130435 534.26087h44.521739v445.217391H267.130435zM489.73913 311.652174h44.52174v667.826087h-44.52174zM44.521739 712.347826h44.521739v267.130435H44.521739zM934.956522 445.217391h44.521739v534.26087h-44.521739z" fill="" p-id="8895"></path></svg>
|
|
Before Width: | Height: | Size: 678 B |
@@ -1 +0,0 @@
|
|||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1503994166937" class="icon" style="" viewBox="0 0 1131 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8786" xmlns:xlink="http://www.w3.org/1999/xlink" width="70.6875" height="64"><defs><style type="text/css"></style></defs><path d="M0 0h53.894737v970.105263H0zM269.473684 431.157895h53.894737v538.947368H269.473684zM538.947368 161.684211h53.894737v808.421052h-53.894737zM808.421053 646.736842h53.894736v323.368421h-53.894736zM1077.894737 323.368421h53.894737v646.736842h-53.894737z" fill="" p-id="8787"></path></svg>
|
|
Before Width: | Height: | Size: 673 B |
@@ -20,7 +20,7 @@ export default {
|
|||||||
backToTop: 'BackToTop',
|
backToTop: 'BackToTop',
|
||||||
charts: 'Charts',
|
charts: 'Charts',
|
||||||
keyboardChart: 'Keyboard Chart',
|
keyboardChart: 'Keyboard Chart',
|
||||||
lineChart: 'Line chart',
|
lineChart: 'Line Chart',
|
||||||
mixChart: 'Mix Chart',
|
mixChart: 'Mix Chart',
|
||||||
example: 'Example',
|
example: 'Example',
|
||||||
Table: 'Table',
|
Table: 'Table',
|
||||||
@@ -44,5 +44,83 @@ export default {
|
|||||||
theme: 'Theme',
|
theme: 'Theme',
|
||||||
clipboardDemo: 'Clipboard',
|
clipboardDemo: 'Clipboard',
|
||||||
i18n: 'I18n'
|
i18n: 'I18n'
|
||||||
|
},
|
||||||
|
navbar: {
|
||||||
|
logOut: 'Log Out',
|
||||||
|
dashboard: 'Dashboard',
|
||||||
|
github: 'Github',
|
||||||
|
screenfull: 'screenfull',
|
||||||
|
theme: 'theme'
|
||||||
|
},
|
||||||
|
login: {
|
||||||
|
title: 'Login Form',
|
||||||
|
logIn: 'Log in',
|
||||||
|
username: 'Username',
|
||||||
|
password: 'Password',
|
||||||
|
any: 'any',
|
||||||
|
thirdparty: 'Or connect with',
|
||||||
|
thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !'
|
||||||
|
},
|
||||||
|
documentation: {
|
||||||
|
documentation: 'Documentation',
|
||||||
|
github: 'Github Repository'
|
||||||
|
},
|
||||||
|
permission: {
|
||||||
|
roles: 'Your roles',
|
||||||
|
switchRoles: 'Switch roles'
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
documentation: 'Documentation',
|
||||||
|
tinymceTips: 'Rich text editor is a core part of management system, but at the same time is a place with lots of problems. In the process of selecting rich texts, I also walked a lot of detours. The common rich text editors in the market are basically used, and the finally chose Tinymce. See documentation for more detailed rich text editor comparisons and introductions.',
|
||||||
|
dropzoneTips: 'Because my business has special needs, and has to upload images to qiniu, so instead of a third party, I chose encapsulate it by myself. It is very simple, you can see the detail code in @/components/Dropzone.',
|
||||||
|
stickyTips: 'when the page is scrolled to the preset position will be sticky on the top.',
|
||||||
|
backToTopTips1: 'When the page is scrolled to the specified position, the Back to Top button appears in the lower right corner',
|
||||||
|
backToTopTips2: 'You can customize the style of the button, show / hide, height of appearance, height of the return. If you need a text prompt, you can use element-ui el-tooltip elements externally',
|
||||||
|
imageUploadTips: 'Since I was using only the vue@1 version, and it is not compatible with mockjs at the moment, I modified it myself, and if you are going to use it, it is better to use official version.'
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
dynamicTips1: 'Fixed header, sorted by header order',
|
||||||
|
dynamicTips2: 'Not fixed header, sorted by click order',
|
||||||
|
dragTips1: 'The default order',
|
||||||
|
dragTips2: 'The after dragging order',
|
||||||
|
title: 'Title',
|
||||||
|
importance: 'Imp',
|
||||||
|
type: 'Type',
|
||||||
|
remark: 'Remark',
|
||||||
|
search: 'Search',
|
||||||
|
add: 'Add',
|
||||||
|
export: 'Export',
|
||||||
|
reviewer: 'reviewer',
|
||||||
|
id: 'ID',
|
||||||
|
date: 'Date',
|
||||||
|
author: 'Author',
|
||||||
|
readings: 'Readings',
|
||||||
|
status: 'Status',
|
||||||
|
actions: 'Actions',
|
||||||
|
edit: 'Edit',
|
||||||
|
publish: 'Publish',
|
||||||
|
draft: 'Draft',
|
||||||
|
delete: 'Delete',
|
||||||
|
cancel: 'Cancel',
|
||||||
|
confirm: 'Confirm'
|
||||||
|
},
|
||||||
|
errorLog: {
|
||||||
|
tips: 'Please click the bug icon in the upper right corner',
|
||||||
|
description: 'Now the management system are basically the form of the spa, it enhances the user experience, but it also increases the possibility of page problems, a small negligence may lead to the entire page deadlock. Fortunately Vue provides a way to catch handling exceptions, where you can handle errors or report exceptions.',
|
||||||
|
documentation: 'Document introduction'
|
||||||
|
},
|
||||||
|
excel: {
|
||||||
|
export: 'Export',
|
||||||
|
selectedExport: 'Export selected items',
|
||||||
|
placeholder: 'Please enter the file name(default excel-list)'
|
||||||
|
},
|
||||||
|
zip: {
|
||||||
|
export: 'Export',
|
||||||
|
placeholder: 'Please enter the file name(default file)'
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
change: 'Theme change',
|
||||||
|
documentation: 'Theme documentation',
|
||||||
|
tips: 'Tips: It is different from the theme-pick on the navbar is two different skinning methods, each with different application scenarios. Refer to the documentation for details.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ const messages = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const i18n = new VueI18n({
|
const i18n = new VueI18n({
|
||||||
locale: Cookies.get('language') || 'zh', // set locale
|
locale: Cookies.get('language') || 'en', // set locale
|
||||||
messages // set locale messages
|
messages // set locale messages
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -44,5 +44,83 @@ export default {
|
|||||||
theme: '换肤',
|
theme: '换肤',
|
||||||
clipboardDemo: 'clipboard',
|
clipboardDemo: 'clipboard',
|
||||||
i18n: '国际化'
|
i18n: '国际化'
|
||||||
|
},
|
||||||
|
navbar: {
|
||||||
|
logOut: '退出登录',
|
||||||
|
dashboard: '首页',
|
||||||
|
github: '项目地址',
|
||||||
|
screenfull: '全屏',
|
||||||
|
theme: '换肤'
|
||||||
|
},
|
||||||
|
login: {
|
||||||
|
title: '系统登录',
|
||||||
|
logIn: '登录',
|
||||||
|
username: '账号',
|
||||||
|
password: '密码',
|
||||||
|
any: '随便填',
|
||||||
|
thirdparty: '第三方登录',
|
||||||
|
thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!'
|
||||||
|
},
|
||||||
|
documentation: {
|
||||||
|
documentation: '文档',
|
||||||
|
github: 'Github 地址'
|
||||||
|
},
|
||||||
|
permission: {
|
||||||
|
roles: '你的权限',
|
||||||
|
switchRoles: '切换权限'
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
documentation: '文档',
|
||||||
|
tinymceTips: '富文本是管理后台一个核心的功能,但同时又是一个有很多坑的地方。在选择富文本的过程中我也走了不少的弯路,市面上常见的富文本都基本用过了,最终权衡了一下选择了Tinymce。更详细的富文本比较和介绍见',
|
||||||
|
dropzoneTips: '由于我司业务有特殊需求,而且要传七牛 所以没用第三方,选择了自己封装。代码非常的简单,具体代码你可以在这里看到 @/components/Dropzone',
|
||||||
|
stickyTips: '当页面滚动到预设的位置会吸附在顶部',
|
||||||
|
backToTopTips1: '页面滚动到指定位置会在右下角出现返回顶部按钮',
|
||||||
|
backToTopTips2: '可自定义按钮的样式、show/hide、出现的高度、返回的位置 如需文字提示,可在外部使用Element的el-tooltip元素',
|
||||||
|
imageUploadTips: '由于我在使用时它只有vue@1版本,而且和mockjs不兼容,所以自己改造了一下,如果大家要使用的话,优先还是使用官方版本。'
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
dynamicTips1: '固定表头, 按照表头顺序排序',
|
||||||
|
dynamicTips2: '不固定表头, 按照点击顺序排序',
|
||||||
|
dragTips1: '默认顺序',
|
||||||
|
dragTips2: '拖拽后顺序',
|
||||||
|
title: '标题',
|
||||||
|
importance: '重要性',
|
||||||
|
type: '类型',
|
||||||
|
remark: '点评',
|
||||||
|
search: '搜索',
|
||||||
|
add: '添加',
|
||||||
|
export: '导出',
|
||||||
|
reviewer: '审核人',
|
||||||
|
id: '序号',
|
||||||
|
date: '时间',
|
||||||
|
author: '作者',
|
||||||
|
readings: '阅读数',
|
||||||
|
status: '状态',
|
||||||
|
actions: '操作',
|
||||||
|
edit: '编辑',
|
||||||
|
publish: '发布',
|
||||||
|
draft: '草稿',
|
||||||
|
delete: '删除',
|
||||||
|
cancel: '取 消',
|
||||||
|
confirm: '确 定'
|
||||||
|
},
|
||||||
|
errorLog: {
|
||||||
|
tips: '请点击右上角bug小图标',
|
||||||
|
description: '现在的管理后台基本都是spa的形式了,它增强了用户体验,但同时也会增加页面出问题的可能性,可能一个小小的疏忽就导致整个页面的死锁。好在 Vue 官网提供了一个方法来捕获处理异常,你可以在其中进行错误处理或者异常上报。',
|
||||||
|
documentation: '文档介绍'
|
||||||
|
},
|
||||||
|
excel: {
|
||||||
|
export: '导出',
|
||||||
|
selectedExport: '导出已选择项',
|
||||||
|
placeholder: '请输入文件名(默认excel-list)'
|
||||||
|
},
|
||||||
|
zip: {
|
||||||
|
export: '导出',
|
||||||
|
placeholder: '请输入文件名(默认file)'
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
change: '换肤',
|
||||||
|
documentation: '换肤文档',
|
||||||
|
tips: 'Tips: 它区别于 navbar 上的 theme-pick, 是两种不同的换肤方法,各自有不同的应用场景,具体请参考文档。'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
src/main.js
17
src/main.js
@@ -1,17 +1,26 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
import 'normalize.css/normalize.css'// A modern alternative to CSS resets
|
||||||
|
|
||||||
import Element from 'element-ui'
|
import Element from 'element-ui'
|
||||||
import 'element-ui/lib/theme-chalk/index.css'
|
import 'element-ui/lib/theme-chalk/index.css'
|
||||||
import i18n from './lang' // 国际化
|
|
||||||
|
import '@/styles/index.scss' // global css
|
||||||
|
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import * as filters from './filters' // 全局filter
|
|
||||||
|
import i18n from './lang' // Internationalization
|
||||||
import './icons' // icon
|
import './icons' // icon
|
||||||
import './errorLog'// error log
|
import './errorLog'// error log
|
||||||
import './permission' // 权限
|
import './permission' // permission control
|
||||||
import './mock' // 该项目所有请求使用mockjs模拟
|
import './mock' // simulation data
|
||||||
|
|
||||||
|
import * as filters from './filters' // global filters
|
||||||
|
|
||||||
Vue.use(Element, {
|
Vue.use(Element, {
|
||||||
|
size: 'medium', // set element-ui default size
|
||||||
i18n: (key, value) => i18n.t(key, value)
|
i18n: (key, value) => i18n.t(key, value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -8,9 +8,9 @@ for (let i = 0; i < count; i++) {
|
|||||||
List.push(Mock.mock({
|
List.push(Mock.mock({
|
||||||
id: '@increment',
|
id: '@increment',
|
||||||
timestamp: +Mock.Random.date('T'),
|
timestamp: +Mock.Random.date('T'),
|
||||||
author: '@cname',
|
author: '@first',
|
||||||
auditor: '@cname',
|
reviewer: '@first',
|
||||||
title: '@ctitle(10, 20)',
|
title: '@title(5, 10)',
|
||||||
forecast: '@float(0, 100, 2, 2)',
|
forecast: '@float(0, 100, 2, 2)',
|
||||||
importance: '@integer(1, 3)',
|
importance: '@integer(1, 3)',
|
||||||
'type|1': ['CN', 'US', 'JP', 'EU'],
|
'type|1': ['CN', 'US', 'JP', 'EU'],
|
||||||
@@ -43,7 +43,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getPv: () => ({
|
getPv: () => ({
|
||||||
pvData: [{ key: 'PC网站', pv: 1024 }, { key: 'mobile网站', pv: 1024 }, { key: 'ios', pv: 1024 }, { key: 'android', pv: 1024 }]
|
pvData: [{ key: 'PC', pv: 1024 }, { key: 'mobile', pv: 1024 }, { key: 'ios', pv: 1024 }, { key: 'android', pv: 1024 }]
|
||||||
}),
|
}),
|
||||||
getArticle: () => ({
|
getArticle: () => ({
|
||||||
id: 120000000001,
|
id: 120000000001,
|
||||||
|
@@ -2,14 +2,14 @@ import { param2Obj } from '@/utils'
|
|||||||
|
|
||||||
const userMap = {
|
const userMap = {
|
||||||
admin: {
|
admin: {
|
||||||
role: ['admin'],
|
roles: ['admin'],
|
||||||
token: 'admin',
|
token: 'admin',
|
||||||
introduction: '我是超级管理员',
|
introduction: '我是超级管理员',
|
||||||
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
||||||
name: 'Super Admin'
|
name: 'Super Admin'
|
||||||
},
|
},
|
||||||
editor: {
|
editor: {
|
||||||
role: ['editor'],
|
roles: ['editor'],
|
||||||
token: 'editor',
|
token: 'editor',
|
||||||
introduction: '我是编辑',
|
introduction: '我是编辑',
|
||||||
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
||||||
|
@@ -1,60 +1,63 @@
|
|||||||
import router from './router'
|
import router from './router'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import NProgress from 'nprogress' // Progress 进度条
|
|
||||||
import 'nprogress/nprogress.css'// Progress 进度条样式
|
|
||||||
import { getToken } from '@/utils/auth' // 验权
|
|
||||||
import { Message } from 'element-ui'
|
import { Message } from 'element-ui'
|
||||||
|
import NProgress from 'nprogress' // progress bar
|
||||||
|
import 'nprogress/nprogress.css'// progress bar style
|
||||||
|
import { getToken } from '@/utils/auth' // getToken from cookie
|
||||||
|
|
||||||
// permissiom judge
|
NProgress.configure({ showSpinner: false })// NProgress Configuration
|
||||||
|
|
||||||
|
// permissiom judge function
|
||||||
function hasPermission(roles, permissionRoles) {
|
function hasPermission(roles, permissionRoles) {
|
||||||
if (roles.indexOf('admin') >= 0) return true // admin权限 直接通过
|
if (roles.indexOf('admin') >= 0) return true // admin permission passed directly
|
||||||
if (!permissionRoles) return true
|
if (!permissionRoles) return true
|
||||||
return roles.some(role => permissionRoles.indexOf(role) >= 0)
|
return roles.some(role => permissionRoles.indexOf(role) >= 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
const whiteList = ['/login', '/authredirect']// 不重定向白名单
|
const whiteList = ['/login', '/authredirect']// no redirect whitelist
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
NProgress.start() // 开启Progress
|
NProgress.start() // start progress bar
|
||||||
if (getToken()) { // 判断是否有token
|
if (getToken()) { // determine if there has token
|
||||||
|
/* has token*/
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
next({ path: '/' })
|
next({ path: '/' })
|
||||||
NProgress.done() // router在hash模式下 手动改变hash 重定向回来 不会触发afterEach 暂时hack方案 ps:history模式下无问题,可删除该行!
|
NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it
|
||||||
} else {
|
} else {
|
||||||
if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
|
if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
|
||||||
store.dispatch('GetUserInfo').then(res => { // 拉取user_info
|
store.dispatch('GetUserInfo').then(res => { // 拉取user_info
|
||||||
const roles = res.data.role
|
const roles = res.data.roles // note: roles must be a array! such as: ['editor','develop']
|
||||||
store.dispatch('GenerateRoutes', { roles }).then(() => { // 生成可访问的路由表
|
store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表
|
||||||
router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
|
router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
|
||||||
next({ ...to }) // hack方法 确保addRoutes已完成
|
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
store.dispatch('FedLogOut').then(() => {
|
store.dispatch('FedLogOut').then(() => {
|
||||||
Message.error('验证失败,请重新登录')
|
Message.error('Verification failed, please login again')
|
||||||
next({ path: '/login' })
|
next({ path: '/login' })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
|
// 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
|
||||||
if (hasPermission(store.getters.roles, to.meta.role)) {
|
if (hasPermission(store.getters.roles, to.meta.roles)) {
|
||||||
next()//
|
next()//
|
||||||
} else {
|
} else {
|
||||||
next({ path: '/401', query: { noGoBack: true }})
|
next({ path: '/401', replace: true, query: { noGoBack: true }})
|
||||||
NProgress.done() // router在hash模式下 手动改变hash 重定向回来 不会触发afterEach 暂时hack方案 ps:history模式下无问题,可删除该行!
|
|
||||||
}
|
}
|
||||||
// 可删 ↑
|
// 可删 ↑
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* has no token*/
|
||||||
if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入
|
if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
next('/login') // 否则全部重定向到登录页
|
next('/login') // 否则全部重定向到登录页
|
||||||
NProgress.done() // router在hash模式下 手动改变hash 重定向回来 不会触发afterEach 暂时hack方案 ps:history模式下无问题,可删除该行!
|
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
NProgress.done() // 结束Progress
|
NProgress.done() // finish progress bar
|
||||||
})
|
})
|
||||||
|
@@ -9,12 +9,16 @@ Vue.use(Router)
|
|||||||
/* Layout */
|
/* Layout */
|
||||||
import Layout from '../views/layout/Layout'
|
import Layout from '../views/layout/Layout'
|
||||||
|
|
||||||
|
/** note: submenu only apppear when children.length>=1
|
||||||
|
* detail see https://panjiachen.github.io/vue-element-admin-site/#/router-and-nav?id=sidebar
|
||||||
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
|
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
|
||||||
* redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
|
* redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
|
||||||
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
||||||
* meta : {
|
* meta : {
|
||||||
role: ['admin','editor'] will control the page role (you can set multiple roles)
|
roles: ['admin','editor'] will control the page roles (you can set multiple roles)
|
||||||
title: 'title' the name show in submenu and breadcrumb (recommend set)
|
title: 'title' the name show in submenu and breadcrumb (recommend set)
|
||||||
icon: 'svg-name' the icon show in the sidebar,
|
icon: 'svg-name' the icon show in the sidebar,
|
||||||
noCache: true if fasle ,the page will no be cached(default is false)
|
noCache: true if fasle ,the page will no be cached(default is false)
|
||||||
@@ -50,7 +54,7 @@ export const constantRouterMap = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
// mode: 'history', //后端支持可开
|
// mode: 'history', // require service support
|
||||||
scrollBehavior: () => ({ y: 0 }),
|
scrollBehavior: () => ({ y: 0 }),
|
||||||
routes: constantRouterMap
|
routes: constantRouterMap
|
||||||
})
|
})
|
||||||
@@ -60,7 +64,7 @@ export const asyncRouterMap = [
|
|||||||
path: '/permission',
|
path: '/permission',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/permission/index',
|
redirect: '/permission/index',
|
||||||
meta: { role: ['admin'] },
|
meta: { roles: ['admin'] }, // you can set roles in root nav
|
||||||
children: [{
|
children: [{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
component: _import('permission/index'),
|
component: _import('permission/index'),
|
||||||
@@ -68,7 +72,7 @@ export const asyncRouterMap = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: 'permission',
|
title: 'permission',
|
||||||
icon: 'lock',
|
icon: 'lock',
|
||||||
role: ['admin']
|
roles: ['admin'] // or you can only set roles in sub nav
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
const errLog = {
|
|
||||||
state: {
|
|
||||||
errLog: []
|
|
||||||
},
|
|
||||||
pushLog(log) {
|
|
||||||
this.state.errLog.unshift(log)
|
|
||||||
},
|
|
||||||
clearLog() {
|
|
||||||
this.state.errLog = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default errLog
|
|
@@ -1,8 +1,8 @@
|
|||||||
const getters = {
|
const getters = {
|
||||||
sidebar: state => state.app.sidebar,
|
sidebar: state => state.app.sidebar,
|
||||||
language: state => state.app.language,
|
language: state => state.app.language,
|
||||||
visitedViews: state => state.app.visitedViews,
|
visitedViews: state => state.tagsView.visitedViews,
|
||||||
cachedViews: state => state.app.cachedViews,
|
cachedViews: state => state.tagsView.cachedViews,
|
||||||
token: state => state.user.token,
|
token: state => state.user.token,
|
||||||
avatar: state => state.user.avatar,
|
avatar: state => state.user.avatar,
|
||||||
name: state => state.user.name,
|
name: state => state.user.name,
|
||||||
@@ -11,6 +11,7 @@ const getters = {
|
|||||||
roles: state => state.user.roles,
|
roles: state => state.user.roles,
|
||||||
setting: state => state.user.setting,
|
setting: state => state.user.setting,
|
||||||
permission_routers: state => state.permission.routers,
|
permission_routers: state => state.permission.routers,
|
||||||
addRouters: state => state.permission.addRouters
|
addRouters: state => state.permission.addRouters,
|
||||||
|
errorLogs: state => state.errorLog.logs
|
||||||
}
|
}
|
||||||
export default getters
|
export default getters
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import app from './modules/app'
|
import app from './modules/app'
|
||||||
import user from './modules/user'
|
import errorLog from './modules/errorLog'
|
||||||
import permission from './modules/permission'
|
import permission from './modules/permission'
|
||||||
|
import tagsView from './modules/tagsView'
|
||||||
|
import user from './modules/user'
|
||||||
import getters from './getters'
|
import getters from './getters'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
@@ -10,8 +12,10 @@ Vue.use(Vuex)
|
|||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
app,
|
app,
|
||||||
user,
|
errorLog,
|
||||||
permission
|
permission,
|
||||||
|
tagsView,
|
||||||
|
user
|
||||||
},
|
},
|
||||||
getters
|
getters
|
||||||
})
|
})
|
||||||
|
@@ -5,9 +5,7 @@ const app = {
|
|||||||
sidebar: {
|
sidebar: {
|
||||||
opened: !+Cookies.get('sidebarStatus')
|
opened: !+Cookies.get('sidebarStatus')
|
||||||
},
|
},
|
||||||
language: Cookies.get('language') || 'zh',
|
language: Cookies.get('language') || 'en'
|
||||||
visitedViews: [],
|
|
||||||
cachedViews: []
|
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
TOGGLE_SIDEBAR: state => {
|
TOGGLE_SIDEBAR: state => {
|
||||||
@@ -21,32 +19,6 @@ const app = {
|
|||||||
SET_LANGUAGE: (state, language) => {
|
SET_LANGUAGE: (state, language) => {
|
||||||
state.language = language
|
state.language = language
|
||||||
Cookies.set('language', language)
|
Cookies.set('language', language)
|
||||||
},
|
|
||||||
ADD_VISITED_VIEWS: (state, view) => {
|
|
||||||
if (state.visitedViews.some(v => v.path === view.path)) return
|
|
||||||
state.visitedViews.push({
|
|
||||||
name: view.name,
|
|
||||||
path: view.path,
|
|
||||||
title: view.meta.title || 'no-name'
|
|
||||||
})
|
|
||||||
if (!view.meta.noCache) {
|
|
||||||
state.cachedViews.push(view.name)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
DEL_VISITED_VIEWS: (state, view) => {
|
|
||||||
for (const [i, v] of state.visitedViews.entries()) {
|
|
||||||
if (v.path === view.path) {
|
|
||||||
state.visitedViews.splice(i, 1)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const i of state.cachedViews) {
|
|
||||||
if (i === view.name) {
|
|
||||||
const index = state.cachedViews.indexOf(i)
|
|
||||||
state.cachedViews.splice(index, 1)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@@ -55,15 +27,6 @@ const app = {
|
|||||||
},
|
},
|
||||||
setLanguage({ commit }, language) {
|
setLanguage({ commit }, language) {
|
||||||
commit('SET_LANGUAGE', language)
|
commit('SET_LANGUAGE', language)
|
||||||
},
|
|
||||||
addVisitedViews({ commit }, view) {
|
|
||||||
commit('ADD_VISITED_VIEWS', view)
|
|
||||||
},
|
|
||||||
delVisitedViews({ commit, state }, view) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
commit('DEL_VISITED_VIEWS', view)
|
|
||||||
resolve([...state.visitedViews])
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
src/store/modules/errorLog.js
Normal file
17
src/store/modules/errorLog.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
const errorLog = {
|
||||||
|
state: {
|
||||||
|
logs: []
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
ADD_ERROR_LOG: (state, log) => {
|
||||||
|
state.logs.push(log)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
addErrorLog({ commit }, log) {
|
||||||
|
commit('ADD_ERROR_LOG', log)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default errorLog
|
@@ -6,8 +6,8 @@ import { asyncRouterMap, constantRouterMap } from '@/router'
|
|||||||
* @param route
|
* @param route
|
||||||
*/
|
*/
|
||||||
function hasPermission(roles, route) {
|
function hasPermission(roles, route) {
|
||||||
if (route.meta && route.meta.role) {
|
if (route.meta && route.meta.roles) {
|
||||||
return roles.some(role => route.meta.role.indexOf(role) >= 0)
|
return roles.some(role => route.meta.roles.indexOf(role) >= 0)
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
78
src/store/modules/tagsView.js
Normal file
78
src/store/modules/tagsView.js
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
const tagsView = {
|
||||||
|
state: {
|
||||||
|
visitedViews: [],
|
||||||
|
cachedViews: []
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
ADD_VISITED_VIEWS: (state, view) => {
|
||||||
|
if (state.visitedViews.some(v => v.path === view.path)) return
|
||||||
|
state.visitedViews.push({
|
||||||
|
name: view.name,
|
||||||
|
path: view.path,
|
||||||
|
title: view.meta.title || 'no-name'
|
||||||
|
})
|
||||||
|
if (!view.meta.noCache) {
|
||||||
|
state.cachedViews.push(view.name)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DEL_VISITED_VIEWS: (state, view) => {
|
||||||
|
for (const [i, v] of state.visitedViews.entries()) {
|
||||||
|
if (v.path === view.path) {
|
||||||
|
state.visitedViews.splice(i, 1)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const i of state.cachedViews) {
|
||||||
|
if (i === view.name) {
|
||||||
|
const index = state.cachedViews.indexOf(i)
|
||||||
|
state.cachedViews.splice(index, index + 1)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DEL_OTHERS_VIEWS: (state, view) => {
|
||||||
|
for (const [i, v] of state.visitedViews.entries()) {
|
||||||
|
if (v.path === view.path) {
|
||||||
|
state.visitedViews = state.visitedViews.slice(i, i + 1)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const i of state.cachedViews) {
|
||||||
|
if (i === view.name) {
|
||||||
|
const index = state.cachedViews.indexOf(i)
|
||||||
|
state.cachedViews = state.cachedViews.slice(index, i + 1)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DEL_ALL_VIEWS: (state) => {
|
||||||
|
state.visitedViews = []
|
||||||
|
state.cachedViews = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
addVisitedViews({ commit }, view) {
|
||||||
|
commit('ADD_VISITED_VIEWS', view)
|
||||||
|
},
|
||||||
|
delVisitedViews({ commit, state }, view) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
commit('DEL_VISITED_VIEWS', view)
|
||||||
|
resolve([...state.visitedViews])
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delOthersViews({ commit, state }, view) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
commit('DEL_OTHERS_VIEWS', view)
|
||||||
|
resolve([...state.visitedViews])
|
||||||
|
})
|
||||||
|
},
|
||||||
|
delAllViews({ commit, state }) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
commit('DEL_ALL_VIEWS')
|
||||||
|
resolve([...state.visitedViews])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default tagsView
|
@@ -67,7 +67,7 @@ const user = {
|
|||||||
reject('error')
|
reject('error')
|
||||||
}
|
}
|
||||||
const data = response.data
|
const data = response.data
|
||||||
commit('SET_ROLES', data.role)
|
commit('SET_ROLES', data.roles)
|
||||||
commit('SET_NAME', data.name)
|
commit('SET_NAME', data.name)
|
||||||
commit('SET_AVATAR', data.avatar)
|
commit('SET_AVATAR', data.avatar)
|
||||||
commit('SET_INTRODUCTION', data.introduction)
|
commit('SET_INTRODUCTION', data.introduction)
|
||||||
@@ -116,13 +116,13 @@ const user = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 动态修改权限
|
// 动态修改权限
|
||||||
ChangeRole({ commit }, role) {
|
ChangeRoles({ commit }, role) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
commit('SET_TOKEN', role)
|
commit('SET_TOKEN', role)
|
||||||
setToken(role)
|
setToken(role)
|
||||||
getUserInfo(role).then(response => {
|
getUserInfo(role).then(response => {
|
||||||
const data = response.data
|
const data = response.data
|
||||||
commit('SET_ROLES', data.role)
|
commit('SET_ROLES', data.roles)
|
||||||
commit('SET_NAME', data.name)
|
commit('SET_NAME', data.name)
|
||||||
commit('SET_AVATAR', data.avatar)
|
commit('SET_AVATAR', data.avatar)
|
||||||
commit('SET_INTRODUCTION', data.introduction)
|
commit('SET_INTRODUCTION', data.introduction)
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
//覆盖一些element-ui样式
|
//覆盖一些element-ui样式
|
||||||
|
|
||||||
|
.el-breadcrumb__inner, .el-breadcrumb__inner a{
|
||||||
|
font-weight: 400!important;
|
||||||
|
}
|
||||||
|
|
||||||
.el-upload {
|
.el-upload {
|
||||||
input[type="file"] {
|
input[type="file"] {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
@@ -23,6 +27,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fixed-width{
|
||||||
|
.el-button--mini{
|
||||||
|
padding: 7px 10px;
|
||||||
|
width: 60px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.status-col {
|
.status-col {
|
||||||
.cell {
|
.cell {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
|
@@ -98,10 +98,12 @@ div:focus{
|
|||||||
|
|
||||||
code {
|
code {
|
||||||
background: #eef1f6;
|
background: #eef1f6;
|
||||||
padding: 15px 10px;
|
padding: 15px 16px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 36px;
|
line-height: 36px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
|
||||||
a {
|
a {
|
||||||
color: #337ab7;
|
color: #337ab7;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@@ -3,7 +3,7 @@ import Clipboard from 'clipboard'
|
|||||||
|
|
||||||
function clipboardSuccess() {
|
function clipboardSuccess() {
|
||||||
Vue.prototype.$message({
|
Vue.prototype.$message({
|
||||||
message: '复制成功',
|
message: 'Copy successfully',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
@@ -11,7 +11,7 @@ function clipboardSuccess() {
|
|||||||
|
|
||||||
function clipboardError() {
|
function clipboardError() {
|
||||||
Vue.prototype.$message({
|
Vue.prototype.$message({
|
||||||
message: '复制失败',
|
message: 'Copy failed',
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
10
src/utils/i18n.js
Normal file
10
src/utils/i18n.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// translate router.meta.title, be used in breadcrumb sidebar tagsview
|
||||||
|
export function generateTitle(title) {
|
||||||
|
const hasKey = this.$te('route.' + title)
|
||||||
|
const translatedTitle = this.$t('route.' + title) // $t :this method from vue-i18n, inject in @/lang/index.js
|
||||||
|
|
||||||
|
if (hasKey) {
|
||||||
|
return translatedTitle
|
||||||
|
}
|
||||||
|
return title
|
||||||
|
}
|
@@ -265,9 +265,3 @@ export function deepClone(source) {
|
|||||||
}
|
}
|
||||||
return targetObj
|
return targetObj
|
||||||
}
|
}
|
||||||
|
|
||||||
// get dependencies verison from package.json
|
|
||||||
export function getVersion(name) {
|
|
||||||
const p = require('../../package')
|
|
||||||
return p.dependencies[name]
|
|
||||||
}
|
|
||||||
|
@@ -3,17 +3,17 @@ import { Message } from 'element-ui'
|
|||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
// 创建axios实例
|
// create an axios instance
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: process.env.BASE_API, // api的base_url
|
baseURL: process.env.BASE_API, // api的base_url
|
||||||
timeout: 5000 // 请求超时时间
|
timeout: 5000 // request timeout
|
||||||
})
|
})
|
||||||
|
|
||||||
// request拦截器
|
// request interceptor
|
||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(config => {
|
||||||
// Do something before request is sent
|
// Do something before request is sent
|
||||||
if (store.getters.token) {
|
if (store.getters.token) {
|
||||||
config.headers['X-Token'] = getToken() // 让每个请求携带token--['X-Token']为自定义key 请根据实际情况自行修改
|
config.headers['X-Token'] = getToken() // 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}, error => {
|
}, error => {
|
||||||
@@ -22,7 +22,7 @@ service.interceptors.request.use(config => {
|
|||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
// respone拦截器
|
// respone interceptor
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
response => response,
|
response => response,
|
||||||
/**
|
/**
|
||||||
|
2
src/vendor/Export2Excel.js
vendored
2
src/vendor/Export2Excel.js
vendored
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
require('script-loader!file-saver');
|
require('script-loader!file-saver');
|
||||||
require('script-loader!vendor/Blob');
|
require('script-loader!@/vendor/Blob');
|
||||||
import XLSX from 'xlsx'
|
import XLSX from 'xlsx'
|
||||||
|
|
||||||
function generateArray(table) {
|
function generateArray(table) {
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container" style='height:100vh'>
|
<div class='chart-container'>
|
||||||
<div class='chart-container'>
|
<chart height='100%' width='100%'></chart>
|
||||||
<chart height='100%' width='100%'></chart>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -18,8 +16,9 @@ export default {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.chart-container{
|
.chart-container{
|
||||||
position: relative;
|
position: relative;
|
||||||
|
padding: 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 90%;
|
height: 85vh;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container" style='height:100vh'>
|
<div class='chart-container'>
|
||||||
<div class='chart-container'>
|
<chart height='100%' width='100%'></chart>
|
||||||
<chart height='100%' width='100%'></chart>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -18,8 +16,9 @@ export default {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.chart-container{
|
.chart-container{
|
||||||
position: relative;
|
position: relative;
|
||||||
|
padding:20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80%;
|
height:85vh;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container" style='height:100vh'>
|
<div class='chart-container'>
|
||||||
<div class='chart-container'>
|
<chart height='100%' width='100%'></chart>
|
||||||
<chart height='100%' width='100%'></chart>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -18,9 +16,9 @@ export default {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.chart-container{
|
.chart-container{
|
||||||
position: relative;
|
position: relative;
|
||||||
|
padding: 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 90%;
|
height:85vh;
|
||||||
padding-bottom: 40px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-tabs v-model="activeName">
|
<el-tabs v-model="activeName">
|
||||||
<el-tab-pane label="use clipboard directly" name="directly">
|
<el-tab-pane label="use clipboard directly" name="directly">
|
||||||
<el-input v-model="inputData" placeholder="请输入内容" style='width:400px;'></el-input>
|
<el-input v-model="inputData" placeholder="Please input" style='width:400px;'></el-input>
|
||||||
<el-button type="primary" icon="document" @click='handleCopy(inputData,$event)'>copy</el-button>
|
<el-button type="primary" icon="document" @click='handleCopy(inputData,$event)'>copy</el-button>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="use clipboard by v-directive" name="v-directive">
|
<el-tab-pane label="use clipboard by v-directive" name="v-directive">
|
||||||
<el-input v-model="inputData" placeholder="请输入内容" style='width:400px;'></el-input>
|
<el-input v-model="inputData" placeholder="Please input" style='width:400px;'></el-input>
|
||||||
<el-button type="primary" icon="document" v-clipboard:copy='inputData' v-clipboard:success='clipboardSuccess'>copy</el-button>
|
<el-button type="primary" icon="document" v-clipboard:copy='inputData' v-clipboard:success='clipboardSuccess'>copy</el-button>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>这里核心代码用的是
|
<code>This is based on
|
||||||
<a class="link-type" href="//github.com/dai-siki/vue-image-crop-upload"> vue-image-crop-upload</a>
|
<a class="link-type" href="//github.com/dai-siki/vue-image-crop-upload"> vue-image-crop-upload</a>.
|
||||||
由于我在使用时它只有vue@1版本,而且有些业务的需求耦合到七牛等等原因吧,自己改造了一下,如果大家要使用的话,优先还是使用官方component
|
{{$t('components.imageUploadTips')}}
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
<pan-thumb :image="image"></pan-thumb>
|
<pan-thumb :image="image"></pan-thumb>
|
||||||
|
|
||||||
<el-button type="primary" icon="upload" style="position: absolute;bottom: 15px;margin-left: 40px;" @click="imagecropperShow=true">修改头像
|
<el-button type="primary" icon="upload" style="position: absolute;bottom: 15px;margin-left: 40px;" @click="imagecropperShow=true">Change avatar
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<image-cropper :width="300" :height="300" url="https://httpbin.org/post" @close='close' @crop-upload-success="cropSuccess"
|
<image-cropper :width="300" :height="300" url="https://httpbin.org/post" @close='close' @crop-upload-success="cropSuccess" langType="en"
|
||||||
:key="imagecropperKey" v-show="imagecropperShow"></image-cropper>
|
:key="imagecropperKey" v-show="imagecropperShow"></image-cropper>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -1,134 +1,121 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>页面滚动到指定位置会在右下角出现返回顶部按钮</code>
|
<code>{{$t('components.backToTopTips1')}}</code>
|
||||||
<code>可自定义按钮的样式、show/hide临界点、返回的位置 如需文字提示,可在外部使用Element的el-tooltip元素 </code>
|
<code>{{$t('components.backToTopTips2')}}</code>
|
||||||
<div>我是占位</div>
|
<div class="placeholder-container">
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
</div>
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<div>我是占位</div>
|
|
||||||
<!--可自定义按钮的样式、show/hide临界点、返回的位置 -->
|
<!--可自定义按钮的样式、show/hide临界点、返回的位置 -->
|
||||||
<!--如需文字提示,可在外部添加element的<el-tooltip></el-tooltip>元素 -->
|
<!--如需文字提示,可在外部添加element的<el-tooltip></el-tooltip>元素 -->
|
||||||
<el-tooltip placement="top" content="文字提示">
|
<el-tooltip placement="top" content="tooltip">
|
||||||
<back-to-top transitionName="fade" :customStyle="myBackToTopStyle" :visibilityHeight="300" :backPosition="50"></back-to-top>
|
<back-to-top transitionName="fade" :customStyle="myBackToTopStyle" :visibilityHeight="300" :backPosition="50"></back-to-top>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
@@ -148,10 +135,16 @@ export default {
|
|||||||
width: '40px',
|
width: '40px',
|
||||||
height: '40px',
|
height: '40px',
|
||||||
'border-radius': '4px',
|
'border-radius': '4px',
|
||||||
'line-height': '45px', // 请保持与高度一致以垂直居中
|
'line-height': '45px', // 请保持与高度一致以垂直居中 Please keep consistent with height to center vertically
|
||||||
background: '#e7eaf1'// 按钮的背景颜色
|
background: '#e7eaf1'// 按钮的背景颜色 The background color of the button
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.placeholder-container div {
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<a href="https://github.com/SortableJS/Vue.Draggable" target="_blank">Vue.Draggable</a>
|
<a href="https://github.com/SortableJS/Vue.Draggable" target="_blank">Vue.Draggable</a>
|
||||||
</code>
|
</code>
|
||||||
<div class="editor-container">
|
<div class="editor-container">
|
||||||
<dnd-list :list1="list1" :list2="list2" list1Title="头条列表" list2Title="文章池"></dnd-list>
|
<dnd-list :list1="list1" :list2="list2" list1Title="List" list2Title="Article pool"></dnd-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -14,7 +14,7 @@ import DndList from '@/components/DndList'
|
|||||||
import { fetchList } from '@/api/article'
|
import { fetchList } from '@/api/article'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'dnd-list-demo',
|
name: 'dndList-demo',
|
||||||
components: { DndList },
|
components: { DndList },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>
|
<code>
|
||||||
基于<a class="link-type" href="https://github.com/rowanwins/vue-dropzone"> dropzone </a>封装 ,
|
Based on <a class="link-type" href="https://github.com/rowanwins/vue-dropzone"> dropzone </a>.
|
||||||
由于我司业务有特殊需求,而且要传七牛 所以没用第三方 选择了自己封装
|
{{$t('components.dropzoneTips')}}
|
||||||
</code>
|
</code>
|
||||||
<div class="editor-container">
|
<div class="editor-container">
|
||||||
<dropzone v-on:dropzone-removedFile="dropzoneR" v-on:dropzone-success="dropzoneS" id="myVueDropzone" url="https://httpbin.org/post"></dropzone>
|
<dropzone v-on:dropzone-removedFile="dropzoneR" v-on:dropzone-success="dropzoneS" id="myVueDropzone" url="https://httpbin.org/post"></dropzone>
|
||||||
@@ -19,11 +19,11 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
dropzoneS(file) {
|
dropzoneS(file) {
|
||||||
console.log(file)
|
console.log(file)
|
||||||
this.$message({ message: '上传成功', type: 'success' })
|
this.$message({ message: 'Upload success', type: 'success' })
|
||||||
},
|
},
|
||||||
dropzoneR(file) {
|
dropzoneR(file) {
|
||||||
console.log(file)
|
console.log(file)
|
||||||
this.$message({ message: '删除成功', type: 'success' })
|
this.$message({ message: 'Delete success', type: 'success' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>Markdown 我们这里选用了
|
<code>Markdown is based on
|
||||||
<a href="https://github.com/sparksuite/simplemde-markdown-editor" target="_blank">simplemde-markdown-editor</a> ,简单的用vue封装了一下
|
<a href="https://github.com/sparksuite/simplemde-markdown-editor" target="_blank">simplemde-markdown-editor</a> ,Simply encapsulated in Vue.
|
||||||
<a target="_blank" href="https://segmentfault.com/a/1190000009762198#articleHeader14">
|
<a target="_blank" href="https://segmentfault.com/a/1190000009762198#articleHeader14">
|
||||||
相关文章 </a>
|
相关文章 </a>
|
||||||
</code>
|
</code>
|
||||||
<div class="editor-container">
|
<div class="editor-container">
|
||||||
<markdown-editor id="contentEditor" ref="contentEditor" v-model="content" :height="300" :zIndex="20"></markdown-editor>
|
<markdown-editor id="contentEditor" ref="contentEditor" v-model="content" :height="300" :zIndex="20"></markdown-editor>
|
||||||
</div>
|
</div>
|
||||||
<el-button @click="markdown2Html" style="margin-top:80px;" type="primary" icon="el-icon-document">转为HTML</el-button>
|
<el-button @click="markdown2Html" style="margin-top:80px;" type="primary" icon="el-icon-document">To HTML</el-button>
|
||||||
<div v-html="html"></div>
|
<div v-html="html"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>splitPane 如果你用过
|
<code><strong>SplitPane</strong> If you've used
|
||||||
<a href="http://codepen.io/" target="_blank"> codepen</a>,
|
<a href="http://codepen.io/" target="_blank"> codepen</a>,
|
||||||
<a href="https://jsfiddle.net/" target="_blank"> jsfiddle </a>就不会陌生了
|
<a href="https://jsfiddle.net/" target="_blank"> jsfiddle </a>will not be unfamiliar.
|
||||||
<a href="https://github.com/PanJiaChen/vue-split-pane" target='_blank'>项目地址</a>
|
<a href="https://github.com/PanJiaChen/vue-split-pane" target='_blank'> Github repository</a>
|
||||||
</code>
|
</code>
|
||||||
<split-pane v-on:resize="resize" split="vertical">
|
<split-pane v-on:resize="resize" split="vertical">
|
||||||
<template slot="paneL">
|
<template slot="paneL">
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<sticky className="sub-navbar">
|
<sticky className="sub-navbar">
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<el-button>
|
<el-button plain>
|
||||||
平台<i class="el-icon-caret-bottom el-icon--right"></i>
|
Platform<i class="el-icon-caret-bottom el-icon--right"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown-menu class="no-border" slot="dropdown">
|
<el-dropdown-menu class="no-border" slot="dropdown">
|
||||||
<el-checkbox-group v-model="platforms" style="padding: 5px 15px;">
|
<el-checkbox-group v-model="platforms" style="padding: 5px 15px;">
|
||||||
@@ -15,79 +15,79 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<el-button>
|
<el-button plain>
|
||||||
外链<i class="el-icon-caret-bottom el-icon--right"></i>
|
Link<i class="el-icon-caret-bottom el-icon--right"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown-menu class="no-padding no-border" style="width:300px" slot="dropdown">
|
<el-dropdown-menu class="no-padding no-border" style="width:300px" slot="dropdown">
|
||||||
<el-input placeholder="请输入内容" v-model="url">
|
<el-input placeholder="Please enter the content" v-model="url">
|
||||||
<template slot="prepend">填写url</template>
|
<template slot="prepend">Url</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
<div class="time-container">
|
<div class="time-container">
|
||||||
<el-date-picker v-model="time" type="datetime" :picker-options="pickerOptions" format="yyyy-MM-dd HH:mm:ss" placeholder="发布时间">
|
<el-date-picker v-model="time" type="datetime" :picker-options="pickerOptions" format="yyyy-MM-dd HH:mm:ss" placeholder="Release time">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-button style="margin-left: 10px;" type="success">发布
|
<el-button style="margin-left: 10px;" type="success">publish
|
||||||
</el-button>
|
</el-button>
|
||||||
</sticky>
|
</sticky>
|
||||||
|
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>Sticky header 当页面滚动到预设的位置会吸附在顶部</code>
|
<code>Sticky header, {{$t('components.stickyTips')}}</code>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
<div>我是占位</div>
|
<div>placeholder</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -105,9 +105,9 @@ export default {
|
|||||||
url: '',
|
url: '',
|
||||||
platforms: ['a-platform'],
|
platforms: ['a-platform'],
|
||||||
platformsOptions: [
|
platformsOptions: [
|
||||||
{ key: 'a-platform', name: '平台A' },
|
{ key: 'a-platform', name: 'platformA' },
|
||||||
{ key: 'b-platform', name: '平台B' },
|
{ key: 'b-platform', name: 'platformB' },
|
||||||
{ key: 'c-platform', name: '平台C' }
|
{ key: 'c-platform', name: 'platformC' }
|
||||||
],
|
],
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
disabledDate(time) {
|
disabledDate(time) {
|
||||||
@@ -120,8 +120,11 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.time-container {
|
.components-container div {
|
||||||
display: inline-block;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
|
||||||
|
.time-container {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>公司做的后台主要是一个cms系统,公司也是以自媒体为核心的,所以富文本是后台很核心的功能。在选择富文本的过程中也走了不少的弯路,市面上常见的富文本都基本用过了,最终选择了Tinymce
|
<code>
|
||||||
<a target="_blank" class="link-type" href="https://panjiachen.github.io/vue-element-admin-site/#/rich-editor">文档介绍</a>
|
{{$t('components.tinymceTips')}}
|
||||||
|
<a target="_blank" class="link-type" href="https://panjiachen.github.io/vue-element-admin-site/#/rich-editor"> {{$t('components.documentation')}}</a>
|
||||||
</code>
|
</code>
|
||||||
<div>
|
<div>
|
||||||
<tinymce :height="200" v-model="content"></tinymce>
|
<tinymce :height="300" v-model="content"></tinymce>
|
||||||
</div>
|
</div>
|
||||||
<div class="editor-content" v-html="content"></div>
|
<div class="editor-content" v-html="content"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -18,7 +19,14 @@ export default {
|
|||||||
components: { Tinymce },
|
components: { Tinymce },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
content: 'Tinymce'
|
content:
|
||||||
|
`<h1 style="text-align: center;">Welcome to the TinyMCE demo!</h1>
|
||||||
|
<ul>
|
||||||
|
<li>Our <a href="//www.tinymce.com/docs/">documentation</a> is a great resource for learning how to configure TinyMCE.</li>
|
||||||
|
<li>Have a specific question? Visit the <a href="https://community.tinymce.com/forum/">Community Forum</a>.</li>
|
||||||
|
<li>We also offer enterprise grade support as part of <a href="https://tinymce.com/pricing">TinyMCE premium subscriptions</a>.</li>
|
||||||
|
</ul>
|
||||||
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echarts from 'echarts'
|
import echarts from 'echarts'
|
||||||
require('echarts/theme/macarons') // echarts 主题
|
require('echarts/theme/macarons') // echarts theme
|
||||||
import { debounce } from '@/utils'
|
import { debounce } from '@/utils'
|
||||||
|
|
||||||
const animationDuration = 6000
|
const animationDuration = 6000
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echarts from 'echarts'
|
import echarts from 'echarts'
|
||||||
require('echarts/theme/macarons') // echarts 主题
|
require('echarts/theme/macarons') // echarts theme
|
||||||
import { debounce } from '@/utils'
|
import { debounce } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-panel-description">
|
<div class="card-panel-description">
|
||||||
<div class="card-panel-text">New Visits</div>
|
<div class="card-panel-text">New Visits</div>
|
||||||
<count-to class="card-panel-num" :startVal="0" :endVal="102400" :duration="3600"></count-to>
|
<count-to class="card-panel-num" :startVal="0" :endVal="102400" :duration="2600"></count-to>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-panel-description">
|
<div class="card-panel-description">
|
||||||
<div class="card-panel-text">Messages</div>
|
<div class="card-panel-text">Messages</div>
|
||||||
<count-to class="card-panel-num" :startVal="0" :endVal="81212" :duration="4000"></count-to>
|
<count-to class="card-panel-num" :startVal="0" :endVal="81212" :duration="3000"></count-to>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-panel-description">
|
<div class="card-panel-description">
|
||||||
<div class="card-panel-text">Purchases</div>
|
<div class="card-panel-text">Purchases</div>
|
||||||
<count-to class="card-panel-num" :startVal="0" :endVal="9280" :duration="4000"></count-to>
|
<count-to class="card-panel-num" :startVal="0" :endVal="9280" :duration="3200"></count-to>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-panel-description">
|
<div class="card-panel-description">
|
||||||
<div class="card-panel-text">Shoppings</div>
|
<div class="card-panel-text">Shoppings</div>
|
||||||
<count-to class="card-panel-num" :startVal="0" :endVal="13600" :duration="4600"></count-to>
|
<count-to class="card-panel-num" :startVal="0" :endVal="13600" :duration="3600"></count-to>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echarts from 'echarts'
|
import echarts from 'echarts'
|
||||||
require('echarts/theme/macarons') // echarts 主题
|
require('echarts/theme/macarons') // echarts theme
|
||||||
import { debounce } from '@/utils'
|
import { debounce } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echarts from 'echarts'
|
import echarts from 'echarts'
|
||||||
require('echarts/theme/macarons') // echarts 主题
|
require('echarts/theme/macarons') // echarts theme
|
||||||
import { debounce } from '@/utils'
|
import { debounce } from '@/utils'
|
||||||
|
|
||||||
const animationDuration = 3000
|
const animationDuration = 3000
|
||||||
|
@@ -44,7 +44,7 @@ export default {
|
|||||||
fetchList().then(response => {
|
fetchList().then(response => {
|
||||||
this.list = response.data.items.slice(0, 7)
|
this.list = response.data.items.slice(0, 7)
|
||||||
})
|
})
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dashboard-editor-container">
|
<div class="dashboard-editor-container">
|
||||||
<div class=" clearfix">
|
<div class=" clearfix">
|
||||||
<pan-thumb style="float: left" :image="avatar"> 你的权限:
|
<pan-thumb style="float: left" :image="avatar"> Your roles:
|
||||||
<span class="pan-info-roles" :key='item' v-for="item in roles">{{item}}</span>
|
<span class="pan-info-roles" :key='item' v-for="item in roles">{{item}}</span>
|
||||||
</pan-thumb>
|
</pan-thumb>
|
||||||
<github-corner></github-corner>
|
<github-corner></github-corner>
|
||||||
<div class="info-container">
|
<div class="info-container">
|
||||||
<span class="display_name">{{name}}</span>
|
<span class="display_name">{{name}}</span>
|
||||||
<span style="font-size:20px;padding-top:20px;display:inline-block;">普通编辑dashboard</span>
|
<span style="font-size:20px;padding-top:20px;display:inline-block;">editor : dashboard</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@@ -1,16 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container documentation-container">
|
<div class="app-container documentation-container">
|
||||||
<a class="document-btn" target='_blank' href="https://panjiachen.github.io/vue-element-admin-site/#/">文档</a>
|
<a class="document-btn" target='_blank' href="https://panjiachen.github.io/vue-element-admin-site/#/">{{$t('documentation.documentation')}}</a>
|
||||||
<a class="document-btn" target='_blank' href="https://github.com/PanJiaChen/vue-element-admin/">Github 地址</a>
|
<a class="document-btn" target='_blank' href="https://github.com/PanJiaChen/vue-element-admin/">{{$t('documentation.github')}}</a>
|
||||||
<dropdown-menu style="float:left;margin-left:50px;" title='系列文章' :items='articleList'></dropdown-menu>
|
<dropdown-menu style="float:left;margin-left:50px;" title='系列文章' :items='articleList'></dropdown-menu>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import DropdownMenu from '@/components/Share/dropdownMenu'
|
import DropdownMenu from '@/components/Share/dropdownMenu'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'clipboardDemo',
|
name: 'documentation',
|
||||||
components: { DropdownMenu },
|
components: { DropdownMenu },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@@ -5,3 +5,9 @@
|
|||||||
<!--error code-->
|
<!--error code-->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'errorTestA'
|
||||||
|
}
|
||||||
|
</script>
|
11
src/views/errorLog/errorTestB.vue
Normal file
11
src/views/errorLog/errorTestB.vue
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<template>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
created() {
|
||||||
|
this.b = b // eslint-disable-line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@@ -1,21 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="errPage-container">
|
<div class="errPage-container">
|
||||||
<err-code></err-code>
|
<errorA></errorA>
|
||||||
|
<errorB></errorB>
|
||||||
<h3>请点击右上角bug小图表</h3>
|
<!-- $t is vue-i18n global function to translate lang -->
|
||||||
|
<h3>{{$t('errorLog.tips')}}</h3>
|
||||||
<code>
|
<code>
|
||||||
现在的管理后台基本都是spa的形式了,它增强了用户体验,但同时也会增加页面出问题的可能性,可能一个小小的疏忽就导致整个页面的死锁。好在Vue官网提供了一个方法来捕获处理异常
|
{{$t('errorLog.description')}}
|
||||||
|
<a target="_blank" class="link-type" href="https://panjiachen.github.io/vue-element-admin-site/#/error?id=%e4%bb%a3%e7%a0%81">
|
||||||
|
{{$t('errorLog.documentation')}}
|
||||||
|
</a>
|
||||||
</code>
|
</code>
|
||||||
<a href="#"><img src='http://panjiachen.github.io/images/errHandler.png'></a>
|
<a href="#">
|
||||||
|
<img src='https://wpimg.wallstcn.com/360e4842-4db5-42d0-b078-f9a84a825546.gif'>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import errCode from './errcode'
|
import errorA from './errorTestA'
|
||||||
|
import errorB from './errorTestB'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'errorLog',
|
name: 'errorLog',
|
||||||
components: { errCode }
|
components: { errorA, errorB }
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -1,45 +1,45 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-table :data="list"border fit highlight-current-row style="width: 100%">
|
<el-table :data="list" border fit highlight-current-row style="width: 100%">
|
||||||
|
|
||||||
<el-table-column align="center" label="序号" width="65" v-loading="loading"
|
<el-table-column align="center" label="ID" width="65" v-loading="loading"
|
||||||
element-loading-text="请给我点时间!">
|
element-loading-text="请给我点时间!">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.id}}</span>
|
<span>{{scope.row.id}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="180px" align="center" label="时间">
|
<el-table-column width="180px" align="center" label="Date">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column min-width="300px" label="标题">
|
<el-table-column min-width="300px" label="Title">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.title}}</span>
|
<span>{{scope.row.title}}</span>
|
||||||
<el-tag>{{scope.row.type}}</el-tag>
|
<el-tag>{{scope.row.type}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="110px" align="center" label="作者">
|
<el-table-column width="110px" align="center" label="Author">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.author}}</span>
|
<span>{{scope.row.author}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="80px" label="重要性">
|
<el-table-column width="120px" label="Importance">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon v-for="n in +scope.row.importance" icon-class="star" :key="n"></svg-icon>
|
<svg-icon v-for="n in +scope.row.importance" icon-class="star" :key="n"></svg-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="阅读数" width="95">
|
<el-table-column align="center" label="Readings" width="95">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.pageviews}}</span>
|
<span>{{scope.row.pageviews}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column class-name="status-col" label="状态" width="110">
|
<el-table-column class-name="status-col" label="Status" width="110">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -20,10 +20,10 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabMapOptions: [
|
tabMapOptions: [
|
||||||
{ label: '中国', key: 'CN' },
|
{ label: 'China', key: 'CN' },
|
||||||
{ label: '美国', key: 'US' },
|
{ label: 'USA', key: 'US' },
|
||||||
{ label: '日本', key: 'JP' },
|
{ label: 'Japan', key: 'JP' },
|
||||||
{ label: '欧元区', key: 'EU' }
|
{ label: 'Eurozone', key: 'EU' }
|
||||||
],
|
],
|
||||||
activeName: 'CN',
|
activeName: 'CN',
|
||||||
createdTimes: 0
|
createdTimes: 0
|
||||||
|
@@ -1,84 +1,84 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container calendar-list-container">
|
<div class="app-container calendar-list-container">
|
||||||
<div class="filter-container">
|
<div class="filter-container">
|
||||||
<el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="标题" v-model="listQuery.title">
|
<el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" :placeholder="$t('table.title')" v-model="listQuery.title">
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-select clearable style="width: 90px" class="filter-item" v-model="listQuery.importance" placeholder="重要性">
|
<el-select clearable style="width: 90px" class="filter-item" v-model="listQuery.importance" :placeholder="$t('table.importance')">
|
||||||
<el-option v-for="item in importanceOptions" :key="item" :label="item" :value="item">
|
<el-option v-for="item in importanceOptions" :key="item" :label="item" :value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select clearable class="filter-item" style="width: 130px" v-model="listQuery.type" placeholder="类型">
|
<el-select clearable class="filter-item" style="width: 130px" v-model="listQuery.type" :placeholder="$t('table.type')">
|
||||||
<el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name+'('+item.key+')'" :value="item.key">
|
<el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name+'('+item.key+')'" :value="item.key">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select @change='handleFilter' style="width: 120px" class="filter-item" v-model="listQuery.sort" placeholder="排序">
|
<el-select @change='handleFilter' style="width: 140px" class="filter-item" v-model="listQuery.sort">
|
||||||
<el-option v-for="item in sortOptions" :key="item.key" :label="item.label" :value="item.key">
|
<el-option v-for="item in sortOptions" :key="item.key" :label="item.label" :value="item.key">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜索</el-button>
|
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||||
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加</el-button>
|
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
|
||||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
|
<el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">{{$t('table.export')}}</el-button>
|
||||||
<el-checkbox class="filter-item" style='margin-left:15px;' @change='tableKey=tableKey+1' v-model="showAuditor">显示审核人</el-checkbox>
|
<el-checkbox class="filter-item" style='margin-left:15px;' @change='tableKey=tableKey+1' v-model="showReviewer">{{$t('table.reviewer')}}</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
|
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
|
||||||
style="width: 100%">
|
style="width: 100%">
|
||||||
<el-table-column align="center" label="序号" width="65">
|
<el-table-column align="center" :label="$t('table.id')" width="65">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.id}}</span>
|
<span>{{scope.row.id}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column width="180px" align="center" label="时间">
|
<el-table-column width="150px" align="center" :label="$t('table.date')">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column min-width="150px" label="标题">
|
<el-table-column min-width="150px" :label="$t('table.title')">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span class="link-type" @click="handleUpdate(scope.row)">{{scope.row.title}}</span>
|
<span class="link-type" @click="handleUpdate(scope.row)">{{scope.row.title}}</span>
|
||||||
<el-tag>{{scope.row.type | typeFilter}}</el-tag>
|
<el-tag>{{scope.row.type | typeFilter}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column width="110px" align="center" label="作者">
|
<el-table-column width="110px" align="center" :label="$t('table.author')">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.author}}</span>
|
<span>{{scope.row.author}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column width="110px" v-if='showAuditor' align="center" label="审核人">
|
<el-table-column width="110px" v-if='showReviewer' align="center" :label="$t('table.reviewer')">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span style='color:red;'>{{scope.row.auditor}}</span>
|
<span style='color:red;'>{{scope.row.reviewer}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column width="80px" label="重要性">
|
<el-table-column width="80px" :label="$t('table.importance')">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon v-for="n in +scope.row.importance" icon-class="star" class="meta-item__icon" :key="n"></svg-icon>
|
<svg-icon v-for="n in +scope.row.importance" icon-class="star" class="meta-item__icon" :key="n"></svg-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="阅读数" width="95">
|
<el-table-column align="center" :label="$t('table.readings')" width="95">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.pageviews" class="link-type" @click='handleFetchPv(scope.row.pageviews)'>{{scope.row.pageviews}}</span>
|
<span v-if="scope.row.pageviews" class="link-type" @click='handleFetchPv(scope.row.pageviews)'>{{scope.row.pageviews}}</span>
|
||||||
<span v-else>无</span>
|
<span v-else>0</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column class-name="status-col" label="状态" width="100">
|
<el-table-column class-name="status-col" :label="$t('table.status')" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="操作" width="220" class-name="small-padding">
|
<el-table-column align="center" :label="$t('table.actions')" width="230" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
|
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
|
||||||
<el-button v-if="scope.row.status!='published'" size="mini" type="success" @click="handleModifyStatus(scope.row,'published')">发布
|
<el-button v-if="scope.row.status!='published'" size="mini" type="success" @click="handleModifyStatus(scope.row,'published')">{{$t('table.publish')}}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="scope.row.status!='draft'" size="mini" @click="handleModifyStatus(scope.row,'draft')">草稿
|
<el-button v-if="scope.row.status!='draft'" size="mini" @click="handleModifyStatus(scope.row,'draft')">{{$t('table.draft')}}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="scope.row.status!='deleted'" size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">删除
|
<el-button v-if="scope.row.status!='deleted'" size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">{{$t('table.delete')}}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<div v-show="!listLoading" class="pagination-container">
|
<div class="pagination-container">
|
||||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page"
|
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page"
|
||||||
:page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
:page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||||
</el-pagination>
|
</el-pagination>
|
||||||
@@ -86,47 +86,47 @@
|
|||||||
|
|
||||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="70px" style='width: 400px; margin-left:50px;'>
|
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="70px" style='width: 400px; margin-left:50px;'>
|
||||||
<el-form-item label="类型" prop="type">
|
<el-form-item :label="$t('table.type')" prop="type">
|
||||||
<el-select class="filter-item" v-model="temp.type" placeholder="请选择">
|
<el-select class="filter-item" v-model="temp.type" placeholder="Please select">
|
||||||
<el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name" :value="item.key">
|
<el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name" :value="item.key">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="时间" prop="timestamp">
|
<el-form-item :label="$t('table.date')" prop="timestamp">
|
||||||
<el-date-picker v-model="temp.timestamp" type="datetime" placeholder="选择日期时间">
|
<el-date-picker v-model="temp.timestamp" type="datetime" placeholder="Please pick a date">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="标题" prop="title">
|
<el-form-item :label="$t('table.title')" prop="title">
|
||||||
<el-input v-model="temp.title"></el-input>
|
<el-input v-model="temp.title"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态">
|
<el-form-item :label="$t('table.status')">
|
||||||
<el-select class="filter-item" v-model="temp.status" placeholder="请选择">
|
<el-select class="filter-item" v-model="temp.status" placeholder="Please select">
|
||||||
<el-option v-for="item in statusOptions" :key="item" :label="item" :value="item">
|
<el-option v-for="item in statusOptions" :key="item" :label="item" :value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="重要性">
|
<el-form-item :label="$t('table.importance')">
|
||||||
<el-rate style="margin-top:8px;" v-model="temp.importance" :colors="['#99A9BF', '#F7BA2A', '#FF9900']" :max='3'></el-rate>
|
<el-rate style="margin-top:8px;" v-model="temp.importance" :colors="['#99A9BF', '#F7BA2A', '#FF9900']" :max='3'></el-rate>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="点评">
|
<el-form-item :label="$t('table.remark')">
|
||||||
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="temp.remark">
|
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="Please input" v-model="temp.remark">
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
|
||||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确 定</el-button>
|
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
|
||||||
<el-button v-else type="primary" @click="updateData">确 定</el-button>
|
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog title="阅读数统计" :visible.sync="dialogPvVisible">
|
<el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
|
||||||
<el-table :data="pvData" border fit highlight-current-row style="width: 100%">
|
<el-table :data="pvData" border fit highlight-current-row style="width: 100%">
|
||||||
<el-table-column prop="key" label="渠道"> </el-table-column>
|
<el-table-column prop="key" label="Channel"> </el-table-column>
|
||||||
<el-table-column prop="pv" label="pv"> </el-table-column>
|
<el-table-column prop="pv" label="Pv"> </el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="dialogPvVisible = false">确 定</el-button>
|
<el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
@@ -139,13 +139,13 @@ import waves from '@/directive/waves' // 水波纹指令
|
|||||||
import { parseTime } from '@/utils'
|
import { parseTime } from '@/utils'
|
||||||
|
|
||||||
const calendarTypeOptions = [
|
const calendarTypeOptions = [
|
||||||
{ key: 'CN', display_name: '中国' },
|
{ key: 'CN', display_name: 'China' },
|
||||||
{ key: 'US', display_name: '美国' },
|
{ key: 'US', display_name: 'USA' },
|
||||||
{ key: 'JP', display_name: '日本' },
|
{ key: 'JP', display_name: 'Japan' },
|
||||||
{ key: 'EU', display_name: '欧元区' }
|
{ key: 'EU', display_name: 'Eurozone' }
|
||||||
]
|
]
|
||||||
|
|
||||||
// arr to obj ,such as { CN : "中国", US : "美国" }
|
// arr to obj ,such as { CN : "China", US : "USA" }
|
||||||
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
|
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
|
||||||
acc[cur.key] = cur.display_name
|
acc[cur.key] = cur.display_name
|
||||||
return acc
|
return acc
|
||||||
@@ -172,9 +172,9 @@ export default {
|
|||||||
},
|
},
|
||||||
importanceOptions: [1, 2, 3],
|
importanceOptions: [1, 2, 3],
|
||||||
calendarTypeOptions,
|
calendarTypeOptions,
|
||||||
sortOptions: [{ label: '按ID升序列', key: '+id' }, { label: '按ID降序', key: '-id' }],
|
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
||||||
statusOptions: ['published', 'draft', 'deleted'],
|
statusOptions: ['published', 'draft', 'deleted'],
|
||||||
showAuditor: false,
|
showReviewer: false,
|
||||||
temp: {
|
temp: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
importance: 1,
|
importance: 1,
|
||||||
@@ -187,8 +187,8 @@ export default {
|
|||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
dialogStatus: '',
|
dialogStatus: '',
|
||||||
textMap: {
|
textMap: {
|
||||||
update: '编辑',
|
update: 'Edit',
|
||||||
create: '创建'
|
create: 'Create'
|
||||||
},
|
},
|
||||||
dialogPvVisible: false,
|
dialogPvVisible: false,
|
||||||
pvData: [],
|
pvData: [],
|
||||||
@@ -196,7 +196,8 @@ export default {
|
|||||||
type: [{ required: true, message: 'type is required', trigger: 'change' }],
|
type: [{ required: true, message: 'type is required', trigger: 'change' }],
|
||||||
timestamp: [{ type: 'date', required: true, message: 'timestamp is required', trigger: 'change' }],
|
timestamp: [{ type: 'date', required: true, message: 'timestamp is required', trigger: 'change' }],
|
||||||
title: [{ required: true, message: 'title is required', trigger: 'blur' }]
|
title: [{ required: true, message: 'title is required', trigger: 'blur' }]
|
||||||
}
|
},
|
||||||
|
downloadLoading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
@@ -266,7 +267,7 @@ export default {
|
|||||||
this.$refs['dataForm'].validate((valid) => {
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.temp.id = parseInt(Math.random() * 100) + 1024 // mock a id
|
this.temp.id = parseInt(Math.random() * 100) + 1024 // mock a id
|
||||||
this.temp.author = '原创作者'
|
this.temp.author = 'vue-element-admin'
|
||||||
createArticle(this.temp).then(() => {
|
createArticle(this.temp).then(() => {
|
||||||
this.list.unshift(this.temp)
|
this.list.unshift(this.temp)
|
||||||
this.dialogFormVisible = false
|
this.dialogFormVisible = false
|
||||||
@@ -330,12 +331,13 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleDownload() {
|
handleDownload() {
|
||||||
require.ensure([], () => {
|
this.downloadLoading = true
|
||||||
const { export_json_to_excel } = require('vendor/Export2Excel')
|
import('@/vendor/Export2Excel').then(excel => {
|
||||||
const tHeader = ['时间', '地区', '类型', '标题', '重要性']
|
const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||||
const filterVal = ['timestamp', 'province', 'type', 'title', 'importance']
|
const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||||
const data = this.formatJson(filterVal, this.list)
|
const data = this.formatJson(filterVal, this.list)
|
||||||
export_json_to_excel(tHeader, data, 'table数据')
|
excel.export_json_to_excel(tHeader, data, 'table-list')
|
||||||
|
this.downloadLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
formatJson(filterVal, jsonData) {
|
formatJson(filterVal, jsonData) {
|
||||||
|
@@ -1,60 +1,60 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container calendar-list-container">
|
<div class="app-container calendar-list-container">
|
||||||
|
<!-- Note that row-key is necessary to get a correct row order. -->
|
||||||
|
<el-table :data="list" row-key="id" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%">
|
||||||
|
|
||||||
<el-table :data="list" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%">
|
<el-table-column align="center" label="ID" width="65">
|
||||||
|
|
||||||
<el-table-column align="center" label="序号" width="65">
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.id}}</span>
|
<span>{{scope.row.id}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="180px" align="center" label="时间">
|
<el-table-column width="180px" align="center" label="Date">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column min-width="300px" label="标题">
|
<el-table-column min-width="300px" label="Title">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.title}}</span>
|
<span>{{scope.row.title}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="110px" align="center" label="作者">
|
<el-table-column width="110px" align="center" label="Author">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.author}}</span>
|
<span>{{scope.row.author}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="80px" label="重要性">
|
<el-table-column width="100px" label="Importance">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon v-for="n in +scope.row.importance" icon-class="star" class="meta-item__icon" :key="n"></svg-icon>
|
<svg-icon v-for="n in +scope.row.importance" icon-class="star" class="icon-star" :key="n"></svg-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="阅读数" width="95">
|
<el-table-column align="center" label="Readings" width="95">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.pageviews}}</span>
|
<span>{{scope.row.pageviews}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column class-name="status-col" label="状态" width="110">
|
<el-table-column class-name="status-col" label="Status" width="110">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="拖拽" width="95">
|
<el-table-column align="center" label="Drag" width="80">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon class='drag-handler' icon-class="drag"></svg-icon>
|
<svg-icon class='drag-handler' icon-class="drag"></svg-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<!-- $t is vue-i18n global function to translate lang (lang in @/lang) -->
|
||||||
<div class='show-d'>默认顺序 {{ olderList}}</div>
|
<div class='show-d'>{{$t('table.dragTips1')}} : {{ oldList}}</div>
|
||||||
<div class='show-d'>拖拽后顺序{{newList}}</div>
|
<div class='show-d'>{{$t('table.dragTips2')}} : {{newList}}</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -75,7 +75,7 @@ export default {
|
|||||||
limit: 10
|
limit: 10
|
||||||
},
|
},
|
||||||
sortable: null,
|
sortable: null,
|
||||||
olderList: [],
|
oldList: [],
|
||||||
newList: []
|
newList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -99,8 +99,8 @@ export default {
|
|||||||
this.list = response.data.items
|
this.list = response.data.items
|
||||||
this.total = response.data.total
|
this.total = response.data.total
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
this.olderList = this.list.map(v => v.id)
|
this.oldList = this.list.map(v => v.id)
|
||||||
this.newList = this.olderList.slice()
|
this.newList = this.oldList.slice()
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.setSort()
|
this.setSort()
|
||||||
})
|
})
|
||||||
@@ -109,7 +109,12 @@ export default {
|
|||||||
setSort() {
|
setSort() {
|
||||||
const el = document.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
|
const el = document.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
|
||||||
this.sortable = Sortable.create(el, {
|
this.sortable = Sortable.create(el, {
|
||||||
|
ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
|
||||||
onEnd: evt => {
|
onEnd: evt => {
|
||||||
|
const targetRow = this.list.splice(evt.oldIndex, 1)[0]
|
||||||
|
this.list.splice(evt.newIndex, 0, targetRow)
|
||||||
|
|
||||||
|
// for show the changes, you can delete in you code
|
||||||
const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]
|
const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]
|
||||||
this.newList.splice(evt.newIndex, 0, tempIndex)
|
this.newList.splice(evt.newIndex, 0, tempIndex)
|
||||||
}
|
}
|
||||||
@@ -119,10 +124,21 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.sortable-ghost{
|
||||||
|
opacity: .8;
|
||||||
|
color: #fff!important;
|
||||||
|
background: #42b983!important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.icon-star{
|
||||||
|
margin-right:2px;
|
||||||
|
}
|
||||||
.drag-handler{
|
.drag-handler{
|
||||||
width: 30px;
|
width: 20px;
|
||||||
height: 30px;
|
height: 20px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.show-d{
|
.show-d{
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<el-table :data="tableData" :key='key' border fit highlight-current-row style="width: 100%">
|
<el-table :data="tableData" :key='key' border fit highlight-current-row style="width: 100%">
|
||||||
<el-table-column prop="name" label="fruitName" width="180"></el-table-column>
|
<el-table-column prop="name" label="fruitName" width="180"></el-table-column>
|
||||||
<el-table-column :key='fruit' v-for='(fruit,index) in formThead' :label="fruit">
|
<el-table-column :key='fruit' v-for='fruit in formThead' :label="fruit">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row[fruit]}}
|
{{scope.row[fruit]}}
|
||||||
</template>
|
</template>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const defaultFormThead = ['apple', 'banana'] // 默认选中项
|
const defaultFormThead = ['apple', 'banana']
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -42,15 +42,15 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
key: 1, // table key
|
key: 1, // table key
|
||||||
formTheadOptions: ['apple', 'banana', 'orange'], // 可选择表头
|
formTheadOptions: ['apple', 'banana', 'orange'],
|
||||||
checkboxVal: defaultFormThead, // checkboxVal
|
checkboxVal: defaultFormThead, // checkboxVal
|
||||||
formThead: defaultFormThead // 默认表头
|
formThead: defaultFormThead // 默认表头 Default header
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
checkboxVal(valArr) {
|
checkboxVal(valArr) {
|
||||||
this.formThead = this.formTheadOptions.filter(i => valArr.indexOf(i) >= 0)
|
this.formThead = this.formTheadOptions.filter(i => valArr.indexOf(i) >= 0)
|
||||||
this.key = this.key + 1// 为了保证table 每次都会重渲 (牺牲性能保证效果,当然也可以不用)
|
this.key = this.key + 1// 为了保证table 每次都会重渲 In order to ensure the table will be re-rendered each time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<div style='margin:0 0 5px 20px'>固定表头 按照表头顺序排序</div>
|
<div style='margin:0 0 5px 20px'>{{$t('table.dynamicTips1')}}</div>
|
||||||
<fixed-thead></fixed-thead>
|
<fixed-thead></fixed-thead>
|
||||||
|
|
||||||
<div style='margin:30px 0 5px 20px'>不固定表头 按照点击顺序排序</div>
|
<div style='margin:30px 0 5px 20px'>{{$t('table.dynamicTips2')}}</div>
|
||||||
<unfixed-thead></unfixed-thead>
|
<unfixed-thead></unfixed-thead>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
<el-table :data="tableData" border fit highlight-current-row style="width: 100%">
|
<el-table :data="tableData" border fit highlight-current-row style="width: 100%">
|
||||||
<el-table-column prop="name" label="fruitName" width="180">
|
<el-table-column prop="name" label="fruitName" width="180">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :key='fruit' v-for='(fruit,index) in formThead' :label="fruit">
|
<el-table-column :key='fruit' v-for='fruit in formThead' :label="fruit">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row[fruit]}}
|
{{scope.row[fruit]}}
|
||||||
</template>
|
</template>
|
||||||
|
@@ -11,7 +11,7 @@ export default {
|
|||||||
name: 'TableMain',
|
name: 'TableMain',
|
||||||
computed: {
|
computed: {
|
||||||
cachedViews() {
|
cachedViews() {
|
||||||
return this.$store.state.app.cachedViews
|
return this.$store.state.tagsView.cachedViews
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,46 +3,50 @@
|
|||||||
|
|
||||||
<el-table :data="list" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%">
|
<el-table :data="list" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%">
|
||||||
|
|
||||||
<el-table-column align="center" label="序号" width="80">
|
<el-table-column align="center" label="ID" width="80">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.id}}</span>
|
<span>{{scope.row.id}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="180px" align="center" label="时间">
|
<el-table-column width="180px" align="center" label="Date">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="120px" align="center" label="作者">
|
<el-table-column width="120px" align="center" label="Author">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{scope.row.author}}</span>
|
<span>{{scope.row.author}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="100px" label="重要性">
|
<el-table-column width="100px" label="Importance">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon v-for="n in +scope.row.importance" icon-class="star" class="meta-item__icon" :key="n"></svg-icon>
|
<svg-icon v-for="n in +scope.row.importance" icon-class="star" class="meta-item__icon" :key="n"></svg-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column class-name="status-col" label="状态" width="110">
|
<el-table-column class-name="status-col" label="Status" width="110">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
<el-tag :type="scope.row.status | statusFilter">{{scope.row.status}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column min-width="300px" label="标题">
|
<el-table-column min-width="300px" label="Title">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-show="scope.row.edit" size="small" v-model="scope.row.title"></el-input>
|
<template v-if="scope.row.edit">
|
||||||
<span v-show="!scope.row.edit">{{ scope.row.title }}</span>
|
<el-input class="edit-input" size="small" v-model="scope.row.title"></el-input>
|
||||||
|
<el-button class='cancel-btn' size="small" icon="el-icon-refresh" type="warning" @click="cancelEdit(scope.row)">cancel</el-button>
|
||||||
|
</template>
|
||||||
|
<span v-else>{{ scope.row.title }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" label="编辑" width="120">
|
<el-table-column align="center" label="Actions" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button :type="scope.row.edit?'success':'primary'" @click='scope.row.edit=!scope.row.edit' size="small" icon="edit">{{scope.row.edit?'完成':'编辑'}}</el-button>
|
<el-button v-if="scope.row.edit" type="success" @click="confirmEdit(scope.row)" size="small" icon="el-icon-circle-check-outline">Ok</el-button>
|
||||||
|
<el-button v-else type="primary" @click='scope.row.edit=!scope.row.edit' size="small" icon="el-icon-edit">Edit</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -84,12 +88,42 @@ export default {
|
|||||||
fetchList(this.listQuery).then(response => {
|
fetchList(this.listQuery).then(response => {
|
||||||
const items = response.data.items
|
const items = response.data.items
|
||||||
this.list = items.map(v => {
|
this.list = items.map(v => {
|
||||||
this.$set(v, 'edit', false)
|
this.$set(v, 'edit', false) // https://vuejs.org/v2/guide/reactivity.html
|
||||||
|
|
||||||
|
v.originalTitle = v.title // will be used when user click the cancel botton
|
||||||
|
|
||||||
return v
|
return v
|
||||||
})
|
})
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
cancelEdit(row) {
|
||||||
|
row.title = row.originalTitle
|
||||||
|
row.edit = false
|
||||||
|
this.$message({
|
||||||
|
message: 'The title has been restored to the original value',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
confirmEdit(row) {
|
||||||
|
row.edit = false
|
||||||
|
row.originalTitle = row.title
|
||||||
|
this.$message({
|
||||||
|
message: 'The title has been edited',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.edit-input {
|
||||||
|
padding-right: 100px;
|
||||||
|
}
|
||||||
|
.cancel-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 15px;
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@@ -1,29 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<!-- $t is vue-i18n global function to translate lang -->
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-input style='width:240px;' placeholder="请输入文件名(默认excel-list)" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
<el-input style='width:340px;' :placeholder="$t('excel.placeholder')" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
||||||
<el-button style='margin-bottom:20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">导出excel</el-button>
|
<el-button style='margin-bottom:20px;' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">{{$t('excel.export')}} excel</el-button>
|
||||||
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>
|
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>
|
||||||
<el-table-column align="center" label='ID' width="95">
|
<el-table-column align="center" label='Id' width="95">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.$index}}
|
{{scope.$index}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="文章标题">
|
<el-table-column label="Title">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.title}}
|
{{scope.row.title}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="作者" width="95" align="center">
|
<el-table-column label="Author" width="110" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag>{{scope.row.author}}</el-tag>
|
<el-tag>{{scope.row.author}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="阅读数" width="115" align="center">
|
<el-table-column label="Readings" width="115" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.pageviews}}
|
{{scope.row.pageviews}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="created_at" label="发布时间" width="220">
|
<el-table-column align="center" label="Date" width="220">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<i class="el-icon-time"></i>
|
<i class="el-icon-time"></i>
|
||||||
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||||
@@ -35,7 +36,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { fetchList } from '@/api/article'
|
import { fetchList } from '@/api/article'
|
||||||
import { parseTime } from 'utils'
|
import { parseTime } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'exportExcel',
|
name: 'exportExcel',
|
||||||
@@ -60,13 +61,12 @@ export default {
|
|||||||
},
|
},
|
||||||
handleDownload() {
|
handleDownload() {
|
||||||
this.downloadLoading = true
|
this.downloadLoading = true
|
||||||
require.ensure([], () => {
|
import('@/vendor/Export2Excel').then(excel => {
|
||||||
const { export_json_to_excel } = require('vendor/Export2Excel')
|
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date']
|
||||||
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
|
|
||||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
||||||
const list = this.list
|
const list = this.list
|
||||||
const data = this.formatJson(filterVal, list)
|
const data = this.formatJson(filterVal, list)
|
||||||
export_json_to_excel(tHeader, data, this.filename)
|
excel.export_json_to_excel(tHeader, data, this.filename)
|
||||||
this.downloadLoading = false
|
this.downloadLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@@ -1,31 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-input style='width:240px;' placeholder="请输入文件名(默认excel-list)" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
<!-- $t is vue-i18n global function to translate lang -->
|
||||||
<el-button style='margin-bottom:20px' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">导出已选择项</el-button>
|
<el-input style='width:340px;' :placeholder="$t('excel.placeholder')" prefix-icon="el-icon-document" v-model="filename"></el-input>
|
||||||
|
<el-button style='margin-bottom:20px' type="primary" icon="document" @click="handleDownload" :loading="downloadLoading">{{$t('excel.selectedExport')}}</el-button>
|
||||||
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row @selection-change="handleSelectionChange"
|
<el-table :data="list" v-loading.body="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row @selection-change="handleSelectionChange"
|
||||||
ref="multipleTable">
|
ref="multipleTable">
|
||||||
<el-table-column type="selection" align="center"></el-table-column>
|
<el-table-column type="selection" align="center"></el-table-column>
|
||||||
<el-table-column align="center" label='ID' width="95">
|
<el-table-column align="center" label='Id' width="95">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.$index}}
|
{{scope.$index}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="文章标题">
|
<el-table-column label="Title">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.title}}
|
{{scope.row.title}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="作者" width="95" align="center">
|
<el-table-column label="Author" width="110" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag>{{scope.row.author}}</el-tag>
|
<el-tag>{{scope.row.author}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="阅读数" width="115" align="center">
|
<el-table-column label="Readings" width="115" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.pageviews}}
|
{{scope.row.pageviews}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="created_at" label="发布时间" width="220">
|
<el-table-column align="center" label="PDate" width="220">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<i class="el-icon-time"></i>
|
<i class="el-icon-time"></i>
|
||||||
<span>{{scope.row.display_time}}</span>
|
<span>{{scope.row.display_time}}</span>
|
||||||
@@ -66,19 +67,18 @@ export default {
|
|||||||
handleDownload() {
|
handleDownload() {
|
||||||
if (this.multipleSelection.length) {
|
if (this.multipleSelection.length) {
|
||||||
this.downloadLoading = true
|
this.downloadLoading = true
|
||||||
require.ensure([], () => {
|
import('@/vendor/Export2Excel').then(excel => {
|
||||||
const { export_json_to_excel } = require('vendor/Export2Excel')
|
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date']
|
||||||
const tHeader = ['序号', '文章标题', '作者', '阅读数', '发布时间']
|
|
||||||
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
|
||||||
const list = this.multipleSelection
|
const list = this.multipleSelection
|
||||||
const data = this.formatJson(filterVal, list)
|
const data = this.formatJson(filterVal, list)
|
||||||
export_json_to_excel(tHeader, data, this.filename)
|
excel.export_json_to_excel(tHeader, data, this.filename)
|
||||||
this.$refs.multipleTable.clearSelection()
|
this.$refs.multipleTable.clearSelection()
|
||||||
this.downloadLoading = false
|
this.downloadLoading = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请至少选择一条记录',
|
message: 'Please select at least one item',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import UploadExcelComponent from 'components/UploadExcel/index.vue'
|
import UploadExcelComponent from '@/components/UploadExcel/index.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'uploadExcel',
|
name: 'uploadExcel',
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<el-button>{{!postForm.comment_disabled?'评论已打开':'评论已关闭'}}
|
<el-button plain>{{!postForm.comment_disabled?'评论已打开':'评论已关闭'}}
|
||||||
<i class="el-icon-caret-bottom el-icon--right"></i>
|
<i class="el-icon-caret-bottom el-icon--right"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown-menu class="no-padding" slot="dropdown">
|
<el-dropdown-menu class="no-padding" slot="dropdown">
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<el-button>平台
|
<el-button plain>平台
|
||||||
<i class="el-icon-caret-bottom el-icon--right"></i>
|
<i class="el-icon-caret-bottom el-icon--right"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown-menu class="no-border" slot="dropdown">
|
<el-dropdown-menu class="no-border" slot="dropdown">
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
<el-dropdown trigger="click">
|
<el-dropdown trigger="click">
|
||||||
<el-button>
|
<el-button plain>
|
||||||
外链
|
外链
|
||||||
<i class="el-icon-caret-bottom el-icon--right"></i>
|
<i class="el-icon-caret-bottom el-icon--right"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user