chunk-5542237d.46d32f1c.js 5.6 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5542237d"],{"04ba":function(e,t,n){},d2b4:function(e,t,n){"use strict";n("04ba")},eaa4:function(e,t,n){"use strict";n.r(t);var s=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.title,brief:e.brief,tid:e.tid},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)},r=[],o=n("5530"),i=(n("14d9"),n("b64b"),n("e9c4"),n("4de4"),n("d3b7"),n("98e5")),a=n("71ed"),c=n("2f62"),u=n("bf3a"),f={components:{headBar:a["a"],topicVue:u["a"]},data:function(){return{courseid:"",cid:this.$route.query.courseid,userid:this.$route.query.userid,see:!1,tid:"",title:"",brief:"",look:"",cJson:[],cJson2:[]}},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};Object(i["e"])(t).then((function(t){e.cJson=JSON.parse(t[0][0].chapters),e.cJson2=JSON.parse(t[0][0].chapters),e.title=t[0][0].title,e.brief=t[0][0].brief,e.see=1==t[0][0].open,e.testType=[];for(var n=0;n<t[1].length;n++)e.testType.push(t[1][n].typeid);e.look=t[0][0].look,e.$forceUpdate()})).catch((function(e){console.error(e)}))},getTestWorkByCid:function(e){var t=this;this.courseid=e;var n={cid:this.cid,uid:this.userinfo.userid};console.log("getTestWorkByCidparams",n);var s=e;Object(i["g"])(n).then((function(e){if(console.log("selectTestWorksCid",e),e[0].length){var n=e[0];t.tid="";e:for(var r=0;r<n.length;r++)for(var o=t.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){t.cJson=i,console.log(t.cJson),t.tid=n[r].id,t.$forceUpdate();break e}}t.tid||(t.cJson=t.setJSON(t.setCourseid(JSON.parse(JSON.stringify(t.cJson2)))))}else t.tid="",t.cJson=t.setJSON(t.setCourseid(JSON.parse(JSON.stringify(t.cJson2))));t.$forceUpdate()})).catch((function(e){console.error(e)}))},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=[]),1!=e.ttype&&e.array.length>0||1==e.ttype}));return n},setCourseid:function(e){var t=this,n=e,s=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=""),1!=e.ttype&&e.array.length>0||1==e.ttype}));return console.log("checkArray",s),s},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},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}))},panJSON:function(e){for(var t=0,n=0;n<e.length;n++)if(6!=e[n].type){var s=e[n].json;(5==e[n].type&&s.file&&s.file.length>0||s.answer2.length||"number"===typeof s.answer2)&&t++}return t>0},publish2:function(){var e=this;console.log("publish2");var t=this.$refs["topicVue"].checkArray,n=this.JSONSetting(JSON.parse(JSON.stringify(t))),s=this.panJSON(n);if(s){var r=[{uid:this.tid?this.tid:this.userinfo.userid,cid:this.cid,cjson:encodeURIComponent(JSON.stringify(t)),type:"2"}];this.tid?Object(i["b"])(r).then((function(t){e.$message.success("保存成功")})).catch((function(e){console.error(e)})):Object(i["a"])(r).then((function(t){e.$message.success("保存成功")})).catch((function(e){console.error(e)}))}else setTimeout((function(){e.isloading=!1}),500)},publish:function(){var e=this;console.log("publish");var t=this.$refs["topicVue"].checkArray,n=[{uid:this.tid?this.tid:this.userinfo.userid,cid:this.cid,cjson:encodeURIComponent(JSON.stringify(t)),type:2}];this.tid?Object(i["b"])(n).then((function(t){e.$message.success("提交成功"),e.back()})).catch((function(e){console.error(e)})):(console.log("shangchuan"),Object(i["a"])(n).then((function(t){e.$message.success("提交成功"),e.back()})).catch((function(e){console.error(e)})))}},mounted:function(){this.getData()}},p=f,l=(n("d2b4"),n("2877")),d=Object(l["a"])(p,s,r,!1,null,"4e39bdca",null);t["default"]=d.exports}}]);