lsc 1 gadu atpakaļ
vecāks
revīzija
5c07a756e3

+ 1 - 1
dist/index.html

@@ -32,7 +32,7 @@
       width: 100%;
       background: #e6eaf0;
       font-family: 'Source Han Sans SC', sans-serif;
-    }</style><link href=./static/css/app.1459f271133a75186d32a06be84db619.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.571c38d63f24b1ae9e16.js></script><script type=text/javascript src=./static/js/vendor.11d8a4dfbebdec332b5f.js></script><script type=text/javascript src=./static/js/app.c7f56e7ea003edb3b7da.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.c92e15eba08aa80dfa7c844494a9a67d.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.571c38d63f24b1ae9e16.js></script><script type=text/javascript src=./static/js/vendor.11d8a4dfbebdec332b5f.js></script><script type=text/javascript src=./static/js/app.847c74f17a702faed0c1.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/static/css/app.c92e15eba08aa80dfa7c844494a9a67d.css


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/static/css/app.c92e15eba08aa80dfa7c844494a9a67d.css.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/static/js/app.847c74f17a702faed0c1.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/static/js/app.847c74f17a702faed0c1.js.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/static/js/manifest.571c38d63f24b1ae9e16.js.map


+ 42 - 8
src/components/pages/testStudent/view/component/course.vue

@@ -60,6 +60,10 @@ export default {
         see: {
             type: Boolean,
             default: false
+        },
+        issetPage: {
+            type: Boolean,
+            default: false
         }
     },
     data() {
@@ -77,7 +81,8 @@ export default {
             isTong: false,
             page: 0,
             isloading: false,
-            courseDetail:{}
+            courseDetail:{},
+            courseid: ''
         }
     },
     computed: {
@@ -90,6 +95,29 @@ export default {
             },
             deep: true
         },
