ocr修改提示
This commit is contained in:
parent
18720cc96b
commit
333784a914
|
|
@ -143,6 +143,9 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="custom-toast" :class="{'show': isShow, 'top': position === 'top', 'bottom': position === 'bottom'}">
|
||||
{{ message }}
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -178,10 +181,14 @@ export default {
|
|||
focusTimeout: null,
|
||||
// 设备信息
|
||||
systemInfo: null,
|
||||
isOverToday: false
|
||||
isOverToday: false,
|
||||
isShow: false,
|
||||
message: '',
|
||||
position: 'bottom' // 'top' | 'bottom'
|
||||
}
|
||||
},
|
||||
onBackPress(options) {
|
||||
console.log("进了-----")
|
||||
// 相机打开时处理返回事件
|
||||
if (this.showCamera){
|
||||
console.log('关闭相机...');
|
||||
|
|
@ -211,6 +218,14 @@ export default {
|
|||
this.cleanup();
|
||||
},
|
||||
methods: {
|
||||
show(message, position = 'top', duration = 2000) {
|
||||
this.message = message
|
||||
this.position = position
|
||||
this.isShow = true
|
||||
setTimeout(() => {
|
||||
this.isShow = false
|
||||
}, duration)
|
||||
},
|
||||
handleIsOverToday() {
|
||||
if (!this.codeData.nextCheckTime) {
|
||||
this.isOverToday = true
|
||||
|
|
@ -572,23 +587,15 @@ export default {
|
|||
icon: 'success'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '识别失败!' + resData.data.msg,
|
||||
icon: 'none',
|
||||
})
|
||||
console.log('识别失败!' + resData.data.msg)
|
||||
this.$refs.toast.show('识别失败!', 'bottom')
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '识别失败!',
|
||||
icon: 'none',
|
||||
})
|
||||
this.$refs.toast.show('识别失败!', 'bottom')
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({
|
||||
title: '请求失败:' + err.errMsg,
|
||||
icon: 'none',
|
||||
})
|
||||
this.$refs.toast.show('请求失败!', 'bottom')
|
||||
},
|
||||
})
|
||||
} catch (error) {
|
||||
|
|
@ -679,16 +686,10 @@ export default {
|
|||
icon: 'success'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '识别失败!' + resData.data.msg,
|
||||
icon: 'none',
|
||||
})
|
||||
this.$refs.toast.show('识别失败!', 'bottom')
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '识别失败!',
|
||||
icon: 'none',
|
||||
})
|
||||
this.$refs.toast.show('识别失败!', 'bottom')
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
|
|
@ -700,10 +701,7 @@ export default {
|
|||
});
|
||||
} catch (error) {
|
||||
console.error('相册图片处理或OCR识别失败:', error);
|
||||
uni.showToast({
|
||||
title: '识别失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
this.$refs.toast.show('识别失败!', 'bottom')
|
||||
} finally {
|
||||
this.isProcessing = false;
|
||||
}
|
||||
|
|
@ -807,6 +805,22 @@ export default {
|
|||
|
||||
<style>
|
||||
|
||||
.custom-toast {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 12px;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
color: white;
|
||||
text-align: center;
|
||||
z-index: 9999;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
.custom-toast.top { top: 0; }
|
||||
.custom-toast.bottom { bottom: 0; }
|
||||
.custom-toast.show { opacity: 1; }
|
||||
|
||||
.page-container {
|
||||
display: flex;
|
||||
height: auto;
|
||||
|
|
|
|||
Loading…
Reference in New Issue