|
@@ -13,7 +13,7 @@ export default {
|
|
|
console.log(12121212);
|
|
|
this.getCode();
|
|
|
},
|
|
|
- mounted(){
|
|
|
+ mounted() {
|
|
|
console.log(17171717171717);
|
|
|
},
|
|
|
methods: {
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
`wx907c27f16841a919` +
|
|
|
'&redirect_uri=' +
|
|
|
encodeURIComponent(local) +
|
|
|
- '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect';
|
|
|
+ '&response_type=code&scope=snsapi_base&state=1#wechat_redirect';
|
|
|
} else {
|
|
|
this.getOpenId(code); //把code传给后台获取用户信息
|
|
|
}
|
|
@@ -37,10 +37,15 @@ export default {
|
|
|
async getOpenId(code) {
|
|
|
// 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
|
|
|
let _this = this;
|
|
|
+
|
|
|
+ // ?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
|
|
|
const res = await WxJsOpenId({
|
|
|
+ appid: 'wx907c27f16841a919',
|
|
|
+ secret: 'd9c81d6c47f7de322a2ff85847de6728',
|
|
|
code,
|
|
|
+ grant_type: 'authorization_code',
|
|
|
});
|
|
|
- console.log(res);
|
|
|
+ console.log(4848484848, res);
|
|
|
// this.$http
|
|
|
// .post('/api/user/wechat/login', { code: code })
|
|
|
// .then((res) => {
|