(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ed14ae0c"],{"0d69":function(e,t,a){"use strict";a("a69a")},"31a8":function(e,t,a){"use strict";var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"upload-corp-container"},[a("div",{staticClass:"source"},[a("div",[a("div",{staticClass:"avatar-uploader"},[a("div",{staticClass:"el-upload el-upload--text",attrs:{tabindex:"0"}},[e.hasImg?e._e():a("i",{staticClass:"el-icon-plus avatar-uploader-icon",on:{click:e.handleClick}}),e.hasImg?a("img",{staticClass:"upload-preview-img",attrs:{alt:"",src:e.initialImgUrl},on:{click:e.showInitImg}}):e._e(),a("input",{ref:"fileinput",staticClass:"el-upload__input",attrs:{type:"file",name:"file",accept:"image/*"},on:{change:e.handleChange}}),e.hasImg?a("div",{staticClass:"action-bar"},[a("el-button",{attrs:{type:"success",size:"small",icon:"el-icon-edit"},on:{click:e.handleClick}},[e._v(" 替换 ")]),a("el-button",{attrs:{type:"danger",size:"small",icon:"el-icon-delete"},on:{click:e.removeImg}},[e._v(" 移除 ")])],1):e._e()])])])]),a("div",{directives:[{name:"show",rawName:"v-show",value:e.show,expression:"show"}],staticClass:"vue-image-crop-upload"},[a("div",{staticClass:"vicp-wrap"},[a("div",{staticClass:"vicp-close",on:{click:e.off}},[a("i",{staticClass:"vicp-icon4"})]),2===e.step?a("div",{staticClass:"vicp-step2"},[a("div",{staticClass:"vicp-crop"},[a("div",{directives:[{name:"show",rawName:"v-show",value:!0,expression:"true"}],staticClass:"vicp-crop-left"},[a("div",{staticClass:"vicp-img-container",on:{wheel:function(t){return t.preventDefault(),e.handleMouseWheel(t)}}},[a("img",{ref:"img",staticClass:"vicp-img",style:e.sourceImgStyle,attrs:{src:e.sourceImgUrl,draggable:"false",alt:""},on:{drag:e.preventDefault,dragstart:e.preventDefault,dragend:e.preventDefault,dragleave:e.preventDefault,dragover:e.preventDefault,dragenter:e.preventDefault,drop:e.preventDefault,touchstart:e.imgStartMove,touchmove:e.imgMove,touchend:e.createImg,touchcancel:e.createImg,mousedown:e.imgStartMove,mousemove:e.imgMove,mouseup:e.createImg,mouseout:e.createImg}}),a("div",{staticClass:"vicp-img-shade vicp-img-shade-1",style:e.sourceImgShadeStyle}),a("div",{staticClass:"vicp-img-shade vicp-img-shade-2",style:e.sourceImgShadeStyle})]),a("div",{staticClass:"vicp-range"},[a("input",{directives:[{name:"model",rawName:"v-model",value:e.scale.range,expression:"scale.range"}],attrs:{type:"range",step:"1",min:"0",max:"100"},domProps:{value:e.scale.range},on:{mousemove:e.zoomChange,__r:function(t){return e.$set(e.scale,"range",t.target.value)}}}),a("i",{staticClass:"vicp-icon5",on:{mousedown:e.startZoomSub,mouseout:e.endZoomSub,mouseup:e.endZoomSub}}),a("i",{staticClass:"vicp-icon6",on:{mousedown:e.startZoomAdd,mouseout:e.endZoomAdd,mouseup:e.endZoomAdd}})]),e.noRotate?e._e():a("div",{staticClass:"vicp-rotate"},[a("i",{on:{click:e.rotateImg}},[e._v("↻")])])]),a("div",{directives:[{name:"show",rawName:"v-show",value:!0,expression:"true"}],staticClass:"vicp-crop-right"},[a("div",{staticClass:"vicp-preview"},[e.noSquare?e._e():a("div",{staticClass:"vicp-preview-item"},[a("img",{style:e.previewStyle,attrs:{src:e.createImgUrl}}),a("span",[e._v("预览")])]),e.noCircle?e._e():a("div",{staticClass:"vicp-preview-item vicp-preview-item-circle"},[a("img",{style:e.previewStyle,attrs:{src:e.createImgUrl}}),a("span",[e._v("预览")])])])])]),a("div",{staticClass:"vicp-operate"},[a("el-button",{attrs:{type:"warning",size:"small",icon:"el-icon-edit"},on:{click:e.off}},[e._v(" 取消 ")]),a("el-button",{attrs:{type:"primary",size:"small",icon:"el-icon-success"},on:{click:e.prepareUpload}},[e._v(" 保存 ")])],1)]):e._e(),3===e.step?a("div",{staticClass:"vicp-step3"},[a("div",{staticClass:"vicp-upload"},[a("span",{directives:[{name:"show",rawName:"v-show",value:1===e.loading,expression:"loading === 1"}],staticClass:"vicp-loading"},[e._v("正在上传……")]),a("div",{staticClass:"vicp-progress-wrap"},[a("span",{directives:[{name:"show",rawName:"v-show",value:1===e.loading,expression:"loading === 1"}],staticClass:"vicp-progress",style:e.progressStyle})]),a("div",{directives:[{name:"show",rawName:"v-show",value:2===e.loading,expression:"loading === 2"}],staticClass:"vicp-success"},[a("i",{staticClass:"vicp-icon3"}),e._v(" 上传成功 ")])]),a("div",{staticClass:"vicp-operate"},[a("a",{on:{click:function(t){return e.setStep(2)},mousedown:e.ripple}},[e._v("返回")]),a("a",{on:{click:e.off,mousedown:e.ripple}},[e._v("关闭")])])]):e._e(),a("canvas",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],ref:"canvas",attrs:{width:e.width,height:e.height}})])])])},i=[],n=a("1da1"),s=a("53ca"),o=a("d4ec"),l=a("bee2"),c=a("262e"),u=a("2caf"),p=(a("96cf"),a("c975"),a("4795"),a("b0c0"),a("4160"),a("159b"),a("b64b"),a("d3b7"),a("9ab4")),h=a("1b40"),d=(a("4ec9"),a("3ca3"),a("ddb0"),new Map([["jpg","image/jpeg"],["png","image/png"],["gif","image/gif"],["svg","image/svg+xml"],["psd","image/photoshop"]]));a("ac1f"),a("1276"),a("ace4"),a("5cc6"),a("9a8c"),a("a975"),a("735e"),a("c1ac"),a("d139"),a("3a7b"),a("d5d6"),a("82f8"),a("e91f"),a("60bd"),a("5f96"),a("3280"),a("3fcc"),a("ca91"),a("25a1"),a("cd26"),a("3c5d"),a("2954"),a("649e"),a("219c"),a("170b"),a("b39a"),a("72f7");function m(e,t){e=e.split(",")[1],e=window.atob(e);for(var a=new Uint8Array(e.length),r=0;rn&&(u=i.width/e,c=i.width/a,o=(i.height-c)/2),{scale:u,x:s,y:o,width:l,height:c}}},{key:"sourceImgShadeStyle",get:function(){var e=this.sourceImgMasking,t=this.sourceImgContainer,a=t,r=e,i=r.width===a.width?r.width:(a.width-r.width)/2,n=r.height===a.height?r.height:(a.height-r.height)/2;return{width:i+"px",height:n+"px"}}},{key:"previewStyle",get:function(){var e=this.ratio,t=this.previewContainer,a=t,r=a.width,i=a.height,n=r/i;return en&&(i=a.width/e),{width:r+"px",height:i+"px"}}},{key:"beforeUnmount",value:function(){document.removeEventListener("keyup",this.handleEscClose)}},{key:"mounted",value:function(){this.sourceImgUrl&&this.startCrop()}},{key:"showInitImg",value:function(){this.initialImgUrl&&(this.sourceImgUrl=this.initialImgUrl,this.startCrop())}},{key:"handleEscClose",value:function(e){!this.show||"Escape"!==e.key&&27!==e.keyCode||this.off()}},{key:"ripple",value:function(e){g(e)}},{key:"stepChange",value:function(){this.show=1!==this.step}},{key:"checkShowError",value:function(){this.hasError&&this.errorMsg&&(this.$message.error(this.errorMsg),this.hasError=!1,this.errorMsg="")}},{key:"off",value:function(){var e=this;setTimeout((function(){e.show=!1,3===e.step&&2===e.loading&&e.setStep(1)}),200)}},{key:"setStep",value:function(e){var t=this;setTimeout((function(){t.step=e}),200)}},{key:"preventDefault",value:function(e){return e.preventDefault(),!1}},{key:"handleClick",value:function(e){1!==this.loading&&e.target!==this.$refs.fileinput&&(e.preventDefault(),this.$refs.fileinput.click())}},{key:"handleChange",value:function(e){if(e.preventDefault(),1!==this.loading){var t=e.target.files||e.dataTransfer.files;this.reset(),this.checkFile(t[0])?this.setSourceImg(t[0]):this.off()}}},{key:"checkFile",value:function(e){var t=this.maxSize;return-1===e.type.indexOf("image")?(this.hasError=!0,this.errorMsg="仅限图片格式",!1):!(e.size/1024>t)||(this.hasError=!0,this.errorMsg="单文件大小不能超过 "+t+"kb",!1)}},{key:"reset",value:function(){this.loading=0,this.hasError=!1,this.errorMsg="",this.progress=0}},{key:"setSourceImg",value:function(e){this.$emit("src-file-set",e.name,e.type,e.size);var t=new FileReader,a=this;t.onload=function(e){a.sourceImgUrl=t.result+"",a.startCrop()},t.readAsDataURL(e)}},{key:"startCrop",value:function(){var e=this.width,t=this.height,a=this.ratio,r=this.scale,i=this.sourceImgUrl,n=this.sourceImgMasking,s=n,o=new Image;o.src=i,o.setAttribute("crossOrigin","Anonymous");var l=this;o.onload=function(){var i=o.naturalWidth,n=o.naturalHeight,c=i/n,u=s.width,p=s.height,h=0,d=0;if(ic&&(p=u/c,d=(s.height-p)/2),a0&&(g=0),f>0&&(f=0),g0&&this.zoomImg(t.range>=100?100:++t.range),e.wheelDelta<0&&this.zoomImg(t.range<=0?0:--t.range)):e.detail&&(e.detail>0&&this.zoomImg(t.range>=100?100:++t.range),e.detail<0&&this.zoomImg(t.range<=0?0:--t.range))}},{key:"startZoomAdd",value:function(e){var t=this.scale,a=this;function r(){if(t.zoomAddOn){var e=t.range>=100?100:++t.range;a.zoomImg(e),setTimeout((function(){r()}),60)}}t.zoomAddOn=!0,r()}},{key:"endZoomAdd",value:function(e){this.scale.zoomAddOn=!1}},{key:"startZoomSub",value:function(e){var t=this.scale,a=this;function r(){if(t.zoomSubOn){var e=t.range<=0?0:--t.range;a.zoomImg(e),setTimeout((function(){r()}),60)}}t.zoomSubOn=!0,r()}},{key:"endZoomSub",value:function(e){var t=this.scale;t.zoomSubOn=!1}},{key:"zoomChange",value:function(e){this.zoomImg(e.target.value)}},{key:"zoomImg",value:function(e){var t=this.sourceImgMasking,a=this.scale,r=a.maxWidth,i=a.maxHeight,n=a.minWidth,s=a.minHeight,o=a.width,l=a.height,c=a.x,u=a.y,p=t,h=p.width,d=p.height,m=n+(r-n)*e/100,g=s+(i-s)*e/100,f=h/2-m/o*(h/2-c),v=d/2-g/l*(d/2-u);f>0&&(f=0),v>0&&(v=0),f0?"删除选中项":"删除所有",this.exportBtnName=this.multipleSelection.length>0?"导出选中项":"导出所有"}},{key:"shopChange",value:function(){console.log("shop change: ".concat(this.shop)),this.getList()}},{key:"defaultPuzzle",value:function(){return{_id:void 0,question:"",a1:"",a2:"",a3:"",a4:"",type:1}}},{key:"handleClick",value:function(e){var t=e.target.files;if(t){var a=t[0];this.upload(a)}}},{key:"handleAddQuestion",value:function(){this.dialogType="new",this.dialogVisible=!0,this.record=Object.assign({},this.defaultPuzzle())}},{key:"handleEditQuestion",value:function(e){this.dialogType="edit",this.dialogVisible=!0,this.record=Object(x["cloneDeep"])(e.row)}},{key:"handleImport",value:function(){this.$refs["excel-upload-input"].click()}},{key:"handleRemoveAll",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,a,r,i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,t=this.multipleSelection.length>0?"确定删除选中的题目":"确定删除所有题目",e.next=4,this.$confirm(t,"Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 4:if(this.multipleSelection.length>0){a=Object(n["a"])(this.multipleSelection);try{for(a.s();!(r=a.n()).done;)i=r.value,this.questions.splice(this.questions.indexOf(i),1)}catch(s){a.e(s)}finally{a.f()}this.$refs.question_table.clearSelection()}else this.questions.length=0;this.sliceData(),this.$message({type:"success",message:"Deleted!"}),e.next=12;break;case 9:e.prev=9,e.t0=e["catch"](0),console.log(e.t0);case 12:case"end":return e.stop()}}),e,this,[[0,9]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"handleExport",value:function(){this.handleDownload()}},{key:"handleDelete",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(t){var a,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=t.$index,r=t.row,console.log(a,r),e.prev=2,e.next=5,this.$confirm("确定删除当前记录?","Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 5:this.questions.splice(this.questions.indexOf(r),1),this.sliceData(),this.$message({type:"success",message:"Deleted!"}),e.next=13;break;case 10:e.prev=10,e.t0=e["catch"](2),console.log(e.t0);case 13:case"end":return e.stop()}}),e,this,[[2,10]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"handleSelectionChange",value:function(e){this.multipleSelection=e,console.log(this.multipleSelection)}},{key:"upload",value:function(e){this.$refs["excel-upload-input"].value="",this.readerData(e)}},{key:"readerData",value:function(e){var t=this;this.loading=!0;var a=new FileReader;a.onload=function(e){var a=e.target.result,r=F.a.read(a,{type:"array"}),i=r.SheetNames[0],n=r.Sheets[i],s=t.getHeaderRow(n),o=F.a.utils.sheet_to_json(n);t.generateData(s,o),t.loading=!1},a.readAsArrayBuffer(e)}},{key:"getHeaderRow",value:function(e){for(var t=[],a=F.a.utils.decode_range(e["!ref"]),r=a.s.r,i=a.s.c;i<=a.e.c;++i){var n=e[F.a.utils.encode_cell({c:i,r:r})],s="";n&&n.t&&(s=F.a.utils.format_cell(n)),""===s&&(s="UNKNOWN "+i),t.push(s)}return t}},{key:"generateData",value:function(e,t){this.excelData.header=e,this.excelData.results=t;var a,r=new Set,i=Object(n["a"])(this.questions);try{for(i.s();!(a=i.n()).done;){var s=a.value;r.add(s.question)}}catch(h){i.e(h)}finally{i.f()}var o,l=0,c=Object(n["a"])(t);try{for(c.s();!(o=c.n()).done;){var u=o.value;r.has(u.question)||(this.questions.push(u),r.add(u.question),l+=1)}}catch(h){c.e(h)}finally{c.f()}this.sliceData(),console.log(this.excelData);var p="操作成功, 共导入".concat(l,"个题目");this.$message({type:"success",message:p})}},{key:"sizeChange",value:function(e){this.pageSize=e,this.sliceData()}},{key:"pageChange",value:function(e){this.currentPage=e,this.sliceData()}},{key:"computeTableIndex",value:function(e){return(this.currentPage-1)*this.pageSize+e+1}},{key:"sliceData",value:function(){var e=this.filterData();this.tableData=e.slice((this.currentPage-1)*this.pageSize,this.currentPage*this.pageSize),0===this.tableData.length&&this.currentPage>1&&(this.currentPage-=1,this.sliceData())}},{key:"filterData",value:function(){var e,t=[],a=Object(n["a"])(this.questions);try{for(a.s();!(e=a.n()).done;){var r=e.value;t.push(r)}}catch(i){a.e(i)}finally{a.f()}return this.dataCount=t.length,t}},{key:"valchange",value:function(e){console.log("valchange",e),this.$emit("update",e)}},{key:"handleDownload",value:function(){this.downloadLoading=!0;var e=["question","a1","a2","a3","a4","type"],t=this.multipleSelection.length>0?this.multipleSelection.slice(0):this.questions.slice(0);this.filename=Object(I["d"])(new Date,"{y}{m}{d}{h}{i}{s}");var a=Object(I["c"])(e,t);console.log("begin generate excel"),Object($["a"])(e,a,this.filename?this.filename:void 0,void 0,void 0,!0,"xlsx"),this.downloadLoading=!1}},{key:"importFromOther",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(console.log("importFromOther"),9!==j["a"].level||!j["a"].department){e.next=4;break}return e.next=4,this.getList();case 4:this.listVisible=!0;case 5:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"closeModal",value:function(){this.dialogVisible=!1,this.$refs.modalForm.clearValidate()}},{key:"closeListModal",value:function(){this.listVisible=!1}},{key:"saveModalData",value:function(){var e=this,t="edit"===this.dialogType;this.$refs.modalForm.validate(function(){var a=Object(s["a"])(regeneratorRuntime.mark((function a(r){var i;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(r){a.next=3;break}return e.$message.error("请按要求填写表单"),a.abrupt("return",!1);case 3:if(!t){a.next=14;break}i=0;case 5:if(!(i0){e.next=3;break}return this.$message.error("请先选择一个有题目的活动"),e.abrupt("return");case 3:return e.prev=3,e.next=6,this.$confirm("确定导入当前挑战活动的所有题目?","Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 6:r=new Set,i=Object(n["a"])(this.questions);try{for(i.s();!(s=i.n()).done;)o=s.value,r.add(o.question)}catch(d){i.e(d)}finally{i.f()}l=0,c=Object(n["a"])(this.tableRadio.questions);try{for(c.s();!(u=c.n()).done;)p=u.value,r.has(p.question)||(this.questions.push(p),r.add(p.question),l+=1)}catch(d){c.e(d)}finally{c.f()}this.sliceData(),console.log(this.excelData),this.closeListModal(),h="操作成功, 共导入".concat(l,"个题目"),this.$message({type:"success",message:h}),e.next=22;break;case 19:e.prev=19,e.t0=e["catch"](3),console.log(e.t0);case 22:case"end":return e.stop()}}),e,this,[[3,19]])})));function t(){return e.apply(this,arguments)}return t}()}]),a}(h["c"]);Object(p["a"])([Object(h["d"])("questions")],q.prototype,"initDataChange",null),Object(p["a"])([Object(h["d"])("multipleSelection")],q.prototype,"selectChange",null),Object(p["a"])([Object(h["d"])("shop")],q.prototype,"shopChange",null),q=Object(p["a"])([Object(h["a"])({name:"PuzzleList",props:["questions","examid"],model:{prop:"questions",event:"update"}})],q);var T=q,z=T,M=(a("5ba4"),a("0c7c")),E=Object(M["a"])(z,S,_,!1,null,"76734f22",null),L=E.exports,U=a("31a8"),N=a("0314"),V=function(e){Object(c["a"])(a,e);var t=Object(u["a"])(a);function a(){var e;return Object(o["a"])(this,a),e=t.apply(this,arguments),e.validateRequire=function(t,a,r){""===a?("imageURL"===t.field?e.$message({message:"Upload cover image is required",type:"error"}):e.$message({message:t.field+" 是必填的",type:"error"}),r(new Error(t.field+" 是必填的"))):r()},e.activeName="first",e.dataRange=[],e.shopCates=[],e.postForm=Object.assign({},k["a"]),e.loading=!1,e.allDepts=[],e.typeOptions=[],e.typeSelected=[],e.defaultProps={children:"children",label:"label"},e.rules={name:[{validator:e.validateRequire}]},e.dialogType="new",e.record={type:0,count:1,rewardType:0},e.dialogVisible=!1,e.modalRules={rank:[{required:!0,message:"请输入分数",trigger:"blur"}]},e.coupons=[],e.marks={0:"0%",100:"100%"},e}return Object(l["a"])(a,[{key:"userLevel",get:function(){return j["a"].level}},{key:"lang",get:function(){return d["a"].language}},{key:"created",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,a,r=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=null===(t=this.$route.params)||void 0===t?void 0:t.id,e.next=3,this.getRemoteCategory();case 3:if(!a){e.next=6;break}return e.next=6,this.fetchData(a);case 6:if(1!==j["a"].level){e.next=12;break}return e.next=9,this.getRemoteDeptList();case 9:D["k"].$on(D["j"],(function(){r.getRemoteDeptList()})),e.next=17;break;case 12:return this.postForm.shop=j["a"].department,e.next=15,this.fetchMyShop();case 15:return e.next=17,this.getRemoteShopCategory();case 17:this.tempTagView=Object.assign({},this.$route),D["k"].$on(D["c"],(function(){r.postForm.shop&&r.getCouponList(r.postForm.shop)}));case 19:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"beforeDestory",value:function(){D["k"].$off(D["c"]),1===j["a"].level&&D["k"].$off(D["j"])}},{key:"formatTooltip",value:function(e){return e+"%"}},{key:"fetchData",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(t){var a,r,i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Object(k["c"])(t,{});case 3:a=e.sent,r=a.data,console.log(r),this.postForm=r,void 0!==r.beginTime&&void 0!==r.endTime&&(this.dataRange.push(new Date(r.beginTime)),this.dataRange.push(new Date(r.endTime))),i="zh"===this.lang?"编辑挑战":"Edit Exam",this.setTagsViewTitle(i),this.setPageTitle(i),e.next=16;break;case 13:e.prev=13,e.t0=e["catch"](0),console.error(e.t0);case 16:case"end":return e.stop()}}),e,this,[[0,13]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setTagsViewTitle",value:function(e){var t=this.tempTagView;t&&(t.title="".concat(e,"-").concat(this.postForm._id),m["a"].updateVisitedView(t))}},{key:"setPageTitle",value:function(e){document.title="".concat(e," - ").concat(this.postForm._id)}},{key:"submitForm",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$refs.postForm.validate();case 3:return this.dataRange.length>1&&(this.postForm.beginTime=this.dataRange[0].getTime(),this.postForm.endTime=this.dataRange[1].getTime()),0===this.postForm.source&&this.$refs.typeTree?this.postForm.qtypes=this.$refs.typeTree.getCheckedKeys():this.postForm.qtypes=[],this.loading=!0,e.next=8,Object(k["e"])(this.postForm);case 8:t=e.sent,a=t.data,this.postForm=a,this.loading=!1,this.$notify({title:"Success",message:"The post save successfully",type:"success",duration:2e3}),D["k"].$emit(D["d"],{}),e.next=20;break;case 16:return e.prev=16,e.t0=e["catch"](0),console.error("Submit Error!"),e.abrupt("return",!1);case 20:case"end":return e.stop()}}),e,this,[[0,16]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"onCancel",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$confirm("确认不保存当前挑战信息?","Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:this.$store.dispatch("delView",this.$route),this.$router.go(-1),e.next=9;break;case 7:e.prev=7,e.t0=e["catch"](0);case 9:case"end":return e.stop()}}),e,this,[[0,7]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"getRemoteDeptList",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(y["k"])({});case 2:if(t=e.sent,a=t.data,a.records){e.next=6;break}return e.abrupt("return");case 6:this.allDepts=a.records;case 7:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"fetchMyShop",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(y["d"])();case 2:t=e.sent,a=t.data,this.typeSelected=a.qtypes,console.log(this.typeSelected),this.$refs.typeTree.setCheckedKeys(this.typeSelected);case 7:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"onShopChange",value:function(){var e;if(this.postForm.shop&&(this.getCouponList(this.postForm.shop),this.getRemoteShopCategory()),(null===(e=this.postForm.qtypes)||void 0===e?void 0:e.length)>0)this.typeSelected=this.postForm.qtypes;else if(this.postForm.shop){var t,a,r=Object(n["a"])(this.allDepts);try{for(r.s();!(a=r.n()).done;){var i=a.value;if(i._id===this.postForm.shop){t=i;break}}}catch(s){r.e(s)}finally{r.f()}this.typeSelected=t?t.qtypes:[]}this.$refs.typeTree.setCheckedKeys(this.typeSelected)}},{key:"getRemoteCategory",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,a,r,i,s,o,l,c,u;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(w["d"])();case 2:t=e.sent,a=t.data,r=Object(n["a"])(a);try{for(r.s();!(i=r.n()).done;){s=i.value,o=[],l=Object(n["a"])(s.children);try{for(l.s();!(c=l.n()).done;)u=c.value,o.push({id:u._id,label:u.name})}catch(p){l.e(p)}finally{l.f()}this.typeOptions.push({id:s._id,label:s.name,children:o})}}catch(p){r.e(p)}finally{r.f()}this.typeOptions.push({id:"customer",label:"自定义",children:[]});case 7:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getCouponList",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(t){var a,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(O["d"])({shop:t});case 2:a=e.sent,r=a.data,this.coupons=r.records;case 5:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"formatCoupon",value:function(e,t,a,r){var i,s="未知(".concat(a,")"),o=this.postForm.rewardInfo[r],l=Object(n["a"])(this.coupons);try{for(l.s();!(i=l.n()).done;){var c=i.value;if(c._id===a){s=c.name;break}}}catch(u){l.e(u)}finally{l.f()}return"lottery_ticket"===a?"抽奖券 x ".concat(o.count):"".concat(s," x ").concat(o.count)}},{key:"formatRewardType",value:function(e,t,a,r){switch(a){case 0:return"单局积分";case 1:return"累计积分";case 2:return"累计排名"}}},{key:"formatRank",value:function(e,t,a,r){var i=this.postForm.rewardInfo[r],n="第 ".concat(i.rank," 名");return i.rankEnd&&(n="第 ".concat(i.rank," 至 ").concat(i.rankEnd," 名")),n}},{key:"deleteRank",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(t){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=t.$index,e.prev=1,e.next=4,this.$confirm("Confirm to remove the record?","Warning",{confirmButtonText:"Confirm",cancelButtonText:"Cancel",type:"warning"});case 4:this.postForm.rewardInfo.splice(a,1),this.$message({type:"success",message:"删除成功, 请点击保存"}),e.next=10;break;case 8:e.prev=8,e.t0=e["catch"](1);case 10:case"end":return e.stop()}}),e,this,[[1,8]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"handleCreateReward",value:function(){this.record=Object.assign({},C["b"]),this.record.id=this.postForm.rewardInfo.length,this.dialogType="new",this.dialogVisible=!0}},{key:"handleEdit",value:function(e){this.dialogType="edit",this.dialogVisible=!0,this.record=Object(x["cloneDeep"])(e.row)}},{key:"closeModal",value:function(){this.dialogVisible=!1,this.$refs.modalForm.clearValidate()}},{key:"saveReward",value:function(){var e=this,t="edit"===this.dialogType;this.$refs.modalForm.validate(function(){var a=Object(s["a"])(regeneratorRuntime.mark((function a(r){var i;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(r){a.next=3;break}return e.$message.error("请按要求填写表单"),a.abrupt("return",!1);case 3:if("lottery_ticket"===e.record.coupon?e.record.rewardType=1:e.record.rewardType=0,!t){a.next=15;break}i=0;case 6:if(!(i