浏览代码

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta

lsc 1 年之前
父节点
当前提交
2f0b0dbe37

+ 18 - 0
src/components/pages/test/add/edit/edit/index.vue

@@ -153,6 +153,24 @@ export default {
 			// if(this.manualJson.filter(i=>i.type==6).length>=1){
 			// 	return this.$message.error("一个表单只能添加一个课程组件");
 			// }
+			function checkType(obj){
+				if(obj.filter(i=>i.array).length>0){
+					let bol = false;
+					obj.forEach(i=>{
+						console.log(i.array)
+						if(bol)return;
+						bol = checkType(i.array);
+					})
+					return bol;
+				}else if(obj.filter(i=>i.type==6).length>=1){
+					return true;
+				}else{
+					return false;
+				}
+			}
+			if(topicType == 6 && checkType(this.manualJson)){
+				return this.$message.error("一个表单只能添加一个课程组件");
+			}
       if (this.manualJson.length > 0) {
         for (var i = 0; i < this.manualJson.length; i++) {
           if (this.manualJson[i].ttype == 2) {

+ 18 - 0
src/components/pages/test/add/setInfo/manualCreated.vue

@@ -139,6 +139,24 @@ export default {
 			// if(this.checkJson.filter(i=>i.type==6).length>=1){
 			// 	return this.$message.error("一个表单只能添加一个课程组件");
 			// }
+			function checkType(obj){
+				if(obj.filter(i=>i.array).length>0){
+					let bol = false;
+					obj.forEach(i=>{
+						console.log(i.array)
+						if(bol)return;
+						bol = checkType(i.array);
+					})
+					return bol;
+				}else if(obj.filter(i=>i.type==6).length>=1){
+					return true;
+				}else{
+					return false;
+				}
+			}
+			if(this.topicType == 6 && checkType(this.checkJson)){
+				return this.$message.error("一个表单只能添加一个课程组件");
+			}
       if (this.checkJson.length > 0) {
         for (var i = 0; i < this.checkJson.length; i++) {
           if (this.checkJson[i].ttype == 2) {

+ 2 - 1
src/components/pages/test/check/index.vue

@@ -618,7 +618,8 @@ export default {
               topic.courseArray = [];
               topic.array.forEach(async i => {
                 let data = await this.getCourse(i)
-                data.update_at = new Date(data.update_at).toLocaleString().replace('/', '-')
+								console.log(data.update_at)
+                data.update_at = new Date(data.update_at).toLocaleString('zh-CN', {year: 'numeric',month: '2-digit',day: '2-digit',hour: '2-digit',minute: '2-digit',second: '2-digit',hour12: false}).replace(/\//g,'-')
                 topic.courseArray.push(data)
               })
             } else if (topic.type == 7) {