We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在react中我自己结合项目的做法是把授权做到了加载这个组件中(顾名思义是显示加载的页面),附上代码‘
`
getUserinfo() { const url = localStorage.getItem(“url”) if(url) { const getcode = GetRequ(window.location.search); const _props = JSON.parse(localStorage.getItem('_ props')); let code = getcode.code; axios.get(https: //www.xxx.com/xxx/xxx/xxx?code=${code})。then(res => { window.localStorage.setItem('userinfo',JSON.stringify(res.data.data))window.localStorage.removeItem('url')alert(res.data); setTimeout(() = >{ if(_props.location.state.pathname === '/ single') { this.props.history.replace('/ single') } else if(_props.location.state.pathname = =='/ setmeal') { this.props。 } else if(_props.location.state.pathname === '/ user') { this.props.history.replace('/ user') } else if(_props.location.state.pathname === '/ activity ') { this.props.history.replace('/ activity') } },1000) }). catch(err = >{ if(err) { alert('登录失效,重新登录'); localStorage.removeItem('userinfo'); localStorage.removeItem('_ props'); localStorage.removeItem('url'); this.props.history.replace('/ user'); } }) } else { window.location.href = ' https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxea312fb8dd46a9f8&redirect_uri=http://www.xxx.com/xxx/xxxx&RESPONSE_TYPE =代码&范围= snsapi_userinfo&状态=状态#wechat_redirect'localStorage.setItem('_ props',JSON.stringify(this.props))localStorage.setItem(“url”,window.location.href); }
let href = window.location.href; let url2 = encodeURIComponent(href.split('#') [0]); axios.get(https: //www.xxx.com/index/access/access?url=${url2})。then(res => { console.log(res)window.wx.config( { debug:false,appId:res.data.appId,timestamp:res.data.timestamp,nonceStr:res.data.nonceStr,signature:res.data.signature,jsApiList: ['checkJsApi','scanQRCode','chooseWXPay','getLocation'] }) }). catch(err = >{ console.log(err); })
The text was updated successfully, but these errors were encountered:
No branches or pull requests
最近在工作中,接连到两个项目都是微信公众号网页开发,起初觉得没有太大难度,因为也就是一些微信页面而已,可是在实际的开发中还是遇到了几个让自己抓狂的坑。
1.关于授权
在react中我自己结合项目的做法是把授权做到了加载这个组件中(顾名思义是显示加载的页面),附上代码‘
`
`
2.关于使用js-jdk
`
`
小结:其他微信就是授权和jdk这里比较麻烦,其他的都和我们平时正在开发一样..
The text was updated successfully, but these errors were encountered: