企微助手 ,仓库名 短剧

shareToGroupH5.0b2c8a755587eae1.1711446198136.js 4.3KB

1
  1. "use strict";(self["webpackChunkqwh5"]=self["webpackChunkqwh5"]||[]).push([[686],{5275:function(e,t,n){function o(e){const t=window.location.href,n={};if(-1!=t.indexOf("?")){let e="",o=[];t.split("?").forEach(((t,r)=>{if(0!=r){e=t,o=e.split("&");for(let e=0;e<o.length;e++)n[o[e].split("=")[0]]=decodeURIComponent(o[e].split("=")[1])}}))}return e?n[e]?n[e]:"":n}function r(e){if("string"!=typeof e)return!1;try{let t=JSON.parse(e);return!("object"!=typeof t||!t)}catch(t){return!1}}n.d(t,{W:function(){return o},p:function(){return r}})},3017:function(e,t,n){var o=n(2595),r=n(5275);function a(e,t){o.Z.post("/api/h5/auth/commonAuthData",{corpid:(0,r.W)("corpid"),url:location.href.split("#")[0]}).then((n=>{console.log("getAuthInfo => res ",n),t&&t(n.rst),e&&(c()&&"false"!=c()&&-1!=l(c(),"3.0.24")?s(n.rst,e):i(n.rst,e))})).catch((e=>{console.log(e,"err")}))}function i(e,t){wx.config({beta:!0,debug:!1,appId:e.corpid,timestamp:e.timestamp,nonceStr:e.nonce_str,signature:e.signature,jsApiList:["getCurExternalContact","sendChatMessage","getCurExternalContact","openUserProfile","shareToExternalChat","launchMiniprogram"]}),wx.ready((function(n){console.log(n,"QYready"),s(e,t)})),wx.error((function(e){console.log(e,"QYerror")}))}function s(e,t){wx.agentConfig({debug:!1,corpid:e.corpid,agentid:e.agent_id,timestamp:e.timestamp,nonceStr:e.nonce_str,signature:e.app_signature,jsApiList:["getCurExternalContact","sendChatMessage","getCurExternalContact","openUserProfile","shareToExternalChat","launchMiniprogram"],success:function(n){console.log(n,"YYready"),t&&t(e)},fail:function(e){e.errMsg.indexOf("function not exist")>-1&&alert("版本过低请升级")}})}function c(){let e=navigator.userAgent.split("wxwork/");return e.length>1&&e[1].split(" ")[0]}function l(e,t){if(e==t)return 0;const n=e.split(".").map((e=>parseInt(e))),o=t.split(".").map((e=>parseInt(e))),r=Math.min(n.length,o.length);for(let a=0;a<r;a++){if(n[a]>o[a])return 1;if(n[a]<o[a])return-1}return r==n.length?-1:1}t["Z"]=a},7831:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var o=n(3396),r=n(4870),a=n(9733),i=n(5275),s=n(2595),c=n(3017);const l={class:"shareGroup-wrap"};var d=(0,o.aZ)({__name:"shareToGroupH5",setup(e){const t=(0,r.qj)({corpid:(0,i.W)("corpid"),chat_id:(0,i.W)("chat_id"),rule_id:(0,i.W)("rule_id")}),n=(0,r.iH)({});(0,o.wF)((()=>{(0,i.W)("againJump")?(t.corpid=(0,i.W)("corpid"),t.chat_id=(0,i.W)("chat_id"),t.rule_id=(0,i.W)("rule_id"),(0,c.Z)((()=>{d()}))):(0,c.Z)("",(e=>{let t=encodeURIComponent(window.location.href+"&againJump=true"),n=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${e.corpid}&redirect_uri=${t}&response_type=code&scope=snsapi_base&state=1&agentid=${e.agent_id}#wechat_redirect`,o=document.createElement("a");o.href=n,document.body.appendChild(o),o.click(),document.body.removeChild(o)}))}));const d=async()=>{try{a.F.loading({message:"加载中...",duration:0,forbidClick:!0});const{errno:e,rst:o}=await s.Z.get("/api/h5/chatGroupMag/getMessage",{corpid:t.corpid,rule_id:t.rule_id,chat_id:t.chat_id});0==e?1==o?.data?.status?(0,a.F)({message:"当前消息已发送过,请选择其他消息",onClose:()=>{wx.closeWindow()}}):0==o?.data?.status&&(n.value=o.data,p()):(0,a.F)({message:"群发内容获取失败,请联系管理员",onClose:()=>{wx.closeWindow()}})}catch(e){console.log("error =>",e)}},u=async(e,n)=>{a.F.loading({message:"数据上报中,请稍等...",duration:0,forbidClick:!0});const{errno:o,rst:r}=await s.Z.get("/api/h5/chatGroupMag/report",{corpid:t.corpid,rule_id:t.rule_id,chat_id:t.chat_id,type:e,errmsg:n});0==o?1==e?(0,a.F)({message:"发送成功!",onClose:()=>{wx.closeWindow()}}):(0,a.F)({message:"发送失败,请检查消息是否合法或联系管理员",onClose:()=>{wx.closeWindow()}}):(0,a.F)({message:"数据上报失败,请联系管理员",onClose:()=>{wx.closeWindow()}})},p=()=>{a.F.loading({message:"加载中...如果长时间未调起【新建群发】页面,请检查消息是否合法或联系管理员",duration:0,forbidClick:!0}),wx.invoke("shareToExternalChat",n.value,(function(e){a.F.clear(),"shareToExternalChat:ok"==e.err_msg?u(1,JSON.stringify(e)):"shareToExternalChat:cancel"==e.err_msg?wx.closeWindow():u(2,JSON.stringify(e))}))};return(e,t)=>((0,o.wg)(),(0,o.iD)("div",l))}}),u=n(89);const p=(0,u.Z)(d,[["__scopeId","data-v-c1ebe434"]]);var g=p}}]);