pyxis-page/dist/js/chunk-4d11ba9a.748d0a55.js
2021-06-07 20:16:03 +08:00

2 lines
11 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4d11ba9a"],{"0314":function(t,e,r){"use strict";r.d(e,"d",(function(){return n})),r.d(e,"c",(function(){return o})),r.d(e,"f",(function(){return i})),r.d(e,"e",(function(){return s})),r.d(e,"a",(function(){return c})),r.d(e,"b",(function(){return u}));r("99af");var a=r("b32d"),n=function(t){return Object(a["a"])({url:"/api/".concat(t.shop,"/puzzles"),method:"post",data:t})},o=function(t,e,r){return Object(a["a"])({url:"/api/".concat(t,"/puzzle/").concat(e),method:"get",params:r})},i=function(t){return Object(a["a"])({url:"/api/".concat(t.shop,"/puzzle/save"),method:"post",data:t})},s=function(t,e){return Object(a["a"])({url:"/api/".concat(t,"/puzzle/import"),method:"post",data:e})},c=function(t,e){return Object(a["a"])({url:"/api/".concat(t,"/puzzle/delete"),method:"post",data:{ids:e}})},u=function(t){return Object(a["a"])({url:"/api/".concat(t,"/categorys"),method:"get"})}},6008:function(t,e,r){"use strict";r.r(e);var a=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"createPost-container"},[r("el-form",{ref:"postForm",staticClass:"form-container",attrs:{model:t.postForm,rules:t.rules,"label-width":"120px"}},[r("div",{staticClass:"createPost-main-container"},[r("el-row",[r("el-col",{attrs:{span:24}},[r("el-form-item",{staticStyle:{"margin-bottom":"40px"},attrs:{prop:"question"}},[r("material-input",{attrs:{maxlength:100,name:"question",required:""},model:{value:t.postForm.question,callback:function(e){t.$set(t.postForm,"question",e)},expression:"postForm.question"}},[t._v(" 题目 ")])],1)],1)],1),r("el-row",[r("el-col",{attrs:{span:6}},[r("el-form-item",{staticStyle:{"margin-bottom":"40px"},attrs:{label:"答案:",prop:"a1"}},[r("el-input",{attrs:{placeholder:"输入答案",name:"a1",required:""},model:{value:t.postForm.a1,callback:function(e){t.$set(t.postForm,"a1",e)},expression:"postForm.a1"}})],1)],1),r("el-col",{attrs:{span:6}},[r("el-form-item",{staticClass:"postInfo-container-item",attrs:{label:"评分:"}},[r("el-rate",{staticStyle:{display:"inline-block"},attrs:{max:3,colors:["#99A9BF","#F7BA2A","#ff5900"],"low-threshold":1,"high-threshold":3},model:{value:t.postForm.quality,callback:function(e){t.$set(t.postForm,"quality",e)},expression:"postForm.quality"}})],1)],1)],1),r("el-row",[r("el-col",{attrs:{span:6}},[r("el-form-item",{staticStyle:{"margin-bottom":"40px"},attrs:{label:"混淆答案1:"}},[r("el-input",{attrs:{rows:1,placeholder:"输入答案"},model:{value:t.postForm.a2,callback:function(e){t.$set(t.postForm,"a2",e)},expression:"postForm.a2"}})],1)],1),r("el-col",{attrs:{span:6}},[r("el-form-item",{staticStyle:{"margin-bottom":"40px"},attrs:{label:"混淆答案2:"}},[r("el-input",{attrs:{rows:1,placeholder:"输入答案"},model:{value:t.postForm.a3,callback:function(e){t.$set(t.postForm,"a3",e)},expression:"postForm.a3"}})],1)],1),r("el-col",{attrs:{span:6}},[r("el-form-item",{staticStyle:{"margin-bottom":"40px"},attrs:{label:"混淆答案3:"}},[r("el-input",{attrs:{rows:1,placeholder:"输入答案"},model:{value:t.postForm.a4,callback:function(e){t.$set(t.postForm,"a4",e)},expression:"postForm.a4"}})],1)],1)],1),r("el-row",[r("el-col",{attrs:{span:24}},[r("el-form-item",{attrs:{label:"TAGS:"}},[r("el-select",{staticStyle:{width:"50%"},attrs:{multiple:"",filterable:"","allow-create":"","default-first-option":"",placeholder:"请选择"},model:{value:t.postForm.groups,callback:function(e){t.$set(t.postForm,"groups",e)},expression:"postForm.groups"}},t._l(t.tagOptions,(function(t){return r("el-option",{key:t,attrs:{label:t,value:t}})})),1)],1)],1)],1),r("el-row",[r("el-col",{attrs:{span:24}},[r("el-form-item",[r("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"},{name:"permission",rawName:"v-permission",value:["shoppuzzle:edit"],expression:"['shoppuzzle:edit']"}],attrs:{type:"primary"},on:{click:t.submitForm}},[t._v(" 保存 ")]),r("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"},{name:"permission",rawName:"v-permission",value:["shoppuzzle:delete"],expression:"['shoppuzzle:delete']"}],staticStyle:{"margin-left":"10px"},attrs:{type:"danger"},on:{click:t.deleteRecord}},[t._v(" 删除 ")]),r("el-button",{on:{click:t.onCancel}},[t._v(" 取消 ")])],1)],1)],1)],1)])],1)},n=[],o=r("1da1"),i=r("d4ec"),s=r("bee2"),c=r("262e"),u=r("2caf"),l=(r("96cf"),r("d3b7"),r("6062b"),r("3ca3"),r("ddb0"),r("99af"),r("9ab4")),p=r("1b40"),m=r("ac1a"),d=r("e741"),h=r("da80"),f=r("b804"),g=r("8256"),v=r("6b45"),b=r("63a2"),w=r("0314"),y=r("4c9b"),x=function(t){Object(c["a"])(r,t);var e=Object(u["a"])(r);function r(){var t;return Object(i["a"])(this,r),t=e.apply(this,arguments),t.validateRequire=function(e,r,a){""===r?("imageURL"===e.field?t.$message({message:"Upload cover image is required",type:"error"}):t.$message({message:e.field+" 是必填的",type:"error"}),a(new Error(e.field+" 是必填的"))):a()},t.postForm=Object.assign({},b["a"]),t.loading=!1,t.rules={question:[{validator:t.validateRequire}],a1:[{validator:t.validateRequire}]},t.typeSelect=[],t.tagSet=new Set,t.tagOptions=[],t}return Object(s["a"])(r,[{key:"lang",get:function(){return m["a"].language}},{key:"created",value:function(){var t=this.$route.params&&this.$route.params.shop;this.postForm.shop=t;var e=this.$route.params&&this.$route.params.id;e&&this.fetchData(t,e),this.tempTagView=Object.assign({},this.$route),this.getRemoteCategory()}},{key:"fetchData",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(e,r){var a,n,o;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(w["c"])(e,r,{});case 3:a=t.sent,n=a.data,this.postForm=n,this.typeSelect=[this.postForm.tag||"",this.postForm.sub_tag||""],o="zh"===this.lang?"编辑题目":"Edit Question",this.setTagsViewTitle(o),this.setPageTitle(o),t.next=15;break;case 12:t.prev=12,t.t0=t["catch"](0),console.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})));function e(e,r){return t.apply(this,arguments)}return e}()},{key:"setTagsViewTitle",value:function(t){var e=this.tempTagView;e&&(e.title="".concat(t,"-").concat(this.postForm._id),d["a"].updateVisitedView(e))}},{key:"setPageTitle",value:function(t){document.title="".concat(t," - ").concat(this.postForm._id)}},{key:"typeChange",value:function(){this.postForm.tag=this.typeSelect[0],this.postForm.sub_tag=this.typeSelect[1]}},{key:"tagChange",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:console.log("tagchange: ",e);case 1:case"end":return t.stop()}}),t)})));function e(e){return t.apply(this,arguments)}return e}()},{key:"submitForm",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,this.saveRecord(!1);case 2:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}()},{key:"saveNext",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,this.saveRecord(!0);case 2:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}()},{key:"saveRecord",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.$refs.postForm.validate();case 3:return this.loading=!0,t.next=6,Object(w["f"])(this.postForm);case 6:r=t.sent,a=r.data,this.postForm=a,this.loading=!1,this.$notify({title:"Success",message:"题目保存成功",type:"success",duration:2e3}),y["i"].$emit(y["g"],{}),t.next=19;break;case 14:return t.prev=14,t.t0=t["catch"](0),console.error("Submit Error!"),this.loading=!1,t.abrupt("return",!1);case 19:case"end":return t.stop()}}),t,this,[[0,14]])})));function e(e){return t.apply(this,arguments)}return e}()},{key:"deleteRecord",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,this.loading=!0,t.next=4,this.$confirm("确认删除当前记录?","Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 4:return t.next=6,Object(w["a"])(this.postForm.shop,[this.postForm._id]);case 6:this.loading=!1,y["i"].$emit(y["g"],{}),this.$store.dispatch("delView",this.$route),this.$router.go(-1),t.next=15;break;case 12:t.prev=12,t.t0=t["catch"](0),this.loading=!1;case 15:case"end":return t.stop()}}),t,this,[[0,12]])})));function e(){return t.apply(this,arguments)}return e}()},{key:"getRemoteCategory",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(){var e,r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(w["b"])(this.postForm.shop);case 3:e=t.sent,r=e.data,this.tagOptions=r,this.$forceUpdate(),t.next=11;break;case 9:t.prev=9,t.t0=t["catch"](0);case 11:case"end":return t.stop()}}),t,this,[[0,9]])})));function e(){return t.apply(this,arguments)}return e}()},{key:"onCancel",value:function(){var t=Object(o["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.$confirm("确认不保存当前记录?","Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:this.$store.dispatch("delView",this.$route),this.$router.go(-1),t.next=9;break;case 7:t.prev=7,t.t0=t["catch"](0);case 9:case"end":return t.stop()}}),t,this,[[0,7]])})));function e(){return t.apply(this,arguments)}return e}()}]),r}(p["c"]);x=Object(l["a"])([Object(p["a"])({name:"ShopPuzzleEdit",components:{MaterialInput:h["a"],Sticky:f["a"],Tinymce:g["a"],UploadImage:v["a"]}})],x);var k=x,F=k,O=(r("62bd"),r("0c7c")),j=Object(O["a"])(F,a,n,!1,null,"07943c3e",null);e["default"]=j.exports},"6062b":function(t,e,r){"use strict";var a=r("6d61"),n=r("6566");t.exports=a("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),n)},"62bd":function(t,e,r){"use strict";r("da09")},"63a2":function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"c",(function(){return o})),r.d(e,"g",(function(){return i})),r.d(e,"f",(function(){return s})),r.d(e,"h",(function(){return c})),r.d(e,"i",(function(){return u})),r.d(e,"b",(function(){return l})),r.d(e,"e",(function(){return p})),r.d(e,"j",(function(){return m})),r.d(e,"d",(function(){return d}));var a=r("b32d"),n={withNext:!1,quality:3,a1:"",question:""};function o(t){switch(t){case 1:return"普通";case 2:return"图片";case 3:return"问卷";default:return"未知"}}var i=function(t){return Object(a["a"])({url:"/api/puzzles",method:"post",params:t})},s=function(t,e){return Object(a["a"])({url:"/api/puzzle/".concat(t),method:"get",params:e})},c=function(t){return Object(a["a"])({url:"/api/nextpuzzle",method:"post",data:{id:t}})},u=function(t){return Object(a["a"])({url:"/api/puzzle/save",method:"post",data:t})},l=function(t){return Object(a["a"])({url:"/api/puzzle/".concat(t,"/delete"),method:"post"})},p=function(){return Object(a["a"])({url:"/api/tags",method:"get"})},m=function(t){return Object(a["a"])({url:"/api/tag/save",method:"post",data:{name:t}})},d=function(){return Object(a["a"])({url:"/api/question/categorys",method:"get"})}},da09:function(t,e,r){}}]);
//# sourceMappingURL=chunk-4d11ba9a.748d0a55.js.map