This commit is contained in:
parent
2c55e72f39
commit
72ea67e75e
|
@ -181,6 +181,10 @@ function searchDevices(address = '', vlist1 = [], vlist2 = []) {
|
|||
address: n_address
|
||||
});
|
||||
BAdapter.cancelDiscovery();
|
||||
}else {
|
||||
setTimeout(()=>{
|
||||
BAdapter.cancelDiscovery();
|
||||
}, 12*1000)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -221,7 +225,7 @@ const connect = (mac_address, callback)=>{
|
|||
callback(false);
|
||||
}
|
||||
bluetoothSocket.close();
|
||||
}, 300)
|
||||
},200)
|
||||
}
|
||||
|
||||
//开始连接打印
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"name" : "采购收银系统",
|
||||
"appid" : "__UNI__D15002B",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"versionName" : "1.0.2",
|
||||
"versionCode" : 102,
|
||||
"transformPx" : false,
|
||||
"globalStyle" : {
|
||||
"navigationBarTextStyle" : "black",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<web-view src="http://192.168.1.55:5178/" @message="onmessage"></web-view>
|
||||
<web-view :src="src" @message="onmessage"></web-view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -11,6 +11,9 @@
|
|||
import * as pos from "@/utils/EscPostUtils.js"
|
||||
const vw = ref(null); // web-view
|
||||
|
||||
const src = ref("https://erp-cashier.lihaink.cn/#/login");
|
||||
// const src = ref("http://192.168.1.55:5178/#/");
|
||||
|
||||
onLoad(() => {
|
||||
// #ifdef APP-PLUS
|
||||
// plus.screen.lockOrientation('default'); //设置横屏
|
||||
|
|
|
@ -200,6 +200,10 @@ if (uni.restoreGlobal) {
|
|||
address: n_address
|
||||
});
|
||||
BAdapter.cancelDiscovery();
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
BAdapter.cancelDiscovery();
|
||||
}, 12 * 1e3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -228,14 +232,14 @@ if (uni.restoreGlobal) {
|
|||
}
|
||||
setTimeout(() => {
|
||||
if (bluetoothSocket.isConnected()) {
|
||||
formatAppLog("log", "at js_sdk/wangqingzhou311-android-blueTooth/searchDevices.js:216", "已连接=====", mac_address);
|
||||
formatAppLog("log", "at js_sdk/wangqingzhou311-android-blueTooth/searchDevices.js:220", "已连接=====", mac_address);
|
||||
callback(true);
|
||||
} else {
|
||||
formatAppLog("log", "at js_sdk/wangqingzhou311-android-blueTooth/searchDevices.js:220", "未连接", mac_address);
|
||||
formatAppLog("log", "at js_sdk/wangqingzhou311-android-blueTooth/searchDevices.js:224", "未连接", mac_address);
|
||||
callback(false);
|
||||
}
|
||||
bluetoothSocket.close();
|
||||
}, 300);
|
||||
}, 200);
|
||||
};
|
||||
function print(mac_address, data, callback) {
|
||||
if (!mac_address) {
|
||||
|
@ -255,7 +259,7 @@ if (uni.restoreGlobal) {
|
|||
plus.android.importClass(device);
|
||||
bluetoothSocket = device.createInsecureRfcommSocketToServiceRecord(uuid);
|
||||
plus.android.importClass(bluetoothSocket);
|
||||
formatAppLog("log", "at js_sdk/wangqingzhou311-android-blueTooth/searchDevices.js:249", "蓝牙", bluetoothSocket.isConnected());
|
||||
formatAppLog("log", "at js_sdk/wangqingzhou311-android-blueTooth/searchDevices.js:253", "蓝牙", bluetoothSocket.isConnected());
|
||||
if (!bluetoothSocket.isConnected()) {
|
||||
uni.showToast({
|
||||
title: "正在打印小票, 请耐心等待",
|
||||
|
@ -298,6 +302,7 @@ if (uni.restoreGlobal) {
|
|||
__name: "index",
|
||||
setup(__props) {
|
||||
const vw = vue.ref(null);
|
||||
const src = vue.ref("http://192.168.1.55:5178/#/");
|
||||
onLoad(() => {
|
||||
plus.navigator.setFullscreen(true);
|
||||
getLocationManager(() => {
|
||||
|
@ -330,14 +335,14 @@ if (uni.restoreGlobal) {
|
|||
title: "不可打印空内容",
|
||||
icon: "exception"
|
||||
});
|
||||
formatAppLog("log", "at pages/index/index.vue:63", "打印内容", stringData);
|
||||
formatAppLog("log", "at pages/index/index.vue:66", "打印内容", stringData);
|
||||
let deviceId = uni.getStorageSync("deviceId");
|
||||
if (!deviceId)
|
||||
return uni.showToast({
|
||||
title: "蓝牙未连接到T58打印机, 请检查是否已配对T58打印机",
|
||||
icon: "exception"
|
||||
});
|
||||
formatAppLog("log", "at pages/index/index.vue:79", "打印机地址=>", deviceId);
|
||||
formatAppLog("log", "at pages/index/index.vue:82", "打印机地址=>", deviceId);
|
||||
print(deviceId, stringData, () => {
|
||||
uni.showToast({
|
||||
title: "打印成功",
|
||||
|
@ -348,7 +353,7 @@ if (uni.restoreGlobal) {
|
|||
};
|
||||
const onmessage = (e) => {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
||||
formatAppLog("log", "at pages/index/index.vue:97", "收到消息", e);
|
||||
formatAppLog("log", "at pages/index/index.vue:100", "收到消息", e);
|
||||
if (((_b = (_a = e.detail) == null ? void 0 : _a.data[0]) == null ? void 0 : _b.type) == "print") {
|
||||
if ((_d = (_c = e.detail) == null ? void 0 : _c.data[0]) == null ? void 0 : _d.content) {
|
||||
onPrintClick((_f = (_e = e.detail) == null ? void 0 : _e.data[0]) == null ? void 0 : _f.content);
|
||||
|
@ -371,23 +376,17 @@ if (uni.restoreGlobal) {
|
|||
address: e2.address
|
||||
}
|
||||
};
|
||||
formatAppLog("log", "at pages/index/index.vue:121", "连接成功", e2);
|
||||
formatAppLog("log", "at pages/index/index.vue:124", "连接成功", e2);
|
||||
uni.setStorageSync("deviceId", e2.address);
|
||||
vw.value.evalJS(`receiveData('${JSON.stringify(obj)}')`);
|
||||
});
|
||||
}
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return vue.openBlock(), vue.createElementBlock(
|
||||
"web-view",
|
||||
{
|
||||
src: "http://192.168.1.55:5178/",
|
||||
return vue.openBlock(), vue.createElementBlock("web-view", {
|
||||
src: src.value,
|
||||
onMessage: onmessage
|
||||
},
|
||||
null,
|
||||
32
|
||||
/* NEED_HYDRATION */
|
||||
);
|
||||
}, null, 40, ["src"]);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
"iPhone",
|
||||
"iPad"
|
||||
],
|
||||
"id": "__UNI__D15002B",
|
||||
"name": "采购收银系统",
|
||||
"id": "__UNI__3A527D1",
|
||||
"name": "采购收银测试",
|
||||
"version": {
|
||||
"name": "1.0.0",
|
||||
"code": "100"
|
||||
"name": "1.0.1",
|
||||
"code": 101
|
||||
},
|
||||
"description": "",
|
||||
"developer": {
|
||||
|
|
Loading…
Reference in New Issue