Commit d0694349 by 李伟康

fix(dailyNewspaper): 修复表单验证和日期选择器问题

- 将默认最大日期从 2020-01-01 更新为 2099-12-31
- 修复输入框最大长度限制为 10 位数字
- 调整数字输入类型配置并添加失焦事件处理
- 在 OCR 识别过程中添加加载提示
- 修复日历组件月份切换按钮显示逻辑错误
- 防止超出日期范围时月份切换按钮被点击
1 parent bccdb1fa
......@@ -107,7 +107,7 @@ export default {
item = this.currentItem
if (childrenRules && item.key) {
let rules = childrenRules[item.key]
return rules?.maxDate ? dayjs(eval(rules.maxDate)).format('YYYY-MM-DD') : '2020-01-01'
return rules?.maxDate ? dayjs(eval(rules.maxDate)).format('YYYY-MM-DD') : '2099-12-31'
}
},
},
......
......@@ -97,10 +97,12 @@
:placeholder="item.placeholder || '请输入'"
v-model="item.value"
class="input"
:maxlength="rules.maxLength || 11"
:maxlength="rules.maxLength || 10"
placeholder-class="placeholderStyle"
:type="rules.integer ? 'numeric' : 'decimal'"
:type="rules.integer ? 'number' : 'digit'"
@input="numberInput"
@blur="numberBlur"
:key="numberViewKey"
/>
</template>
<template v-else-if="item.type == 'carBrandSelect'">
......@@ -169,6 +171,7 @@ export default {
data () {
return {
item: null,
numberViewKey: Date.now()
}
},
mounted () {
......@@ -208,14 +211,20 @@ export default {
// 将图片转换为base64
const tempFilePath = res.tempFilePaths[0]
try {
uni.showLoading({
title: '正在识别...',
mask: true
})
const base64 = await that.getBase64FromImagePath(tempFilePath)
that.orcRecogintion(base64)
} catch (error) {
uni.hideLoading()
console.error('转换base64失败:', error)
uni.showToast({
title: '图片转换失败',
icon: 'none'
})
}
}
})
......@@ -261,8 +270,9 @@ export default {
* type 3 : standNo 车架号
*/
const res = await uni.$api.commonApi.orcRecognition({ type: 3, imgBase64 })
uni.hideLoading()
console.log('进行 orc 识别', res)
if(res.vin) this.$emit('onScanSuccess', res.vin)
if (res.vin) this.$emit('onScanSuccess', res.vin)
else uni.showToast({ title: '识别失败', icon: 'none' })
},
numberInput (e) {
......@@ -331,12 +341,12 @@ export default {
}
this.$set(this.item, 'value', filtered)
this.$emit('onInput', filtered)
this.$nextTick(() => {
this.$forceUpdate()
})
}
},
numberBlur(){
this.numberViewKey = Date.now()
}
}
}
</script>
......
......@@ -302,8 +302,8 @@ export default {
},
showPreBtn () {
let { cale, startDate, nowDate } = this,
minDate = cale.getDate(startDate, -1, 'month')
return !startDate ? true : cale.dateCompare(`${nowDate.year}/${nowDate.month}`, `${minDate.year}/${minDate.month}`)
minDate = cale.getDate(startDate, +1, 'month')
return !startDate ? true : cale.dateCompare(`${minDate.year}/${minDate.month}`,`${nowDate.year}/${nowDate.month}`)
}
},
watch: {
......@@ -514,6 +514,7 @@ export default {
* 上个月
*/
pre () {
if(!this.showPreBtn) return
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
this.setDate(preDate)
this.monthSwitch()
......@@ -523,6 +524,7 @@ export default {
* 下个月
*/
next () {
if(!this.showNextBtn) return
let { showNextBtn } = this
if (!showNextBtn) return
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!