1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5bb2a616"],{"1cc7":function(t,e,n){},"3a2e":function(t,e,n){"use strict";n.r(e);n("b0c0");var s=function(){var t=this,e=t._self._c;return e("div",{staticClass:"home-container"},[e("head-bar",{on:{back:t.back},scopedSlots:t._u([{key:"title",fn:function(){return[e("div",{staticClass:"navTitle"},[t._v("修改问卷")])]},proxy:!0}])}),e("div",{staticClass:"step_box"},[e("topicVue",{ref:"topicVue",attrs:{cJson:t.cJson,title:t.name,tid:t.tid,brief:t.brief,gcourseid:t.gcourseid},on:{"update:cJson":function(e){t.cJson=e},"update:c-json":function(e){t.cJson=e},getTestWorkByCid:t.getTestWorkByCid,publish2:t.publish2}})],1),e("div",{staticClass:"edit_top"},[e("div",{staticClass:"op_btn"},[e("el-button",{attrs:{type:"primary",size:"small"},on:{click:t.publish}},[t._v("修改")])],1)])],1)},r=[],o=n("5530"),i=(n("14d9"),n("b64b"),n("4de4"),n("d3b7"),n("e9c4"),n("159b"),n("c740"),n("98e5")),a=n("71ed"),c=n("2f62"),u=n("bf3a"),l={components:{headBar:a["a"],topicVue:u["a"]},data:function(){return{courseid:"",tid:this.$route.query.tid,name:this.$route.query.name,title:"",brief:"",cJson:[],cJson2:[],cid:this.$route.query.courseid,userid:this.$route.query.userid,gcourseid:this.$route.query.courseid}},computed:Object(o["a"])({},Object(c["c"])(["userinfo"])),methods:{back:function(){this.$router.push({path:"/test"})},getData:function(){var t=this,e={cid:this.cid,tid:this.tid};Object(i["g"])(e).then((function(e){e[1].length&&(t.cJson=JSON.parse(e[1][0].courseJson),t.cJson2=JSON.parse(e[1][0].courseJson)),t.getTestWorks2(),t.title=e[0][0].title,t.brief=e[0][0].brief,t.$forceUpdate()})).catch((function(t){console.error(t)}))},JSONSetting:function(t){var e=t,n=[];return e.filter((function(t){return t.array&&(t.array=t.array.filter((function(t){return 1==t.ttype&&t.json&&n.push(t),t.array&&(t.array=t.array.filter((function(t){return 1==t.ttype&&t.json&&n.push(t),t}))),t}))),1==t.ttype&&t.json&&n.push(t),t})),n},setJson2:function(t){var e=t,n=e.filter((function(t){return t.array&&(t.array=t.array.filter((function(t){return 1==t.ttype&&t.json&&!t.json.answer2&&(t.json.answer2=[]),t.array&&(t.array=t.array.filter((function(t){return 1==t.ttype&&t.json&&!t.json.answer2&&(t.json.answer2=[]),t}))),1!=t.ttype&&t.array.length>0||1==t.ttype}))),1==t.ttype&&t.json&&!t.json.answer2&&(t.json.answer2=[]),console.log(t.array),1!=t.ttype&&t.array.length>0||1==t.ttype}));return console.log(n),n},setJSON:function(t){return t.filter((function(t){return t.array?t.array=t.array.filter((function(t){return 1==t.ttype&&t.json&&(delete t.json.answer2,delete t.json.score2,delete t.json.file),t.array&&(t.array=t.array.filter((function(t){return 1==t.ttype&&t.json&&(delete t.json.answer2,delete t.json.score2,delete t.json.file),t}))),t})):1==t.ttype&&t.json&&(delete t.json.answer2,delete t.json.score2,delete t.json.file),t}))},setCourseid:function(t){var e=this,n=t,s=n.filter((function(t){return t.array&&(t.array=t.array.filter((function(t){return 1==t.ttype&&t.json&&!t.json.answer2&&6!=t.type&&7!=t.type?t.json.answer2=[]:6==t.type?t.json.answer2=e.courseid?e.courseid:"":7==t.type&&(t.json.answer2=""),t.array&&(t.array=t.array.filter((function(t){return 1==t.ttype&&t.json&&!t.json.answer2&&6!=t.type&&7!=t.type?t.json.answer2=[]:6==t.type?t.json.answer2=e.courseid?e.courseid:"":7==t.type&&(t.json.answer2=""),t}))),1!=t.ttype&&t.array.length>0||1==t.ttype}))),1==t.ttype&&t.json&&!t.json.answer2&&6!=t.type&&6!=t.type&&7!=t.type?t.json.answer2=[]:6==t.type?t.json.answer2=e.courseid?e.courseid:"":7==t.type&&(t.json.answer2=""),console.log(t.array),1!=t.ttype&&t.array.length>0||1==t.ttype}));return console.log(s),s},getTestWorkByCid:function(t){var e=this;console.log("修改问卷"),this.courseid=t;var n={cid:this.cid,uid:this.userid};console.log("getTestWorkByCidparams",n);var s=t;Object(i["h"])(n).then((function(t){if(t[0].length){var n=t[0];console.log("rData",n),e.tid="";t:for(var r=0;r<n.length;r++)for(var o=e.JSONSetting(JSON.parse(n[r].courseJson)),i=JSON.parse(n[r].courseJson),a=0;a<o.length;a++){var c=o[a];if(6==c.type&&c.json.answer2&&c.json.answer2==s){e.cJson=i,console.log(e.cJson),e.tid=n[r].id,e.$forceUpdate();break t}}console.log("tid",e.tid),e.tid||(e.cJson=e.setJSON(e.setCourseid(JSON.parse(JSON.stringify(e.cJson2)))))}else e.tid="",console.log(111),e.cJson=e.setJSON(e.setCourseid(JSON.parse(JSON.stringify(e.cJson2))));e.$forceUpdate()})).catch((function(t){console.error(t)}))},panJSON:function(t){for(var e=0,n=0;n<t.length;n++)if(6!=t[n].type){var s=t[n].json;(5==t[n].type&&s.file&&s.file.length>0||s.answer2.length||"number"==typeof s.answer2)&&e++}return e>0},publish:function(){for(var t=this,e=this.$refs["topicVue"].checkArray,n=0;n<e.length;n++){var s=e[n];if(14==s.type){if(!s.json.answer2)return void this.$toast.fail(n+1+"、"+s.json.title+"未打卡");if(!s.json.codeScanningTime)return void this.$toast.fail(n+1+"、"+s.json.title+"未打卡");var r=(new Date).getTime(),o=new Date(s.json.codeScanningTime).getTime(),a=parseInt(s.json.minutes);r-o>60*a*1e3&&this.$toast.fail(n+1+"、"+s.json.title+"二维码已过期,请重新扫码打卡。")}}var c=[{uid:this.tid,cid:this.cid,cjson:encodeURIComponent(JSON.stringify(e)),type:"2"}];Object(i["b"])(c).then((function(e){t.$message.success("修改成功"),t.back()})).catch((function(t){console.error(t)}))},publish2:function(){for(var t=this,e=this.$refs["topicVue"].checkArray,n=0;n<e.length;n++){var s=e[n];if(14==s.type){if(!s.json.answer2)return void this.$toast.fail(n+1+"、"+s.json.title+"未打卡");if(!s.json.codeScanningTime)return void this.$toast.fail(n+1+"、"+s.json.title+"未打卡");var r=(new Date).getTime(),o=new Date(s.json.codeScanningTime).getTime(),a=parseInt(s.json.minutes);r-o>60*a*1e3&&this.$toast.fail(n+1+"、"+s.json.title+"二维码已过期,请重新扫码打卡。")}}var c=this.JSONSetting(JSON.parse(JSON.stringify(e))),u=this.panJSON(c);if(console.log("pan",u),u){var l=[{uid:this.tid,cid:this.cid,cjson:encodeURIComponent(JSON.stringify(e)),type:"2"}];this.tid?Object(i["b"])(l).then((function(e){t.$message.success("修改成功")})).catch((function(t){console.error(t)})):console.log("tid呢")}else setTimeout((function(){t.isloading=!1}),500)},getTestWorks2:function(){var t=this;Object(i["f"])({cid:this.cid,tid:this.tid}).then((function(e){console.log("res",e);var n=JSON.parse(e[2][0].courseJson),s=JSON.parse(e[0][0].chapters);s.forEach((function(t){var e=n.findIndex((function(e){return e.ttype==t.ttype&&e.type==t.type&&e.json.title==t.json.title}));-1!=e&&(t.json=n[e].json)})),t.cJson=JSON.parse(JSON.stringify(s)),t.$forceUpdate()}))}},mounted:function(){this.getData()}},f=l,d=(n("3d29"),n("2877")),p=Object(d["a"])(f,s,r,!1,null,"593c7e48",null);e["default"]=p.exports},"3d29":function(t,e,n){"use strict";n("1cc7")}}]);
|