收藏
回答

企业微信在H5页面引入weixin-js-sdk . wx.agentConfig 方法不存在。

问题类型 API/组件名称 终端类型 微信版本 基础库版本
Bug wx.agentConfig 微信安卓客户端 3.0.0 weixin-js-sdk@1.4.0-test

importwxfrom'weixin-js-sdk'

    exportdefault {

        data(){

          return {

            

          }

        },

        created(){

            consolelogwx);

            thisinit();

        },

        methods: {

          init(){

            letself = this;  

            self$apiget({

                sc:"member2"

                url:`h5/wechat/qy/config/get?url=${windowlocationhref

                success=> {

                    letresult = result || {};

                    letappId = resultappId

                    letagentid = resultagentid

                    lettimestamp = resulttimestamp

                    letnonceStr = resultnonceStr

                    letsignature = resultsignature

                    letagentSignature = resultagentSignature

                    wxconfig({

                        beta:true

                        debug:true

                        appId:appId

                        timestamp:timestamp

                        nonceStr:nonceStr

                        signature:signature

                        jsApiList: [

                            'agentConfig'

                            'getCurExternalContact'

                        ]

                    })

                    wxreadyfunction () {

                        wxagentConfig({

                            corpid:appId// 必填,企业微信的corpid,必须与当前登录的企业一致

                            agentid:agentid// 必填,企业微信的应用id

                            timestamp:timestamp// 必填,生成签名的时间戳

                            nonceStr:nonceStr// 必填,生成签名的随机串

                            signature:agentSignature// 必填,签名,见附录1

                            jsApiList: ['agentConfig''getCurExternalContact'], //必填

                            successfunctionres) {

                                // 回调

                                consolelog'success');

                                wxinvoke'getCurExternalContact', {

                                    

                                    }, functionres){

                                        consolelog'res');

                                        consolelogres);

                                        ifreserr_msg == "getCurExternalContact:ok"){

                                            letuserId  = resuserId ; //返回当前外部联系人userId

                                        }else {

                                            //错误处理

                                            consolelog'error');

                                        }

                                })

                            },

                            failfunctionres) {

                                consolelog'fail');

                                ifreserrMsgindexOf'function not exist') > -){

                                    alert'版本过低请升级'

                                }

                            }

                        })

                    })

                }

            })  

          }

        }

    }

最后一次编辑于  2019-12-25
回答关注问题邀请回答
收藏

4 个回答

  • MaveRicK
    MaveRicK
    2020-10-22

    如果没有wx.agentConfig,可以尝试用wx.invoke('agentConfig', params, callback)调用

    2020-10-22
    有用
    回复
  • 王承石
    王承石
    2020-05-03

    这肯定不存在啊 在企业微信里面调动的 而且在源文件中搜索,根本也没有agentConfig


    2020-05-03
    有用
    回复
  • LBJ
    LBJ
    2020-01-01

    已解决。vue项目在index.html中引入1.2版本的jdk,高版本没有这个方法

    2020-01-01
    有用
    回复
  • 深知你是梦@
    深知你是梦@
    2019-12-25

    @企业微信运营专员-千夜 

    2019-12-25
    有用
    回复 12
    查看更多(7)
登录 后发表内容
问题标签