(function(c,d){d.wxFocus={getNeedSubscribe:function(i){var n=this;i&&i();var a={init:function(){var e=this;n.request({noCloseLayer:!0,url:"/api/welink/isWxOASubscribed",type:"get",success:function(r){r.success&&!r.data?e.getIsNeedSubscribe(function(s){var o=s.data;parseInt(o.isNeedSubscribe)==1?(e.renderLayer(o.subscribeTitle),e.getWxOAQrCode(),e.bingEvent()):i&&i()}):r.data}})},renderLayer:function(e){var r=this,s="",o='

'+e+'

\u4F7F\u7528\u5FAE\u4FE1\u626B\u4E00\u626B\u5173\u6CE8\u516C\u4F17\u53F7

\u6CE8\u610F\uFF1A

\u5173\u6CE8\u6210\u529F\u540E\uFF0C\u5C06\u572810\u79D2\u5185\u81EA\u52A8\u5237\u65B0

\u5982\u679C\u9875\u9762\u6CA1\u6709\u54CD\u5E94\uFF0C\u70B9\u51FB\u6B64\u5904\u624B\u52A8\u8DF3\u8F6C

';r.needSubscribeLayer=layer.open({type:1,title:"\u8BF7\u5148\u5173\u6CE8\u516C\u4F17\u53F7",skin:"needSubscribe",area:["705px","auto"],cancel:function(u,t){clearInterval(r.isWxOASubscribed)},content:s+o})},getIsNeedSubscribe:function(e){n.request({noCloseLayer:!0,url:"/api/welink/isNeedSubscribe",type:"get",data:{actionType:2},success:function(r){e&&e(r)}})},getWxOAQrCode:function(){n.request({noCloseLayer:!0,url:"/api/welink/publicPlatform/getBindQrcode",type:"get",success:function(e){e.success&&c(".canvasImage img").attr("src",e.data)}})},getWxOASubscribed:function(e){var r=this;n.request({noCloseLayer:!0,url:"/api/welink/isWxOASubscribed",type:"get",success:function(s){s.success&&s.data?(i&&i(),layer.close(r.needSubscribeLayer),clearInterval(r.isWxOASubscribed)):e&&layer.msg("\u60A8\u8FD8\u672A\u5173\u6CE8\u516C\u4F17\u53F7")}})},bingEvent:function(){var e=this;c(".needBody .reload").on("click",function(){e.getWxOASubscribed(!0)}),e.isWxOASubscribed=setInterval(function(){e.getWxOASubscribed()},1e4)}};a.init()},request:function(i){var n=i.url,a=i.type||"GET",e=i.data,r=i.success,s=i.error,o=i.loading,u=i.noCloseLayer;o&&layer.load(2),c.ajax({headers:{token:getCookie("token")},type:a,url:n,contentType:"application/json",dataType:"json",data:e,async:!0,success:function(t){u||layer.closeAll(),r(t),!t.success&&parseInt(t.code)!==401&&layer.msg(t.message)},error:function(t){layer.closeAll(),s(t)}})}}})(jQuery,window);