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