refactor(layout): 优化 AdminLayout 页面布局和滚动功能

- 在 el-main 组件中添加 scroll-wrapper 类,实现内容区域的滚动功能
- 调整 admin-main 和 scroll-wrapper 的样式,确保滚动效果正常
- 修改 CommentDTO、PlaylistDTO 和 PlaylistServiceImpl 中的歌单类型相关字段和方法
This commit is contained in:
ikmkj
2025-07-26 22:56:10 +08:00
parent a1e5294fdd
commit b1d795337c
4 changed files with 29 additions and 8 deletions

View File

@@ -46,6 +46,11 @@ public class CommentDTO {
*/
private List<CommentDTO> children;
/**
* 状态0-禁用1-正常
*/
private Integer status;
/**
* 创建时间
*/

View File

@@ -38,9 +38,14 @@ public class PlaylistDTO {
private UserDTO creator;
/**
* 歌单类型
* 歌单类型ID
*/
private PlaylistTypeDTO type;
private Long typeId;
/**
* 歌单类型名称
*/
private String typeName;
/**
* 是否官方歌单0-否1-是

View File

@@ -251,8 +251,8 @@ public class PlaylistServiceImpl implements PlaylistService {
playlist.setIsOfficial(0); // 默认为非官方歌单
// 设置歌单类型
if (playlistDTO.getType() != null && playlistDTO.getType().getId() != null) {
PlaylistType type = playlistTypeRepository.findById(playlistDTO.getType().getId())
if (playlistDTO.getTypeId() != null) {
PlaylistType type = playlistTypeRepository.findById(playlistDTO.getTypeId())
.orElseThrow(() -> new BusinessException("歌单类型不存在"));
playlist.setType(type);
}
@@ -300,8 +300,8 @@ public class PlaylistServiceImpl implements PlaylistService {
System.out.println("更新后的歌单isOfficial值: " + playlist.getIsOfficial());
// 更新歌单类型
if (playlistDTO.getType() != null && playlistDTO.getType().getId() != null) {
PlaylistType type = playlistTypeRepository.findById(playlistDTO.getType().getId())
if (playlistDTO.getTypeId() != null) {
PlaylistType type = playlistTypeRepository.findById(playlistDTO.getTypeId())
.orElseThrow(() -> new BusinessException("歌单类型不存在"));
playlist.setType(type);
}
@@ -551,6 +551,12 @@ public class PlaylistServiceImpl implements PlaylistService {
playlistDTO.setCreator(creatorDTO);
}
// 设置类型信息
if (playlist.getType() != null) {
playlistDTO.setTypeId(playlist.getType().getId());
playlistDTO.setTypeName(playlist.getType().getName());
}
// 设置音乐列表
if (playlist.getMusics() != null && !playlist.getMusics().isEmpty()) {
List<MusicDTO> musicDTOs = playlist.getMusics().stream()

View File

@@ -183,7 +183,9 @@ const menuItems = [
<!-- 内容区域 -->
<el-main class="admin-main">
<router-view />
<div class="scroll-wrapper">
<router-view />
</div>
</el-main>
<!-- 页脚 -->
@@ -290,8 +292,11 @@ const menuItems = [
.admin-main {
background: linear-gradient(135deg, #f8bbd0 0%, #e1bee7 50%, #bbdefb 100%);
padding: 20px;
}
.scroll-wrapper {
height: 100%;
overflow-y: auto;
flex: 1;
}
/* 修改卡片样式 */