1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-72ec17e8"],{"649a":function(t,e,i){var a=i("e317");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[t.i,a,""]]),a.locals&&(t.exports=a.locals);var n=i("499e").default;n("6e491fe0",a,!0,{sourceMap:!1,shadowMode:!1})},"6ff8":function(t,e,i){"use strict";i.r(e);var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{attrs:{id:"questions"}},[i("div",{staticClass:"navTitle set-pc-style"},[i("van-icon",{attrs:{name:"arrow-left"},on:{click:t.goback}}),t._v(" "+t._s(t.plugin_name)+" ")],1),i("div",{staticStyle:{width:"100%",height:"3.6rem"}}),i("div",{staticClass:"banner"},[i("div",{staticClass:"title"},[t._v(t._s(t.title))])]),t._l(t.info,(function(e,a){return i("div",{key:a,staticClass:"selectBox"},[i("div",{staticClass:"queTitle"},[e.required?i("span",[t._v("*")]):t._e(),i("div",[t._v(t._s(a+1)+".("+t._s(1==e.type?"单选":"多选")+")"+t._s(e.choice_title))])]),e.answer?t._l(e.answer.answer,(function(n,o){return i("div",{key:o,staticStyle:{display:"flex","align-items":"center"},on:{click:function(i){return t.typeSelect(e,a,o)}}},[1==e.type?i("van-radio-group",{attrs:{value:n}},[i("van-radio",{attrs:{name:t.datainfo[a]&&t.datainfo[a][0].answer[o],"checked-color":"#2672ff"}})],1):t._e(),2==e.type?i("van-checkbox-group",{attrs:{value:n}},[i("van-checkbox",{attrs:{name:t.datainfo[a]&&t.datainfo[a][0].answer[o],shape:"square","checked-color":"#2672ff"}})],1):t._e(),i("div",{staticClass:"answer",class:[t.datainfo[a]&&t.datainfo[a][0].answer[o]==n?"contenBack":""]},[t._v(" "+t._s(n)+" "),t.datainfo[a]&&t.datainfo[a][0].answer[o]==n?i("i",{staticClass:"iconfont icon-record_go"}):t._e()])],1)})):t._e()],2)})),t.hint?i("div",{staticClass:"hint"},[t._v("您还有必填项未选中")]):t._e(),i("div",{staticClass:"btn set-pc-style",class:[t.isLoading?"btnShow":""]},[i("div",{on:{click:t.submit}},[t._v("提交")])])],2)},n=[],o=i("2909"),s=(i("e7e5"),i("d399")),r=(i("99af"),i("a9e3"),i("4de4"),i("d3b7"),i("e9c4"),i("6968")),d=i("ac0d"),l={mixins:[d["a"]],data:function(){return{isLoadMore:!0,page:1,total_page:0,isLoading:!1,info:[],id:"",tag:"index",goods_id:"",title:"",allNum:0,datainfo:[],hint:!1,plugin_name:""}},activated:function(){this.init(),this.$route.params.goods_id&&(this.goods_id=this.$route.params.goods_id),this.$route.params.id&&(this.id=this.$route.params.id),this.$route.params.tag&&(this.tag=this.$route.params.tag),this.getData()},mouted:function(){},methods:{goback:function(){"video"==this.tag?this.$router.push(this.fun.getUrl("CourseDetail",{id:this.$route.params.goods_id})):"index"==this.tag?this.$router.go(-1):this.$router.push(this.fun.getUrl("questionnaireIndex",{}))},init:function(){this.isLoadMore=!0,this.page=1,this.total_page=0,this.info=[],this.datainfo=[],this.goods_id="",this.id="",this.tag=""},onSearch:function(t){this.getData()},getMoreData:function(){var t=this;t.isLoadMore=!1,this.page>=this.total_page||(this.page=this.page+1,$http.get("plugin.questionnaire.api.index.indexInfo",{answer:"answer",questionnaire_id:t.id,page:t.page,goods_id:t.goods_id?t.goods_id:""},"加载中").then((function(e){if(t.isLoadMore=!0,1!==e.result)return t.page=t.page-1,void(t.isLoadMore=!1);var i=e.data.answer.choice.data;t.info=t.info.concat(i),Number(t.page)>=Number(t.total_page)?t.isLoading=!1:t.isLoading=!0}),(function(t){})))},getData:function(){var t=this;$http.post("plugin.questionnaire.api.index.indexInfo",{answer:"answer",questionnaire_id:t.id,page:t.page,goods_id:t.goods_id?t.goods_id:""},"").then((function(e){1===e.result?(t.info=e.data.answer.choice.data,t.id=e.data.answer.questionnaire_id,t.title=e.data.answer.title,t.total_page=e.data.answer.choice.last_page,t.plugin_name=e.data.plugin_name,t.fun.setWXTitle(t.plugin_name),Number(t.page)>=Number(t.total_page)?t.isLoading=!1:t.isLoading=!0):Object(s["a"])(e.msg)}),(function(t){Object(s["a"])(t)})).catch((function(t){}))},typeSelect:function(t,e,i){"1"==t.type?this.radio(t,e,i):this.multiple(t,e,i)},radio:function(t,e,i){var a=[],n=this.datainfo,o=t.answer.answer[i],s=t.answer.fraction[i];a.push({answer:{}},{fraction:{}},{id:t.id},{questionnaire_id:t.questionnaire_id}),a[0].answer[i]=o,a[1].fraction[i]=s,n[e]=a,this.datainfo=n,this.$forceUpdate()},multiple:function(t,e,i){var a=this.datainfo,n=t.answer.answer[i],o=t.answer.fraction[i],s=[];if(0==a.length)s.push({answer:{}},{fraction:{}},{id:t.id},{questionnaire_id:t.questionnaire_id}),s[0].answer[i]=n,s[1].fraction[i]=o,a[e]=s;else{var r=this.cheackarr(a,e,t.id);if(r)for(var d=0;d<a[e].length;d++)a[e][d].answer&&(a[e][d].answer[i]?delete a[e][d].answer[i]:a[e][d].answer[i]=n),a[e][d].fraction&&(a[e][d].fraction[i]?delete a[e][d].fraction[i]:a[e][d].fraction[i]=o);else s.push({answer:{}},{fraction:{}},{id:t.id},{questionnaire_id:t.questionnaire_id}),s[0].answer[i]=n,s[1].fraction[i]=o,a[e]=s}this.datainfo=a,this.$forceUpdate()},cheackarr:function(t,e,i){var a;if(!t[e])return a=!1,a;for(var n=0;n<t[e].length;n++)if(t[e][n].id==i)return a=!0,a},submit:function(){var t=this,e=this.datainfo;this.allNum=0;for(var i=this.info,a=this.allNum,n=0;n<i.length;n++)if(i[n].answer&&i[n].answer.fraction){if(2==i[n].type)for(var s in i[n].answer.fraction)a+=Number(i[n].answer.fraction[s]);if(1==i[n].type){var r=[];for(var d in i[n].answer.fraction)r[d]=Number(i[n].answer.fraction[d]);var l=r.filter((function(t,e,i){if(t)return t}));a+=Math.max.apply(Math,Object(o["a"])(l))}}this.allNum=a;for(var c=0;c<i.length;c++)if(i[c].id&&i[c].required&&!e[c])return this.hint=!0,void setTimeout((function(){t.hint=!1}),1500);this.pushData()},pushData:function(){var t=this,e=this;$http.get("plugin.questionnaire.api.index.indexInfo",{answerScore:"answerScore",questionnaire_id:e.id?e.id:"",data:JSON.stringify(e.datainfo)},"").then((function(i){if(1===i.result){var a=i.data.answerScore,n={score:a.score,questionnaire_id:a.questionnaire_id,allNum:e.allNum,rewardPoint:a.rewardPoint,tag:e.tag,goods_id:e.goods_id,plugin_point_name:a.plugin_point_name};t.$router.push(t.fun.getUrl("surveyResult",n))}else Object(s["a"])(i.msg)})).catch((function(t){}))}},components:{cTitle:r["a"]}},c=l,f=c,u=(i("9283"),i("2877")),h=Object(u["a"])(f,a,n,!1,null,"f853da34",null);e["default"]=h.exports},9283:function(t,e,i){"use strict";i("649a")},ac0d:function(t,e,i){"use strict";i.d(e,"a",(function(){return o}));var a=document.documentElement,n=document.body,o={data:function(){return{}},activated:function(){window.addEventListener("scroll",this.handleScroll)},deactivated:function(){window.removeEventListener("scroll",this.handleScroll)},methods:{getScrollTop:function(){var t=0;return a&&a.scrollTop?t=a.scrollTop:n&&(t=n.scrollTop),t},getClientHeight:function(){var t=0;return t=n.clientHeight&&a.clientHeight?Math.min(n.clientHeight,a.clientHeight):Math.max(n.clientHeight,a.clientHeight),t},getScrollHeight:function(){return Math.max(n.scrollHeight,a.scrollHeight)},handleScroll:function(){this.otherScroll();var t=document.documentElement.scrollTop||document.body.scrollTop;this.btnFlag=t>60,this.getScrollTop()+this.getClientHeight()+105>this.getScrollHeight()?(this.isLoadMore&&this.getMoreData(),this.isBottom=!0):this.isBottom=!1},otherScroll:function(){}}}},e317:function(t,e,i){var a=i("24fb");e=a(!1),e.push([t.i,".btn[data-v-f853da34]{position:fixed;bottom:0;width:100%;height:3.0625rem;background:#fff;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.btnShow[data-v-f853da34]{display:none;-webkit-transition:1s;transition:1s}.btn div[data-v-f853da34]{width:20.0938rem;height:2.375rem;background-color:#2672ff;border-radius:.125rem;line-height:2.375rem;font-size:1rem}.btn div[data-v-f853da34],.hint[data-v-f853da34]{text-align:center;color:#fff;letter-spacing:.0625rem}.hint[data-v-f853da34]{position:fixed;bottom:3.125rem;width:100%;height:1.9375rem;background-color:#000;opacity:.4;line-height:1.9375rem;font-size:.75rem}#questions[data-v-f853da34]{background:#fff;padding-bottom:3.0625rem}.selectBox[data-v-f853da34]{padding:0 .78rem;margin-bottom:1.75rem}.selectBox .queTitle[data-v-f853da34]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;font-size:1rem;text-align:left;margin-bottom:.9rem}.selectBox .queTitle span[data-v-f853da34]{color:#fa0505;font-size:16px}.selectBox .answer[data-v-f853da34]{text-align:left;padding-left:.91rem;height:2rem;-ms-flex-align:center;font-size:1rem;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.contenBack[data-v-f853da34],.selectBox .answer[data-v-f853da34]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.contenBack[data-v-f853da34]{background:#f3f7ff;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;padding-right:.9rem}.contenBack i[data-v-f853da34]{color:#0c6cff}.navTitle[data-v-f853da34]{font-size:1.25rem;padding:1rem 0;-webkit-box-sizing:border-box;box-sizing:border-box;text-align:left;background:#fff;padding-left:.72rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;position:fixed;top:0;z-index:999}.banner[data-v-f853da34],.navTitle[data-v-f853da34]{width:100%;overflow:hidden}.banner[data-v-f853da34]{height:8.8438rem;margin-bottom:.8125rem;background-image:url(https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/wj_titlebg@2x.png);background-repeat:no-repeat;background-size:cover}.title[data-v-f853da34]{width:11.25rem;margin:2.7188rem 0 0 1.5938rem;font-size:1.125rem;color:#fff;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-align:left}",""]),t.exports=e}}]); |