Commit f2544d0e authored by 一日看尽长安花's avatar 一日看尽长安花 Committed by trumansdo
Browse files

none

parent 95285c62
module.exports = { module.exports = {
root: true, root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: { env: {
browser: true, node: true
node: true,
es6: true,
}, },
extends: ['plugin:vue/recommended', 'eslint:recommended'],
// add your custom rules here extends: ['plugin:vue/essential', '@vue/prettier'],
//it is base on https://github.com/vuejs/eslint-config-vue // 各种eslint检查的规则
rules: { rules: {
"vue/max-attributes-per-line": [2, {
"singleline": 10,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}],
"vue/singleline-html-element-content-newline": "off",
"vue/multiline-html-element-content-newline":"off",
"vue/name-property-casing": ["error", "PascalCase"],
"vue/no-v-html": "off",
'accessor-pairs': 2,
'arrow-spacing': [2, {
'before': true,
'after': true
}],
'block-spacing': [2, 'always'],
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
'camelcase': [0, {
'properties': 'always'
}],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-style': [2, 'last'],
'constructor-super': 2,
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': ["error", "always", {"null": "ignore"}],
'generator-star-spacing': [2, {
'before': true,
'after': true
}],
'handle-callback-err': [2, '^(err|error)$'],
'indent': [2, 2, {
'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-console': 'off',
'no-class-assign': 2, 'no-debugger': 'off',
'no-cond-assign': 2, 'no-unused-vars': 'off',
'no-const-assign': 2, 'vue/no-unused-vars': 'off',
'no-control-regex': 0, quotes: [
'no-delete-var': 2, 2,
'no-dupe-args': 2, 'single',
'no-dupe-class-members': 2, {
'no-dupe-keys': 2, avoidEscape: true,
'no-duplicate-case': 2, allowTemplateLiterals: true
'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'], 'jsx-quotes': [2, 'prefer-single']
'quotes': [2, 'single', { },
'avoidEscape': true,
'allowTemplateLiterals': true parserOptions: {
}], parser: 'babel-eslint'
'semi': [2, 'never'], },
'semi-spacing': [2, {
'before': false, overrides: [
'after': true {
}], files: ['**/__tests__/*.{j,t}s?(x)'],
'space-before-blocks': [2, 'always'], env: {
'space-before-function-paren': [2, 'never'], jest: true
'space-in-parens': [2, 'never'], }
'space-infix-ops': 2, }
'space-unary-ops': [2, { ],
'words': true,
'nonwords': false extends: ['plugin:vue/essential', '@vue/prettier']
}], };
'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']
}
}
{
"eslintIntegration": true,
"singleQuote": true,
"semi": false
}
const tokens = { const tokens = {
admin: { admin: {
token: 'admin-token' token: 'admin-token'
...@@ -12,13 +11,15 @@ const users = { ...@@ -12,13 +11,15 @@ const users = {
'admin-token': { 'admin-token': {
roles: ['admin'], roles: ['admin'],
introduction: 'I am a super administrator', introduction: 'I am a super administrator',
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-token': { 'editor-token': {
roles: ['editor'], roles: ['editor'],
introduction: 'I am an editor', introduction: 'I am an editor',
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', avatar:
'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
name: 'Normal Editor' name: 'Normal Editor'
} }
} }
...@@ -49,7 +50,7 @@ export default [ ...@@ -49,7 +50,7 @@ export default [
// get user info // get user info
{ {
url: '/user/info\.*', url: '/user/info.*',
type: 'get', type: 'get',
response: config => { response: config => {
const { token } = config.query const { token } = config.query
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
"@babel/register": "7.0.0", "@babel/register": "7.0.0",
"@vue/cli-plugin-babel": "3.5.3", "@vue/cli-plugin-babel": "3.5.3",
"@vue/cli-plugin-eslint": "^3.9.1", "@vue/cli-plugin-eslint": "^3.9.1",
"@vue/eslint-config-prettier": "^5.0.0",
"@vue/cli-plugin-unit-jest": "3.5.3", "@vue/cli-plugin-unit-jest": "3.5.3",
"@vue/cli-service": "3.5.3", "@vue/cli-service": "3.5.3",
"@vue/test-utils": "1.0.0-beta.29", "@vue/test-utils": "1.0.0-beta.29",
...@@ -86,7 +87,9 @@ ...@@ -86,7 +87,9 @@
"chokidar": "2.1.5", "chokidar": "2.1.5",
"connect": "3.6.6", "connect": "3.6.6",
"eslint": "5.15.3", "eslint": "5.15.3",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-vue": "5.2.2", "eslint-plugin-vue": "5.2.2",
"prettier": "^1.18.2",
"html-webpack-plugin": "3.2.0", "html-webpack-plugin": "3.2.0",
"husky": "1.3.1", "husky": "1.3.1",
"lint-staged": "8.1.5", "lint-staged": "8.1.5",
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
<script> <script>
export default { export default {
name: "App" name: 'App'
}; }
</script> </script>
...@@ -27,10 +27,12 @@ import * as filters from './filters' // global filters ...@@ -27,10 +27,12 @@ import * as filters from './filters' // global filters
* Currently MockJs will be used in the production environment, * Currently MockJs will be used in the production environment,
* please remove it before going online! ! ! * please remove it before going online! ! !
*/ */
/*
import { mockXHR } from '../mock' import { mockXHR } from '../mock'
if (process.env.NODE_ENV === 'unknown env') { if (process.env.NODE_ENV === 'unknown env') {
mockXHR() mockXHR()
} }
*/
Vue.use(Element, { Vue.use(Element, {
size: Cookies.get('size') || 'medium' // set element-ui default size size: Cookies.get('size') || 'medium' // set element-ui default size
......
...@@ -3,6 +3,9 @@ import { MessageBox, Message } from 'element-ui' ...@@ -3,6 +3,9 @@ import { MessageBox, Message } from 'element-ui'
import store from '@/store' import store from '@/store'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
const axiosUrl =
process.env.NODE_ENV === 'development' ? 'localhost:8080' : 'localhost' // request host
// create an axios instance // create an axios instance
const service = axios.create({ const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
...@@ -25,7 +28,7 @@ service.interceptors.request.use( ...@@ -25,7 +28,7 @@ service.interceptors.request.use(
}, },
error => { error => {
// do something with request error // do something with request error
console.log(error) // for debug console.log('request err => ' + error) // for debug
return Promise.reject(error) return Promise.reject(error)
} }
) )
...@@ -35,7 +38,7 @@ service.interceptors.response.use( ...@@ -35,7 +38,7 @@ service.interceptors.response.use(
/** /**
* If you want to get http information such as headers or status * If you want to get http information such as headers or status
* Please return response => response * Please return response => response
*/ */
/** /**
* Determine the request status by custom code * Determine the request status by custom code
...@@ -56,11 +59,15 @@ service.interceptors.response.use( ...@@ -56,11 +59,15 @@ service.interceptors.response.use(
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
if (res.code === 50008 || res.code === 50012 || res.code === 50014) { if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
// to re-login // to re-login
MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', { MessageBox.confirm(
confirmButtonText: 'Re-Login', 'You have been logged out, you can cancel to stay on this page, or log in again',
cancelButtonText: 'Cancel', 'Confirm logout',
type: 'warning' {
}).then(() => { confirmButtonText: 'Re-Login',
cancelButtonText: 'Cancel',
type: 'warning'
}
).then(() => {
store.dispatch('user/resetToken').then(() => { store.dispatch('user/resetToken').then(() => {
location.reload() location.reload()
}) })
...@@ -72,7 +79,7 @@ service.interceptors.response.use( ...@@ -72,7 +79,7 @@ service.interceptors.response.use(
} }
}, },
error => { error => {
console.log('err' + error) // for debug console.log('response err ==> ' + error) // for debug
Message({ Message({
message: error.message, message: error.message,
type: 'error', type: 'error',
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" autocomplete="on" label-position="left"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" autocomplete="on" label-position="left">
<div class="title-container"> <div class="title-container">
<h3 class="title">Login Form</h3> <h3 class="title">用户登录</h3>
</div> </div>
<el-form-item prop="username"> <el-form-item prop="username">
...@@ -49,14 +49,8 @@ ...@@ -49,14 +49,8 @@
<div style="position:relative"> <div style="position:relative">
<div class="tips"> <div class="tips">
<span>Username : admin</span> <span />
<span>Password : any</span>
</div> </div>
<div class="tips">
<span style="margin-right:18px;">Username : editor</span>
<span>Password : any</span>
</div>
<el-button class="thirdparty-button" type="primary" @click="showDialog=true"> <el-button class="thirdparty-button" type="primary" @click="showDialog=true">
Or connect with Or connect with
</el-button> </el-button>
...@@ -64,7 +58,7 @@ ...@@ -64,7 +58,7 @@
</el-form> </el-form>
<el-dialog title="Or connect with" :visible.sync="showDialog"> <el-dialog title="Or connect with" :visible.sync="showDialog">
Can not be simulated on local, so please combine you own business simulation! ! ! 本地环境无法模拟,请合并到线上环境再测试!!
<br> <br>
<br> <br>
<br> <br>
......
...@@ -6,7 +6,7 @@ function resolve(dir) { ...@@ -6,7 +6,7 @@ function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
const name = defaultSettings.title || 'vue Element Admin' // page title const name = defaultSettings.title || 'Boot Plus Admin' // page title
// If your port is set to 80, // If your port is set to 80,
// use administrator privileges to execute the command line. // use administrator privileges to execute the command line.
...@@ -93,47 +93,45 @@ module.exports = { ...@@ -93,47 +93,45 @@ module.exports = {
config config
// https://webpack.js.org/configuration/devtool/#development // https://webpack.js.org/configuration/devtool/#development
.when(process.env.NODE_ENV === 'development', .when(process.env.NODE_ENV === 'development', config =>
config => config.devtool('cheap-source-map') config.devtool('cheap-source-map')
) )
config config.when(process.env.NODE_ENV !== 'development', config => {
.when(process.env.NODE_ENV !== 'development', config
config => { .plugin('ScriptExtHtmlWebpackPlugin')
config .after('html')
.plugin('ScriptExtHtmlWebpackPlugin') .use('script-ext-html-webpack-plugin', [
.after('html') {
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime` // `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/ inline: /runtime\..*\.js$/
}]) }
.end() ])
config .end()
.optimization.splitChunks({ config.optimization.splitChunks({
chunks: 'all', chunks: 'all',
cacheGroups: { cacheGroups: {
libs: { libs: {
name: 'chunk-libs', name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
priority: 10, priority: 10,
chunks: 'initial' // only package third parties that are initially dependent chunks: 'initial' // only package third parties that are initially dependent
}, },
elementUI: { elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
}, },
commons: { commons: {
name: 'chunk-commons', name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number minChunks: 3, // minimum common number
priority: 5, priority: 5,
reuseExistingChunk: true reuseExistingChunk: true
} }
}
})
config.optimization.runtimeChunk('single')
} }
) })
config.optimization.runtimeChunk('single')
})
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment