Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
JAVA小学生-王铁柱
eladmin
提交
685985ce
E
eladmin
项目概览
JAVA小学生-王铁柱
/
eladmin
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
eladmin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
685985ce
编写于
1月 21, 2019
作者:
郑
郑杰
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v1.5 正式版发布 ,详情查看发行版说明
上级
45655e2b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
68 addition
and
63 deletion
+68
-63
src/api/myTest.js
src/api/myTest.js
+0
-24
src/permission.js
src/permission.js
+2
-2
src/store/modules/user.js
src/store/modules/user.js
+2
-5
src/utils/auth.js
src/utils/auth.js
+4
-12
src/utils/request.js
src/utils/request.js
+1
-3
src/views/login/index.vue
src/views/login/index.vue
+37
-12
src/views/monitor/log/msg.vue
src/views/monitor/log/msg.vue
+22
-5
未找到文件。
src/api/myTest.js
已删除
100644 → 0
浏览文件 @
45655e2b
import
request
from
'
@/utils/request
'
export
function
add
(
data
)
{
return
request
({
url
:
'
api/myTest
'
,
method
:
'
post
'
,
data
})
}
export
function
del
(
id
)
{
return
request
({
url
:
'
api/myTest/
'
+
id
,
method
:
'
delete
'
})
}
export
function
edit
(
data
)
{
return
request
({
url
:
'
api/myTest
'
,
method
:
'
put
'
,
data
})
}
src/permission.js
浏览文件 @
685985ce
...
...
@@ -2,7 +2,7 @@ import router from './router'
import
store
from
'
./store
'
import
NProgress
from
'
nprogress
'
// progress bar
import
'
nprogress/nprogress.css
'
// progress bar style
import
{
getToken
,
getStorageToken
}
from
'
@/utils/auth
'
// getToken from cookie
import
{
getToken
}
from
'
@/utils/auth
'
// getToken from cookie
import
{
buildMenus
}
from
'
@/api/menu
'
import
{
filterAsyncRouter
}
from
'
./store/modules/permission
'
...
...
@@ -12,7 +12,7 @@ const whiteList = ['/login']// no redirect whitelist
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
NProgress
.
start
()
// start progress bar
if
(
getToken
()
||
getStorageToken
()
)
{
if
(
getToken
())
{
// 已登录且要跳转的页面是登录页
if
(
to
.
path
===
'
/login
'
)
{
next
({
path
:
'
/
'
})
...
...
src/store/modules/user.js
浏览文件 @
685985ce
import
{
login
,
getInfo
}
from
'
@/api/login
'
import
{
getToken
,
setToken
,
setStorageToken
,
removeToken
}
from
'
@/utils/auth
'
import
{
getToken
,
setToken
,
removeToken
}
from
'
@/utils/auth
'
import
{
parseTime
}
from
'
@/utils/index
'
const
user
=
{
...
...
@@ -41,11 +41,8 @@ const user = {
const
rememberMe
=
userInfo
.
rememberMe
return
new
Promise
((
resolve
,
reject
)
=>
{
login
(
username
,
password
).
then
(
res
=>
{
setToken
(
res
.
token
)
setToken
(
res
.
token
,
rememberMe
)
commit
(
'
SET_TOKEN
'
,
res
.
token
)
if
(
rememberMe
)
{
setStorageToken
(
res
.
token
)
}
resolve
()
}).
catch
(
error
=>
{
reject
(
error
)
...
...
src/utils/auth.js
浏览文件 @
685985ce
import
Cookies
from
'
js-cookie
'
const
TokenKey
=
'
Admin-Token
'
const
storageTokenKey
=
'
EL_ADMIN_COOKIE_TOKEN
'
export
function
getToken
()
{
return
Cookies
.
get
(
TokenKey
)
}
export
function
getStorageToken
()
{
return
localStorage
.
getItem
(
storageTokenKey
)
}
export
function
setToken
(
token
)
{
return
Cookies
.
set
(
TokenKey
,
token
)
}
export
function
setStorageToken
(
token
)
{
return
localStorage
.
setItem
(
storageTokenKey
,
token
)
export
function
setToken
(
token
,
rememberMe
)
{
if
(
rememberMe
)
{
return
Cookies
.
set
(
TokenKey
,
token
,
{
expires
:
1
})
}
else
return
Cookies
.
set
(
TokenKey
,
token
)
}
export
function
removeToken
()
{
localStorage
.
removeItem
(
storageTokenKey
)
return
Cookies
.
remove
(
TokenKey
)
}
src/utils/request.js
浏览文件 @
685985ce
...
...
@@ -2,7 +2,7 @@ import axios from 'axios'
import
router
from
'
@/router
'
import
{
Notification
,
MessageBox
}
from
'
element-ui
'
import
store
from
'
../store
'
import
{
getToken
,
getStorageToken
}
from
'
@/utils/auth
'
import
{
getToken
}
from
'
@/utils/auth
'
// 创建axios实例
const
service
=
axios
.
create
({
...
...
@@ -15,8 +15,6 @@ service.interceptors.request.use(
config
=>
{
if
(
getToken
())
{
config
.
headers
[
'
Authorization
'
]
=
'
Bearer
'
+
getToken
()
// 让每个请求携带自定义token 请根据实际情况自行修改
}
else
if
(
getStorageToken
())
{
config
.
headers
[
'
Authorization
'
]
=
'
Bearer
'
+
getStorageToken
()
}
config
.
headers
[
'
Content-Type
'
]
=
'
application/json
'
return
config
...
...
src/views/login/index.vue
浏览文件 @
685985ce
...
...
@@ -12,27 +12,29 @@
<svg-icon
slot=
"prefix"
icon-class=
"password"
class=
"el-input__icon"
style=
"height: 39px;width: 13px;margin-left: 2px;"
/>
</el-input>
</el-form-item>
<el-checkbox
v-model=
"loginForm.rememberMe"
style=
"margin:0px 0px
3
5px 0px;"
>
记住密码
</el-checkbox>
<el-checkbox
v-model=
"loginForm.rememberMe"
style=
"margin:0px 0px
2
5px 0px;"
>
记住密码
</el-checkbox>
<el-form-item
style=
"width:100%;"
>
<el-button
:loading=
"loading"
size=
"medium"
type=
"primary"
style=
"width:100%;"
@
click.native.prevent=
"handleLogin"
>
<span
v-if=
"!loading"
>
登 录
</span>
<span
v-else
>
登 录 中...
</span>
</el-button>
</el-form-item>
<p
class=
"login-tip"
>
系统默认用户名:admin,密码:123456
</p>
</el-form>
</div>
</
template
>
<
script
>
import
{
md5
}
from
'
@/utils/md5
'
import
Cookies
from
'
js-cookie
'
export
default
{
name
:
'
Login
'
,
data
()
{
return
{
checked
:
false
,
md5Pwd
:
''
,
loginForm
:
{
username
:
'
admin
'
,
password
:
'
123456
'
,
username
:
''
,
password
:
''
,
rememberMe
:
false
},
loginRules
:
{
...
...
@@ -40,7 +42,6 @@ export default {
password
:
[{
required
:
true
,
trigger
:
'
blur
'
,
message
:
'
密码不能为空
'
}]
},
loading
:
false
,
pwdType
:
'
password
'
,
redirect
:
undefined
}
},
...
...
@@ -52,19 +53,38 @@ export default {
immediate
:
true
}
},
created
()
{
this
.
getCookie
()
},
methods
:
{
showPwd
()
{
if
(
this
.
pwdType
===
'
password
'
)
{
this
.
pwdType
=
''
}
else
{
this
.
pwdType
=
'
password
'
getCookie
()
{
const
username
=
Cookies
.
get
(
'
username
'
)
const
password
=
Cookies
.
get
(
'
password
'
)
const
rememberMe
=
Cookies
.
get
(
'
rememberMe
'
)
// 保存cookie里面的加密后的密码
this
.
md5Pwd
=
password
===
undefined
?
''
:
password
this
.
loginForm
=
{
username
:
username
===
undefined
?
''
:
username
,
password
:
this
.
md5Pwd
,
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
)
}
},
handleLogin
()
{
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
const
user
=
{
username
:
this
.
loginForm
.
username
,
password
:
md5
(
this
.
loginForm
.
password
),
rememberMe
:
this
.
loginForm
.
rememberMe
}
let
pass
=
this
.
loginForm
.
password
if
(
pass
!==
this
.
md5Pwd
)
{
pass
=
md5
(
pass
)
}
const
user
=
{
username
:
this
.
loginForm
.
username
,
password
:
pass
,
rememberMe
:
this
.
loginForm
.
rememberMe
}
if
(
valid
)
{
this
.
loading
=
true
if
(
user
.
rememberMe
)
{
Cookies
.
set
(
'
username
'
,
user
.
username
,
{
expires
:
1
})
Cookies
.
set
(
'
password
'
,
user
.
password
,
{
expires
:
1
})
Cookies
.
set
(
'
rememberMe
'
,
user
.
rememberMe
,
{
expires
:
1
})
}
else
{
Cookies
.
remove
(
'
username
'
)
Cookies
.
remove
(
'
password
'
)
Cookies
.
remove
(
'
rememberMe
'
)
}
this
.
$store
.
dispatch
(
'
Login
'
,
user
).
then
(()
=>
{
this
.
loading
=
false
this
.
$router
.
push
({
path
:
this
.
redirect
||
'
/
'
})
...
...
@@ -92,7 +112,7 @@ export default {
.title
{
margin
:
0px
auto
40px
auto
;
text-align
:
center
;
color
:
#
555
;
color
:
#
707070
;
}
.login-form
{
...
...
@@ -107,4 +127,9 @@ export default {
}
}
}
.login-tip
{
font-size
:
13px
;
text-align
:
center
;
color
:
#bfbfbf
;
}
</
style
>
src/views/monitor/log/msg.vue
浏览文件 @
685985ce
<
template
>
<div
class=
"container"
>
<div
:style=
"'width:' + width"
class=
"container"
>
<el-tooltip
:content=
"content"
class=
"lock item"
effect=
"dark"
placement=
"left"
>
<el-button
type=
"info"
size=
"mini"
circle
@
click=
"doLock"
><svg-icon
:icon-class=
"ico"
/></el-button>
</el-tooltip>
<div
id=
"console"
:style=
"'height:'+ height"
class=
"console"
>
<div
v-for=
"item in data"
:key=
"item.time"
>
<span>
{{
item
.
name
}}
</span>
...
...
@@ -24,7 +27,9 @@ export default {
name
:
'
Msg
'
,
data
()
{
return
{
height
:
document
.
documentElement
.
clientHeight
-
95
+
'
px;
'
,
ico
:
'
unlock
'
,
unlock
:
true
,
content
:
'
锁定滚动条
'
,
height
:
document
.
documentElement
.
clientHeight
-
94.5
+
'
px;
'
,
width
:
document
.
documentElement
.
clientWidth
-
185
+
'
px;
'
,
data
:
[{
name
:
'
elAdmin-
'
,
timestamp
:
new
Date
(),
threadName
:
'
system-prompt-message
'
,
level
:
'
INFO
'
,
className
:
'
me.zhengjie.AppRun
'
+
'
:
'
,
body
:
'
Welcome, no log output~
'
}],
// level
INFO
:
'
#0000ff
'
,
WARN
:
'
#FFFF00
'
,
ERROR
:
'
#FF0000
'
,
DEBUG
:
'
#DEA000
'
...
...
@@ -40,8 +45,10 @@ export default {
data
:
{
handler
(
val
,
oldVal
)
{
this
.
$nextTick
(()
=>
{
var
div
=
document
.
getElementById
(
'
console
'
)
div
.
scrollTop
=
div
.
scrollHeight
if
(
this
.
unlock
)
{
var
div
=
document
.
getElementById
(
'
console
'
)
div
.
scrollTop
=
div
.
scrollHeight
}
})
}
}
...
...
@@ -106,11 +113,21 @@ export default {
}
else
{
return
this
.
ERROR
}
},
doLock
()
{
if
(
this
.
unlock
)
{
this
.
content
=
'
解除锁定
'
this
.
ico
=
'
lock
'
}
else
{
this
.
content
=
'
锁定滚动条
'
this
.
ico
=
'
unlock
'
}
this
.
unlock
=
!
this
.
unlock
}
}
}
</
script
>
<
style
scoped
>
button
,
input
,
textarea
{
outline
:
0
}
.container
.buttons
.closes
,
.container
.buttons
.maximize
,
.container
.buttons
.minimize
{
padding
:
0
;
margin
:
0
;
margin-right
:
6px
;
width
:
12px
;
height
:
12px
;
border
:
1px
solid
transparent
;
border-radius
:
6px
}
.container
{
width
:
100%
;
margin
:
5px
}
.container
.console
{
font-family
:
consolas
;
overflow-y
:
scroll
;
background
:
#494949
;
color
:
#f7f7f7
;
padding
:
10px
;
font-size
:
14px
}
button
,
input
,
textarea
{
outline
:
0
}
.container
.buttons
.closes
,
.container
.buttons
.maximize
,
.container
.buttons
.minimize
{
padding
:
0
;
margin
:
0
;
margin-right
:
6px
;
width
:
12px
;
height
:
12px
;
border
:
1px
solid
transparent
;
border-radius
:
6px
}
.container
{
width
:
100%
;
margin
:
5px
}
.container
.console
{
font-family
:
consolas
;
overflow-y
:
scroll
;
background
:
#494949
;
color
:
#f7f7f7
;
padding
:
10px
;
font-size
:
14px
}
.lock
{
position
:
fixed
;
right
:
45px
;
bottom
:
6.8%
;
z-index
:
100000
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录