| | |
| | | <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> |
| | |
| | | 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, //为true只允许相机扫码,不加允许相册扫码 |
| | | 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({ |