From 3fc12840947618c73d66ef9fbb829b315a44032b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=B0=91=E5=90=9B?= <476671688@qq.com> Date: Fri, 1 Mar 2024 19:05:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E5=8F=B7=E7=99=BB=E5=BD=95=E8=8E=B7=E5=8F=96openid?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/index.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/login/index.vue b/pages/login/index.vue index 9a8b6ec..da225a2 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -15,6 +15,7 @@ import { useInterface } from "@/hooks/useInterface"; import { privacyAgreementUrl, sendSmsCode as sendSmsCodeRequest, smsLogin, userAgreementUrl } from '@/api/auth' import { useMainStore } from "@/store/modules/useMainStore"; import { afterLogin } from "@/utils"; +import { wxLogin } from "@/utils/wechatUtils"; const {getParams, goBack, push, pushToTab} = useRouter() const {toast} = useInterface(); @@ -30,6 +31,7 @@ const codeFocus = ref(false) const form = ref({ mobile: '', code: '', + loginCode: undefined,// 微信环境的CODE invitationCode: undefined }) @@ -146,6 +148,10 @@ async function doLogin() { if (!(unref(form).code)) return toast({title: '请输入正确的验证码'}) try { loginLoading.value = true + // 如果是微信小程序环境,获取wx.login的code给后端去获取openid + // #ifdef MP-WEIXIN + form.value.loginCode = await wxLogin(); + // #endif const res = await smsLogin(form.value); if (res) { await mainStore.setAccessToken(res)