基本完成

This commit is contained in:
Chester.X 2024-07-05 14:40:30 +08:00
parent cc404e0ec4
commit d087dc171f
2 changed files with 38 additions and 4 deletions

View File

@ -78,10 +78,12 @@ const beforeImageUpload = (file) => {
const handleVideoSuccess = (response, file, fileList) => { const handleVideoSuccess = (response, file, fileList) => {
file.url = response.url; file.url = response.url;
form.value.videoPath = response.url; //
}; };
const handleImageSuccess = (response, file, fileList) => { const handleImageSuccess = (response, file, fileList) => {
file.url = response.url; file.url = response.url;
form.value.imagePath = response.url; //
}; };
const handleVideoError = (error, file, fileList) => { const handleVideoError = (error, file, fileList) => {

View File

@ -78,17 +78,48 @@ const handleSearch = async () => {
} }
}; };
const handleReset = () => { const handleReset = async () => {
searchTitle.value = ''; searchTitle.value = '';
searchAuthor.value = ''; searchAuthor.value = '';
searchDescription.value = ''; searchDescription.value = '';
sortOrder.value = ''; sortOrder.value = '';
await loadCourses(true); //
};
const handleSort = async () => {
try {
const response = await axios.get('/api/courses/sort', {
params: {
token: token,
sortField: 'orderNo',
sortDirection: 'asc',
start: 0,
end: pageSize.value
}
});
const data = response.data;
coursesCount.value = data.courseCount;
allCoursesData.value = data.courseList;
coursesData.value = allCoursesData.value.slice(0, pageSize.value);
currentPage.value = 1;
firstTimeLoad.value = false;
} catch (e) {
console.error(e);
}
}; };
const handleEditButton = () => { const handleEditButton = () => {
selections.value.forEach(selection => { if (selections.value.length === 1) {
router.push({ name: 'Course', params: { id: selection.id } }); //
}); const selectedCourse = selections.value[0];
router.push({ name: 'Course', query: { mode: 'edit', id: selectedCourse.id } });
} else if (selections.value.length > 1) {
//
ElMessage.warning('无法同时修改多个目标');
} else {
//
ElMessage.warning('请先选择要修改的课程');
}
}; };
const handleDeleteButton = async () => { const handleDeleteButton = async () => {
@ -161,6 +192,7 @@ const handleDeleteInTable = async (index) => {
<el-button type="success" @click="router.push('/course?mode=create')">新增</el-button> <el-button type="success" @click="router.push('/course?mode=create')">新增</el-button>
<el-button type="warning" @click="handleEditButton">修改</el-button> <el-button type="warning" @click="handleEditButton">修改</el-button>
<el-button type="danger" @click="handleDeleteButton">删除</el-button> <el-button type="danger" @click="handleDeleteButton">删除</el-button>
<el-button type="info" @click="handleSort">排序</el-button>
</div> </div>
<el-table :data="coursesData" style="width: 100%;" @selection-change="handleSelectionChange"> <el-table :data="coursesData" style="width: 100%;" @selection-change="handleSelectionChange">