"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([[3769],{3931:function(e,t,n){var i=n(2180),a=n(4165),o=n(1413),c=n(5861),r=n(9439),l=n(1515),s=n(2954),_=n.n(s),u=n(7294),d={common_safe_area_y:"index-module__common_safe_area_y___sl5GO","flex-col":"index-module__flex-col___B8Y4R","flex-row":"index-module__flex-row____RBnI","justify-between":"index-module__justify-between___QpaMW","justify-center":"index-module__justify-center___JlvrN","items-center":"index-module__items-center___K0BtP","flex-item":"index-module__flex-item___c_9Qn","full-100":"index-module__full-100___YScAN","color-blue":"index-module__color-blue___KFGVz","color-yellow":"index-module__color-yellow___RMYNM","color-green":"index-module__color-green___iwgkw","color-grey":"index-module__color-grey___w2OXP","color-white":"index-module__color-white___xam0S","s-w":"index-module__s-w___PoIX3","s-e":"index-module__s-e___nuQP7",filter:"index-module__filter___kRFZi",main:"index-module__main___wZfpa",content:"index-module__content___twyWc",background:"index-module__background___Y3any",left:"index-module__left___Sxptt",title:"index-module__title___iLZoU",description:"index-module__description___zMEBS",right:"index-module__right___Imomb",iconContainer:"index-module__iconContainer___B2oFp",icon:"index-module__icon___LRgzx",inviteCodeContent:"index-module__inviteCodeContent___CBJAM",codeBar:"index-module__codeBar___Wf8_v",inviteCodeBar:"index-module__inviteCodeBar___E0XVF",invite:"index-module__invite___aSRHM",tips:"index-module__tips___Ms22B",inviteListTitle:"index-module__inviteListTitle___HHN1q",listTitle:"index-module__listTitle___WzPIg",titleIconLeft:"index-module__titleIconLeft___cZFdu",titleIconRight:"index-module__titleIconRight___JMTXc",bottomBar:"index-module__bottomBar___B7QVy",bottomBar__text:"index-module__bottomBar__text___gpIYU",codePreview:"index-module__codePreview___yqzNd",imageContainer:"index-module__imageContainer___BNg7I",image:"index-module__image___y5oen",previewTips:"index-module__previewTips___KvTOj"},x=n(4262),m=n(8260),f=n(2128),p=n(4203),h=n(9742),v=n(1115),g=n(1263),w=n(2495),y=n(5893),Z=[{key:"invitee",title:"被邀请人",dataIndex:"invitee",width:"50%"},{key:"InviteResults",title:"邀请进度",dataIndex:"InviteResults",width:"50%"}],j=function InviteCode(){var e=(0,u.useRef)(24),t=(0,g.v_)().fetchData,n=(0,g.Bg)().fetchData,i=(0,g.DX)().fetchData,j=(0,u.useState)({}),C=(0,r.Z)(j,2),b=C[0],N=C[1],I=(0,u.useState)({columns:Z,dataSource:{list:[],total:0}}),T=(0,r.Z)(I,2),k=T[0],B=T[1],S=(0,u.useState)(!1),G=(0,r.Z)(S,2),P=G[0],R=G[1],E=function(){var n=(0,c.Z)((0,a.Z)().mark((function _callee(){var n;return(0,a.Z)().wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t({size:e.current});case 2:(n=i.sent).success&&(console.log("getInviteCode",n),B((function(e){return(0,o.Z)((0,o.Z)({},e),{},{dataSource:{list:n.data.list.map((function(e,t){return{key:t,index:t+1,invitee:e.invitee_name||"--",InviteResults:e.schedule}})),total:n.data.list.length}})})));case 4:case"end":return i.stop()}}),_callee)})));return function getInvitationList(){return n.apply(this,arguments)}}(),F=function(){var e=(0,c.Z)((0,a.Z)().mark((function _callee2(){var e;return(0,a.Z)().wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n();case 2:(e=t.sent).success&&N(e.data);case 4:case"end":return t.stop()}}),_callee2)})));return function getInviteCode(){return e.apply(this,arguments)}}(),L=function(){var e=(0,c.Z)((0,a.Z)().mark((function _callee3(){var e;return(0,a.Z)().wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i({content:"InviteCode:".concat(b.invitation_code)});case 2:if(!(e=t.sent).success){t.next=7;break}return t.abrupt("return",e.data.qrcode_base64);case 7:R(!1);case 8:case"end":return t.stop()}}),_callee3)})));return function genQRcode(){return e.apply(this,arguments)}}(),M=(0,u.useState)({}),$=(0,r.Z)(M,2)[1],D=(0,u.useRef)(null),z=(0,u.useRef)(null),O=(0,u.useState)(!1),Q=(0,r.Z)(O,2),X=Q[0],J=Q[1],Y=(0,u.useState)(""),W=(0,r.Z)(Y,2),q=W[0],A=W[1],H=function getImageObject(e,t){return new Promise((function(n,i){console.log("getImageObject param",e,t);var a=e.createImage();a.src=t,a.onload=function(){console.log("image===>",a),n(a)},a.onerror=function(e){console.log("image error===>",e),v.Z9.error("图片加载失败"),i(e)}}))},K=function saveCanvasToImage(e){_().canvasToTempFilePath({canvas:e,fileType:"png",success:function success(e){console.log("tempFilePath",e.tempFilePath),A(e.tempFilePath)},fail:function fail(e){console.log("error",e)},complete:function complete(){R(!1)}})},V=function(){var e=(0,c.Z)((0,a.Z)().mark((function _callee4(){return(0,a.Z)().wrap((function _callee4$(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,t){_().nextTick((function(){_().createSelectorQuery().select("#canvas").node((function(t){var n=t.node;console.log("canvas==>",n);var i=n.getContext("2d");console.log("ctx",i),D.current=n,z.current=i,console.log("canvas",n),$({}),e(!0)})).exec()}))})));case 1:case"end":return e.stop()}}),_callee4)})));return function initCanvas(){return e.apply(this,arguments)}}(),U=function doublePick(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e/2:2*e},ee=(0,u.useState)({}),te=(0,r.Z)(ee,2),ne=te[0],ie=te[1],ae=function(){var e=(0,c.Z)((0,a.Z)().mark((function _callee5(e,t,n){var i,o,c,r,l;return(0,a.Z)().wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return i=t.width,o=t.height,console.log("startPaint param",e,t,n),(c=e).clearRect(0,0,i,o),c.drawImage(n,0,0,i,o),c.save(),c.font="".concat(U(40),"px 微软雅黑"),c.fillStyle="#000000",c.fillText("蜘蛛管家",U(40),U(80)),c.save(),c.font="".concat(U(26),"px 微软雅黑"),c.fillStyle="#8f9398",c.fillText("真挚邀请您建立合作关系",U(40),U(130)),c.save(),c.font="".concat(U(24),"px 微软雅黑"),c.fillStyle="#a6a6a6",c.fillText("请前往邀请码页面,进行扫描邀请",U(100),U(630)),c.save(),c.font="".concat(U(36),"px 微软雅黑"),c.fillStyle="#7f7f7f",c.fillText("邀 请 码",U(72),U(730)),c.save(),c.font="".concat(U(24),"px 微软雅黑"),c.fillStyle="#cccccc",c.fillText("|",U(258),U(724)),c.save(),c.font="".concat(U(36),"px 微软雅黑"),c.fillStyle="#7f7f7f",c.fillText("".concat(b.invitation_code),U(311),U(730)),c.save(),a.next=32,L();case 32:return r=a.sent,a.prev=33,a.next=36,H(t,r);case 36:l=a.sent,c.drawImage(l,U(110),U(213),U(342),U(342)),a.next=45;break;case 40:throw a.prev=40,a.t0=a.catch(33),console.error("合成二维邀请码失败",a.t0),R(!1),new Error("合成二维邀请码失败");case 45:K(t);case 46:case"end":return a.stop()}}),_callee5,null,[[33,40]])})));return function startPaint(t,n,i){return e.apply(this,arguments)}}(),oe=function(){var e=(0,c.Z)((0,a.Z)().mark((function _callee8(){return(0,a.Z)().wrap((function _callee8$(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=(0,c.Z)((0,a.Z)().mark((function _callee7(e,t){var n;return(0,a.Z)().wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:if(R(!0),z.current){i.next=4;break}return i.next=4,V();case 4:n=D.current,_().getImageInfo({src:(0,w.mT)("/user/inviteCodePopup.png"),success:function success(i){console.log("res==>",i),n.width=i.width,n.height=i.height,ie({width:"".concat(U(n.width,!0),"px"),height:"".concat(U(n.height,!0),"px")}),H(n,"".concat(i.path)).then(function(){var i=(0,c.Z)((0,a.Z)().mark((function _callee6(i){return(0,a.Z)().wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,ae(z.current,n,i);case 3:e(!0),a.next=11;break;case 6:a.prev=6,a.t0=a.catch(0),console.log(a.t0),R(!1),t(new Error("绘制失败"));case 11:case"end":return a.stop()}}),_callee6,null,[[0,6]])})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){throw R(!1),new Error(e)}))}});case 6:case"end":return i.stop()}}),_callee7)})));return function(t,n){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),_callee8)})));return function drawPictorial(){return e.apply(this,arguments)}}(),ce=function(){var e=(0,c.Z)((0,a.Z)().mark((function _callee9(){return(0,a.Z)().wrap((function _callee9$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,oe();case 3:e.sent&&J(!0),e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(0),new Error("弹出二维码失败");case 10:case"end":return e.stop()}}),_callee9,null,[[0,7]])})));return function handleQRcodeShare(){return e.apply(this,arguments)}}();return(0,s.useReady)((function(){F(),E(),setTimeout((function(){V()}),200)})),(0,y.jsxs)(l.G7,{className:d.main,children:[(0,y.jsxs)(l.G7,{className:d.content,children:[(0,y.jsxs)(l.G7,{className:d.background,children:[(0,y.jsxs)(l.G7,{className:d.left,children:[(0,y.jsx)(l.G7,{className:d.title,children:"蜘蛛管家"}),(0,y.jsx)(l.G7,{className:d.description,children:"真挚邀请您建立合作关系"})]}),(0,y.jsx)(l.G7,{className:d.right,children:(0,y.jsx)(l.G7,{className:d.iconContainer,children:(0,y.jsx)(l.Ee,{className:d.icon,src:(0,w.mT)("/user/inviteCode.png"),mode:"widthFix"})})})]}),(0,y.jsxs)(l.G7,{className:d.inviteCodeContent,children:[(0,y.jsx)(m.Z,{circle:!0,children:(0,y.jsxs)(l.G7,{className:d.codeBar,children:[(0,y.jsxs)(l.G7,{className:d.inviteCodeBar,children:[(0,y.jsx)(l.G7,{className:d.invite,children:"邀请码"}),(0,y.jsx)(f.Z,{direction:"vertical"}),(0,y.jsx)(l.G7,{className:d.invite,children:b.invitation_code})]}),(0,y.jsx)(l.G7,{className:d.tips,children:"填写邀请码,即可在蜘蛛管家下单购物"})]})}),(0,y.jsxs)(m.Z,{circle:!0,customStyle:{paddingTop:"10px",paddingBottom:"10px"},children:[(0,y.jsxs)(l.G7,{className:d.inviteListTitle,children:[(0,y.jsx)(l.G7,{className:d.titleIconLeft}),(0,y.jsx)(l.xv,{className:d.listTitle,children:"成功邀请"}),(0,y.jsx)(l.G7,{className:d.titleIconRight})]}),(0,y.jsx)(l.G7,{className:d.inviteList,children:(0,y.jsx)(p.Z,{columns:k.columns,emptyText:"暂无邀请信息",safeAreaInsetBottom:!1,dataSource:k.dataSource,onLoadMore:function handleLoadMore(){e.current+=24}})})]}),(0,y.jsx)(l.G7,{className:d.tips,style:{justifyContent:"flex-start"},children:"温馨提示:邀请码确定绑定后,不支持解绑。"})]})]}),(0,y.jsx)(l.Xz,{style:(0,o.Z)({position:"absolute",left:"-9999rpx"},ne),id:"canvas",type:"2d"}),(0,y.jsxs)(l.G7,{className:d.bottomBar,children:[(0,y.jsx)(h.Z,{loading:P,plain:!0,type:"primary",customTextClassName:d.bottomBar__text,customStyles:{width:"45%"},round:!0,onClick:ce,children:"二维码分享"}),(0,y.jsx)(h.Z,{type:"primary",round:!0,customTextClassName:d.bottomBar__text,customStyles:{width:"45%"},onClick:function handleCopyInviteCode(){_().setClipboardData({data:b.invitation_code})},children:"复制邀请码"})]}),(0,y.jsx)(x.Z,{show:X,onChange:function handleChange(e){J(e)},children:(0,y.jsxs)(l.G7,{className:d.codePreview,children:[(0,y.jsx)(l.G7,{className:d.imageContainer,children:(0,y.jsx)(l.Ee,{className:d.image,src:q,mode:"widthFix",id:"originImage",showMenuByLongpress:!0})}),(0,y.jsx)(l.xv,{className:d.previewTips,children:"长按图片保存到手机"})]})})]})};Page((0,i.createPageConfig)(j,"pages/inviteCode/index",{root:{cn:[]}},{navigationBarTitleText:"邀请码",navigationBarTextStyle:"black",navigationBarBackgroundColor:"#E4EEFD",backgroundColor:"#E4EEFD",backgroundColorTop:"#E4EEFD"}||{}))}},function(e){e.O(0,[2107,1216,8592],(function(){return t=3931,e(e.s=t);var t}));e.O()}]);