fenye
This commit is contained in:
@@ -65,6 +65,7 @@ export default {
|
||||
return {
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
currentPage: {
|
||||
get() {
|
||||
@@ -98,16 +99,6 @@ 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)
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="handlePagination"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改活动对话框 -->
|
||||
@@ -123,7 +123,9 @@
|
||||
type="datetime"
|
||||
placeholder="选择开始时间"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%"
|
||||
:clearable="true"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
@@ -132,7 +134,9 @@
|
||||
type="datetime"
|
||||
placeholder="选择结束时间"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%"
|
||||
:clearable="true"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商家状态" prop="shelf">
|
||||
@@ -166,10 +170,23 @@ export default {
|
||||
// 验证结束时间必须大于开始时间
|
||||
const validateEndTime = (rule, value, callback) => {
|
||||
if (value && this.form.startTime) {
|
||||
if (new Date(value) <= new Date(this.form.startTime)) {
|
||||
callback(new Error('结束时间必须大于开始时间'));
|
||||
} else {
|
||||
callback();
|
||||
try {
|
||||
const startDate = new Date(this.form.startTime);
|
||||
const endDate = new Date(value);
|
||||
|
||||
// 检查日期是否有效
|
||||
if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
|
||||
callback(new Error('时间格式不正确'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (endDate <= startDate) {
|
||||
callback(new Error('结束时间必须大于开始时间'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} catch (error) {
|
||||
callback(new Error('时间格式不正确'));
|
||||
}
|
||||
} else {
|
||||
callback();
|
||||
@@ -265,7 +282,7 @@ export default {
|
||||
|
||||
listActivity(cleanParams).then(response => {
|
||||
this.activityList = response.rows || [];
|
||||
this.total = response.total || 0;
|
||||
this.total = parseInt(response.total) || 0;
|
||||
this.loading = false;
|
||||
|
||||
console.log('活动搜索结果:', {
|
||||
@@ -321,13 +338,7 @@ export default {
|
||||
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)
|
||||
@@ -346,6 +357,34 @@ export default {
|
||||
const id = row.id || this.ids
|
||||
getActivity(id).then(response => {
|
||||
this.form = response.data;
|
||||
|
||||
// 处理时间格式,确保日期选择器能正确显示
|
||||
if (this.form.startTime) {
|
||||
// 如果是时间戳,转换为日期字符串
|
||||
if (typeof this.form.startTime === 'number') {
|
||||
this.form.startTime = new Date(this.form.startTime).toISOString().slice(0, 19).replace('T', ' ');
|
||||
} else if (typeof this.form.startTime === 'string') {
|
||||
// 确保时间格式正确
|
||||
const date = new Date(this.form.startTime);
|
||||
if (!isNaN(date.getTime())) {
|
||||
this.form.startTime = date.toISOString().slice(0, 19).replace('T', ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.form.endTime) {
|
||||
// 如果是时间戳,转换为日期字符串
|
||||
if (typeof this.form.endTime === 'number') {
|
||||
this.form.endTime = new Date(this.form.endTime).toISOString().slice(0, 19).replace('T', ' ');
|
||||
} else if (typeof this.form.endTime === 'string') {
|
||||
// 确保时间格式正确
|
||||
const date = new Date(this.form.endTime);
|
||||
if (!isNaN(date.getTime())) {
|
||||
this.form.endTime = date.toISOString().slice(0, 19).replace('T', ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 确保图片URL正确处理,用于回显
|
||||
if (this.form.img) {
|
||||
// 如果img不是完整URL,则处理为相对路径
|
||||
@@ -362,25 +401,55 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('修改活动数据处理后:', this.form);
|
||||
this.open = true;
|
||||
this.title = "修改活动";
|
||||
}).catch(error => {
|
||||
console.error('获取活动详情失败:', error);
|
||||
this.$modal.msgError("获取活动详情失败");
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
// 验证时间格式
|
||||
if (this.form.startTime) {
|
||||
const startDate = new Date(this.form.startTime);
|
||||
if (isNaN(startDate.getTime())) {
|
||||
this.$modal.msgError("开始时间格式不正确");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.form.endTime) {
|
||||
const endDate = new Date(this.form.endTime);
|
||||
if (isNaN(endDate.getTime())) {
|
||||
this.$modal.msgError("结束时间格式不正确");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('提交活动数据:', this.form);
|
||||
|
||||
if (this.form.id != null) {
|
||||
updateActivity(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch(error => {
|
||||
console.error('修改活动失败:', error);
|
||||
this.$modal.msgError("修改失败,请重试");
|
||||
});
|
||||
} else {
|
||||
addActivity(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch(error => {
|
||||
console.error('新增活动失败:', error);
|
||||
this.$modal.msgError("新增失败,请重试");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -389,7 +458,8 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除活动编号为"' + ids + '"的数据项?').then(function() {
|
||||
const activityName = row.name || '选中的活动';
|
||||
this.$modal.confirm('是否确认删除活动"' + activityName + '"?').then(function() {
|
||||
return delActivity(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
|
||||
@@ -193,7 +193,7 @@ export default {
|
||||
this.loading = true
|
||||
listInfo(this.queryParams).then(response => {
|
||||
this.infoList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -174,7 +174,7 @@ export default {
|
||||
this.loading = true;
|
||||
listBanner(this.queryParams).then(response => {
|
||||
this.bannerList = response.rows;
|
||||
this.total = response.total;
|
||||
this.total = parseInt(response.total) || 0;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
:total="musicTotal"
|
||||
:page.sync="musicQueryParams.pageNum"
|
||||
:limit.sync="musicQueryParams.pageSize"
|
||||
@pagination="handleMusicPagination"
|
||||
@pagination="getMusicList"
|
||||
/>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@@ -282,7 +282,7 @@ export default {
|
||||
this.loading = true;
|
||||
listCategory(this.queryParams).then(response => {
|
||||
this.categoryList = response.rows;
|
||||
this.total = response.total;
|
||||
this.total = parseInt(response.total) || 0;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
@@ -515,12 +515,7 @@ export default {
|
||||
this.$message.error('绑定失败,请重试');
|
||||
});
|
||||
},
|
||||
/** 音乐分页 */
|
||||
handleMusicPagination(val) {
|
||||
this.musicQueryParams.pageNum = val.pageNum;
|
||||
this.musicQueryParams.pageSize = val.pageSize;
|
||||
this.getMusicList();
|
||||
},
|
||||
|
||||
/** 搜索音乐按钮操作 */
|
||||
handleMusicQuery() {
|
||||
this.musicQueryParams.pageNum = 1;
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
:total="musicTotal"
|
||||
:page.sync="musicQueryParams.pageNum"
|
||||
:limit.sync="musicQueryParams.pageSize"
|
||||
@pagination="handleMusicPagination"
|
||||
@pagination="getMusicList"
|
||||
style="margin-top: 15px;"
|
||||
/>
|
||||
|
||||
@@ -277,7 +277,7 @@ export default {
|
||||
this.loading = true;
|
||||
listRecommend(this.queryParams).then(response => {
|
||||
this.recommendList = response.rows;
|
||||
this.total = response.total;
|
||||
this.total = parseInt(response.total) || 0;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
@@ -529,12 +529,7 @@ export default {
|
||||
this.$message.error('绑定失败,请重试');
|
||||
});
|
||||
},
|
||||
/** 音乐分页 */
|
||||
handleMusicPagination(val) {
|
||||
this.musicQueryParams.pageNum = val.pageNum;
|
||||
this.musicQueryParams.pageSize = val.pageSize;
|
||||
this.getMusicList();
|
||||
},
|
||||
|
||||
/** 搜索音乐 */
|
||||
handleMusicQuery() {
|
||||
this.musicQueryParams.pageNum = 1;
|
||||
|
||||
@@ -129,7 +129,7 @@ export default {
|
||||
this.loading = true;
|
||||
listTag(this.queryParams).then(response => {
|
||||
this.tagList = response.rows;
|
||||
this.total = response.total;
|
||||
this.total = parseInt(response.total) || 0;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式信息" prop="contactInfo">
|
||||
<el-form-item label="联系方式信息" label-width="100px" prop="contactInfo">
|
||||
<el-input
|
||||
v-model="queryParams.contactInfo"
|
||||
placeholder="请输入联系方式信息"
|
||||
@@ -33,7 +33,7 @@
|
||||
placeholder="请选择更新时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户IP地址" prop="ipAddress">
|
||||
<el-form-item label="用户IP地址" label-width="100px" prop="ipAddress">
|
||||
<el-input
|
||||
v-model="queryParams.ipAddress"
|
||||
placeholder="请输入用户IP地址"
|
||||
@@ -86,9 +86,9 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="唯一标识符" align="center" prop="id" />
|
||||
<el-table-column label="反馈内容" align="center" prop="feedbackContent" />
|
||||
<el-table-column label="用户姓名" align="center" prop="userName" />
|
||||
<el-table-column label="联系方式类型" align="center" prop="contactType" />
|
||||
<el-table-column label="联系方式信息" align="center" prop="contactInfo" />
|
||||
<el-table-column label="用户姓名" align="center" prop="userName" :show-overflow-tooltip="true" width="120" />
|
||||
<el-table-column label="联系方式类型" align="center" prop="contactType" :show-overflow-tooltip="true" width="120" />
|
||||
<el-table-column label="联系方式信息" align="center" prop="contactInfo" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="处理状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="getStatusType(scope.row.status)">{{ getStatusLabel(scope.row.status) }}</el-tag>
|
||||
@@ -104,9 +104,9 @@
|
||||
<span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户IP地址" align="center" prop="ipAddress" />
|
||||
<el-table-column label="用户浏览器信息" align="center" prop="userAgent" />
|
||||
<el-table-column label="附件路径" align="center" prop="attachmentPath" />
|
||||
<el-table-column label="用户IP地址" align="center" prop="ipAddress" :show-overflow-tooltip="true" width="130" />
|
||||
<el-table-column label="用户浏览器信息" align="center" prop="userAgent" :show-overflow-tooltip="true" width="200" />
|
||||
<el-table-column label="附件路径" align="center" prop="attachmentPath" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown @command="(command) => handleStatusChange(command, scope.row)" trigger="click" size="mini">
|
||||
@@ -204,7 +204,7 @@ export default {
|
||||
this.loading = true
|
||||
listFeedback(this.queryParams).then(response => {
|
||||
this.feedbackList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
@@ -270,14 +270,14 @@ export default {
|
||||
"resolved": "已解决",
|
||||
"closed": "已关闭"
|
||||
};
|
||||
|
||||
|
||||
this.$modal.confirm('确认将反馈状态修改为"' + statusLabels[status] + '"吗?').then(() => {
|
||||
// 克隆对象,避免直接修改表格数据
|
||||
const feedbackData = JSON.parse(JSON.stringify(row));
|
||||
feedbackData.status = status;
|
||||
// 更新时间为当前时间
|
||||
feedbackData.updatedAt = new Date();
|
||||
|
||||
|
||||
return updateFeedback(feedbackData);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
@@ -299,4 +299,4 @@ export default {
|
||||
.el-dropdown-menu__item i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -129,7 +129,7 @@ export default {
|
||||
this.loading = true;
|
||||
listOrderInfo(this.queryParams).then(response => {
|
||||
this.orderList = response.rows;
|
||||
this.total = response.total;
|
||||
this.total = parseInt(response.total) || 0;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="handlePagination"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改普通歌曲对话框 -->
|
||||
@@ -388,12 +388,7 @@ 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();
|
||||
|
||||
@@ -349,7 +349,7 @@ export default {
|
||||
this.loading = true;
|
||||
listRemixSong(this.queryParams).then(response => {
|
||||
this.playlistList = response.rows;
|
||||
this.total = response.total;
|
||||
this.total = parseInt(response.total) || 0;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="handlePagination"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改场景音乐对话框 -->
|
||||
@@ -204,12 +204,7 @@ export default {
|
||||
this.$modal.msgError("获取场景音乐列表失败");
|
||||
});
|
||||
},
|
||||
/** 分页事件处理 */
|
||||
handlePagination(pagination) {
|
||||
this.queryParams.pageNum = pagination.page;
|
||||
this.queryParams.pageSize = pagination.limit;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
|
||||
@@ -152,7 +152,7 @@ export default {
|
||||
this.loading = true
|
||||
listContent(this.queryParams).then(response => {
|
||||
this.contentList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -241,7 +241,7 @@ export default {
|
||||
this.loading = true
|
||||
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.configList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
}
|
||||
)
|
||||
|
||||
@@ -296,7 +296,7 @@ export default {
|
||||
this.loading = true
|
||||
listData(this.queryParams).then(response => {
|
||||
this.dataList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -245,7 +245,7 @@ export default {
|
||||
this.loading = true
|
||||
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.typeList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
}
|
||||
)
|
||||
|
||||
@@ -225,7 +225,7 @@ export default {
|
||||
this.loading = true
|
||||
listNotice(this.queryParams).then(response => {
|
||||
this.noticeList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -215,7 +215,7 @@ export default {
|
||||
this.loading = true
|
||||
listPost(this.queryParams).then(response => {
|
||||
this.postList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -144,7 +144,7 @@ export default {
|
||||
this.loading = true
|
||||
allocatedUserList(this.queryParams).then(response => {
|
||||
this.userList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
}
|
||||
)
|
||||
|
||||
@@ -350,7 +350,7 @@ export default {
|
||||
this.loading = true
|
||||
listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.roleList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
}
|
||||
)
|
||||
|
||||
@@ -336,7 +336,7 @@ export default {
|
||||
this.loading = true
|
||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.userList = response.rows
|
||||
this.total = response.total
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user