13404089107
2026-04-30 6e69c2a72691308914f437395a6c79fedb696c48
fix(传统App): 修复验证码输入框处理逻辑并添加URL schemes

- 将验证码输入框类型从number改为text,避免移动端键盘切换问题
- 实现handleCodeInput方法统一处理输入逻辑,确保只保留6位数字并正确处理光标位置
- 在Android和iOS配置中添加URL schemes支持
2个文件已修改
41 ■■■■■ 已修改文件
traditionalApp/manifest.json 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/pages/bindPhone/bindPhone.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
traditionalApp/manifest.json
@@ -48,11 +48,13 @@
                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
                ],
                "minSdkVersion" : 28,
                "targetSdkVersion" : 30
                "targetSdkVersion" : 30,
                "schemes" : [ "ag8spw" ]
            },
            /* ios打包配置 */
            "ios" : {
                "dSYMs" : false,
                "schemes" : [ "ag8spw" ],
                "capabilities" : {
                    "entitlements" : {
                        "com.apple.developer.associated-domains" : [
traditionalApp/pages/bindPhone/bindPhone.vue
@@ -25,7 +25,16 @@
                    <view class="cursor" v-if="code.length === index && isFocused"></view>
                </view>
            </view>
            <input class="hidden-input" type="number" :maxlength="6" v-model="code" :focus="isFocused" @blur="isFocused = false" @focus="isFocused = true" />
            <input
                class="hidden-input"
                type="text"
                :value="code"
                :maxlength="6"
                :focus="isFocused"
                @input="handleCodeInput"
                @blur="isFocused = false"
                @focus="isFocused = true"
            />
            <view class="get-code-btn" :class="{ disabled: loading }" @tap="verifyCode">
                {{ loading ? '验证中...' : '立即验证' }}
            </view>
@@ -113,6 +122,32 @@
}
/**
 * 验证码输入统一按左到右处理,并只保留 6 位数字。
 */
const handleCodeInput = (event: { detail?: { value?: string } }) => {
    const rawValue = event?.detail?.value || ''
    const nextValue = rawValue.replace(/\D/g, '').slice(0, 6)
    const previousValue = code.value
    if (!nextValue) {
        code.value = ''
        return
    }
    if (nextValue.length <= previousValue.length) {
        code.value = nextValue
        return
    }
    if (nextValue.startsWith(previousValue)) {
        code.value = nextValue
        return
    }
    if (nextValue.endsWith(previousValue) && nextValue.length === previousValue.length + 1) {
        code.value = (previousValue + nextValue.slice(0, 1)).slice(0, 6)
        return
    }
    code.value = nextValue
}
/**
 * 校验验证码并绑定当前微信登录账号手机号。
 */
const verifyCode = async () => {