pyxis-page/dist/js/chunk-42ca4960.52f6ecf7.js
2021-05-19 20:41:13 +08:00

2 lines
12 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-42ca4960"],{"6b45":function(e,t,a){"use strict";var i=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"upload-container"},[a("el-upload",{staticClass:"image-uploader",attrs:{data:e.dataObj,name:"image-file",accept:"image/jpeg,image/gif,image/png",multiple:!1,"show-file-list":!1,"on-success":e.handleImageSuccess,drag:"",action:e.uploadUrl}},[a("i",{staticClass:"el-icon-upload"}),a("div",{staticClass:"el-upload__text"},[e._v(" 将文件拖到此处,或"),a("em",[e._v("点击上传")])])]),a("div",{staticClass:"image-preview"},[a("div",{directives:[{name:"show",rawName:"v-show",value:e.imageUrl.length>1,expression:"imageUrl.length>1"}],staticClass:"image-preview-wrapper"},[a("img",{attrs:{src:e.imageUrl}}),a("div",{staticClass:"image-preview-action"},[a("i",{staticClass:"el-icon-delete",on:{click:e.rmImage}})])])])],1)},r=[],n=a("d4ec"),o=a("bee2"),s=a("262e"),c=a("2caf"),l=a("9ab4"),u=a("1b40"),p=function(e){Object(s["a"])(a,e);var t=Object(c["a"])(a);function a(){var e;return Object(n["a"])(this,a),e=t.apply(this,arguments),e.uploadUrl="https://opm.kingsome.cn/api/upload",e.tempUrl="",e.dataObj={sub_path:"game",type:"image"},e}return Object(o["a"])(a,[{key:"imageUrl",get:function(){return this.value}},{key:"emitInput",value:function(e){this.$emit("input",e)}},{key:"rmImage",value:function(){this.emitInput("")}},{key:"handleImageSuccess",value:function(e){console.log(e),this.emitInput(e.url_cdn)}}]),a}(u["c"]);Object(l["a"])([Object(u["b"])({default:""})],p.prototype,"value",void 0),p=Object(l["a"])([Object(u["a"])({name:"UploadImage"})],p);var d=p,h=d,m=(a("961d"),a("0c7c")),f=Object(m["a"])(h,i,r,!1,null,"62f54f8e",null);t["a"]=f.exports},"7ff3":function(e,t,a){},"961d":function(e,t,a){"use strict";a("b43b")},a2c3:function(e,t,a){"use strict";a("7ff3")},b43b:function(e,t,a){},b804:function(e,t,a){"use strict";var i=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{style:{height:e.height,zIndex:e.zIndex}},[a("div",{class:e.className,style:{top:e.isSticky?e.stickyTop+"px":"",zIndex:e.zIndex,position:e.position,width:e.width,height:e.height}},[e._t("default",[a("div",[e._v("sticky")])])],2)])},r=[],n=a("d4ec"),o=a("bee2"),s=a("262e"),c=a("2caf"),l=(a("0d03"),a("d3b7"),a("25f0"),a("9ab4")),u=a("1b40"),p=function(e){Object(s["a"])(a,e);var t=Object(c["a"])(a);function a(){var e;return Object(n["a"])(this,a),e=t.apply(this,arguments),e.active=!1,e.position="",e.isSticky=!1,e.width="auto",e.height="auto",e}return Object(o["a"])(a,[{key:"mounted",value:function(){this.height=this.$el.getBoundingClientRect().height.toString()+"px",window.addEventListener("scroll",this.handleScroll),window.addEventListener("resize",this.handleResize)}},{key:"activated",value:function(){this.handleScroll()}},{key:"destroyed",value:function(){window.removeEventListener("scroll",this.handleScroll),window.removeEventListener("resize",this.handleResize)}},{key:"sticky",value:function(){this.active||(this.position="fixed",this.active=!0,this.width=this.width+"px",this.isSticky=!0)}},{key:"handleReset",value:function(){this.active&&(this.position="",this.width="auto",this.active=!1,this.isSticky=!1)}},{key:"handleScroll",value:function(){var e=this.$el.getBoundingClientRect().width;this.width=e.toString()+"px"||!1;var t=this.$el.getBoundingClientRect().top;t<this.stickyTop?this.sticky():this.handleReset()}},{key:"handleResize",value:function(){this.isSticky&&(this.width=this.$el.getBoundingClientRect().width.toString()+"px")}}]),a}(u["c"]);Object(l["a"])([Object(u["b"])({default:0})],p.prototype,"stickyTop",void 0),Object(l["a"])([Object(u["b"])({default:1})],p.prototype,"zIndex",void 0),Object(l["a"])([Object(u["b"])({default:""})],p.prototype,"className",void 0),p=Object(l["a"])([Object(u["a"])({name:"Sticky"})],p);var d=p,h=d,m=a("0c7c"),f=Object(m["a"])(h,i,r,!1,null,null,null);t["a"]=f.exports},da48:function(e,t,a){"use strict";a.r(t);var i=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container"},[a("el-form",{ref:"postForm",staticClass:"form-container",attrs:{model:e.postForm,rules:e.rules,"label-width":"121px"}},[a("el-form-item",{attrs:{label:"店铺名"}},[a("el-select",{staticStyle:{width:"50%"},attrs:{"remote-method":e.queryShop,filterable:"","default-first-option":"",remote:"",placeholder:"搜索店铺","allow-create":""},on:{change:e.areaSelectChange},model:{value:e.postForm.name,callback:function(t){e.$set(e.postForm,"name",t)},expression:"postForm.name"}},e._l(e.shopListOptions,(function(e){return a("el-option",{key:e.id,attrs:{label:e.showStr,value:e.title}})})),1)],1),e.postForm.sid?a("el-form-item",{attrs:{label:"ID",prop:"sid"}},[e._v(" "+e._s(e.postForm.sid)+" ")]):e._e(),a("el-form-item",{attrs:{label:"显示名",prop:"showName"}},[a("el-input",{staticStyle:{width:"50%"},attrs:{name:"showName",required:""},model:{value:e.postForm.showName,callback:function(t){e.$set(e.postForm,"showName",t)},expression:"postForm.showName"}})],1),a("el-form-item",{attrs:{label:"类别",prop:"category"}},[a("el-input",{staticStyle:{width:"50%"},attrs:{name:"category"},model:{value:e.postForm.category,callback:function(t){e.$set(e.postForm,"category",t)},expression:"postForm.category"}})],1),a("el-form-item",{attrs:{label:"区域"}},[a("region-picker",{on:{"area-change":e.areaChange},model:{value:e.postForm.areaCode,callback:function(t){e.$set(e.postForm,"areaCode",t)},expression:"postForm.areaCode"}})],1),a("el-form-item",{attrs:{label:"详细地址",prop:"address"}},[a("el-input",{staticStyle:{width:"50%"},attrs:{name:"address",required:""},model:{value:e.postForm.address,callback:function(t){e.$set(e.postForm,"address",t)},expression:"postForm.address"}})],1),a("el-form-item",{attrs:{label:"座标点",prop:"lng"}},[e._v(" "+e._s(e.postForm.location)+" "),a("el-button",{directives:[{name:"loading",rawName:"v-loading",value:e.querying,expression:"querying"}],attrs:{type:"success"},on:{click:e.updateLoc}},[e._v(" 更新座标 ")])],1),a("el-form-item",{attrs:{prop:"imageURL",label:"logo"}},[a("upload-image",{model:{value:e.postForm.logo,callback:function(t){e.$set(e.postForm,"logo",t)},expression:"postForm.logo"}})],1),a("el-form-item",[a("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["shopman:edit"],expression:"['shopman:edit']"}],attrs:{type:"primary"},on:{click:e.submitForm}},[e._v(" 保存 ")]),a("el-button",{on:{click:e.onCancel}},[e._v(" 取消 ")])],1)],1)],1)},r=[],n=a("b85c"),o=a("1da1"),s=a("d4ec"),c=a("bee2"),l=a("262e"),u=a("2caf"),p=(a("99af"),a("b0c0"),a("96cf"),a("9ab4")),d=a("1b40"),h=a("ac1a"),m=a("e741"),f=a("da80"),g=a("b804"),v=a("6b45"),b=a("6a04"),y=a("db85"),w=a("b32d");function k(e,t){return O.apply(this,arguments)}function O(){return O=Object(o["a"])(regeneratorRuntime.mark((function e(t,a){var i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return i={keyword:t,region:a},e.abrupt("return",Object(w["a"])({url:"/api/area/query",method:"post",data:i}));case 2:case"end":return e.stop()}}),e)}))),O.apply(this,arguments)}function F(e){return j.apply(this,arguments)}function j(){return j=Object(o["a"])(regeneratorRuntime.mark((function e(t){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a={address:t},e.abrupt("return",Object(w["a"])({url:"/api/area/geocoder",method:"post",data:a}));case 2:case"end":return e.stop()}}),e)}))),j.apply(this,arguments)}var x=function(e){Object(l["a"])(a,e);var t=Object(u["a"])(a);function a(){var e;return Object(s["a"])(this,a),e=t.apply(this,arguments),e.validateRequire=function(t,a,i){""===a?("imageURL"===t.field?e.$message({message:"Upload cover image is required",type:"error"}):e.$message({message:t.field+" 是必填的",type:"error"}),i(new Error(t.field+" 是必填的"))):i()},e.postForm=Object.assign({},y["a"]),e.loading=!1,e.querying=!1,e.rules={name:[{validator:e.validateRequire}]},e.shopListOptions=[],e}return Object(c["a"])(a,[{key:"lang",get:function(){return h["a"].language}},{key:"created",value:function(){var e,t=null===(e=this.$route.params)||void 0===e?void 0:e.id;t&&this.fetchData(t),this.tempTagView=Object.assign({},this.$route)}},{key:"fetchData",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(t){var a,i,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Object(y["d"])(t,{});case 3:a=e.sent,i=a.data,console.log(i),this.postForm=i,r="zh"===this.lang?"编辑店铺":"Edit Shop",this.setTagsViewTitle(r),this.setPageTitle(r),e.next=15;break;case 12:e.prev=12,e.t0=e["catch"](0),console.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})));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(o["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.loading=!0,e.next=6,Object(y["h"])(this.postForm);case 6:t=e.sent,a=t.data,this.postForm=a,this.loading=!1,this.$notify({title:"Success",message:"The post published successfully",type:"success",duration:2e3}),e.next=17;break;case 13:return e.prev=13,e.t0=e["catch"](0),console.error("Submit Error!"),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,this,[[0,13]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"onCancel",value:function(){var e=Object(o["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:"draftForm",value:function(){this.$message({message:"The draft saved successfully",type:"success",showClose:!0,duration:1e3})}},{key:"areaChange",value:function(e){console.log("new area: ".concat(e)),this.postForm.areaStr=e}},{key:"queryShop",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(t){var a,i,r,o,s;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t&&!(t.length<2)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,k(t,"上海");case 4:a=e.sent,i=a.data,this.shopListOptions.length=0,r=Object(n["a"])(i.records);try{for(r.s();!(o=r.n()).done;)s=o.value,s.showStr="".concat(s.title,"(").concat(s.city,"-").concat(s.district,")")}catch(c){r.e(c)}finally{r.f()}this.shopListOptions=i.records;case 10:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"areaSelectChange",value:function(e){var t,a,i=Object(n["a"])(this.shopListOptions);try{for(i.s();!(a=i.n()).done;){var r=a.value;if(r.title===e){t=r;break}}}catch(o){i.e(o)}finally{i.f()}console.log(t),t&&(this.postForm.address=t.address,this.postForm.showName=this.postForm.name,this.postForm.areaCode=t.adcode,this.postForm.areaStr="".concat(t.province,"-").concat(t.city,"-").concat(t.district),this.postForm.extData=t.id,this.postForm.category=t.category,t.location&&(this.postForm.lat=t.location.lat,this.postForm.lng=t.location.lng,this.postForm.location=[t.location.lng,t.location.lat]))}},{key:"updateLoc",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(){var t,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this.postForm.address){e.next=2;break}return e.abrupt("return");case 2:return this.querying=!0,e.next=5,F(this.postForm.address);case 5:t=e.sent,a=t.data,console.log(a),this.querying=!1,a.location&&(this.postForm.lat=a.location.lat,this.postForm.lng=a.location.lng,this.postForm.location=[a.location.lng,a.location.lat]);case 10:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()}]),a}(d["c"]);x=Object(p["a"])([Object(d["a"])({name:"ShopEditor",components:{MaterialInput:f["a"],Sticky:g["a"],UploadImage:v["a"],RegionPicker:b["a"]}})],x);var S=x,R=S,C=(a("a2c3"),a("0c7c")),$=Object(C["a"])(R,i,r,!1,null,"a549f9fe",null);t["default"]=$.exports}}]);
//# sourceMappingURL=chunk-42ca4960.52f6ecf7.js.map