|
@@ -607,6 +607,22 @@ router.route('/addWorkNew2').all((req, res, next) => {
|
|
|
|
|
|
});
|
|
|
|
|
|
+router.route('/addCourseWorkNew2').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], "addCourseWorkNew2"); //執行存儲過程
|
|
|
+ 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);
|
|
|
+ res.end(JSON.stringify({ ordernumber: ret[0][0].ordernumber, courseId: ret[0][0].courseId, success: 1 }));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
//新增赛事项目
|
|
|
router.route('/addRace').all((req, res, next) => {
|
|
|
if (req.body[0]) {
|
|
@@ -805,6 +821,20 @@ router.route('/updateWorkNew2').all((req, res, next) => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+router.route('/updateStudentWorkNew2').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], "updateStudentWorkNew2"); //執行存儲過程
|
|
|
+ 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);
|
|
|
+ res.end(JSON.stringify({ success: 1 }));
|
|
|
+ });
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
router.route('/updateWorkNew3').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].astudent, req.body[0].see, req.body[0].chapters, req.body[0].template, req.body[0].ateacher];
|
|
@@ -897,6 +927,69 @@ router.route('/updateWorkNew4').all((req, res, next) => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+router.route('/updateStudentWorkNew4').all((req, res, next) => {//学生
|
|
|
+ if (req.body[0]) {
|
|
|
+ let p = [req.body[0].cid];
|
|
|
+ p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_student_course_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], "updateStudentWorkNew4"); //執行存儲過程
|
|
|
+ mysql.usselect(p2, function(ret) {
|
|
|
+ res.end(JSON.stringify({ success: 1 }));
|
|
|
+ });
|
|
|
+ // res.end(JSON.stringify({ success: 1 }));
|
|
|
+ });
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
//协同删除阶段
|
|
|
router.route('/deleteWork').all((req, res, next) => {
|
|
|
if (req.body[0]) {
|
|
@@ -926,6 +1019,37 @@ router.route('/deleteWork').all((req, res, next) => {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+//协同删除阶段
|
|
|
+router.route('/deleteStudentWork').all((req, res, next) => {//学生
|
|
|
+ if (req.body[0]) {
|
|
|
+ let p = [req.body[0].cid];
|
|
|
+ p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_student_course_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], "updateStudentWorkNew4"); //執行存儲過程
|
|
|
+ mysql.usselect(p2, function(ret) {
|
|
|
+ res.end(JSON.stringify({ success: 1 }));
|
|
|
+ });
|
|
|
+ // res.end(JSON.stringify({ success: 1 }));
|
|
|
+ });
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
//协同恢复删除的阶段
|
|
|
router.route('/restoreWork').all((req, res, next) => {
|
|
|
if (req.body[0]) {
|
|
@@ -963,6 +1087,43 @@ router.route('/restoreWork').all((req, res, next) => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+//协同恢复删除的阶段
|
|
|
+router.route('/restoreStudentWork').all((req, res, next) => {//学生
|
|
|
+ if (req.body[0]) {
|
|
|
+ let p = [req.body[0].cid];
|
|
|
+ p.unshift(_mysqlLabor[0], _mysqlLabor[1], "select_student_course_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], "updateStudentWorkNew4"); //執行存儲過程
|
|
|
+ mysql.usselect(p2, function(ret) {
|
|
|
+ res.end(JSON.stringify({ success: 1 }));
|
|
|
+ });
|
|
|
+ // res.end(JSON.stringify({ success: 1 }));
|
|
|
+ });
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
router.route('/selectCourseNew').all((req, res, next) => {
|
|
|
var json = queryString(req.url);
|
|
|
getmysql(req, res, "select_course_new", json['type'], json['uid'], json['oid'], json['typea'], json['typeb'], json['typec'], json['typed'], json['typeE'], json['cu'], json['cn'], json['page'], 10);
|
|
@@ -1192,6 +1353,12 @@ 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_student_course_detail').all((req, res, next) => { //学生
|
|
|
+ var json = queryString(req.url);
|
|
|
+ getmysql(req, res, "select_student_course_detail", json['cid']);
|
|
|
+});
|
|
|
//模糊查找课程
|
|
|
// router.route('/searchCourse').all((req, res, next) => {
|
|
|
// var json = queryString(req.url);
|