refactor(layout): 优化 AdminLayout 页面布局和滚动功能
- 在 el-main 组件中添加 scroll-wrapper 类,实现内容区域的滚动功能 - 调整 admin-main 和 scroll-wrapper 的样式,确保滚动效果正常 - 修改 CommentDTO、PlaylistDTO 和 PlaylistServiceImpl 中的歌单类型相关字段和方法
This commit is contained in:
@@ -46,6 +46,11 @@ public class CommentDTO {
|
|||||||
*/
|
*/
|
||||||
private List<CommentDTO> children;
|
private List<CommentDTO> children;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态:0-禁用,1-正常
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -38,9 +38,14 @@ public class PlaylistDTO {
|
|||||||
private UserDTO creator;
|
private UserDTO creator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 歌单类型
|
* 歌单类型ID
|
||||||
*/
|
*/
|
||||||
private PlaylistTypeDTO type;
|
private Long typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 歌单类型名称
|
||||||
|
*/
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否官方歌单:0-否,1-是
|
* 是否官方歌单:0-否,1-是
|
||||||
|
|||||||
@@ -251,8 +251,8 @@ public class PlaylistServiceImpl implements PlaylistService {
|
|||||||
playlist.setIsOfficial(0); // 默认为非官方歌单
|
playlist.setIsOfficial(0); // 默认为非官方歌单
|
||||||
|
|
||||||
// 设置歌单类型
|
// 设置歌单类型
|
||||||
if (playlistDTO.getType() != null && playlistDTO.getType().getId() != null) {
|
if (playlistDTO.getTypeId() != null) {
|
||||||
PlaylistType type = playlistTypeRepository.findById(playlistDTO.getType().getId())
|
PlaylistType type = playlistTypeRepository.findById(playlistDTO.getTypeId())
|
||||||
.orElseThrow(() -> new BusinessException("歌单类型不存在"));
|
.orElseThrow(() -> new BusinessException("歌单类型不存在"));
|
||||||
playlist.setType(type);
|
playlist.setType(type);
|
||||||
}
|
}
|
||||||
@@ -300,8 +300,8 @@ public class PlaylistServiceImpl implements PlaylistService {
|
|||||||
System.out.println("更新后的歌单isOfficial值: " + playlist.getIsOfficial());
|
System.out.println("更新后的歌单isOfficial值: " + playlist.getIsOfficial());
|
||||||
|
|
||||||
// 更新歌单类型
|
// 更新歌单类型
|
||||||
if (playlistDTO.getType() != null && playlistDTO.getType().getId() != null) {
|
if (playlistDTO.getTypeId() != null) {
|
||||||
PlaylistType type = playlistTypeRepository.findById(playlistDTO.getType().getId())
|
PlaylistType type = playlistTypeRepository.findById(playlistDTO.getTypeId())
|
||||||
.orElseThrow(() -> new BusinessException("歌单类型不存在"));
|
.orElseThrow(() -> new BusinessException("歌单类型不存在"));
|
||||||
playlist.setType(type);
|
playlist.setType(type);
|
||||||
}
|
}
|
||||||
@@ -551,6 +551,12 @@ public class PlaylistServiceImpl implements PlaylistService {
|
|||||||
playlistDTO.setCreator(creatorDTO);
|
playlistDTO.setCreator(creatorDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置类型信息
|
||||||
|
if (playlist.getType() != null) {
|
||||||
|
playlistDTO.setTypeId(playlist.getType().getId());
|
||||||
|
playlistDTO.setTypeName(playlist.getType().getName());
|
||||||
|
}
|
||||||
|
|
||||||
// 设置音乐列表
|
// 设置音乐列表
|
||||||
if (playlist.getMusics() != null && !playlist.getMusics().isEmpty()) {
|
if (playlist.getMusics() != null && !playlist.getMusics().isEmpty()) {
|
||||||
List<MusicDTO> musicDTOs = playlist.getMusics().stream()
|
List<MusicDTO> musicDTOs = playlist.getMusics().stream()
|
||||||
|
|||||||
@@ -183,7 +183,9 @@ const menuItems = [
|
|||||||
|
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<el-main class="admin-main">
|
<el-main class="admin-main">
|
||||||
<router-view />
|
<div class="scroll-wrapper">
|
||||||
|
<router-view />
|
||||||
|
</div>
|
||||||
</el-main>
|
</el-main>
|
||||||
|
|
||||||
<!-- 页脚 -->
|
<!-- 页脚 -->
|
||||||
@@ -290,8 +292,11 @@ const menuItems = [
|
|||||||
.admin-main {
|
.admin-main {
|
||||||
background: linear-gradient(135deg, #f8bbd0 0%, #e1bee7 50%, #bbdefb 100%);
|
background: linear-gradient(135deg, #f8bbd0 0%, #e1bee7 50%, #bbdefb 100%);
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-wrapper {
|
||||||
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
flex: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 修改卡片样式 */
|
/* 修改卡片样式 */
|
||||||
|
|||||||
Reference in New Issue
Block a user