1.申请appid
注册成为微信的商户或者服务群体
2.微信平台授权
在微信的公众服务平台开通服务域
3.通过网页打开连接
var weixinUrl = 'url?'
weixinUrl = weixinUrl + 'appid=' + appid + '&';
weixinUrl = weixinUrl + 'redirect_uri=' + encodeURIComponent(location.origin + '路径和参数' + location.search) + '&';
weixinUrl = weixinUrl + 'response_type=' + 'code' + '&';
weixinUrl = weixinUrl + 'scope=' + 'snsapi_login' + '&';
weixinUrl = weixinUrl + 'state=' + 'STATE';
location.href = weixinUrl;
4.手机扫码
打开手机扫码完成登录确认