https://open.weixin.qq.com/connect/oauth2/authorize?appid=aaaaaaa&redirect_uri=http://www.xxx.com/GDsellers/?path=commission&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirectapi
redirect_uri 跳轉的連接中不能直接加#號。因此咱們加了path參數app
我是在main.js中獲取code值而後傳給後臺的:this
var urls = location.search; //獲取url中"?"符後的字串var theRequest: any = new Object();if (urls.indexOf("?") != -1) { var str = urls.substr(1); let strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); }}if (theRequest.code) { this.$store.state.wxCode = theRequest.code console.log("code", theRequest.code)}