pyxis-page/dist/js/chunk-968583b6.1880f15f.js
2021-05-27 14:40:42 +08:00

2 lines
10 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-968583b6"],{"00eb":function(e,t,n){},"1c12":function(e,t,n){"use strict";n("00eb")},4400:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"app-container"},[n("sticky",{attrs:{"z-index":10,"class-name":"sub-navbar"}},[n("el-button-group",[n("el-button",{attrs:{icon:"el-icon-close"},on:{click:e.onCancel}},[e._v("取消")]),n("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["shop:game_setting"],expression:"['shop:game_setting']"}],attrs:{type:"success",icon:"el-icon-check"},on:{click:e.saveVal}},[e._v("保存")])],1)],1),n("el-row",[1===e.userLevel?n("el-select",{staticClass:"w100",attrs:{placeholder:"选择店铺",name:"shop",required:""},model:{value:e.shop,callback:function(t){e.shop=t},expression:"shop"}},e._l(e.allDepts,(function(e){return n("el-option",{key:e._id,attrs:{label:e.name,value:e._id}})})),1):e._e()],1),e._l(e.list,(function(t){return n("div",{key:t._id,staticClass:"one-block"},[n("el-row",[n("el-switch",{attrs:{"active-text":t.name,disabled:e.noShop,"inactive-text":""},on:{change:function(n){return e.gameSelectedChange(t._id)}},model:{value:t.selected,callback:function(n){e.$set(t,"selected",n)},expression:"game.selected"}})],1),n("el-divider",{attrs:{"content-position":"left"}}),n("el-row",{staticStyle:{display:"flex","flex-wrap":"wrap"}},e._l(t.versions,(function(r,i){return n("el-col",{key:r._id,staticStyle:{"margin-bottom":"20px"},attrs:{span:4,offset:i%4===0?0:2}},[n("el-card",{attrs:{"body-style":{padding:"0px"}}},[n("img",{staticClass:"image",attrs:{src:r.image,alt:r.name}}),n("div",{staticStyle:{padding:"14px"}},[n("div",{staticClass:"sub-bottom"},[n("span",[e._v(e._s(r.name))]),n("span",[e.noShop?e._e():n("router-link",{staticClass:"link-type",attrs:{to:"/shop/theme_edit/"+e.shop+"/"+t._id+"/"+r._id}},[e._v(" 自定义 ")])],1)]),n("div",{staticClass:"bottom"},[e.noShop?e._e():n("el-image",{staticStyle:{width:"40px",height:"40px"},attrs:{src:1===r.type?"img/icons/wqr.png":"img/icons/preview.png"},on:{click:function(t){return e.showPreview(r)}}}),1!==r.type||e.noShop?e._e():n("span",{on:{click:function(t){return e.showPreview(r)}}},[e._v(" 查看小程序码 ")]),0!==r.type||e.noShop?e._e():n("span",[n("a",{attrs:{href:r.url,target:"_blank"}},[e._v("预览游戏 ")])]),n("el-switch",{attrs:{"active-text":"",disabled:e.noShop,"inactive-text":""},on:{change:function(n){return e.versionSelectedChange(t._id,r._id)}},model:{value:r.selected,callback:function(t){e.$set(r,"selected",t)},expression:"vdata.selected"}})],1)])])],1)})),1)],1)})),e.showViewer?n("el-image-viewer",{attrs:{"on-close":e.closeViewer,"url-list":[e.qrUrl]}}):e._e()],2)},i=[],a=n("b85c"),s=n("1da1"),c=n("d4ec"),o=n("bee2"),u=n("262e"),l=n("2caf"),h=(n("7db0"),n("96cf"),n("9ab4")),p=n("1b40"),d=n("c1a2"),v=n("b804"),f=n("08a9"),m=n("db85"),g=n("9dba"),b=function(e){Object(u["a"])(n,e);var t=Object(l["a"])(n);function n(){var e;return Object(c["a"])(this,n),e=t.apply(this,arguments),e.total=0,e.list=[],e.listLoading=!0,e.shop="",e.allDepts=[],e.gameid="",e.versionid="",e.qrUrl="",e.showViewer=!1,e.listQuery={page:1,limit:20,key:"",hasVersion:1},e}return Object(o["a"])(n,[{key:"userLevel",get:function(){return g["a"].level}},{key:"noShop",get:function(){return!this.shop}},{key:"created",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.next=2,this.getList();case 2:if(1!==g["a"].level){e.next=7;break}return e.next=5,this.getRemoteDeptList("");case 5:e.next=8;break;case 7:this.shop=g["a"].department;case 8:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"onShopChange",value:function(){this.shop&&this.getShopGameSetting(this.shop)}},{key:"getList",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.listLoading=!0,e.next=3,Object(d["e"])(this.listQuery);case 3:t=e.sent,n=t.data,this.listLoading=!1,this.list=n.records,this.total=n.total;case 8:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getShopGameSetting",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(t){var n,r,i,s,c,o,u;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(m["f"])({shopid:t});case 2:n=e.sent,r=n.data,console.log(r),this.gameid=r.gameid,this.versionid=r.versionid,this.updateGameSelected(),i=0;case 9:if(!(i<this.list.length)){e.next=34;break}s=this.list[i],c=Object(a["a"])(s.versions),e.prev=12,c.s();case 14:if((o=c.n()).done){e.next=22;break}if(u=o.value,1!==u.type){e.next=20;break}return e.next=19,this.getGameQr(this.shop,s._id,u._id);case 19:u.qr=e.sent;case 20:e.next=14;break;case 22:e.next=27;break;case 24:e.prev=24,e.t0=e["catch"](12),c.e(e.t0);case 27:return e.prev=27,c.f(),e.finish(27);case 30:p["c"].set(this.list,i,s);case 31:i++,e.next=9;break;case 34:case"end":return e.stop()}}),e,this,[[12,24,27,30]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getGameQr",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(t,n,r){var i,a,s;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return i={shop:t,gameId:n,version:r},e.next=3,Object(m["g"])(i);case 3:return a=e.sent,s=a.data,e.abrupt("return",s.url);case 6:case"end":return e.stop()}}),e)})));function t(t,n,r){return e.apply(this,arguments)}return t}()},{key:"updateGameSelected",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t,n,r,i,s,c,o,u,l=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(0!==this.list.length){e.next=2;break}return e.abrupt("return");case 2:this.gameid||(this.gameid=this.list[0]._id),t=Object(a["a"])(this.list),e.prev=4,t.s();case 6:if((n=t.n()).done){e.next=13;break}if(r=n.value,r._id!==this.gameid){e.next=11;break}return r.versions.find((function(e){return e._id===l.versionid}))||(this.versionid=r.versions[0]._id),e.abrupt("break",13);case 11:e.next=6;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e["catch"](4),t.e(e.t0);case 18:return e.prev=18,t.f(),e.finish(18);case 21:for(i=0;i<this.list.length;i++){s=this.list[i],s.selected=s._id===this.gameid,c=Object(a["a"])(s.versions);try{for(c.s();!(o=c.n()).done;)u=o.value,u.selected=u._id===this.versionid}catch(h){c.e(h)}finally{c.f()}p["c"].set(this.list,i,s)}case 22:case"end":return e.stop()}}),e,this,[[4,15,18,21]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"getRemoteDeptList",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!(g["a"].level>1)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Object(m["h"])({key:t});case 4:if(n=e.sent,r=n.data,r.records){e.next=8;break}return e.abrupt("return");case 8:this.allDepts=r.records;case 9:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"gameSelectedChange",value:function(e){console.log(e),this.gameid=e,this.updateGameSelected()}},{key:"versionSelectedChange",value:function(e,t){console.log(e,t),this.gameid=e,this.versionid=t,this.updateGameSelected()}},{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:"saveVal",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this.shop&&this.gameid&&this.versionid){e.next=3;break}return this.$message({message:"请先选择一个游戏",type:"warning"}),e.abrupt("return");case 3:return e.prev=3,t={shopid:this.shop,gameid:this.gameid,versionid:this.versionid},e.next=7,Object(m["k"])(t);case 7:this.$notify({title:"Success",message:"更新店铺游戏配置成功",type:"success",duration:2e3}),e.next=13;break;case 10:e.prev=10,e.t0=e["catch"](3),console.log("save shop gamesetting error");case 13:case"end":return e.stop()}}),e,this,[[3,10]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"showPreview",value:function(e){1===e.type&&e.qr?(this.qrUrl=e.qr,this.showViewer=!0):e.url&&window.open(e.url,"_blank")}},{key:"closeViewer",value:function(){this.qrUrl="",this.showViewer=!1}}]),n}(p["c"]);Object(h["a"])([Object(p["d"])("shop")],b.prototype,"onShopChange",null),b=Object(h["a"])([Object(p["a"])({name:"GameSetting",components:{Sticky:v["a"],ElImageViewer:f["a"]},filters:{parseGameType:function(e){return 1===e?"微信小游戏":"网页版"}}})],b);var k=b,w=k,y=(n("1c12"),n("0c7c")),x=Object(y["a"])(w,r,i,!1,null,"51d4bf66",null);t["default"]=x.exports},"7db0":function(e,t,n){"use strict";var r=n("23e7"),i=n("b727").find,a=n("44d2"),s="find",c=!0;s in[]&&Array(1)[s]((function(){c=!1})),r({target:"Array",proto:!0,forced:c},{find:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a(s)},c1a2:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return a})),n.d(t,"e",(function(){return s})),n.d(t,"d",(function(){return c})),n.d(t,"f",(function(){return o})),n.d(t,"c",(function(){return u}));var r=n("b32d"),i={type:0,name:""},a={versions:[i],name:""},s=function(e){return Object(r["a"])({url:"/api/games",method:"post",params:e})},c=function(e,t){return Object(r["a"])({url:"/api/game/".concat(e),method:"get",params:t})},o=function(e){return Object(r["a"])({url:"/api/game/save",method:"post",data:e})},u=function(e){return Object(r["a"])({url:"/api/game/".concat(e,"/delete"),method:"post"})}}}]);
//# sourceMappingURL=chunk-968583b6.1880f15f.js.map