fix: 修复登录跳转与支付展示异常

修复 H5 未登录扫码跳转登录页路径错误,补充手机号登录印尼/中国区号选择与校验,并修正支付方式单选及币种符号展示,避免支付页显示和选择异常。

Made-with: Cursor
This commit is contained in:
2026-04-25 16:08:43 +08:00
parent 2f618ef6ec
commit 555035388a
6 changed files with 57 additions and 18 deletions
+29 -10
View File
@@ -17,7 +17,7 @@
class="phone-input"
v-model="phone"
type="number"
maxlength="11"
:maxlength="countryCode === '+86' ? 11 : 12"
:placeholder="$t('auth.phonePlaceholder')"
/>
</view>
@@ -41,7 +41,7 @@
<!-- 区域提示 -->
<view class="region-notice">
<text>{{ $t('auth.regionNotSupported') }}</text>
<!-- <text>当前支持印尼+62和中国+86手机号登录</text> -->
</view>
<!-- 登录按钮 -->
@@ -87,20 +87,34 @@
const isAgreed = ref(false) // 是否同意协议
const phone = ref('') // 手机号
const verifyCode = ref('') // 验证码
const countryCode = ref('+86') // 国家区号
const countryCode = ref('+62') // 国家区号,默认印尼
const countdown = ref(0) // 验证码倒计时
let timer = null // 计时器
const countryOptions = [{
label: '印尼 +62',
value: '+62'
}, {
label: '中国 +86',
value: '+86'
}]
// 勾选协议变化
const onAgreementChange = (e) => {
isAgreed.value = e.detail.value.includes('agreed')
}
// 显示国家区号选择器(暂时仅支持+86
// 显示国家区号选择器
const showCountryPicker = () => {
uni.showToast({
title: t('auth.onlyMainlandSupported'),
icon: 'none'
uni.showActionSheet({
itemList: countryOptions.map(item => item.label),
success: ({
tapIndex
}) => {
const selected = countryOptions[tapIndex]
if (!selected || selected.value === countryCode.value) return
countryCode.value = selected.value
phone.value = ''
}
})
}
@@ -110,7 +124,7 @@
uni.showToast({ title: t('auth.phoneRequired'), icon: 'none' })
return false
}
const phoneReg = /^1[3-9]\d{9}$/
const phoneReg = countryCode.value === '+86' ? /^1[3-9]\d{9}$/ : /^8\d{7,11}$/
if (!phoneReg.test(phone.value)) {
uni.showToast({ title: t('auth.phoneInvalid'), icon: 'none' })
return false
@@ -118,6 +132,11 @@
return true
}
const getSubmitPhoneNumber = () => {
// 中国沿用原有 11 位手机号格式;印尼附带国家区号
return countryCode.value === '+86' ? phone.value : `${countryCode.value}${phone.value}`
}
// 发送验证码
const handleSendCode = async () => {
if (countdown.value > 0) return
@@ -126,7 +145,7 @@
try {
uni.showLoading({ title: t('common.sending') })
await sendVerifyCode(phone.value)
await sendVerifyCode(getSubmitPhoneNumber())
uni.hideLoading()
uni.showToast({ title: t('auth.codeSent'), icon: 'success' })
@@ -167,7 +186,7 @@
const res = await quickLogin({
loginType: 'SMS',
appid,
phonenumber: phone.value,
phonenumber: getSubmitPhoneNumber(),
smsCode: verifyCode.value
})