diff --git a/pages.json b/pages.json
index 3e23a64..6f964e8 100644
--- a/pages.json
+++ b/pages.json
@@ -53,6 +53,16 @@
"style": {
"navigationBarTitleText": "图书上传"
}
+ },
+ {
+ "path": "pages/upload/scan-isbn",
+ "style": {
+ "navigationBarTitleText": "",
+ "navigationStyle": "custom",
+ "app-plus": {
+ "render": "native"
+ }
+ }
}
],
"globalStyle": {
diff --git a/pages/upload/scan-isbn.nvue b/pages/upload/scan-isbn.nvue
new file mode 100644
index 0000000..1c5df76
--- /dev/null
+++ b/pages/upload/scan-isbn.nvue
@@ -0,0 +1,91 @@
+
+
+
+
+
+ ✕
+
+
+
+ 对准条码自动识别
+
+
+
+
+
+
+
diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue
index 597f922..eb21551 100644
--- a/pages/upload/upload.vue
+++ b/pages/upload/upload.vue
@@ -958,6 +958,21 @@ export default {
}
},
+ onShow() {
+ // 每次页面显示时注册扫码结果监听
+ uni.$off('scan-isbn-result')
+ uni.$on('scan-isbn-result', (code) => {
+ if (code) {
+ this.isbn = code.trim()
+ this.searchISBN()
+ }
+ })
+ },
+
+ onUnload() {
+ uni.$off('scan-isbn-result')
+ },
+
computed: {
conditionValue() {
const map = {
@@ -1147,16 +1162,8 @@ export default {
uni.showToast({ title: '请先登录孔网账号', icon: 'none' })
return
}
- // 打开安卓原生扫码界面(无自定义取景框,对准即识别)
- uni.scanCode({
- onlyFromCamera: true,
- scanType: ['barcode'],
- success: (res) => {
- this.isbn = (res.result || '').trim()
- this.searchISBN()
- },
- fail: () => {}
- })
+ // 打开nvue扫码页面(全屏摄像头,无取景框,实时识别)
+ uni.navigateTo({ url: '/pages/upload/scan-isbn' })
},
// ISBN搜索 - 查询图书中心 + 孔网市场