处理IOS 链接判断找ai问问加快链接
This commit is contained in:
parent
1f99299bd7
commit
d51e8c9006
34
App.vue
34
App.vue
|
@ -31,12 +31,34 @@ export default {
|
|||
console.log('App @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Launch')
|
||||
// #ifndef APP-PLUS
|
||||
console.log('App 1111111111111Launch')
|
||||
xBlufi.initXBlufi(1);
|
||||
console.log("xBlufi初始化", xBlufi) // 修改日志输出,确保输出有意义的信息
|
||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); // 取消注释,确保事件监听被正确设置
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': true
|
||||
})
|
||||
|
||||
// wx.openBluetoothAdapter({
|
||||
// success: function (res) {
|
||||
// console.log('蓝牙适配器初始化成功')
|
||||
// //xBlufi.initXBlufi(1)
|
||||
|
||||
// xBlufi.initXBlufi(1);
|
||||
// console.log("xBlufi初始化", xBlufi) // 修改日志输出,确保输出有意义的信息
|
||||
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); // 取消注释,确保事件监听被正确设置
|
||||
// xBlufi.notifyStartDiscoverBle({
|
||||
// 'isStart': true
|
||||
// })
|
||||
// // xBlufi.notifyStartDiscoverBle({
|
||||
// // 'isStart': true
|
||||
// // })
|
||||
|
||||
// // 你可以在这里继续调用其他蓝牙相关的API
|
||||
// },
|
||||
// fail: function (err) {
|
||||
// uni.showToast({
|
||||
// title: '蓝牙权限获取失败,请打开系统蓝牙和定位',
|
||||
// icon: 'none',
|
||||
// duration:3000
|
||||
// })
|
||||
// console.error('蓝牙适配器初始化失败,可能是因为没有权限', err)
|
||||
// }
|
||||
// })
|
||||
|
||||
// #endif
|
||||
|
||||
// 添加以下代码,将方法绑定到 uni 全局对象
|
||||
|
|
|
@ -16,8 +16,8 @@ const install = (Vue, vm) => {
|
|||
// },
|
||||
// });
|
||||
Vue.prototype.$u.http.setConfig({
|
||||
baseUrl: 'http://192.168.2.27:10002',
|
||||
// baseUrl: 'https://kg.chuangtewl.com/prod-api',
|
||||
// baseUrl: 'http://192.168.2.27:10002',
|
||||
baseUrl: 'https://kg.chuangtewl.com/prod-api',
|
||||
// loadingText: '加载中...',
|
||||
// loadingTime: 1000,
|
||||
// 设置自定义头部content-type
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name" : "kaiguan",
|
||||
"appid" : "__UNI__F877C47",
|
||||
"appid" : "__UNI__96CC1F5",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
|
|
33
package-lock.json
generated
33
package-lock.json
generated
|
@ -1,38 +1,53 @@
|
|||
{
|
||||
"name": "dianbiao",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"echarts": {
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "dianbiao",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"dianbiao": "file:",
|
||||
"echarts": "^5.4.0",
|
||||
"js-base64": "^3.7.3",
|
||||
"uview-ui": "^1.8.8"
|
||||
}
|
||||
},
|
||||
"node_modules/dianbiao": {
|
||||
"resolved": "",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/echarts": {
|
||||
"version": "5.4.3",
|
||||
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.3.tgz",
|
||||
"integrity": "sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA==",
|
||||
"requires": {
|
||||
"dependencies": {
|
||||
"tslib": "2.3.0",
|
||||
"zrender": "5.4.4"
|
||||
}
|
||||
},
|
||||
"js-base64": {
|
||||
"node_modules/js-base64": {
|
||||
"version": "3.7.5",
|
||||
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz",
|
||||
"integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
|
||||
},
|
||||
"tslib": {
|
||||
"node_modules/tslib": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
|
||||
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
|
||||
},
|
||||
"uview-ui": {
|
||||
"node_modules/uview-ui": {
|
||||
"version": "1.8.8",
|
||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.8.8.tgz",
|
||||
"integrity": "sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg=="
|
||||
},
|
||||
"zrender": {
|
||||
"node_modules/zrender": {
|
||||
"version": "5.4.4",
|
||||
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.4.4.tgz",
|
||||
"integrity": "sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw==",
|
||||
"requires": {
|
||||
"dependencies": {
|
||||
"tslib": "2.3.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/lchighpass/lchighpass-speaking#readme",
|
||||
"dependencies": {
|
||||
"dianbiao": "file:",
|
||||
"echarts": "^5.4.0",
|
||||
"js-base64": "^3.7.3",
|
||||
"uview-ui": "^1.8.8"
|
||||
|
|
|
@ -1099,6 +1099,7 @@ function init() {
|
|||
};
|
||||
mDeviceEvent.notifyDeviceMsgEvent(obj);
|
||||
});
|
||||
console.log("初始化!!!!!!!!!!!!")
|
||||
mDeviceEvent.listenStartDiscoverBle(true, function (options) {
|
||||
if (options.isStart) {
|
||||
//第一步检查蓝牙适配器是否可用
|
||||
|
@ -1109,12 +1110,12 @@ function init() {
|
|||
uni.closeBluetoothAdapter({
|
||||
complete: function (res)
|
||||
{
|
||||
// console.log("这里蓝牙数据")
|
||||
uni.openBluetoothAdapter({
|
||||
console.log("这里蓝牙数据")
|
||||
wx.openBluetoothAdapter({
|
||||
success: function (res) {
|
||||
uni.getBluetoothAdapterState({
|
||||
success: function (res) {
|
||||
// console.log("这里蓝牙数据222")
|
||||
console.log("这里蓝牙数据222")
|
||||
{
|
||||
let devicesList = [];
|
||||
let countsTimes = 0;
|
||||
|
@ -1145,8 +1146,9 @@ function init() {
|
|||
// && devices.devices[0].name != 'SMART_R2XS'
|
||||
// && devices.devices[0].name != 'SMART_R2XS'
|
||||
// )
|
||||
if (devices.devices[0].name.indexOf("CTKG") != -1 || devices.devices[0].name.indexOf("CTPO") != -1 || devices.devices[0].name.indexOf("gjkg") != -1 || devices.devices[0].name.indexOf("CCYK") != -1){
|
||||
// console.log("跳过",devices.devices[0].name)
|
||||
// if (devices.devices[0].name.indexOf("CTKG") != -1 || devices.devices[0].name.indexOf("CTPO") != -1 || devices.devices[0].name.indexOf("gjkg") != -1 || devices.devices[0].name.indexOf("CCYK") != -1){
|
||||
if ( devices.devices[0].name.indexOf("gjkg") != -1 ){
|
||||
// console.log("跳过",devices.devices[0].name)
|
||||
// isnotexist = false;
|
||||
isnotexist = true;
|
||||
}
|
||||
|
@ -1170,6 +1172,13 @@ function init() {
|
|||
|
||||
if (isnotexist) {
|
||||
devicesList.push(devices.devices[0]);
|
||||
console.log("devicesList",devicesList);
|
||||
// let obj = {
|
||||
// 'type': mDeviceEvent.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS,
|
||||
// 'result': true,
|
||||
// 'data': devicesList
|
||||
// };
|
||||
// mDeviceEvent.notifyDeviceMsgEvent(obj);
|
||||
}
|
||||
} else if (devices[0]) {
|
||||
if (devices[0].advertisData) {
|
||||
|
@ -1186,6 +1195,13 @@ function init() {
|
|||
|
||||
if (isnotexist) {
|
||||
devicesList.push(devices[0]);
|
||||
console.log("devicesList",devicesList);
|
||||
// let obj = {
|
||||
// 'type': mDeviceEvent.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS,
|
||||
// 'result': true,
|
||||
// 'data': devicesList
|
||||
// };
|
||||
// mDeviceEvent.notifyDeviceMsgEvent(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ function initXBlufi(type) {
|
|||
break;
|
||||
|
||||
case XMQTT_SYSTEM.WeChat:
|
||||
console.log("初始化@@@@@@@!!!!!!!!!!!!")
|
||||
if(once==0)
|
||||
{
|
||||
once = 1;
|
||||
|
|
|
@ -326,6 +326,8 @@
|
|||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id
|
||||
this.deviceId = option.deviceId
|
||||
this.name = option.name
|
||||
this.$u.put(`/app/bill/${this.id}/refreshPayResult`).then(res => {
|
||||
this.getDevice()
|
||||
})
|
||||
|
@ -349,9 +351,16 @@
|
|||
clearInterval(this.timerone);
|
||||
this.timerone= null
|
||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
||||
wx.closeBLEConnection({
|
||||
deviceId: this.deviceId,
|
||||
})
|
||||
// wx.closeBLEConnection({
|
||||
// deviceId: this.deviceId,
|
||||
// })
|
||||
|
||||
xBlufi.notifyConnectBle({
|
||||
isStart: false,
|
||||
deviceId: this.deviceId,
|
||||
name: this.name
|
||||
});
|
||||
|
||||
},
|
||||
mounted() {
|
||||
// 组件挂载后启动定时器
|
||||
|
@ -580,11 +589,11 @@
|
|||
duration: 2000
|
||||
})
|
||||
} else {
|
||||
if (this.ver_data == null) {
|
||||
if (this.ver_data == null&&this.ver_dataflag != 3) {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: '正在连接蓝牙,请尽量靠近设备',
|
||||
content: '正在连接蓝牙,请尽量靠近设备!',
|
||||
showCancel: false,
|
||||
success: function(res) {
|
||||
|
||||
|
@ -597,32 +606,48 @@
|
|||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(() => {
|
||||
// console.log('close关闭');
|
||||
that.tdtxt = '关闭'
|
||||
that.imgflag = false
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: 'close'
|
||||
})
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11close'
|
||||
})
|
||||
let datas = {
|
||||
mac:that.qrResult,
|
||||
reason:'用户临时开关关闭',
|
||||
command:'11close',
|
||||
result:'成功'
|
||||
}
|
||||
console.log(datas,'111');
|
||||
that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {})
|
||||
}, 1000)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:', err)
|
||||
}
|
||||
})
|
||||
that.tdtxt = '关闭'
|
||||
that.imgflag = false
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: 'close'
|
||||
})
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11close'
|
||||
})
|
||||
let datas = {
|
||||
mac:that.qrResult,
|
||||
reason:'用户临时开关关闭',
|
||||
command:'11close',
|
||||
result:'成功'
|
||||
}
|
||||
console.log(datas,'111');
|
||||
|
||||
// uni.getConnectedBluetoothDevices({
|
||||
// success(res) {
|
||||
// setTimeout(() => {
|
||||
// // console.log('close关闭');
|
||||
// that.tdtxt = '关闭'
|
||||
// that.imgflag = false
|
||||
// xBlufi.notifySendCustomData({
|
||||
// customData: 'close'
|
||||
// })
|
||||
// xBlufi.notifySendCustomData({
|
||||
// customData: '11close'
|
||||
// })
|
||||
// let datas = {
|
||||
// mac:that.qrResult,
|
||||
// reason:'用户临时开关关闭',
|
||||
// command:'11close',
|
||||
// result:'成功'
|
||||
// }
|
||||
// console.log(datas,'111');
|
||||
// that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {})
|
||||
// }, 1000)
|
||||
// },
|
||||
// fail(err) {
|
||||
// console.error('获取已连接蓝牙设备信息失败:', err)
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -631,33 +656,50 @@
|
|||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
setTimeout(() => {
|
||||
// console.log('open开启');
|
||||
that.tdtxt = '开启'
|
||||
that.imgflag = true
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: 'open'
|
||||
})
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11open'
|
||||
})
|
||||
let datas = {
|
||||
mac:that.qrResult,
|
||||
reason:'用户临时开关开启',
|
||||
command:'11open',
|
||||
result:'成功'
|
||||
}
|
||||
console.log(datas,'111');
|
||||
that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {})
|
||||
}, 1000)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:', err)
|
||||
}
|
||||
})
|
||||
}
|
||||
that.tdtxt = '开启'
|
||||
that.imgflag = true
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: 'open'
|
||||
})
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11open'
|
||||
})
|
||||
let datas = {
|
||||
mac:that.qrResult,
|
||||
reason:'用户临时开关开启',
|
||||
command:'11open',
|
||||
result:'成功'
|
||||
}
|
||||
that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {})
|
||||
}
|
||||
|
||||
// uni.getConnectedBluetoothDevices({
|
||||
// success(res) {
|
||||
// setTimeout(() => {
|
||||
// // console.log('open开启');
|
||||
// that.tdtxt = '开启'
|
||||
// that.imgflag = true
|
||||
// xBlufi.notifySendCustomData({
|
||||
// customData: 'open'
|
||||
// })
|
||||
// xBlufi.notifySendCustomData({
|
||||
// customData: '11open'
|
||||
// })
|
||||
// let datas = {
|
||||
// mac:that.qrResult,
|
||||
// reason:'用户临时开关开启',
|
||||
// command:'11open',
|
||||
// result:'成功'
|
||||
// }
|
||||
// console.log(datas,'111');
|
||||
// that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {})
|
||||
// }, 1000)
|
||||
// },
|
||||
// fail(err) {
|
||||
// console.error('获取已连接蓝牙设备信息失败:', err)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -667,39 +709,41 @@
|
|||
},
|
||||
|
||||
getlanya(){
|
||||
this.ver_dataflag = 2
|
||||
xBlufi.initXBlufi(1)
|
||||
this.ver_dataflag = 3
|
||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': true
|
||||
})
|
||||
// 停止蓝牙搜索
|
||||
setTimeout(() => {
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': false
|
||||
})
|
||||
xBlufi.notifyConnectBle({
|
||||
isStart: true,
|
||||
deviceId: this.deviceId,
|
||||
name: this.name
|
||||
})
|
||||
xBlufi.notifyInitBleEsp32({
|
||||
deviceId: this.deviceId
|
||||
})
|
||||
if (this.sbobj.powerStatus == 0) {
|
||||
this.imgflag = false
|
||||
} else {
|
||||
this.imgflag = true
|
||||
}
|
||||
}, 2000)
|
||||
setTimeout(()=>{
|
||||
if(this.ver_data == null){
|
||||
this.ver_dataflag = 1
|
||||
setTimeout(()=>{
|
||||
this.getlanya()
|
||||
},3000)
|
||||
}
|
||||
},15000)
|
||||
// this.ver_dataflag = 2
|
||||
// xBlufi.initXBlufi(1)
|
||||
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||
// xBlufi.notifyStartDiscoverBle({
|
||||
// 'isStart': true
|
||||
// })
|
||||
// // 停止蓝牙搜索
|
||||
// setTimeout(() => {
|
||||
// xBlufi.notifyStartDiscoverBle({
|
||||
// 'isStart': false
|
||||
// })
|
||||
// xBlufi.notifyConnectBle({
|
||||
// isStart: true,
|
||||
// deviceId: this.deviceId,
|
||||
// name: this.name
|
||||
// })
|
||||
// xBlufi.notifyInitBleEsp32({
|
||||
// deviceId: this.deviceId
|
||||
// })
|
||||
// if (this.sbobj.powerStatus == 0) {
|
||||
// this.imgflag = false
|
||||
// } else {
|
||||
// this.imgflag = true
|
||||
// }
|
||||
// }, 2000)
|
||||
// setTimeout(()=>{
|
||||
// if(this.ver_data == null){
|
||||
// this.ver_dataflag = 1
|
||||
// setTimeout(()=>{
|
||||
// this.getlanya()
|
||||
// },3000)
|
||||
// }
|
||||
// },15000)
|
||||
},
|
||||
|
||||
|
||||
|
@ -776,11 +820,11 @@
|
|||
}
|
||||
})
|
||||
} else {
|
||||
if (this.ver_data == null) {
|
||||
if (this.ver_data == null&&this.ver_dataflag != 3) {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: '正在连接蓝牙,请尽量靠近设备',
|
||||
content: '正在连接蓝牙,请尽量靠近设备。',
|
||||
showCancel: false,
|
||||
success: function(res) {
|
||||
|
||||
|
@ -879,7 +923,7 @@
|
|||
}
|
||||
})
|
||||
} else {
|
||||
if (this.ver_data == null) {
|
||||
if (this.ver_data == null&&this.ver_dataflag != 3) {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
|
@ -1144,7 +1188,7 @@
|
|||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||
if (!options.result) {
|
||||
this.lanyaflag = true
|
||||
this.ver_dataflag = 1
|
||||
// this.ver_dataflag = 1
|
||||
return
|
||||
} else {
|
||||
this.lanyaflag = false
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1162,12 +1162,12 @@
|
|||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||||
if (options.result) {
|
||||
let devicesarr = options.data
|
||||
console.log(devicesarr, this.mac, '111');
|
||||
devicesarr.forEach(device => {
|
||||
const mac = device.name.substring(4);
|
||||
if (device.name.slice(5, 17) == this.qrResult) {
|
||||
this.deviceId = device.deviceId
|
||||
this.name = device.name
|
||||
console.log(this.deviceId, '11221');
|
||||
// console.log(device.name,this.mac,'222');
|
||||
this.devicesList.push(device);
|
||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||
|
|
|
@ -160,6 +160,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
var xBlufi = require("@/page_components/blufi/xBlufi.js");
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
@ -216,9 +218,14 @@
|
|||
wx.openBluetoothAdapter({
|
||||
success: function (res) {
|
||||
console.log('蓝牙适配器初始化成功')
|
||||
// 你可以在这里继续调用其他蓝牙相关的API
|
||||
xBlufi.initXBlufi(1)
|
||||
},
|
||||
fail: function (err) {
|
||||
uni.showToast({
|
||||
title: '蓝牙权限获取失败,请打开系统蓝牙和定位',
|
||||
icon: 'none',
|
||||
duration:3000
|
||||
})
|
||||
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user