🐛 fix(frontend): 输入取件码时不再五位自动提交
This commit is contained in:
1 parent
7c6119b0c9
commit
f2461378ef
2 files changed
+11
-7
No files matched your search
@@ -56,7 +56,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { inject, onMounted, watch } from 'vue'
|
import { inject, onMounted } from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import PageHeader from '@/components/common/PageHeader.vue'
|
import PageHeader from '@/components/common/PageHeader.vue'
|
||||||
@@ -101,13 +101,9 @@ const toSend = () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const queryCode = route.query.code
|
const queryCode = route.query.code
|
||||||
if (queryCode && typeof queryCode === 'string') {
|
if (queryCode && typeof queryCode === 'string') {
|
||||||
code.value = queryCode
|
code.value = queryCode.trim()
|
||||||
|
if ([5, 8].includes(code.value.length)) void handleSubmit()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(code, (newCode) => {
|
|
||||||
if ([5, 8].includes(newCode.length)) {
|
|
||||||
void handleSubmit()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
@@ -16,3 +16,11 @@ test('retrieval detail uses accessible shared dialog and exposes entire long fil
|
|||||||
const filename='FlClash-'+'long-'.repeat(25)+'android-arm64-v8a.apk';const html=await render(Detail,{visible:true,record:{filename,size:'51.58 MB',date:'2026/09/18 15:08:09',code:'ABCD2345',downloadUrl:'/share/download?code=ABCD2345'}})
|
const filename='FlClash-'+'long-'.repeat(25)+'android-arm64-v8a.apk';const html=await render(Detail,{visible:true,record:{filename,size:'51.58 MB',date:'2026/09/18 15:08:09',code:'ABCD2345',downloadUrl:'/share/download?code=ABCD2345'}})
|
||||||
assert.ok(html.includes('role="dialog"'));assert.ok(html.includes(filename));assert.ok(html.includes('aria-modal="true"'));assert.ok(html.includes('点击下载'))
|
assert.ok(html.includes('role="dialog"'));assert.ok(html.includes(filename));assert.ok(html.includes('aria-modal="true"'));assert.ok(html.includes('点击下载'))
|
||||||
})
|
})
|
||||||
|
test('retrieve form enables both complete legacy and current codes without truncating eight digits',async()=>{
|
||||||
|
const Form=(await server.ssrLoadModule('/src/components/common/RetrieveForm.vue')).default
|
||||||
|
for(const code of ['ABCDE','ABCD2345']){
|
||||||
|
const html=await render(Form,{modelValue:code,inputStatus:{readonly:false,loading:false}})
|
||||||
|
assert.ok(html.includes('maxlength="8"'));assert.ok(html.includes(`value="${code}"`));assert.ok(!/<button[^>]* disabled(?:=|>| )/.test(html))
|
||||||
|
}
|
||||||
|
const html=await render(Form,{modelValue:'ABC',inputStatus:{readonly:false,loading:false}});assert.ok(/<button[^>]* disabled(?:=|>| )/.test(html))
|
||||||
|
})
|
||||||
Reference in new issue
Block a user