'修复微信小程序登录openid参数名不一致导致支付报错问题'

pull/33/head
Justin 2023-12-27 19:08:19 +08:00
parent 9f134ee5f0
commit e84ad12c5b
1 changed files with 83 additions and 78 deletions

View File

@ -30,8 +30,8 @@
</view>
</view>
<block v-if="isUp">
<mobileLogin :isUp="isUp" @close="maskClose" @wechatPhone="wechatPhone"
:social-code="socialCode" :social-state="socialState" />
<mobileLogin :isUp="isUp" @close="maskClose" @wechatPhone="wechatPhone" :social-code="socialCode"
:social-state="socialState" />
</block>
<block v-if="isPhoneBox">
<routinePhone :logoUrl="logoUrl" :isPhoneBox="isPhoneBox" @close="bindPhoneClose" :authKey="authKey">
@ -47,7 +47,9 @@
import mobileLogin from '@/components/login_mobile/index.vue'
import routinePhone from '@/components/login_mobile/routine_phone.vue'
import * as BrokerageAPI from '@/api/trade/brokerage.js'
import { getUserPhone } from '@/api/public';
import {
getUserPhone
} from '@/api/public';
import Routine from '@/libs/routine';
import wechat from "@/libs/wechat";
export default {
@ -86,7 +88,10 @@
window.scrollTo(0, Math.max(scrollHeight - 1, 0));
}, 100);
});
const { code, state } = options;
const {
code,
state
} = options;
this.options = options
// code
this.code = code || ''
@ -187,14 +192,14 @@
}
//
const loginCode = await Routine.getCode()
AuthApi.weixinMiniAppLogin(phoneCode, loginCode,'default').then(res => {
AuthApi.weixinMiniAppLogin(phoneCode, loginCode, 'default').then(res => {
const data = res.data;
// TODO refreshToken
this.$store.commit("LOGIN", {
'token': data.accessToken
});
// opendId
this.$store.commit("OPENID", data.openId);
this.$store.commit("OPENID", data.openid);
// userId
this.$store.commit("SETUID", data.userId);
this.getUserInfo();