require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/users/user_spread_code/index"],{"00c2":function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"c",(function(){return a})),i.d(t,"a",(function(){}));var n=function(){var e=this.$createElement;this._self._c},a=[]},"5b86":function(e,t,i){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=i("51a2"),a=i("cef1"),s=i("8f59"),o=(i("df83"),i("3c22"),i("d5b1")),c=(i("9366"),{data:function(){return{imgUrls:[],indicatorDots:!1,circular:!1,autoplay:!1,interval:3e3,duration:500,swiperIndex:0,spreadList:[],poster:"",qrcodeSize:1e3,PromotionCode:"",base64List:[],canvasStatus:!0,bgColor:"#e93323"}},computed:(0,s.mapGetters)(["isLogin","uid","userInfo"]),watch:{isLogin:{handler:function(e,t){e&&this.userSpreadBannerList()},deep:!0}},onLoad:function(){this.bgColor=(0,o.setThemeColor)(),this.isLogin?(this.PromotionCode=this.$Cache.get("wechatQRcode"),this.userSpreadBannerList()):(0,a.toLogin)()},onShareAppMessage:function(){return{title:this.userInfo.nickname+"-分销海报",imageUrl:this.spreadList[0].pic,path:"/pages/index/index?id=0&sd=".concat(this.uid)}},onReady:function(){},methods:{userSpreadBannerList:function(){var t=this;e.showLoading({title:"获取中",mask:!0}),(0,n.spreadBanner)({page:1,limit:5}).then((function(i){e.hideLoading(),t.getImageBase64(i.data),t.$set(t,"spreadList",i.data)})).catch((function(t){e.hideLoading()}))},getImageBase64:function(t){var i=this;e.showLoading({title:"海报生成中",mask:!0});this.base64List=t.map((function(e){return e.pic}));var n="";e.downloadFile({url:this.base64List[0],success:function(e){n=e.tempFilePath,i.getImgCanvas(n,0)}})},getImgCanvas:function(e,t){var i=this;this.$nextTick((function(){i.PosterCanvas(e,i.PromotionCode,i.userInfo.nickname,t)}))},make:function(){var t=this;uQRCode.make({canvasId:"qrcode",text:"/pages/index/index?sd="+t.uid,size:this.qrcodeSize,margin:10,success:function(e){t.PromotionCode=e},complete:function(e){},fail:function(i){e.hideLoading(),t.$util.Tips({title:"海报二维码生成失败！"})}})},PosterCanvas:function(t,i,n,a){var s=e.createCanvasContext("canvasOne");s.clearRect(0,0,0,0);var o=this;e.getImageInfo({src:t,success:function(c){s.drawImage(t,0,0,750,1190),s.save(),s.drawImage(i,110,925,140,140),s.restore(),s.setFontSize(28),s.fillText(n,270,980),s.fillText("邀请您加入",270,1020),setTimeout((function(){s.draw(!0,(function(){e.canvasToTempFilePath({destWidth:750,destHeight:1190,canvasId:"canvasOne",fileType:"jpg",success:function(t){e.hideLoading(),o.spreadList[a].pic=t.tempFilePath,o.$set(o,"poster",t.tempFilePath),o.$set(o,"canvasStatus",!1)}})}))}),100)},fail:function(t){e.hideLoading(),o.$util.Tips({title:"无法获取图片信息"})}})},bindchange:function(t){var i=this,n=this.base64List,a=t.detail.current;this.swiperIndex=a;var s="";e.downloadFile({url:n[a],success:function(e){s=e.tempFilePath,setTimeout((function(){i.$set(i,"canvasStatus",!0),i.PosterCanvas(s,i.PromotionCode,i.userInfo.nickname,a)}),300)}})},savePhoto:function(t){var i=this;e.saveImageToPhotosAlbum({filePath:t,success:function(e){i.$util.Tips({title:"保存成功",icon:"success"})},fail:function(e){i.$util.Tips({title:"保存失败"})}})},setShareInfoStatus:function(){if(this.$wechat.isWeixin()){var e={desc:"分销海报",title:this.userInfo.nickname+"-分销海报",link:"/pages/index/index?sd="+this.uid,imgUrl:this.spreadList[0].pic};this.$wechat.wechatEvevt(["updateAppMessageShareData","updateTimelineShareData"],e)}}}});t.default=c}).call(this,i("df3c")["default"])},"5fb2":function(e,t,i){},"921d":function(e,t,i){"use strict";(function(e,t){var n=i("47a9");i("1d3c");n(i("3240"));var a=n(i("b079"));e.__webpack_require_UNI_MP_PLUGIN__=i,t(a.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])},b079:function(e,t,i){"use strict";i.r(t);var n=i("00c2"),a=i("fa8d");for(var s in a)["default"].indexOf(s)<0&&function(e){i.d(t,e,(function(){return a[e]}))}(s);i("de47");var o=i("828b"),c=Object(o["a"])(a["default"],n["b"],n["c"],!1,null,"eab478dc",null,!1,n["a"],void 0);t["default"]=c.exports},de47:function(e,t,i){"use strict";var n=i("5fb2"),a=i.n(n);a.a},fa8d:function(e,t,i){"use strict";i.r(t);var n=i("5b86"),a=i.n(n);for(var s in n)["default"].indexOf(s)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(s);t["default"]=a.a}},[["921d","common/runtime","common/vendor"]]]);