2 lines
3.0 KiB
JavaScript
2 lines
3.0 KiB
JavaScript
|
(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="<style> .needSubscribe { overflow: hidden; border-radius: 6px; } .needSubscribe .layui-layer-title { border: 0; font-size: 18px;color:#333;line-height: 50px;height: 50px; } .needBody { padding: 20px; } .needDesc { font-size: 14px; line-height: 25px;color: #666666;letter-spacing: 1px; } .qrcodetip { text-align: center; font-size: 16px; color:#333; margin-bottom: 20px; } .canvasImage { width: 190px;height:190px;margin: 25px auto 10px;box-shadow: 0px 0px 10px 0px rgba(85,100,115,0.19);border-radius: 4px; box-sizing: border-box; } .canvasImage img{ width: 100%; height:100%;border: 0; } </style>",o='<div class="needBody"><p class="needDesc">'+e+'</p><div class="canvasImage"><img /></div><p class="qrcodetip">\u4F7F\u7528\u5FAE\u4FE1\u626B\u4E00\u626B\u5173\u6CE8\u516C\u4F17\u53F7</p><div class="footerTip"><p style="font-size: 16px;margin-bottom: 5px;">\u6CE8\u610F\uFF1A</p><p>\u5173\u6CE8\u6210\u529F\u540E\uFF0C\u5C06\u572810\u79D2\u5185\u81EA\u52A8\u5237\u65B0</p><p>\u5982\u679C\u9875\u9762\u6CA1\u6709\u54CD\u5E94\uFF0C<span style="color: #39AFE7;cursor: pointer;" class="reload">\u70B9\u51FB\u6B64\u5904</span>\u624B\u52A8\u8DF3\u8F6C</p></div></div>';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);
|