This commit is contained in:
xingyy 2025-03-02 17:21:17 +08:00
parent 2b13718cea
commit a79f1b85da
5 changed files with 15 additions and 20 deletions

View File

@ -1,4 +1,4 @@
import { request } from '@/api/http.js' import { request } from '@/api-collect-code/http.js'
export async function offlineQrcodeList(data) { export async function offlineQrcodeList(data) {
return await request( { return await request( {

View File

@ -64,11 +64,11 @@ export function setupHttp() {
if (data.status === 1) { if (data.status === 1) {
message.error(data.msg || i18n.t('http.error.operationFailed')) message.error(data.msg || i18n.t('http.error.operationFailed'))
} }
console.log('拦截响应',data)
// 处理登录失效 // 处理登录失效
if (data.status === 401) { if (data.status === 401) {
message.error(i18n.t('http.error.loginExpired')) message.error(i18n.t('http.error.loginExpired'))
token.value = '' // 清除 token codeToken.value = '' // 清除 token
router.replace('/collectCode/login') router.replace('/collectCode/login')
} }

View File

@ -65,9 +65,7 @@ const getCode = async () => {
pane.value = 1 pane.value = 1
await nextTick() await nextTick()
vanSwipeRef.value?.swipeTo(pane.value) vanSwipeRef.value?.swipeTo(pane.value)
nextTick(() => {
codeInput.value?.focus()
})
} }
} catch (error) { } catch (error) {
console.error('获取验证码失败:', error) console.error('获取验证码失败:', error)
@ -199,7 +197,7 @@ const togglePasswordVisibility = () => {
type="tel" type="tel"
maxlength="6" maxlength="6"
ref="codeInput" ref="codeInput"
class="opacity-0 absolute top-0 left-0 h-full w-full" class="opacity-0 absolute top-0 left-0 h-full w-full z-999"
@input="code = $event.target.value.replace(/\D/g, '').slice(0, 6)" @input="code = $event.target.value.replace(/\D/g, '').slice(0, 6)"
@focus="isFocused = true" @focus="isFocused = true"
@blur="isFocused = false" @blur="isFocused = false"

View File

@ -81,7 +81,7 @@ const abnormal=ref(false)
const abnormalRow=ref({}) const abnormalRow=ref({})
const inputLotNo=async (data)=>{ const inputLotNo=async (data)=>{
const res=await offlineQrcodeList({ const res=await offlineQrcodeList({
lotNo:createForm.value.lotNo lotNo:createForm.value.lotNo-25000
}) })
if (res.status===0){ if (res.status===0){
if (res.data.Data?.length>0){ if (res.data.Data?.length>0){

View File

@ -100,9 +100,6 @@ const getCode =async () => {
vanSwipeRef.value?.swipeTo(pane.value) vanSwipeRef.value?.swipeTo(pane.value)
startCountdown(); startCountdown();
nextTick(()=>{
codeInput.value.focus()
})
} }
const goBack = () => { const goBack = () => {
code.value = '' code.value = ''
@ -195,18 +192,18 @@ onUnmounted(() => {
<div class="text-[16px] text-[#000]">+{{ selectedZone }} {{ phoneNum }}</div> <div class="text-[16px] text-[#000]">+{{ selectedZone }} {{ phoneNum }}</div>
</div> </div>
<div class="relative"> <div class="relative">
<van-password-input <van-password-input
:value="code" :value="code"
:gutter="10" :gutter="10"
:mask="false" :mask="false"
:focused="isFocused" :focused="isFocused"
/> />
<input <input
v-model="code" v-model="code"
type="tel" type="tel"
maxlength="6" maxlength="6"
ref="codeInput" ref="codeInput"
class="opacity-0 absolute top-0 left-0 h-full w-full" class="opacity-0 absolute top-0 left-0 h-full w-full"
@input="code = $event.target.value.replace(/\D/g, '').slice(0, 6)" @input="code = $event.target.value.replace(/\D/g, '').slice(0, 6)"
@focus="isFocused = true" @focus="isFocused = true"
@blur="isFocused = false" @blur="isFocused = false"