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

Merge pull request !33 from 高靖/master
master-vue2
芋道源码 2023-12-27 11:57:49 +00:00 committed by Gitee
commit 27605c4cd1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 83 additions and 78 deletions

View File

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