Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Springboot Plus
Commits
f2544d0e
Commit
f2544d0e
authored
Sep 01, 2019
by
一日看尽长安花
Committed by
trumansdo
Sep 01, 2019
Browse files
none
parent
95285c62
Changes
9
Hide whitespace changes
Inline
Side-by-side
admin-web/.eslintrc.js
View file @
f2544d0e
module
.
exports
=
{
root
:
true
,
parserOptions
:
{
parser
:
'
babel-eslint
'
,
sourceType
:
'
module
'
},
env
:
{
browser
:
true
,
node
:
true
,
es6
:
true
,
node
:
true
},
extends
:
[
'
plugin:vue/recommended
'
,
'
eslint:recommended
'
],
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
extends
:
[
'
plugin:vue/essential
'
,
'
@vue/prettier
'
],
// 各种eslint检查的规则
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-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
'
'
no-debugger
'
:
'
off
'
,
'
no-unused-vars
'
:
'
off
'
,
'
vue/no-unused-vars
'
:
'
off
'
,
quotes
:
[
2
,
'
single
'
,
{
avoidEscape
:
true
,
allowTemplateLiterals
:
true
}
}],
'
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
'
]
}
}
],
'
jsx-quotes
'
:
[
2
,
'
prefer-single
'
]
},
parserOptions
:
{
parser
:
'
babel-eslint
'
},
overrides
:
[
{
files
:
[
'
**/__tests__/*.{j,t}s?(x)
'
],
env
:
{
jest
:
true
}
}
],
extends
:
[
'
plugin:vue/essential
'
,
'
@vue/prettier
'
]
};
admin-web/.prettierrc
0 → 100644
View file @
f2544d0e
{
"eslintIntegration": true,
"singleQuote": true,
"semi": false
}
admin-web/mock/user.js
View file @
f2544d0e
const
tokens
=
{
admin
:
{
token
:
'
admin-token
'
...
...
@@ -12,13 +11,15 @@ const users = {
'
admin-token
'
:
{
roles
:
[
'
admin
'
],
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
'
},
'
editor-token
'
:
{
roles
:
[
'
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
'
}
}
...
...
@@ -49,7 +50,7 @@ export default [
// get user info
{
url
:
'
/user/info
\
.*
'
,
url
:
'
/user/info.*
'
,
type
:
'
get
'
,
response
:
config
=>
{
const
{
token
}
=
config
.
query
...
...
admin-web/package.json
View file @
f2544d0e
...
...
@@ -75,6 +75,7 @@
"@babel/register"
:
"7.0.0"
,
"@vue/cli-plugin-babel"
:
"3.5.3"
,
"@vue/cli-plugin-eslint"
:
"^3.9.1"
,
"@vue/eslint-config-prettier"
:
"^5.0.0"
,
"@vue/cli-plugin-unit-jest"
:
"3.5.3"
,
"@vue/cli-service"
:
"3.5.3"
,
"@vue/test-utils"
:
"1.0.0-beta.29"
,
...
...
@@ -86,7 +87,9 @@
"chokidar"
:
"2.1.5"
,
"connect"
:
"3.6.6"
,
"eslint"
:
"5.15.3"
,
"eslint-plugin-prettier"
:
"^3.1.0"
,
"eslint-plugin-vue"
:
"5.2.2"
,
"prettier"
:
"^1.18.2"
,
"html-webpack-plugin"
:
"3.2.0"
,
"husky"
:
"1.3.1"
,
"lint-staged"
:
"8.1.5"
,
...
...
admin-web/src/App.vue
View file @
f2544d0e
...
...
@@ -6,6 +6,6 @@
<
script
>
export
default
{
name
:
"
App
"
}
;
name
:
'
App
'
}
</
script
>
admin-web/src/main.js
View file @
f2544d0e
...
...
@@ -27,10 +27,12 @@ import * as filters from './filters' // global filters
* Currently MockJs will be used in the production environment,
* please remove it before going online! ! !
*/
/*
import { mockXHR } from '../mock'
if (process.env.NODE_ENV === 'unknown env') {
mockXHR()
}
*/
Vue
.
use
(
Element
,
{
size
:
Cookies
.
get
(
'
size
'
)
||
'
medium
'
// set element-ui default size
...
...
admin-web/src/utils/request.js
View file @
f2544d0e
...
...
@@ -3,6 +3,9 @@ import { MessageBox, Message } from 'element-ui'
import
store
from
'
@/store
'
import
{
getToken
}
from
'
@/utils/auth
'
const
axiosUrl
=
process
.
env
.
NODE_ENV
===
'
development
'
?
'
localhost:8080
'
:
'
localhost
'
// request host
// create an axios instance
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
// url = base url + request url
...
...
@@ -25,7 +28,7 @@ service.interceptors.request.use(
},
error
=>
{
// do something with request error
console
.
log
(
error
)
// for debug
console
.
log
(
'
request err =>
'
+
error
)
// for debug
return
Promise
.
reject
(
error
)
}
)
...
...
@@ -35,7 +38,7 @@ service.interceptors.response.use(
/**
* If you want to get http information such as headers or status
* Please return response => response
*/
*/
/**
* Determine the request status by custom code
...
...
@@ -56,11 +59,15 @@ service.interceptors.response.use(
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
if
(
res
.
code
===
50008
||
res
.
code
===
50012
||
res
.
code
===
50014
)
{
// to re-login
MessageBox
.
confirm
(
'
You have been logged out, you can cancel to stay on this page, or log in again
'
,
'
Confirm logout
'
,
{
confirmButtonText
:
'
Re-Login
'
,
cancelButtonText
:
'
Cancel
'
,
type
:
'
warning
'
}).
then
(()
=>
{
MessageBox
.
confirm
(
'
You have been logged out, you can cancel to stay on this page, or log in again
'
,
'
Confirm logout
'
,
{
confirmButtonText
:
'
Re-Login
'
,
cancelButtonText
:
'
Cancel
'
,
type
:
'
warning
'
}
).
then
(()
=>
{
store
.
dispatch
(
'
user/resetToken
'
).
then
(()
=>
{
location
.
reload
()
})
...
...
@@ -72,7 +79,7 @@ service.interceptors.response.use(
}
},
error
=>
{
console
.
log
(
'
err
'
+
error
)
// for debug
console
.
log
(
'
response err ==>
'
+
error
)
// for debug
Message
({
message
:
error
.
message
,
type
:
'
error
'
,
...
...
admin-web/src/views/login/index.vue
View file @
f2544d0e
...
...
@@ -3,7 +3,7 @@
<el-form
ref=
"loginForm"
:model=
"loginForm"
:rules=
"loginRules"
class=
"login-form"
autocomplete=
"on"
label-position=
"left"
>
<div
class=
"title-container"
>
<h3
class=
"title"
>
Login Form
</h3>
<h3
class=
"title"
>
用户登录
</h3>
</div>
<el-form-item
prop=
"username"
>
...
...
@@ -49,14 +49,8 @@
<div
style=
"position:relative"
>
<div
class=
"tips"
>
<span>
Username : admin
</span>
<span>
Password : any
</span>
<span
/>
</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"
>
Or connect with
</el-button>
...
...
@@ -64,7 +58,7 @@
</el-form>
<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>
...
...
admin-web/vue.config.js
View file @
f2544d0e
...
...
@@ -6,7 +6,7 @@ function resolve(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,
// use administrator privileges to execute the command line.
...
...
@@ -93,47 +93,45 @@ module.exports = {
config
// https://webpack.js.org/configuration/devtool/#development
.
when
(
process
.
env
.
NODE_ENV
===
'
development
'
,
config
=>
config
.
devtool
(
'
cheap-source-map
'
)
.
when
(
process
.
env
.
NODE_ENV
===
'
development
'
,
config
=>
config
.
devtool
(
'
cheap-source-map
'
)
)
config
.
when
(
process
.
env
.
NODE_ENV
!==
'
development
'
,
config
=>
{
config
.
plugin
(
'
ScriptExtHtmlWebpackPlugin
'
)
.
after
(
'
html
'
)
.
use
(
'
script-ext-html-webpack-plugin
'
,
[{
config
.
when
(
process
.
env
.
NODE_ENV
!==
'
development
'
,
config
=>
{
config
.
plugin
(
'
ScriptExtHtmlWebpackPlugin
'
)
.
after
(
'
html
'
)
.
use
(
'
script-ext-html-webpack-plugin
'
,
[
{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline
:
/runtime
\.
.*
\.
js$/
}])
.
end
()
config
.
optimization
.
splitChunks
({
chunks
:
'
all
'
,
cacheGroups
:
{
libs
:
{
name
:
'
chunk-libs
'
,
test
:
/
[\\/]
node_modules
[\\/]
/
,
priority
:
10
,
chunks
:
'
initial
'
// only package third parties that are initially dependent
},
elementUI
:
{
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
test
:
/
[\\/]
node_modules
[\\/]
_
?
element-ui
(
.*
)
/
// in order to adapt to cnpm
},
commons
:
{
name
:
'
chunk-commons
'
,
test
:
resolve
(
'
src/components
'
),
// can customize your rules
minChunks
:
3
,
// minimum common number
priority
:
5
,
reuseExistingChunk
:
true
}
}
})
config
.
optimization
.
runtimeChunk
(
'
single
'
)
inline
:
/runtime
\.
.*
\.
js$/
}
])
.
end
()
config
.
optimization
.
splitChunks
({
chunks
:
'
all
'
,
cacheGroups
:
{
libs
:
{
name
:
'
chunk-libs
'
,
test
:
/
[\\/]
node_modules
[\\/]
/
,
priority
:
10
,
chunks
:
'
initial
'
// only package third parties that are initially dependent
},
elementUI
:
{
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
test
:
/
[\\/]
node_modules
[\\/]
_
?
element-ui
(
.*
)
/
// in order to adapt to cnpm
},
commons
:
{
name
:
'
chunk-commons
'
,
test
:
resolve
(
'
src/components
'
),
// can customize your rules
minChunks
:
3
,
// minimum common number
priority
:
5
,
reuseExistingChunk
:
true
}
}
)
})
config
.
optimization
.
runtimeChunk
(
'
single
'
)
})
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment