diff --git a/ruoyi-ui/src/components/Pagination/index.vue b/ruoyi-ui/src/components/Pagination/index.vue
index 08ac487..e876702 100644
--- a/ruoyi-ui/src/components/Pagination/index.vue
+++ b/ruoyi-ui/src/components/Pagination/index.vue
@@ -81,10 +81,14 @@ export default {
set(val) {
this.$emit('update:limit', val)
}
+ },
+ maxPage() {
+ return Math.ceil(this.total / this.pageSize) || 1
}
},
methods: {
handleSizeChange(val) {
+ // 当页面大小改变时,检查当前页是否还有效
if (this.currentPage * val > this.total) {
this.currentPage = 1
}
@@ -94,6 +98,16 @@ export default {
}
},
handleCurrentChange(val) {
+ // 计算最大页数,进行边界检查
+ const maxPage = Math.ceil(this.total / this.pageSize) || 1;
+
+ // 如果请求的页码超出范围,限制在有效范围内
+ if (val > maxPage) {
+ val = maxPage;
+ } else if (val < 1) {
+ val = 1;
+ }
+
this.$emit('pagination', { page: val, limit: this.pageSize })
if (this.autoScroll) {
scrollTo(0, 800)
diff --git a/ruoyi-ui/src/views/activity/index.vue b/ruoyi-ui/src/views/activity/index.vue
index 443287f..e529498 100644
--- a/ruoyi-ui/src/views/activity/index.vue
+++ b/ruoyi-ui/src/views/activity/index.vue
@@ -89,7 +89,7 @@
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
- @pagination="getList"
+ @pagination="handlePagination"
/>
@@ -247,10 +247,38 @@ export default {
/** 查询活动列表 */
getList() {
this.loading = true;
- listActivity(this.queryParams).then(response => {
- this.activityList = response.rows;
- this.total = response.total;
+
+ // 清理查询参数,移除空值
+ const cleanParams = {};
+ Object.keys(this.queryParams).forEach(key => {
+ const value = this.queryParams[key];
+ if (value !== null && value !== undefined && value !== '') {
+ cleanParams[key] = value;
+ }
+ });
+
+ // 确保分页参数存在
+ cleanParams.pageNum = this.queryParams.pageNum || 1;
+ cleanParams.pageSize = this.queryParams.pageSize || 10;
+
+ console.log('活动搜索参数:', cleanParams);
+
+ listActivity(cleanParams).then(response => {
+ this.activityList = response.rows || [];
+ this.total = response.total || 0;
this.loading = false;
+
+ console.log('活动搜索结果:', {
+ total: this.total,
+ count: this.activityList.length,
+ params: cleanParams
+ });
+ }).catch(error => {
+ console.error('获取活动列表失败:', error);
+ this.activityList = [];
+ this.total = 0;
+ this.loading = false;
+ this.$modal.msgError("获取活动列表失败");
});
},
// 取消按钮
@@ -276,13 +304,30 @@ export default {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
+ console.log('执行搜索,当前查询参数:', this.queryParams);
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
+ // 手动重置查询参数,确保所有条件都被清空
+ this.queryParams = {
+ pageNum: 1,
+ pageSize: 10,
+ name: null,
+ status: null,
+ shelf: null
+ };
+ console.log('重置查询参数:', this.queryParams);
this.handleQuery();
},
+ /** 分页事件处理 */
+ handlePagination(pagination) {
+ this.queryParams.pageNum = pagination.page;
+ this.queryParams.pageSize = pagination.limit;
+ console.log('分页参数变更:', pagination);
+ this.getList();
+ },
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
diff --git a/ruoyi-ui/src/views/playlist/normal/index.vue b/ruoyi-ui/src/views/playlist/normal/index.vue
index d3fa363..061df81 100644
--- a/ruoyi-ui/src/views/playlist/normal/index.vue
+++ b/ruoyi-ui/src/views/playlist/normal/index.vue
@@ -141,7 +141,7 @@
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
- @pagination="getList"
+ @pagination="handlePagination"
/>
@@ -290,6 +290,20 @@ export default {
}
};
},
+ computed: {
+ // 计算最大页数
+ maxPage() {
+ return Math.ceil(this.total / this.queryParams.pageSize) || 1;
+ },
+ // 检查是否为第一页
+ isFirstPage() {
+ return this.queryParams.pageNum <= 1;
+ },
+ // 检查是否为最后一页
+ isLastPage() {
+ return this.queryParams.pageNum >= this.maxPage;
+ }
+ },
created() {
this.getList();
this.getTagOptions();
@@ -303,9 +317,25 @@ export default {
getList() {
this.loading = true;
listNormalSong(this.queryParams).then(response => {
- this.playlistList = response.rows;
- this.total = response.total;
+ this.playlistList = response.rows || [];
+ this.total = response.total || 0;
+
+ // 简单的边界检查:如果当前页码超出了实际页数,重置到最后一页
+ const maxPage = Math.ceil(this.total / this.queryParams.pageSize) || 1;
+ if (this.queryParams.pageNum > maxPage && this.total > 0) {
+ this.queryParams.pageNum = maxPage;
+ // 重新请求数据
+ this.getList();
+ return;
+ }
+
this.loading = false;
+ }).catch(error => {
+ console.error('获取歌曲列表失败:', error);
+ this.playlistList = [];
+ this.total = 0;
+ this.loading = false;
+ this.$modal.msgError("获取歌曲列表失败");
});
},
// 获取标签选项
@@ -358,6 +388,12 @@ export default {
this.queryParams.musicType = 'ordinary';
this.handleQuery();
},
+ /** 分页事件处理 */
+ handlePagination(pagination) {
+ this.queryParams.pageNum = pagination.page;
+ this.queryParams.pageSize = pagination.limit;
+ this.getList();
+ },
/** 新增按钮操作 */
handleAdd() {
this.reset();
diff --git a/ruoyi-ui/src/views/playlist/scene/index.vue b/ruoyi-ui/src/views/playlist/scene/index.vue
index b08a1dc..cae6a2e 100644
--- a/ruoyi-ui/src/views/playlist/scene/index.vue
+++ b/ruoyi-ui/src/views/playlist/scene/index.vue
@@ -48,8 +48,16 @@
-
-
-
+
+
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
+
+
+
+
+ {{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
+
+
@@ -110,6 +118,7 @@