1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0f334d02"],{"14d9":function(t,e,n){"use strict";var i=n("23e7"),c=n("7b0b"),s=n("07fa"),r=n("3a34"),a=n("3511"),o=n("d039"),u=o((function(){return 4294967297!==[].push.call({length:4294967296},1)})),h=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},f=u||!h();i({target:"Array",proto:!0,arity:1,forced:f},{push:function(t){var e=c(this),n=s(e),i=arguments.length;a(n+i);for(var o=0;o<i;o++)e[n]=arguments[o],n++;return r(e,n),n}})},"301b":function(t,e,n){},3511:function(t,e,n){"use strict";var i=TypeError,c=9007199254740991;t.exports=function(t){if(t>c)throw i("Maximum allowed index exceeded");return t}},"3a34":function(t,e,n){"use strict";var i=n("83ab"),c=n("e8b5"),s=TypeError,r=Object.getOwnPropertyDescriptor,a=i&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=a?function(t,e){if(c(t)&&!r(t,"length").writable)throw new s("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},"4de4":function(t,e,n){"use strict";var i=n("23e7"),c=n("b727").filter,s=n("1dde"),r=s("filter");i({target:"Array",proto:!0,forced:!r},{filter:function(t){return c(this,t,arguments.length>1?arguments[1]:void 0)}})},a2c8:function(t,e,n){"use strict";n("301b")},c740:function(t,e,n){"use strict";var i=n("23e7"),c=n("b727").findIndex,s=n("44d2"),r="findIndex",a=!0;r in[]&&Array(1)[r]((function(){a=!1})),i({target:"Array",proto:!0,forced:a},{findIndex:function(t){return c(this,t,arguments.length>1?arguments[1]:void 0)}}),s(r)},f4b3:function(t,e,n){"use strict";var i=n("23e7"),c=n("d039"),s=n("7b0b"),r=n("c04e"),a=c((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}));i({target:"Date",proto:!0,arity:1,forced:a},{toJSON:function(t){var e=s(this),n=r(e,"number");return"number"!=typeof n||isFinite(n)?e.toISOString():null}})},fce7:function(t,e,n){"use strict";n.r(e);n("4de4"),n("fb6a"),n("b64b"),n("d3b7");var i=function(){var t=this,e=t._self._c;return e("div",{staticClass:"check"},[e("div",{staticClass:"checking"},[e("div",{staticClass:"top-nav-bar"},[e("span",{staticStyle:{"margin-right":"10px"}},[t._v("进度: "+t._s(t.active+1)+" / "+t._s(t.info.total))]),e("van-progress",{staticStyle:{flex:"1","margin-right":"10px"},attrs:{percentage:t.info.total?100*(t.active+1)/t.info.total:0,"show-pivot":!1}})],1),t.checks[t.active]?e("div",{staticClass:"checking-main"},[0==t.checks[t.active].type?[e("span",{staticClass:"check-title"},[t._v(t._s(t.checks[t.active].content))]),t._l(JSON.parse(t.checks[t.active].options),(function(n,i){return e("van-button",{key:i,staticClass:"check-option",attrs:{round:"",icon:i+1==t.checks[t.active].right?"success":i+1==t.checks[t.active].answer?0==t.info.state?"certificate":"cross":null,type:i+1==t.checks[t.active].answer?0==t.info.state?"info":i+1==t.checks[t.active].right?"primary":"danger":"default",block:""},on:{click:function(e){0==t.info.state&&t.select(i)}}},[t._v(t._s(n))])}))]:t._e(),1==t.checks[t.active].type?[e("span",{staticClass:"check-title"},[t._l(t.contentParse(t.checks[t.active].content),(function(n,i){return["text"==n.type?e("span",{key:i},[t._v(t._s(n.text))]):t._e(),"input"==n.type?[0==t.info.state?e("input",{directives:[{name:"model",rawName:"v-model",value:t.inputs[t.contentParse(t.checks[t.active].content).slice(0,i).filter((function(t){return"input"==t.type})).length],expression:"\n inputs[\n contentParse(checks[active].content)\n .slice(0, index)\n .filter((p) => p.type == 'input').length\n ]\n "}],key:i,staticClass:"answer-input",style:{width:n.long+"em"},attrs:{type:"text"},domProps:{value:t.inputs[t.contentParse(t.checks[t.active].content).slice(0,i).filter((function(t){return"input"==t.type})).length]},on:{change:function(e){t.inputs=t.inputs},input:function(e){e.target.composing||t.$set(t.inputs,t.contentParse(t.checks[t.active].content).slice(0,i).filter((function(t){return"input"==t.type})).length,e.target.value)}}}):e("span",{key:i,staticClass:"answer-input",style:{color:t.inputs[t.contentParse(t.checks[t.active].content).slice(0,i).filter((function(t){return"input"==t.type})).length]==t.jsonArray(t.checks[t.active].right)[t.contentParse(t.checks[t.active].content).slice(0,i).filter((function(t){return"input"==t.type})).length]?"#07c160":"#ee0a24"}},[t._v(t._s(t.inputs[t.contentParse(t.checks[t.active].content).slice(0,i).filter((function(t){return"input"==t.type})).length]))])]:t._e()]}))],2)]:t._e()],2):t._e(),t.checks[t.active]?e("div",{staticClass:"bottom-nav-bar"},[e("van-button",{attrs:{type:"default",icon:"arrow-left",disabled:0==t.active},on:{click:function(e){t.active--,t.updateActive()}}},[t._v("上一题")]),e("van-button",{directives:[{name:"show",rawName:"v-show",value:0==t.info.state,expression:"info.state == 0"}],staticStyle:{padding:"0 30px"},attrs:{type:"info",icon:"certificate",disabled:0==t.checks[t.active].type?0!=t.checks.filter((function(t){return""==t.answer})).length:0!=t.checks.filter((function(e,n){return n!=t.active&&""==e.answer})).length||t.inputs.filter((function(t){return t})).length!=t.contentParse(t.checks[t.active].content).filter((function(t){return"input"==t.type})).length},on:{click:t.handleSubmit}},[t._v("提交")]),e("van-button",{attrs:{type:"default",icon:"arrow",disabled:t.active+1==t.checks.length||(0==t.checks[t.active].type?""==t.checks[t.active].answer:t.inputs.filter((function(t){return t})).length!=t.contentParse(t.checks[t.active].content).filter((function(t){return"input"==t.type})).length)},on:{click:t.next}},[t._v("下一题")])],1):t._e()])])},c=[],s=(n("d401"),n("c740"),n("c975"),n("14d9"),n("f4b3"),n("e9c4"),n("25f0"),n("d8c1")),r={data:function(){return{id:0,info:{},checks:[],active:0,now:(new Date).getTime(),timer:null,inputs:[]}},created:function(){var t=this;this.id=this.$route.params&&this.$route.params.id,this.timer=setInterval((function(){t.now=(new Date).getTime()}),1e3)},mounted:function(){this.loadCheckInfo()},destroyed:function(){clearInterval(this.timer)},methods:{jsonArray:function(t){if("string"===typeof t)try{return JSON.parse(t)}catch(e){return[]}return t instanceof Array?t:[]},updateActive:function(){1!=this.checks[this.active].type||(this.inputs=this.jsonArray(this.checks[this.active].answer))},contentParse:function(t){var e=[];while(""!=t){var n=t.indexOf("_");if(-1==n)e.push({type:"text",text:t}),t="";else{for(n>0&&(e.push({type:"text",text:t.slice(0,n)}),t=t.slice(n)),n=0;n<t.length;n++)if("_"!=t[n])break;n>0&&(e.push({type:"input",long:n}),t=t.slice(n))}}return e},loadCheckInfo:function(){var t=this;this.$store.commit("loading/showLoading"),Object(s["f"])(this.id).then((function(e){t.checks=e.data.checks,t.info=e.data.info;var n=t.checks.findIndex((function(t){return 0==t.answer}));0==t.info.state&&0==t.active&&(t.active=n<0?t.checks.length-1:n),2==t.info.state&&t.$router.go(-1),t.updateActive(),t.$store.commit("loading/hideLoading")})).catch((function(){t.$store.commit("loading/hideLoading")}))},select:function(t){var e=this;this.$store.commit("loading/showLoading"),Object(s["m"])({checks_id:this.checks[this.active].id,answer:(t+1).toString()}).then((function(t){e.active<e.checks.length-1&&e.active++,e.loadCheckInfo()})).catch((function(){e.$store.commit("loading/hideLoading")}))},next:function(){var t=this;if(0!=this.info.state||0==this.checks[this.active].type)return this.active++,void this.updateActive();this.$store.commit("loading/showLoading"),Object(s["m"])({checks_id:this.checks[this.active].id,answer:JSON.stringify(this.inputs).toString()}).then((function(e){t.active<t.checks.length-1&&t.active++,t.loadCheckInfo()})).catch((function(){t.$store.commit("loading/hideLoading")}))},handleSubmit:function(){var t=this;0!=this.checks[this.active].type?(this.$store.commit("loading/showLoading"),Object(s["m"])({checks_id:this.checks[this.active].id,answer:JSON.stringify(this.inputs).toString()}).then((function(e){t.submit()})).catch((function(){t.$store.commit("loading/hideLoading")}))):this.submit()},submit:function(){var t=this;this.$store.commit("loading/showLoading"),Object(s["n"])(this.info.id).then((function(e){t.active=0,t.loadCheckInfo(),t.$store.dispatch("user/getInfo").then((function(){t.$router.back(-1)}))})).catch((function(){t.$store.commit("loading/hideLoading")}))}}},a=r,o=(n("a2c8"),n("2877")),u=Object(o["a"])(a,i,c,!1,null,"c9f43ec8",null);e["default"]=u.exports}}]);
|