From 9e4f2038f01fe213562a80d57381353b4e9f73b7 Mon Sep 17 00:00:00 2001 From: huweihang <916879598@qq.com> Date: Wed, 17 Dec 2025 01:54:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=8A=A5=E5=90=8D?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=92=8C=E5=88=A0=E9=99=A4=E6=8A=A5=E5=90=8D?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=EF=BC=8C=E4=BC=98=E5=8C=96=E5=8F=97=E4=BC=97?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=BC=B9=E7=AA=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/course/CourseManage.vue | 128 +++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 2 deletions(-) diff --git a/src/views/course/CourseManage.vue b/src/views/course/CourseManage.vue index 2098b1f6..15044d7a 100644 --- a/src/views/course/CourseManage.vue +++ b/src/views/course/CourseManage.vue @@ -47,7 +47,18 @@
- 导出报名记录 + + 添加报名 + + + 导出报名记录 +
@@ -72,6 +83,22 @@ + + +
@@ -226,6 +253,17 @@
+ +
@@ -452,15 +490,27 @@ import apiCoursePortal from "@/api/modules/coursePortal.js"; import { mapGetters, mapActions } from "vuex"; import apiUser from "@/api/system/user.js"; import apiStudy from "@/api/modules/courseStudy.js"; +import apiCourse from "@/api/modules/course.js"; import { getToken } from "@/utils/token"; import axios from "axios"; import NameFilterSelect from "@/components/NameFilterSelect/index.vue"; +import SignupModal from "@/components/signup/SignupModal.vue"; +import AudienceModal from "@/components/signup/AudienceModal.vue"; NameFilterSelect; export default { - components: { NameFilterSelect }, + components: { NameFilterSelect, SignupModal, AudienceModal }, + props: { + showSignupActions: { + type: Boolean, + default: false, + }, + }, computed: { ...mapGetters(["resOwnerMap", "sysTypeMap"]), + hasCourseCrowds() { + return Array.isArray(this.courseCrowds) && this.courseCrowds.length > 0; + }, }, data() { return { @@ -514,6 +564,8 @@ export default { }, studyDateTime: [], courseDetail: JSON.parse(sessionStorage.getItem("courseDetail")), + // 课程详情中的 crowds 信息(通过 apiCourse.detail 获取) + courseCrowds: [], downParams: {}, typePress: false, isHomeWork: false, @@ -538,6 +590,9 @@ export default { value: "", input: "", tabName: "second", + audienceDialogVisible: false, + addSignupVisible: false, + selectedAudiences: [], learningSituation: { pageIndex: 1, //第几页 pageSize: 10, // 每页多少条 @@ -623,6 +678,7 @@ export default { }; }, mounted() { + this.getCourseDetailCrowds(); this.getSignupList(); this.getResOwnerTree().then((rs) => { this.resOwnerListMap = rs; @@ -639,6 +695,58 @@ export default { loadSysTypes: "sysType/loadSysTypes", }), + // 查询课程详情,获取 crowds 信息 + getCourseDetailCrowds() { + if (!this.courseDetail || !this.courseDetail.id) return; + apiCourse + .detail(this.courseDetail.id) + .then((res) => { + console.log('res1', res); + const result = res.result || {}; + this.courseCrowds = Array.isArray(result.crowds) ? result.crowds : []; + }) + .catch(() => { + this.courseCrowds = []; + }); + }, + // 添加报名按钮点击,根据 crowds 是否有值决定弹窗 + handleAddSignupClick() { + if (this.hasCourseCrowds) { + this.audienceDialogVisible = true; + } else { + this.addSignupVisible = true; + } + }, + handleSignupCreate(payload) { + console.log("signup payload", payload); + this.getSignupList(); + }, + handleDeleteSignup(row) { + this.$confirm(`确认删除${row.name || ''}的报名记录吗?`, '删除确认', { + confirmButtonText: '确定', + cancelButtonText: '取消', + dangerouslyUseHTMLString: true, + type: 'warning', + customClass: 'custom-confirm-dialog' + }).then(() => { + apicourseStudy.deleteSignUp(row.id, this.courseDetail.id) + .then((res) => { + if (res && res.status === 200) { + this.$showMessage("删除成功", 'success'); + this.getSignupList(); + } else if (res) { + this.$showMessage(res.message || "删除失败", 'error'); + } + }) + .catch((err) => { + this.$showMessage("删除失败", 'error'); + }); + }) + .catch((err) => { + // this.$showMessage('已取消删除', 'info'); + }); + }, + resetCommonResourceQuery() { this.$refs.commonResourceStudyPeopleNameFilter.handleReset(); this.commonResourceStudyPeopleQuery = { @@ -1079,6 +1187,10 @@ export default { this.learningRecords.pageIndex = val; this.getStudyRecords(); }, + handleAudienceConfirm(list) { + this.selectedAudiences = list; + this.getSignupList(); + }, // 报名列表 getSignupList() { let params = { @@ -1175,6 +1287,18 @@ export default { word-break: break-all; white-space: nowrap; } +.delete-action-link--danger { + color: #E32E2E; + &:hover { + color: #E32E2E; + } + &:active { + color: #E32E2E; + } + &:focus { + color: #E32E2E; + } +} #courseManage { .option-code { margin-left: 4px;