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