Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_45598856
white-jotter
提交
88c3606b
W
white-jotter
项目概览
qq_45598856
/
white-jotter
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
white-jotter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
88c3606b
编写于
11月 29, 2019
作者:
E
Evan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: daily optimization
上级
b68f770b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
67 addition
and
11 deletion
+67
-11
wj-vue/src/components/admin/user/UserProfile.vue
wj-vue/src/components/admin/user/UserProfile.vue
+23
-1
wj/src/main/java/com/gm/wj/controller/LibraryController.java
wj/src/main/java/com/gm/wj/controller/LibraryController.java
+2
-5
wj/src/main/java/com/gm/wj/controller/LoginController.java
wj/src/main/java/com/gm/wj/controller/LoginController.java
+1
-1
wj/src/main/java/com/gm/wj/controller/UserController.java
wj/src/main/java/com/gm/wj/controller/UserController.java
+12
-2
wj/src/main/java/com/gm/wj/pojo/User.java
wj/src/main/java/com/gm/wj/pojo/User.java
+28
-1
wj/src/main/java/com/gm/wj/service/UserService.java
wj/src/main/java/com/gm/wj/service/UserService.java
+1
-1
未找到文件。
wj-vue/src/components/admin/user/UserProfile.vue
浏览文件 @
88c3606b
...
...
@@ -40,12 +40,20 @@
<el-table-column
prop=
"email"
label=
"邮箱"
show-overflow-tooltip
fit
>
</el-table-column>
<el-table-column
prop=
"status"
label=
"状态"
width=
"100"
>
<template
slot-scope=
"scope"
>
<el-switch
v-model=
"scope.row.enabled"
active-color=
"#13ce66"
inactive-color=
"#ff4949"
@
change=
"(value) => commitChange(value, scope.row.username)"
>
</el-switch>
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
...
...
@@ -98,6 +106,20 @@
_this
.
users
=
resp
.
data
}
})
},
commitChange
(
value
,
username
)
{
this
.
$axios
.
put
(
'
/admin/user
'
,
{
enabled
:
value
,
username
:
username
}).
then
(
resp
=>
{
if
(
resp
&&
resp
.
status
===
200
)
{
if
(
value
)
{
this
.
$message
(
'
用户 [
'
+
username
+
'
] 已启用
'
)
}
else
{
this
.
$message
(
'
用户 [
'
+
username
+
'
] 已禁用
'
)
}
}
})
}
}
}
...
...
wj/src/main/java/com/gm/wj/controller/LibraryController.java
浏览文件 @
88c3606b
...
...
@@ -53,19 +53,16 @@ public class LibraryController {
}
}
@PostMapping
(
"api/covers"
)
public
String
coversUpload
(
MultipartFile
file
,
HttpServletRequest
request
)
throws
Exception
{
@PostMapping
(
"
/
api/covers"
)
public
String
coversUpload
(
MultipartFile
file
)
throws
Exception
{
String
folder
=
"D:/workspace/img"
;
File
imageFolder
=
new
File
(
folder
);
File
f
=
new
File
(
imageFolder
,
getRandomString
(
6
)
+
file
.
getOriginalFilename
()
.
substring
(
file
.
getOriginalFilename
().
length
()
-
4
));
String
filename
=
file
.
getName
();
if
(!
f
.
getParentFile
().
exists
())
f
.
getParentFile
().
mkdirs
();
try
{
file
.
transferTo
(
f
);
// System.out.println(file.getOriginalFilename());
// System.out.println("http://localhost:8443/api/file/" + f.getName());
String
imgURL
=
"http://localhost:8443/api/file/"
+
f
.
getName
();
return
imgURL
;
}
catch
(
IOException
e
)
{
...
...
wj/src/main/java/com/gm/wj/controller/LoginController.java
浏览文件 @
88c3606b
...
...
@@ -61,7 +61,7 @@ public class LoginController {
user
.
setSalt
(
salt
);
user
.
setPassword
(
encodedPassword
);
userService
.
add
(
user
);
userService
.
add
OrUpdate
(
user
);
return
ResultFactory
.
buildSuccessResult
(
user
);
}
...
...
wj/src/main/java/com/gm/wj/controller/UserController.java
浏览文件 @
88c3606b
package
com.gm.wj.controller
;
import
com.gm.wj.pojo.User
;
import
com.gm.wj.result.Result
;
import
com.gm.wj.result.ResultFactory
;
import
com.gm.wj.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
...
...
@@ -17,4 +18,13 @@ public class UserController {
public
List
<
User
>
list
()
throws
Exception
{
return
userService
.
list
();
}
@PutMapping
(
"/api/admin/user"
)
public
Result
updateUserStatus
(
@RequestBody
User
requestUser
)
{
User
user
=
userService
.
getByUserName
(
requestUser
.
getUsername
());
user
.
setEnabled
(
requestUser
.
isEnabled
());
userService
.
addOrUpdate
(
user
);
String
message
=
"用户"
+
requestUser
.
getUsername
()
+
"状态更新成功"
;
return
ResultFactory
.
buildSuccessResult
(
message
);
}
}
wj/src/main/java/com/gm/wj/pojo/User.java
浏览文件 @
88c3606b
...
...
@@ -15,8 +15,11 @@ public class User {
int
id
;
String
username
;
String
password
;
String
name
;
String
salt
;
String
name
;
String
phone
;
String
email
;
boolean
enabled
;
public
int
getId
()
{
return
id
;
...
...
@@ -58,5 +61,29 @@ public class User {
this
.
salt
=
salt
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
boolean
isEnabled
()
{
return
enabled
;
}
public
void
setEnabled
(
boolean
enabled
)
{
this
.
enabled
=
enabled
;
}
}
wj/src/main/java/com/gm/wj/service/UserService.java
浏览文件 @
88c3606b
...
...
@@ -31,7 +31,7 @@ public class UserService {
return
userDAO
.
getByUsernameAndPassword
(
username
,
password
);
}
public
void
add
(
User
user
)
{
public
void
add
OrUpdate
(
User
user
)
{
userDAO
.
save
(
user
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录