其实问题非常的简单就是参数的顺序错了
这是官网的地址
https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID
&redirect_uri=REDIRECT_URI
&response_type=code
&scope=SCOPE
&state=STATE#wechat_redirect
下面是我亲测有用的
window.location.href=`https://open.weixin.qq.com/connect/oauth2/authorize?
appid=${APPID}
&redirect_uri=${REDIRECT_URI}
&response_type=code
&scope=snsapi_userinfo
&state=STATE#wechat_redirect`
就行了