+        cJson: {
+            handler(newValue) {
+                if(newValue.answer2 != this.checkJson.answer2){
+                    this.checkJson = this.depthCopy(newValue)
+                    if(this.checkJson.courses.length){
+                        this.page = this.checkJson.courses.indexOf(this.courseid)
+                        this.checkJson.answer2 = this.courseid
+                    }
+                    this.$forceUpdate()
+                }
+            },
+            deep: true
+        },
+        courseid: {
+            handler(newValue) {
+                if(this.issetPage){
+                    this.$emit('update:issetPage', false)
+                }else{
+                    this.$emit('getTestWorkByCid',newValue)
+                }
+            },
+            deep: true
+        }
     },
     methods: {
         depthCopy(s) {
@@ -99,13 +127,18 @@ export default {
             this.dialogVisiblefile = true
         },
         setPage(index) {
-            if (index == '1') {
-                this.page++
-            } else if (index == '-1') {
-                this.page--
-            }
-            this.checkJson.answer2 = this.checkJson.courses[this.page]
-            this.getCourse(this.checkJson.answer2)
+            this.$emit('publish2')
+            setTimeout(() => {
+                if (index == '1') {
+                    this.page++
+                } else if (index == '-1') {
+                    this.page--
+                }
+                this.checkJson.answer2 = this.checkJson.courses[this.page]
+                this.courseid = this.checkJson.answer2
+                this.$forceUpdate()
+                this.getCourse(this.checkJson.answer2)  
+            }, 500);
         },
         getCourse(id) {
             this.isloading = true
@@ -129,6 +162,7 @@ export default {
         this.checkJson = this.cJson ? this.depthCopy(this.cJson) : undefined
         if(this.checkJson.courses.length){
             this.page = this.checkJson.courses.indexOf(this.checkJson.answer2)
+            this.courseid = this.checkJson.answer2
             this.getCourse(this.checkJson.answer2)
         }
     }

+ 9 - 0
src/components/pages/testStudent/view/component/eva.vue

@@ -56,6 +56,15 @@ export default {
             },
             deep: true
         },
+        cJson: {
+            handler(newValue) {
+                if(newValue.answer2 !== this.checkJson.answer2){
+                    this.checkJson = this.depthCopy(newValue)
+                    this.$forceUpdate()
+                }
+            },
+            deep: true
+        },
     },
     methods: {
         depthCopy(s) {

+ 16 - 7
src/components/pages/testStudent/view/component/topic.vue

@@ -20,7 +20,7 @@
             <fileV :tindex="index" :cJson.sync="item.json" :checktype="checktype" v-else-if="item.type == 5" :see="see"
               :isTeacher="isTeacher"></fileV>
             <courseV :tindex="index" :cJson.sync="item.json" :checktype="checktype" v-else-if="item.type == 6"
-              :see="see" :isTeacher="isTeacher"></courseV>
+              :see="see" :isTeacher="isTeacher" @getTestWorkByCid="getTestWorkByCid" @publish2="publish2" :issetPage.sync="issetPage"></courseV>
             <evaV :tindex="index" :cJson.sync="item.json" :checktype="checktype" v-else-if="item.type == 7" :see="see"
               :isTeacher="isTeacher"></evaV>
             <!-- <span v-else>暂未设置题目</span> -->
@@ -36,7 +36,7 @@
               <fileV :tindex="index2" :cJson.sync="item2.json" :checktype="checktype" v-else-if="item2.type == 5"
                 :see="see" :isTeacher="isTeacher"></fileV>
               <courseV :tindex="index2" :cJson.sync="item2.json" :checktype="checktype" v-else-if="item2.type == 6"
-                :see="see" :isTeacher="isTeacher"></courseV>
+                :see="see" :isTeacher="isTeacher" @getTestWorkByCid="getTestWorkByCid" @publish2="publish2" :issetPage.sync="issetPage"></courseV>
               <evav :tindex="index2" :cJson.sync="item2.json" :checktype="checktype" v-else-if="item2.type == 7"
                 :see="see" :isTeacher="isTeacher"></evav>
               <!-- <span v-else>暂未设置题目</span> -->
@@ -56,7 +56,7 @@
             <fileV :tindex="index" :cJson.sync="item.json" :checktype="checktype" v-else-if="item.type == 5" :see="see"
               :isTeacher="isTeacher"></fileV>
             <courseV :tindex="index" :cJson.sync="item.json" :checktype="checktype" v-else-if="item.type == 6"
-              :see="see" :isTeacher="isTeacher"></courseV>
+              :see="see" :isTeacher="isTeacher" @getTestWorkByCid="getTestWorkByCid" @publish2="publish2" :issetPage.sync="issetPage"></courseV>
             <evaV :tindex="index" :cJson.sync="item.json" :checktype="checktype" v-else-if="item.type == 7" :see="see"
               :isTeacher="isTeacher"></evaV>
             <!-- <span v-else>暂未设置题目</span> -->
@@ -72,7 +72,7 @@
               <fileV :tindex="index2" :cJson.sync="item2.json" :checktype="checktype" v-else-if="item2.type == 5"
                 :see="see" :isTeacher="isTeacher"></fileV>
               <coursev :tindex="index2" :cJson.sync="item2.json" :checktype="checktype" v-else-if="item2.type == 6"
-                :see="see" :isTeacher="isTeacher"></coursev>
+                :see="see" :isTeacher="isTeacher" @getTestWorkByCid="getTestWorkByCid" @publish2="publish2" :issetPage.sync="issetPage"></coursev>
               <evaV :tindex="index2" :cJson.sync="item2.json" :checktype="checktype" v-else-if="item2.type == 7"
                 :see="see" :isTeacher="isTeacher"></evaV>
               <!-- <span v-else>暂未设置题目</span> -->
@@ -149,6 +149,7 @@ export default {
         7: "评分",
       },
       isloading: true,
+      issetPage: false
     };
   },
   computed: {
@@ -213,12 +214,14 @@ export default {
         console.log(newVal);
         console.log(oldVal);
         this.checkArray = this.setJson(this.depthCopy(newVal));
+        this.$forceUpdate()
       },
       deep: true,
     },
   },
   methods: {
     setPage(index) {
+      this.issetPage = true
       this.isloading = false
       if (index == '1') {
         this.page++
@@ -244,7 +247,7 @@ export default {
                 item2.json.answer2 = [];
               } else if (item2.ttype == 1 && item2.json && !item2.json.answer2 && item2.type == 6) {
                 item2.json.answer2 = item2.json.courses[0];
-              } else if (item2.ttype == 1 && item2.json && !item2.json.answer2 && item2.type == 7) {
+              } else if (item2.ttype == 1 && item2.json && !item2.json.answer2 && item2.json.answer2 !== 0 && item2.type == 7) {
                 item2.json.answer2 = '';
               }
               if (item2.array) {
@@ -253,7 +256,7 @@ export default {
                     item3.json.answer2 = [];
                   } else if (item3.ttype == 1 && item3.json && !item3.json.answer2 && item3.type == 6) {
                     item3.json.answer2 = item3.json.courses[0];
-                  } else if (item3.ttype == 1 && item3.json && !item3.json.answer2 && item3.type == 7) {
+                  } else if (item3.ttype == 1 && item3.json && !item3.json.answer2 && item3.json.answer2 !== 0 && item3.type == 7) {
                     item3.json.answer2 = '';
                   }
                   return item3;
@@ -268,7 +271,7 @@ export default {
             item.json.answer2 = [];
           } else if (item.ttype == 1 && item.json && !item.json.answer2 && item.type == 6) {
             item.json.answer2 = item.json.courses[0];
-          } else if (item.ttype == 1 && item.json && !item.json.answer2 && item.type == 7) {
+          } else if (item.ttype == 1 && item.json && !item.json.answer2 && item.json.answer2 !== 0 && item.type == 7) {
             item.json.answer2 = '';
           }
           console.log(item.array);
@@ -280,6 +283,12 @@ export default {
         return [];
       }
     },
+    getTestWorkByCid(cid){
+      this.$emit('getTestWorkByCid', cid)
+    },
+    publish2(){
+      this.$emit('publish2')
+    }
   },
   mounted() {
     this.checkArray = this.setJson(this.depthCopy(this.cJson));

+ 220 - 46
src/components/pages/testStudent/view/preview.vue

@@ -1,32 +1,32 @@
 <template>
-  <div class="pb_content" style="background: #F0F2F5;" v-loading="loading">
+  <div class="pb_content" style="background: #F0F2F5;" v-loading="loading || isloading">
     <div class="pb_content_body" style="position: relative; margin: 0">
       <div class="right">
         <div class="courseTop">
           <div class="stepsNav">
             <el-breadcrumb separator-class="el-icon-arrow-right">
               <el-breadcrumb-item :to="{
-                path:
-                  '/testPerson?userid=' +
-                  userid +
-                  '&oid=' +
-                  oid +
-                  '&org=' +
-                  org +
-                  '&role=' +
-                  role,
-              }"  v-if="type == 3">个人中心</el-breadcrumb-item>
+    path:
+      '/testPerson?userid=' +
+      userid +
+      '&oid=' +
+      oid +
+      '&org=' +
+      org +
+      '&role=' +
+      role,
+  }" v-if="type == 3">个人中心</el-breadcrumb-item>
               <el-breadcrumb-item :to="{
-                path:
-                  '/testStudent?userid=' +
-                  userid +
-                  '&oid=' +
-                  oid +
-                  '&org=' +
-                  org +
-                  '&role=' +
-                  role,
-              }"  v-else>表单中心</el-breadcrumb-item>
+    path:
+      '/testStudent?userid=' +
+      userid +
+      '&oid=' +
+      oid +
+      '&org=' +
+      org +
+      '&role=' +
+      role,
+  }" v-else>表单中心</el-breadcrumb-item>
               <el-breadcrumb-item>
                 <span style="color: rgb(15, 126, 255)">{{ title }}</span>
               </el-breadcrumb-item>
@@ -38,12 +38,13 @@
           <div class="edit_top">
             <div class="op_btn">
               <el-button type="primary" size="small" @click="refresh" v-if="isReset">刷新</el-button>
-              <el-button type="primary" size="small" @click="reset" >重置</el-button>
+              <el-button type="primary" size="small" @click="reset">重置</el-button>
               <el-button type="primary" size="small" @click="save" v-if="type != 3">保存</el-button>
               <el-button type="primary" size="small" @click="publish">提交</el-button>
             </div>
           </div>
-          <topicVue :cJson="cJson" :title="title" :brief="brief" ref="topicVue" v-if="!loading"></topicVue>
+          <topicVue :cJson.sync="cJson" :title="title" :brief="brief" ref="topicVue" v-if="!loading"
+            @getTestWorkByCid="getTestWorkByCid" @publish2="publish2"></topicVue>
         </div>
       </div>
     </div>
@@ -65,6 +66,7 @@ export default {
       cid: this.$route.query.cid,
       tid: this.$route.query.tid,
       type: this.$route.query.type,
+      updateType: this.$route.query.type,
       steps: 1,
       title: "",
       brief: "",
@@ -75,6 +77,8 @@ export default {
       loading: false,
       look: "",
       isReset: false,
+      isloading: false,
+      courseid: ''
     }
   },
   methods: {
@@ -87,7 +91,7 @@ export default {
           type: "warning",
         })
         .then(() => {
-          if(this.type == 3){
+          if (this.type == 3) {
             this.goTo(
               "/testPerson?userid=" +
               this.userid +
@@ -98,7 +102,7 @@ export default {
               "&role=" +
               this.role
             );
-          }else{
+          } else {
             this.goTo(
               "/testStudent?userid=" +
               this.userid +
@@ -126,13 +130,21 @@ export default {
           type: "warning",
         })
         .then(() => {
-          this.cJson = JSON.parse(JSON.stringify(this.cJson2));
-          this.loading = true
-          this.isReset = false
-          setTimeout(() => {
-            this.loading = false
-          }, 0);
-          this.$forceUpdate()
+          if(this.tid){
+            this.deleteTest(this.tid)
+          }else{
+            if(this.courseid){
+              this.cJson = this.setCourseid(JSON.parse(JSON.stringify(this.cJson2)));
+            }else{
+              this.cJson = JSON.parse(JSON.stringify(this.cJson2));
+            }
+            this.loading = true
+            this.isReset = false
+            setTimeout(() => {
+              this.loading = false
+            }, 0);
+            this.$forceUpdate()
+          }
         })
         .catch(() => {
 
@@ -146,13 +158,21 @@ export default {
           type: "warning",
         })
         .then(() => {
-          this.cJson = JSON.parse(JSON.stringify(this.cJson2));
-          this.loading = true
-          this.isReset = false
-          setTimeout(() => {
-            this.loading = false
-          }, 0);
-          this.$forceUpdate()
+          if(this.tid){
+            this.deleteTest(this.tid)
+          }else{
+            if(this.courseid){
+              this.cJson = this.setCourseid(JSON.parse(JSON.stringify(this.cJson2)));
+            }else{
+              this.cJson = JSON.parse(JSON.stringify(this.cJson2));
+            }
+            this.loading = true
+            this.isReset = false
+            setTimeout(() => {
+              this.loading = false
+            }, 0);
+            this.$forceUpdate()
+          }
         })
         .catch(() => {
 
@@ -222,6 +242,81 @@ export default {
           console.error(err);
         });
     },
+    getTestWorkByCid(courseid) {
+      this.isloading = true
+      this.courseid = courseid
+      let params = {
+        cid: this.cid,
+        uid: this.userid,
+      };
+      let _courseid = courseid
+      this.ajax
+        .get(this.$store.state.api + "selectTestWorksCid", params)
+        .then((res) => {
+          if (res.data[0].length) {
+            console.log(res.data[0]);
+            let rData = res.data[0]
+            this.tid = ''
+            aa: for (var i = 0; i < rData.length; i++) {
+              let rDataJson = this.JSONSetting(JSON.parse(rData[i].courseJson))
+              let _json = JSON.parse(rData[i].courseJson)
+              for (var j = 0; j < rDataJson.length; j++) {
+                let _param = rDataJson[j]
+                if (_param.type == 6 && _param.json.answer2 && _param.json.answer2 == _courseid) {
+                  console.log(_json);
+                  this.cJson = _json
+                  let cJson = this.setJSON(JSON.parse(JSON.stringify(this.cJson)))
+                  let cJson2 = this.setJSON(this.setJson2(JSON.parse(JSON.stringify(this.cJson2))))
+                  if (JSON.stringify(cJson) != JSON.stringify(cJson2)) {
+                    this.isReset = true
+                  }
+                  this.tid = rData[i].id
+                  this.$forceUpdate()
+                  break aa;
+                }
+              }
+            }
+            if (!this.tid) {
+              this.cJson = this.setJSON(this.setCourseid(JSON.parse(JSON.stringify(this.cJson2))))
+            }
+          }
+          this.$forceUpdate()
+          this.isloading = false
+        })
+        .catch((err) => {
+          this.isloading = false
+          console.error(err);
+        });
+    },
+    JSONSetting(json) {
+      let _json = json
+      let array = []
+      _json.filter((item) => {
+        if (item.array) {
+          item.array = item.array.filter((item2) => {
+            if (item2.ttype == 1 && item2.json) {
+              array.push(item2)
+            }
+            if (item2.array) {
+              item2.array = item2.array.filter((item3) => {
+                if (item3.ttype == 1 && item3.json) {
+                  array.push(item3)
+                }
+                return item3;
+              });
+            }
+            return item2;
+          });
+        }
+        if (item.ttype == 1 && item.json) {
+          array.push(item)
+        }
+        console.log(item.array);
+        return item;
+      });
+      console.log(array);
+      return array;
+    },
     setJSON(json) {
       return json.filter((item) => {
         if (item.array) {
@@ -283,6 +378,44 @@ export default {
       console.log(checkArray);
       return checkArray;
 
+    },
+    setCourseid(json) {
+      let _json = json;
+      // this.type = _json[0].ttype;
+      let checkArray = _json.filter((item) => {
+        if (item.array) {
+          item.array = item.array.filter((item2) => {
+            if (item2.ttype == 1 && item2.json && !item2.json.answer2 && item2.type != 6) {
+              item2.json.answer2 = [];
+            }else if(item2.type == 6){
+              item2.json.answer2 = this.courseid ? this.courseid : '';
+            }
+            if (item2.array) {
+              item2.array = item2.array.filter((item3) => {
+                if (item3.ttype == 1 && item3.json && !item3.json.answer2 && item3.type != 6) {
+                  item3.json.answer2 = [];
+                }else if(item3.type == 6){
+                  item3.json.answer2 = this.courseid ? this.courseid : '';
+                }
+                return item3;
+              });
+            }
+            return (
+              (item2.ttype != 1 && item2.array.length > 0) || item2.ttype == 1
+            );
+          });
+        }
+        if (item.ttype == 1 && item.json && !item.json.answer2 && item.type != 6) {
+          item.json.answer2 = [];
+        }else if(item.type == 6){
+          item.json.answer2 = this.courseid ? this.courseid : '';
+        }
+        console.log(item.array);
+        return (item.ttype != 1 && item.array.length > 0) || item.ttype == 1;
+      });
+      console.log(checkArray);
+      return checkArray;
+
     },
     getData() {
       this.loading = true
@@ -306,9 +439,9 @@ export default {
           }
           console.log(this.testType);
           this.look = res.data[0][0].look
-          if(this.type == 3){
+          if (this.type == 3) {
             this.getTestWorks2()
-          }else{
+          } else {
             this.getTestWorks()
           }
           this.$forceUpdate();
@@ -355,17 +488,17 @@ export default {
       console.log(cjson);
       let params = [
         {
-          uid: (this.type == 3 && this.tid) ? this.tid : this.userid,
+          uid: (this.tid) ? this.tid : this.userid,
           cid: this.cid,
           cjson: encodeURIComponent(JSON.stringify(cjson)),
           type: '2',
         },
       ];
       this.ajax
-        .post(this.$store.state.api + ((this.type == 3&& this.tid) ? "addTestWorks2" : "addTestWorks"), params)
+        .post(this.$store.state.api + ((this.tid) ? "addTestWorks2" : "addTestWorks"), params)
         .then((res) => {
           this.$message.success('提交成功')
-          if(this.type == 3){
+          if (this.type == 3) {
             this.goTo(
               "/testPerson?userid=" +
               this.userid +
@@ -376,7 +509,7 @@ export default {
               "&role=" +
               this.role
             );
-          }else{
+          } else {
             this.goTo(
               "/testStudent?userid=" +
               this.userid +
@@ -394,7 +527,48 @@ export default {
           console.error(err);
         });
     },
-
+    publish2() {
+      this.isloading = true
+      let cjson = this.$refs['topicVue'].checkArray
+      console.log(cjson);
+      let params = [
+        {
+          uid: (this.tid) ? this.tid : this.userid,
+          cid: this.cid,
+          cjson: encodeURIComponent(JSON.stringify(cjson)),
+          type: '2',
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + ((this.tid) ? "addTestWorks2" : "addTestWorks"), params)
+        .then((res) => {
+          this.$message.success('保存成功')
+          setTimeout(() => {
+            this.isloading = false
+          }, 500);
+        })
+        .catch((err) => {
+          this.$message.error("网络不佳");
+          this.isloading = false
+          console.error(err);
+        });
+    },
+    deleteTest(tid) {
+      let _this = this;
+      let params = [
+        {
+          tid: tid
+        }
+      ];
+      _this.ajax
+        .post(_this.$store.state.api + "deleteTestCourseWorks", params)
+        .then(res => {
+          this.getTestWorkByCid(this.courseid)
+        })
+        .catch(err => {
+          console.error(err);
+        });
+    }
   },
   mounted() {
     this.getData();

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels