mirror of
https://gitee.com/wangkang/udf.git
synced 2026-10-27 00:53:46 +00:00
更新
This commit is contained in:
@@ -40,11 +40,6 @@ public class UserDto implements Serializable {
|
||||
*/
|
||||
private String avatarFileId;
|
||||
|
||||
/**
|
||||
* 用户头像路径
|
||||
*/
|
||||
private String avatarFilePath;
|
||||
|
||||
/**
|
||||
* 用户状态 (1:正常)
|
||||
*/
|
||||
|
||||
+4
-1
@@ -2,6 +2,7 @@ package org.itkk.udf.api.page.auth;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.itkk.udf.api.common.CommonConstant;
|
||||
import org.itkk.udf.api.common.CommonUtil;
|
||||
import org.itkk.udf.api.common.dto.UserDto;
|
||||
import org.itkk.udf.api.common.service.IUserService;
|
||||
@@ -30,8 +31,10 @@ public class CommonHandlerInterceptor implements HandlerInterceptor {
|
||||
UserDto userDto = iUserService.infoByToken(CommonUtil.getTokenByCookie(request));
|
||||
//判断是否登陆
|
||||
if (userDto != null) {
|
||||
//放入token
|
||||
modelAndView.addObject(CommonConstant.PARAMETER_NAME_TOKEN, CommonUtil.getTokenByCookie(request));
|
||||
//放入用户信息
|
||||
modelAndView.addObject("userDto", userDto);
|
||||
modelAndView.addObject(CommonConstant.PARAMETER_NAME_TOKEN_INFO, userDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.itkk.udf.api.page.web;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.itkk.udf.starter.file.db.service.DbFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -8,6 +10,13 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Controller
|
||||
public class HomeController {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Autowired
|
||||
private DbFileService dbFileService;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.itkk.udf.starter.cache.db.service.DbCacheService;
|
||||
import org.itkk.udf.starter.core.CoreUtil;
|
||||
import org.itkk.udf.starter.core.exception.ParameterValidException;
|
||||
import org.itkk.udf.starter.core.id.IdWorker;
|
||||
import org.itkk.udf.starter.file.db.dto.DbFileInfoDto;
|
||||
import org.itkk.udf.starter.file.db.service.DbFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -259,13 +258,6 @@ public class UserService implements IUserService {
|
||||
userDto = new UserDto();
|
||||
//转换
|
||||
CoreUtil.copyPropertiesIgnoreNull(userEntity, userDto);
|
||||
//获得头像路径
|
||||
if (StringUtils.isNotBlank(userDto.getAvatarFileId())) {
|
||||
DbFileInfoDto dbFileInfoDto = dbFileService.get(userDto.getAvatarFileId());
|
||||
if (dbFileInfoDto != null) {
|
||||
userDto.setAvatarFilePath("/file/" + dbFileInfoDto.getRootPathCode() + "/" + dbFileInfoDto.getPhysicalRelativePath() + "/" + dbFileInfoDto.getPhysicalFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
//返回
|
||||
return userDto;
|
||||
|
||||
@@ -14,6 +14,10 @@ org.itkk.udf.api.rbac.api.fileUpload.name=\u6587\u4EF6\u4E0A\u4F20
|
||||
org.itkk.udf.api.rbac.api.fileUpload.uri=/api/udf/web/private/file/upload
|
||||
org.itkk.udf.api.rbac.api.fileUpload.method=POST
|
||||
#
|
||||
org.itkk.udf.api.rbac.api.filePreview.name=\u6587\u4EF6\u9884\u89C8
|
||||
org.itkk.udf.api.rbac.api.filePreview.uri=/api/udf/web/private/file/preview/{id}
|
||||
org.itkk.udf.api.rbac.api.filePreview.method=GET
|
||||
#
|
||||
org.itkk.udf.api.rbac.api.updateUser.name=\u66F4\u65B0\u7528\u6237\u4FE1\u606F
|
||||
org.itkk.udf.api.rbac.api.updateUser.uri=/api/udf/web/private/rbac/user/save
|
||||
org.itkk.udf.api.rbac.api.updateUser.method=PUT
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
org.itkk.udf.api.rbac.rolePublic.publicRole.name=\u516C\u5171\u89D2\u8272
|
||||
org.itkk.udf.api.rbac.rolePublic.publicRole.apis=infoByToken,logout,menu,fileUpload,updateUser
|
||||
org.itkk.udf.api.rbac.rolePublic.publicRole.apis=infoByToken,logout,menu,fileUpload,filePreview,updateUser
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@
|
||||
<div class="item header-right-bar-search-input-div" style="display:none;">
|
||||
<input type="text" class="form-control form-control-lg" placeholder="请输入要搜索的内容">
|
||||
</div>
|
||||
<div th:if="${userDto!=null}" class="item header-right-bar-bell-div">
|
||||
<div th:if="${tokenInfo!=null}" class="item header-right-bar-bell-div">
|
||||
<div class="el-badge">
|
||||
<button type="button" class="btn btn-custom2">
|
||||
<i class="fa fa-bell-o" aria-hidden="true"></i>
|
||||
@@ -336,18 +336,19 @@
|
||||
<sup class="el-badge__content el-badge__content--undefined is-fixed is-dot"></sup>
|
||||
</div>
|
||||
</div>
|
||||
<div th:if="${userDto!=null}" class="item header-right-bar-user-div">
|
||||
<button th:if="${userDto.avatarFilePath==null}" type="button"
|
||||
<div th:if="${tokenInfo!=null}" class="item header-right-bar-user-div">
|
||||
<button th:if="${tokenInfo.avatarFileId==null}" type="button"
|
||||
class="btn btn-info btn-custom3 user-head-img-def">
|
||||
<i class="fa fa-user" aria-hidden="true"></i>
|
||||
</button>
|
||||
<img th:if="${userDto.avatarFilePath!=null}" width="40px" height="40px"
|
||||
th:src="${userDto.avatarFilePath}" class="img-rounded user-head-img" alt="头像">
|
||||
<img th:if="${tokenInfo.avatarFileId!=null}" width="40px" height="40px"
|
||||
th:src="@{/api/udf/web/private/file/preview/{fileId}?token={token}&width=40&height=40(fileId=${tokenInfo.avatarFileId},token=${token})}"
|
||||
class="img-rounded user-head-img" alt="头像">
|
||||
</div>
|
||||
<div th:if="${userDto==null}" class="item header-right-bar-login-div">
|
||||
<div th:if="${tokenInfo==null}" class="item header-right-bar-login-div">
|
||||
<button type="button" class="btn btn-custom rounded-pill">登陆</button>
|
||||
</div>
|
||||
<div th:if="${userDto==null}" class="item header-right-bar-registered-div">
|
||||
<div th:if="${tokenInfo==null}" class="item header-right-bar-registered-div">
|
||||
<button type="button" class="btn btn-custom rounded-pill">注册</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user