lsc 1 년 전
부모
커밋
2c621417e3
1개의 변경된 파일280개의 추가작업 그리고 0개의 파일을 삭제
  1. 280 0
      pbl.js

+ 280 - 0
pbl.js

@@ -892,6 +892,10 @@ router.route("/updateCourseSate").all((req, res, next) => {
 router.route("/updateCourseMode").all((req, res, next) => {
     postmysql(req, res, "updateCourseMode");
 });
+//修改课程管理模式
+router.route("/updateTrainCourseMode").all((req, res, next) => {
+    postmysql(req, res, "updateTrainCourseMode");
+});
 
 //查询课程权限(学生是否能查看所有作业)
 router.route("/selectCourseSLook").all((req, res, next) => {
@@ -1246,6 +1250,38 @@ router.route("/addWorkNew2").all((req, res, next) => {
     }
 });
 
+router.route("/addTrainCourseNew2").all((req, res, next) => {
+    if (req.body[0]) {
+        p = [
+            req.body[0].uid,
+            req.body[0].title,
+            req.body[0].brief,
+            req.body[0].cover,
+            req.body[0].evaId,
+            req.body[0].astudent,
+            req.body[0].see,
+            req.body[0].chapters,
+            req.body[0].template,
+            req.body[0].ateacher,
+        ];
+        p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addTrainCourseNew2"); //執行存儲過程
+        mysql.usselect(p, function(ret) {
+            let course = req.body[0].courseType;
+            let courseId = ret[0][0].courseId;
+            let userid = req.body[0].uid;
+            delCourseType(course, courseId, userid);
+            // delCourseInviteCode(courseId, JSON.parse(req.body[0].inviteCode));
+            res.end(
+                JSON.stringify({
+                    ordernumber: ret[0][0].ordernumber,
+                    courseId: ret[0][0].courseId,
+                    success: 1,
+                })
+            );
+        });
+    }
+});
+
 router.route("/addTestCourse").all((req, res, next) => { //添加评测
     if (req.body[0]) {
         p = [
@@ -1374,6 +1410,39 @@ router.route("/addWorkNew2T").all((req, res, next) => {
         });
     }
 });
+
+router.route("/addTrainCourseNew2T").all((req, res, next) => {
+    if (req.body[0]) {
+        p = [
+            req.body[0].uid,
+            req.body[0].title,
+            req.body[0].brief,
+            req.body[0].cover,
+            req.body[0].evaId,
+            req.body[0].astudent,
+            req.body[0].see,
+            req.body[0].chapters,
+            req.body[0].template,
+            req.body[0].ateacher,
+        ];
+        p.unshift(_mysqlLabor[0], _mysqlLabor[1], "addTrainCourseNew2T"); //執行存儲過程
+        mysql.usselect(p, function(ret) {
+            let course = req.body[0].courseType;
+            let courseId = ret[0][0].courseId;
+            let userid = req.body[0].uid;
+            delCourseType(course, courseId, userid);
+            // delCourseInviteCode(courseId, JSON.parse(req.body[0].inviteCode));
+            res.end(
+                JSON.stringify({
+                    ordernumber: ret[0][0].ordernumber,
+                    courseId: ret[0][0].courseId,
+                    success: 1,
+                })
+            );
+        });
+    }
+});
+
 router.route("/addSynergyCourse").all((req, res, next) => {
     if (req.body[0]) {
         p = [
@@ -1793,6 +1862,33 @@ router.route("/updateWorkNew2").all((req, res, next) => {
     }
 });
 
+router.route("/updateTrainCourseNew2").all((req, res, next) => {
+    if (req.body[0]) {
+        p = [
+            req.body[0].cid,
+            req.body[0].title,
+            req.body[0].brief,
+            req.body[0].cover,
+            req.body[0].evaId,
+            req.body[0].astudent,
+            req.body[0].see,
+            req.body[0].chapters,
+            req.body[0].template,
+            req.body[0].ateacher,
+        ];
+        p.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTrainCourseNew2"); //執行存儲過程
+        mysql.usselect(p, function(ret) {
+            let course = req.body[0].courseType;
+            let courseId = req.body[0].cid;
+            let userid = req.body[0].uid;
+            delCourseType(course, courseId, userid);
+            // delCourseInviteCode(courseId, JSON.parse(req.body[0].inviteCode));
+            res.end(JSON.stringify({ success: 1 }));
+        });
+    }
+});
+
+
 router.route("/updateTestCourse").all((req, res, next) => { //修改评测
     if (req.body[0]) {
         p = [
@@ -2056,6 +2152,72 @@ router.route("/updateWorkNew4").all((req, res, next) => {
     }
 });
 
+router.route("/updateTrainCourseNew4").all((req, res, next) => {
+    if (req.body[0]) {
+        let p = [req.body[0].cid];
+        p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_trainCourse_detail"); //執行存儲過程
+        mysql.usselect(p, function(ret) {
+            let _unitIndex = parseInt(req.body[0].unitIndex);
+            let _chapters = JSON.parse(req.body[0].chapters);
+            let _unitJson = JSON.parse(ret[0][0].chapters);
+            if (_unitJson.length - 1 < _unitIndex) {
+                let _i = _unitIndex - (_unitJson.length - 1);
+                for (let i = 0; i < _i; i++) {
+                    _unitJson.push({
+                        dyName: "", //单元标题
+                        chapterInfo: [{
+                            isread: false,
+                            chapterid: guid(),
+                            title: "",
+                            courseName: "",
+                            taskJson: [{
+                                task: "",
+                                taskDetail: "",
+                                chapterData: [],
+                                toolText: "",
+                                toolChoose: [{
+                                    tool: [],
+                                    toolDetail: "",
+                                    toolType: 0,
+                                    askCount: 1,
+                                    askTitle: "",
+                                    askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
+                                }, ],
+                                isShowTools: false,
+                                askCount: 1,
+                                isFold: 0,
+                                askTitle: "",
+                                askJson: [{ askstitle: "", askItem: 1, checkList: [] }],
+                                checkJson: [{ checkCount: [], checkPerent: [] }],
+                                homeworkList: [],
+                            }, ],
+                            itemCount: 1,
+                            fileList1: [],
+                            video: [],
+                            testData: [],
+                            pData: [],
+                            templateArray: [],
+                        }, ],
+                    });
+                }
+                _unitJson[_unitIndex] = _chapters[_unitIndex];
+            } else {
+                _unitJson[_unitIndex] = _chapters[_unitIndex];
+            }
+            // console.log(_unitJson);
+            let p2 = [
+                req.body[0].cid,
+                JSON.stringify(_unitJson).replaceAll(/%/g, "%25"),
+            ];
+            p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTrainCourseNew4"); //執行存儲過程
+            mysql.usselect(p2, function(ret) {
+                res.end(JSON.stringify({ success: 1 }));
+            });
+            // res.end(JSON.stringify({ success: 1 }));
+        });
+    }
+});
+
 router.route("/updateStudentWorkNew4").all((req, res, next) => {
     //学生
     if (req.body[0]) {
@@ -2156,6 +2318,38 @@ router.route("/deleteWork").all((req, res, next) => {
     }
 });
 
+router.route("/deletetrainCourseWork").all((req, res, next) => {
+    if (req.body[0]) {
+        let p = [req.body[0].cid];
+        p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_trainCourse_detail"); //執行存儲過程
+        mysql.usselect(p, function(ret) {
+            let _chapid = req.body[0].chapid;
+            // console.log(_chapid);
+            let _chapters = JSON.parse(req.body[0].chapters);
+            let _unitJson = JSON.parse(ret[0][0].chapters);
+            let _unitJson2 = [];
+            for (var i = 0; i < _unitJson.length; i++) {
+                if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
+                    // console.log(1);
+                    // _unitJson.splice(i, -1)
+                    _unitJson2.push(_unitJson[i]);
+                    // break;
+                }
+            }
+            // console.log(_unitJson2);
+            let p2 = [
+                req.body[0].cid,
+                JSON.stringify(_unitJson2).replaceAll(/%/g, "%25"),
+            ];
+            p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTrainCourseNew4"); //執行存儲過程
+            mysql.usselect(p2, function(ret) {
+                res.end(JSON.stringify({ success: 1 }));
+            });
+            // res.end(JSON.stringify({ success: 1 }));
+        });
+    }
+});
+
 //协同删除阶段
 router.route("/deleteStudentWork").all((req, res, next) => {
     //学生
@@ -2230,6 +2424,46 @@ router.route("/restoreWork").all((req, res, next) => {
     }
 });
 
+//协同恢复删除的阶段
+router.route("/restoreTrainCourse").all((req, res, next) => {
+    if (req.body[0]) {
+        let p = [req.body[0].cid];
+        p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_trainCourse_detail"); //執行存儲過程
+        mysql.usselect(p, function(ret) {
+            let _chapid = req.body[0].chapid;
+            // console.log(_chapid);
+            let _chapters = JSON.parse(req.body[0].chapters);
+            let _unitJson = JSON.parse(ret[0][0].chapters);
+            let _unitJson2 = [];
+            let chpaindex;
+            for (var i = 0; i < _chapters.length; i++) {
+                if (_chapters[i].chapterInfo[0].chapterid == _chapid) {
+                    chpaindex = i;
+                }
+            }
+            for (var i = 0; i < _unitJson.length; i++) {
+                if (_unitJson[i].chapterInfo[0].chapterid != _chapid) {
+                    // console.log(1);
+                    // _unitJson.splice(i, -1)
+                    _unitJson2.push(_unitJson[i]);
+                    // break;
+                }
+            }
+            _unitJson2.splice(chpaindex, 0, _chapters[chpaindex]);
+            // console.log(_unitJson2);
+            let p2 = [
+                req.body[0].cid,
+                JSON.stringify(_unitJson2).replaceAll(/%/g, "%25"),
+            ];
+            p2.unshift(_mysqlLabor[0], _mysqlLabor[1], "updateTrainCourseNew4"); //執行存儲過程
+            mysql.usselect(p2, function(ret) {
+                res.end(JSON.stringify({ success: 1 }));
+            });
+            // res.end(JSON.stringify({ success: 1 }));
+        });
+    }
+});
+
 //协同恢复删除的阶段
 router.route("/restoreStudentWork").all((req, res, next) => {
     //学生
@@ -2312,6 +2546,27 @@ router.route("/selectCourseNew2").all((req, res, next) => {
         json["pageSize"]
     );
 });
+router.route("/selectTrainCourseNew2").all((req, res, next) => {
+    var json = queryString(req.url);
+    getmysql(
+        req,
+        res,
+        "selectTrainCourseNew2",
+        json["type"],
+        json["uid"],
+        json["oid"],
+        json["org"],
+        json["typea"],
+        json["typeb"],
+        json["typec"],
+        json["typed"],
+        json["typeE"],
+        json["cu"],
+        json["cn"],
+        json["page"],
+        json["pageSize"]
+    );
+});
 router.route("/selectSynergyCourse").all((req, res, next) => {
     var json = queryString(req.url);
     getmysql(
@@ -2883,6 +3138,11 @@ router.route("/deleteCourse").all((req, res, next) => {
     getmysql(req, res, "deleteCourse", json["cid"]);
 });
 //删除课程
+router.route("/deleteTrainCourse").all((req, res, next) => {
+    var json = queryString(req.url);
+    getmysql(req, res, "deleteTrainCourse", json["cid"]);
+});
+//删除课程
 router.route("/deleteSynergyCourse").all((req, res, next) => {
     var json = queryString(req.url);
     getmysql(req, res, "deleteSynergyCourse", json["cid"]);
@@ -2897,6 +3157,10 @@ router.route("/copyCourse").all((req, res, next) => {
     postmysql(req, res, "copyCourse");
 });
 //复制课程
+router.route("/copyTrainCourse").all((req, res, next) => {
+    postmysql(req, res, "copyTrainCourse");
+});
+//复制课程
 router.route("/copySynergyCourse").all((req, res, next) => {
     postmysql(req, res, "copySynergyCourse");
 });
@@ -2914,6 +3178,11 @@ router.route("/select_course_detail").all((req, res, next) => {
     var json = queryString(req.url);
     getmysql(req, res, "select_course_detail", json["cid"]);
 });
+//查看课程
+router.route("/select_trainCourse_detail").all((req, res, next) => {
+    var json = queryString(req.url);
+    getmysql(req, res, "select_trainCourse_detail", json["cid"]);
+});
 //删除评测
 router.route("/deleteTestCourseWorks").all((req, res, next) => {
     postmysql(req, res, "deleteTestCourseWorks");
@@ -3918,11 +4187,22 @@ router.route("/getCourseTemplateT").all((req, res, next) => {
     var json = queryString(req.url);
     getmysql(req, res, "select_courseTemplateT");
 });
+//teacher 查询项目模板
+router.route("/getTrainCourseTemplateT").all((req, res, next) => {
+    var json = queryString(req.url);
+    getmysql(req, res, "getTrainCourseTemplateT");
+});
+
 //teacher 查询项目模板
 router.route("/getCourseTemplateTByOid").all((req, res, next) => {
     var json = queryString(req.url);
     getmysql(req, res, "getCourseTemplateTByOid", json["oid"]);
 });
+//teacher 查询项目模板
+router.route("/getTrainCourseTemplateTByOid").all((req, res, next) => {
+    var json = queryString(req.url);
+    getmysql(req, res, "getTrainCourseTemplateTByOid", json["oid"]);
+});
 
 //目标管理查询目标模板
 router.route("/selectEvaTemplate").all((req, res, next) => {