|
@@ -91,24 +91,24 @@ export default {
|
|
|
});
|
|
|
});*/
|
|
|
// 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
|
|
|
- const { appid, secret } = getAppIdByGroupIdAndMallId({
|
|
|
- groupId: this.$route.params.groupId,
|
|
|
- mallId: this.$route.params.mallId,
|
|
|
- type: 'all',
|
|
|
- });
|
|
|
- console.log(99, appid, secret, code);
|
|
|
+ // const { appid, secret } = getAppIdByGroupIdAndMallId({
|
|
|
+ // groupId: this.$route.params.groupId,
|
|
|
+ // mallId: this.$route.params.mallId,
|
|
|
+ // type: 'all',
|
|
|
+ // });
|
|
|
+ // console.log(99, appid, secret, code);
|
|
|
// return;
|
|
|
// ?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
|
|
|
const res = await WxJsOpenId({
|
|
|
- appid,
|
|
|
- secret,
|
|
|
+ // appid,
|
|
|
+ // secret,
|
|
|
code,
|
|
|
- grant_type: 'authorization_code',
|
|
|
+ // grant_type: 'authorization_code',
|
|
|
});
|
|
|
- if (res?.expires_in && res?.openid) {
|
|
|
- this.$store.commit('SET_OPENID', res.openid);
|
|
|
- this.$store.commit('SET_WX_ACCESS_TOKEN', res.access_token);
|
|
|
- this.$store.commit('SET_WX_REFRESH_TOKEN', res.refresh_token);
|
|
|
+ if (res?.code === '000000' && res?.data) {
|
|
|
+ this.$store.commit('SET_OPENID', res.data);
|
|
|
+ // this.$store.commit('SET_WX_ACCESS_TOKEN', res.access_token);
|
|
|
+ // this.$store.commit('SET_WX_REFRESH_TOKEN', res.refresh_token);
|
|
|
// 判断用户是否需要登录,
|
|
|
await this.checkIsLogin(() => {
|
|
|
this.$router.replace({
|