2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-17bb2ec1"],{"4ec9":function(e,t,a){"use strict";var r=a("6d61"),n=a("6566");e.exports=r("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),n)},"6a04":function(e,t,a){"use strict";var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-cascader",{staticStyle:{width:"50%"},attrs:{options:e.options,filterable:"",size:"medium"},on:{change:e.valchange},model:{value:e.areaSelect,callback:function(t){e.areaSelect=t},expression:"areaSelect"}})},n=[],o=a("3835"),s=a("b85c"),i=a("1da1"),c=a("d4ec"),u=a("bee2"),l=a("262e"),p=a("2caf"),h=(a("4ec9"),a("d3b7"),a("3ca3"),a("ddb0"),a("96cf"),a("9ab4")),d=a("1b40"),m=a("bc3a"),f=a.n(m),g=function(e){Object(l["a"])(a,e);var t=Object(p["a"])(a);function a(){var e;return Object(c["a"])(this,a),e=t.apply(this,arguments),e.options=[],e.areaData={},e.areaSelect=[],e}return Object(u["a"])(a,[{key:"mounted",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){var t,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.initArea&&(t=this.getCcode(this.initArea),a=this.getPcode(this.initArea),this.areaSelect=[a,t,this.initArea]),e.next=3,this.prepareRegion();case 3:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"updateArea",value:function(e){if(e){var t=this.getCcode(e),a=this.getPcode(e);this.areaSelect=[a,t,e]}}},{key:"prepareRegion",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){var t,a,r,n,i,c,u,l,p,h,d,m,f,g,b,v,y,w,O,j,k,F,x,R,S,$,C,_,q,T,D;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.fetchData();case 2:for(i in t=e.sent,this.areaData=t,a=new Map,r=new Map,n=new Map,t)c=+i,c%1e4==0?a.set(c,t[c]):c%100==0?(u=this.getPcode(c),r.has(u)?(l=r.get(u),l.push([c,t[c]])):r.set(u,[[c,t[c]]])):(p=this.getCcode(c),n.has(p)?(h=n.get(p),h.push([c,t[c]])):n.set(p,[[c,t[c]]]));d=Object(s["a"])(n);try{for(d.s();!(m=d.n()).done;)f=Object(o["a"])(m.value,2),g=f[0],f[1],b=this.getPcode(g),r.has(b)||r.set(b,[[g,a.get(b)]])}catch(P){d.e(P)}finally{d.f()}v=[],y=Object(s["a"])(a);try{for(y.s();!(w=y.n()).done;){if(O=Object(o["a"])(w.value,2),j=O[0],k=O[1],F=[],r.has(j)){x=r.get(j),R=Object(s["a"])(x);try{for(R.s();!(S=R.n()).done;){if($=S.value,C=[],n.has($[0])){_=n.get($[0]),q=Object(s["a"])(_);try{for(q.s();!(T=q.n()).done;)D=T.value,C.push({value:D[0],label:D[1]})}catch(P){q.e(P)}finally{q.f()}}F.push({value:$[0],label:$[1],children:C})}}catch(P){R.e(P)}finally{R.f()}}v.push({value:j,label:k,children:F})}}catch(P){y.e(P)}finally{y.f()}return this.options=v,e.abrupt("return",v);case 15:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"fetchData",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t="https://passer-by.com/data_location/list.json",e.abrupt("return",f.a.get(t,{}).then((function(e){return e.data})));case 2:case"end":return e.stop()}}),e)})));function t(){return e.apply(this,arguments)}return t}()},{key:"valchange",value:function(e){this.$emit("update",this.areaSelect[this.areaSelect.length-1]);var t,a="",r=Object(s["a"])(this.areaSelect);try{for(r.s();!(t=r.n()).done;){var n=t.value;this.areaData.hasOwnProperty(n)&&(a&&(a+="-"),a+=this.areaData[n])}}catch(o){r.e(o)}finally{r.f()}this.$emit("area-change",a)}},{key:"getPcode",value:function(e){return 1e4*(e/1e4|0)}},{key:"getCcode",value:function(e){return 100*(e/100|0)}}]),a}(d["c"]);Object(h["a"])([Object(d["d"])("initArea")],g.prototype,"updateArea",null),g=Object(h["a"])([Object(d["a"])({name:"RegionPicker",props:["initArea"],model:{prop:"initArea",event:"update"}})],g);var b=g,v=b,y=a("0c7c"),w=Object(y["a"])(v,r,n,!1,null,null,null);t["a"]=w.exports},"7ff3":function(e,t,a){},a2c3:function(e,t,a){"use strict";a("7ff3")},da48:function(e,t,a){"use strict";a.r(t);var r=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)},n=[],o=a("b85c"),s=a("1da1"),i=a("d4ec"),c=a("bee2"),u=a("262e"),l=a("2caf"),p=(a("99af"),a("b0c0"),a("96cf"),a("9ab4")),h=a("1b40"),d=a("ac1a"),m=a("e741"),f=a("da80"),g=a("b804"),b=a("6b45"),v=a("6a04"),y=a("db85"),w=a("b32d");function O(e,t){return j.apply(this,arguments)}function j(){return j=Object(s["a"])(regeneratorRuntime.mark((function e(t,a){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r={keyword:t,region:a},e.abrupt("return",Object(w["a"])({url:"/api/area/query",method:"post",data:r}));case 2:case"end":return e.stop()}}),e)}))),j.apply(this,arguments)}function k(e){return F.apply(this,arguments)}function F(){return F=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={address:t},e.abrupt("return",Object(w["a"])({url:"/api/area/geocoder",method:"post",data:a}));case 2:case"end":return e.stop()}}),e)}))),F.apply(this,arguments)}var x=function(e){Object(u["a"])(a,e);var t=Object(l["a"])(a);function a(){var e;return Object(i["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.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 d["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(s["a"])(regeneratorRuntime.mark((function e(t){var a,r,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Object(y["e"])(t,{});case 3:a=e.sent,r=a.data,console.log(r),this.postForm=r,n="zh"===this.lang?"编辑店铺":"Edit Shop",this.setTagsViewTitle(n),this.setPageTitle(n),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(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.loading=!0,e.next=6,Object(y["j"])(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(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:"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(s["a"])(regeneratorRuntime.mark((function e(t){var a,r,n,s,i;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,O(t,"上海");case 4:a=e.sent,r=a.data,this.shopListOptions.length=0,n=Object(o["a"])(r.records);try{for(n.s();!(s=n.n()).done;)i=s.value,i.showStr="".concat(i.title,"(").concat(i.city,"-").concat(i.district,")")}catch(c){n.e(c)}finally{n.f()}this.shopListOptions=r.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,r=Object(o["a"])(this.shopListOptions);try{for(r.s();!(a=r.n()).done;){var n=a.value;if(n.title===e){t=n;break}}}catch(s){r.e(s)}finally{r.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(s["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,k(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}(h["c"]);x=Object(p["a"])([Object(h["a"])({name:"ShopEditor",components:{MaterialInput:f["a"],Sticky:g["a"],UploadImage:b["a"],RegionPicker:v["a"]}})],x);var R=x,S=R,$=(a("a2c3"),a("0c7c")),C=Object($["a"])(S,r,n,!1,null,"a549f9fe",null);t["default"]=C.exports},db85:function(e,t,a){"use strict";a.d(t,"a",(function(){return n})),a.d(t,"h",(function(){return o})),a.d(t,"e",(function(){return s})),a.d(t,"d",(function(){return i})),a.d(t,"j",(function(){return c})),a.d(t,"b",(function(){return u})),a.d(t,"k",(function(){return l})),a.d(t,"f",(function(){return p})),a.d(t,"g",(function(){return h})),a.d(t,"m",(function(){return d})),a.d(t,"l",(function(){return m})),a.d(t,"c",(function(){return f})),a.d(t,"i",(function(){return g}));var r=a("b32d"),n={name:"",address:"",logo:"",qtypes:[]},o=function(e){return Object(r["a"])({url:"/api/shops",method:"post",params:e})},s=function(e,t){return Object(r["a"])({url:"/api/shop/".concat(e),method:"get",params:t})},i=function(){return Object(r["a"])({url:"/api/myshop",method:"get"})},c=function(e){return Object(r["a"])({url:"/api/shop/save",method:"post",data:e})},u=function(e){return Object(r["a"])({url:"/api/shop/".concat(e,"/delete"),method:"post"})},l=function(e){return Object(r["a"])({url:"/api/shop/gameinfo/save",method:"post",data:e})},p=function(e){return Object(r["a"])({url:"/api/shop/gameinfo",method:"post",data:e})},h=function(e){return Object(r["a"])({url:"/api/shop/gameqr",method:"post",data:e})},d=function(e){return Object(r["a"])({url:"/api/shop/save_qtype",method:"post",data:e})},m=function(e){return Object(r["a"])({url:"/api/shop/publish",method:"post",data:e})},f=function(e){return Object(r["a"])({url:"/api/shop/gametheme",method:"post",data:e})},g=function(e){return Object(r["a"])({url:"/api/shop/gametheme/save",method:"post",data:e})}}}]);
|
|
//# sourceMappingURL=chunk-17bb2ec1.4cc73c85.js.map
|