From 6f59fd655854adf8130a2e67a638181958d2e2b3 Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期四, 31 七月 2025 13:11:22 +0800
Subject: [PATCH] 1.平板扫描
---
PadClient2/pages/index/test/test.vue | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/PadClient2/pages/index/test/test.vue b/PadClient2/pages/index/test/test.vue
index e5b81c6..c918418 100644
--- a/PadClient2/pages/index/test/test.vue
+++ b/PadClient2/pages/index/test/test.vue
@@ -1,5 +1,6 @@
<template>
- <web-view class="myView" ref="webview" src="http://192.168.1.145:86/UserLogin.aspx" @message="onMessage"></web-view>
+ <web-view class="myView" src="http://192.168.1.145:86/UserLogin.aspx" @message="onMessage" id="webviewRef" ref="webviewRef" name="webviewRef"
+></web-view>
<!-- "http://192.168.1.145:86/UserLogin.aspx" -->
</template>
<script>
@@ -40,12 +41,45 @@
console.log(_obj.Ip);
console.log(_obj.Port);
console.log(_obj.Detail);
+ console.log(_obj.Type);
+
this.ip = _obj.Ip;
this.port = _obj.Port;
this.info = _obj.Detail;
/////////////////////////璁块棶鏈嶅姟鍣�
- this.printHandle();
+ if(_obj.Type === "Bar")
+ {
+ this.printHandle();
+ }
+ else if(_obj.Type === "Scan")
+ {
+ //璇诲彇鎵爜beg 2025-7-28
+ console.log(_obj.txtName);
+ var currentWebview = this.$refs.webviewRef;
+ let _funName='msgFromUniapp';
+ let _fundata = { msg:'',txtName:''};
+ currentWebview = this.$scope.$getAppWebview().children()[0];
+ uni.scanCode({
+ onlyFromCamera: true, //涓簍rue鍙厑璁哥浉鏈烘壂鐮侊紝涓嶅姞鍏佽鐩稿唽鎵爜
+ success: function(res) {
+ console.log(JSON.stringify(res));
+ _fundata.msg=res.result;
+ _fundata.txtName=_obj.txtName;
+ currentWebview.evalJS(`${_funName}(${JSON.stringify(_fundata)})`);
+ uni.showToast({
+ title: '鎵爜鎴愬姛'
+ });
+ },
+ fail: function(err) {
+ console.log('鎵爜澶辫触', err)
+ }
+ });
+ //璇诲彇鎵爜end 2025-7-28
+ }
+
+
+
},
callH5Method(){
uni.postMessage({
--
Gitblit v1.9.3