打包dist

This commit is contained in:
lijiaqi 2023-02-06 15:38:58 +08:00
parent 200ab473e3
commit af9ceafb15
4 changed files with 23 additions and 4 deletions

2
.gitignore vendored
View File

@ -51,3 +51,5 @@ tests/**/coverage/
logs/ logs/
upload/ upload/
/src/main/resources/html/
/src/main/resources/templates/

View File

@ -4,10 +4,7 @@ import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.ydool.common.constant.UrlConstant; import com.ydool.common.constant.UrlConstant;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
public class SaTokenConfig implements WebMvcConfigurer { public class SaTokenConfig implements WebMvcConfigurer {
@ -22,9 +19,16 @@ public class SaTokenConfig implements WebMvcConfigurer {
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/assets/**").addResourceLocations("classpath:/html/dist/assets/");
registry.addResourceHandler("/upload/**").addResourceLocations("file:" + System.getProperty("user.dir") + "/upload/"); registry.addResourceHandler("/upload/**").addResourceLocations("file:" + System.getProperty("user.dir") + "/upload/");
} }
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("dist/index.html");
}
@Override @Override
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {

View File

@ -7,6 +7,7 @@ import com.ydool.system.entity.Menu;
import com.ydool.system.entity.Role; import com.ydool.system.entity.Role;
import com.ydool.system.service.impl.UserServiceImpl; import com.ydool.system.service.impl.UserServiceImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,6 +34,7 @@ public class StpInterfaceImpl implements StpInterface {
return list; return list;
} }
/** /**
* 返回一个账号所拥有的角色标识集合 (权限与角色可分开校验) * 返回一个账号所拥有的角色标识集合 (权限与角色可分开校验)
*/ */

View File

@ -13,6 +13,7 @@ import com.ydool.common.cache.ConfigCache;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.HttpServletUtil; import com.ydool.common.utils.HttpServletUtil;
import com.ydool.common.utils.PasswordUtil; import com.ydool.common.utils.PasswordUtil;
import com.ydool.system.entity.Dept;
import com.ydool.system.entity.Menu; import com.ydool.system.entity.Menu;
import com.ydool.system.entity.Role; import com.ydool.system.entity.Role;
import com.ydool.system.entity.User; import com.ydool.system.entity.User;
@ -39,6 +40,9 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
@Autowired @Autowired
private IUserService userService; private IUserService userService;
@Autowired
private DeptServiceImpl deptService;
/** /**
* 登录接口 * 登录接口
@ -102,6 +106,13 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
} }
result.set("perms", perms); result.set("perms", perms);
String deptName = "";
Dept dept = deptService.getById(loginUser.getDept());
if (ObjectUtil.isNotNull(dept)) {
deptName = dept.getName();
}
result.set("deptName", deptName);
//是否需要强制修改密码 //是否需要强制修改密码
result.set("need_init_password", password.equals(ConfigCache.getStr(ConfigCache.USER_INIT_PASSWORD, result.set("need_init_password", password.equals(ConfigCache.getStr(ConfigCache.USER_INIT_PASSWORD,
"888888")) ? true : false); "888888")) ? true : false);