收藏
回答

getCurCorpGroupContact在通过注册后不能使用checkJsApi报false?

我在企业微信-微信客服功能接入来自小程序的客服咨询,希望获取用户的UnionId或者小程序用户的Openid,按找官方文档操作后getCurCorpGroupContact在通过注册后不能使用checkJsApi报false,请问该如何解决

useEffect(() => {

    const load = async () => {

      //    npx wwutil ticket wwde0d1858d8800bd4 xz0EA00nQzYEQJ5hV43Q68aeih-5pYtiMAKLROQ7mUI

      const JSAPI_TICKET = 'LIKLckvwlJT9cWIhEQTwfOVve5Xilg47C5TodlFAE_30JZuwDfg5MEghBFaiTeOaPcRbe7eYLwXW_jkpxLfetw'

      const JSAPI_TICKET2 = 'lmXlyesWnBLl+hNFzwRQWA=='


      ww.register({

        corpId: 'wwde0d1858d8800bd4',

        jsApiList: ['getCurCorpGroupContact'],

        // agentId: '1000018',

        getConfigSignature() {

          return ww.getSignature(JSAPI_TICKET);

        },

        // getAgentConfigSignature() {

        //   return ww.getSignature(JSAPI_TICKET2);

        // },

        onConfigSuccess() {

          infoToast('config success')

          setTimeout(() => {

            ww.checkJsApi({

              jsApiList: ['getCurCorpGroupContact'],

              success(res) {

                infoToast('checkJsApi success' + JSON.stringify(res))

                setResult5('checkJsApi success' + JSON.stringify(res))

              },

            })

          }, 1000);


          // 调用 register 后可以立刻调用其他 JS 接口

          // ww.getCurCorpGroupContact({

          //   success(res) {

          //     setResult5('success' + JSON.stringify(res))

          //     infoToast('success' + JSON.stringify(res))

          //   },

          //   fail(res) {

          //     setResult5('fail' + JSON.stringify(res))

          //     infoToast('fail' + JSON.stringify(res))

          //   },

          //   cancel(res) {

          //     setResult5('cancel' + JSON.stringify(res))

          //     infoToast('cancel' + JSON.stringify(res))

          //   },

          //   complete(res) {

          //     setResult55('complete' + JSON.stringify(res))

          //   }

          // })

        },

        onConfigFail() {

          infoToast('config fail')

        },

        onConfigComplete() {

          //infoToast('config complete')


        },

        onAgentConfigSuccess() {

          infoToast('config1 success')


        },

        onAgentConfigFail() {

          infoToast('config1 fail')

        },

        onAgentConfigComplete() {

          infoToast('config1 complete')

        },

      })



    };

    load();

  }, []);

回答关注问题邀请回答
收藏

2 个回答

  • 社区技术运营专员-Jahozheng
    社区技术运营专员-Jahozheng
    06-30

    你好,请移步企微官方讨论区:https://developer.work.weixin.qq.com/community/question

    06-30
    有用
    回复
登录 后发表内容