fix:多平台兼容

This commit is contained in:
2026-03-16 11:52:27 +08:00
parent b3836b8bf2
commit a79cf10bd4
18 changed files with 358 additions and 295 deletions
+12 -2
View File
@@ -69,7 +69,8 @@
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { sendVerifyCode, loginWithCode } from '@/config/api/user.js'
import { sendVerifyCode, quickLogin } from '@/config/api/user.js'
import { appid } from '@/config/url.js'
import { fetchAndCacheCustomerPhone } from '@/util/index.js'
import { useI18n } from '@/utils/i18n.js'
@@ -163,7 +164,16 @@
try {
uni.showLoading({ title: t('common.loggingIn') })
const res = await loginWithCode(phone.value, verifyCode.value)
const res = await quickLogin({
loginType: 'SMS',
appid,
phonenumber: phone.value,
smsCode: verifyCode.value
})
if (res && res.code !== 200) {
throw new Error(res.msg || res.message || t('auth.loginFailed'))
}
// 保存token和client_id
// 兼容多种返回格式:res.data.token, res.token, res.data.access_token