<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<script>
wx.config({:$config});
wx.agentConfig({:$agentConfig});alert(111);
setTimeout(function() {
wx.ready(function () {
$('#config').html('config配置成功');
wx.invoke('getContext', {}, function (res) {
$('#getContext').html('<pre>' + JSON.stringify(res) + '</pre>')
if (res.err_msg === "getContext:ok") {
entry = res.entry;
shareTicket = res.shareTicket;
} else {
}
});
wx.invoke('getCurExternalContact', {}, function (res) {
$('#userId').html('<pre>' + JSON.stringify(res) + '</pre>');
alert(JSON.stringify(res));
if (res.err_msg === "getCurExternalContact:ok") {
alert("以获取useriD:"+ res.userId)
let userId = res.userId;
} else {
}
});
});
wx.error(function(res){
console.log('失败');
});
}, 5000)
</script>
安卓手机和pc端企业微信都可以正常运行,ios 返回错误 {“err_info":"success","checkResult":{"getContext":false,"getCurExternalContact":false},"errMsg":"confg":ok"}
你好,getcontext 和getcurexternalcontact接口是需要传入agentconfig jsapilist执行的