1 line
3.3 KiB
JavaScript
1 line
3.3 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-91b115e2"],{"5ef0":function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div")},a=[],o=n("d76c"),r={mixins:[o["a"]],data:function(){return{}},created:function(){var t=this;this.appjsApiList=["openEnterpriseChat"],this.appSignSuccess=function(){t.time=setTimeout((function(){t.callOpenEnterpriseChat()}),100)},this.agentConfigUrl="plugin.customer-radar.frontend.controller.member.login.getConfig"},destroyed:function(){clearTimeout(this.time)},methods:{callOpenEnterpriseChat:function(){var t=this,e=this.fun.getKey("external_userid"),n=this.fun.getKey("user_id");if(!e&&!n)return this.$toast("联系人id为空,无法打开会话!");wx.openEnterpriseChat({userIds:n||"",externalUserIds:e||"",success:function(){t.fun.isIphone()||wx.closeWindow()},fail:function(e){e.errMsg.indexOf("function not exist")>-1?alert("版本过低请升级"):alert(e.errMsg),t.$toast(e.errMsg)}})}},components:{}},s=r,c=n("2877"),g=Object(c["a"])(s,i,a,!1,null,"74c2eb5d",null);e["default"]=g.exports},d76c:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n("c7eb"),a=n("1da1"),o=(n("e9c4"),{data:function(){return{agentConfigUrl:null,isSignWorkApp:!1,agentData:{agent_secret:"",agentid:"",corpid:""},get_token:{},appjsApiList:[],appSignCallback:null,appSignError:null,agentConfigLoading:0}},created:function(){if(this.fun.getKey("crop_id")){var t=this.fun.getKey("crop_id");window.localStorage.setItem("crop_id",t),this.corp_id=t}else this.corp_id=window.localStorage.getItem("crop_id")||"0"},activated:function(){("work"===this.fun.getKey("client")||window.localStorage.getItem("client"))&&this.getAgentConfig()},methods:{getAgentConfig:function(){var t=this;return Object(a["a"])(Object(i["a"])().mark((function e(){var n,a,o,r,s;return Object(i["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t,a=t.agentConfigUrl||"plugin.wechat-chat-sidebar.frontend.controller.index.get-config",o="ios"===t.fun.isIosOrAndroid()?window.initUrl:document.location.href,e.prev=3,e.next=6,$http.post(a,{crop_id:t.corp_id,url:o},"loading");case 6:if(r=e.sent,1!=r.result){e.next=11;break}t.agentData=r.data,e.next=13;break;case 11:return t.agentConfigLoading=-1,e.abrupt("return",t.$toast(r.msg));case 13:t.agentConfigLoading=0,t.get_token=t.agentData.get_token,s={debug:!1,beta:!0,jsApiList:["agentConfig","closeWindow"],openTagList:["ww-open-data"],appId:t.agentData.corpid,nonceStr:t.get_token.noncestr,timestamp:t.get_token.timestamp,signature:t.get_token.token},wx.config(s),wx.ready((function(){setTimeout((function(){t.getAgentSign(s,t.get_token.app_token)}),500)})),wx.error((function(t){n.$toast(JSON.stringify(t))})),e.next=24;break;case 21:e.prev=21,e.t0=e["catch"](3),t.$toast(e.t0);case 24:case"end":return e.stop()}}),e,null,[[3,21]])})))()},getAgentSign:function(t,e){var n=this;wx.agentConfig({debug:!1,corpid:t.appId,agentid:this.agentData.agentid,timestamp:t.timestamp,nonceStr:t.nonceStr,signature:e,jsApiList:n.appjsApiList,success:function(){n.isSignWorkApp=!0,n.agentConfigLoading=1,n.appSignSuccess&&n.appSignSuccess()},fail:function(t){n.agentConfigLoading=-1,n.appSignError&&n.appSignError(),t.errMsg.indexOf("function not exist")>-1?n.$toast("版本过低请升级"):n.$toast("企业应用授权失败,请联系管理员重新配置!")}})}}})}}]); |