处理IOS 链接判断找ai问问加快链接

This commit is contained in:
zenghi 2025-02-06 20:53:16 +08:00
parent 1f99299bd7
commit d51e8c9006
11 changed files with 9547 additions and 9343 deletions

34
App.vue
View File

@ -31,12 +31,34 @@ export default {
console.log('App @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Launch') console.log('App @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Launch')
// #ifndef APP-PLUS // #ifndef APP-PLUS
console.log('App 1111111111111Launch') console.log('App 1111111111111Launch')
xBlufi.initXBlufi(1);
console.log("xBlufi初始化", xBlufi) // // wx.openBluetoothAdapter({
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); // // success: function (res) {
xBlufi.notifyStartDiscoverBle({ // console.log('')
'isStart': true // //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 // #endif
// uni // uni

View File

@ -16,8 +16,8 @@ const install = (Vue, vm) => {
// }, // },
// }); // });
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
baseUrl: 'http://192.168.2.27:10002', // baseUrl: 'http://192.168.2.27:10002',
// baseUrl: 'https://kg.chuangtewl.com/prod-api', baseUrl: 'https://kg.chuangtewl.com/prod-api',
// loadingText: '加载中...', // loadingText: '加载中...',
// loadingTime: 1000, // loadingTime: 1000,
// 设置自定义头部content-type // 设置自定义头部content-type

View File

@ -1,6 +1,6 @@
{ {
"name" : "kaiguan", "name" : "kaiguan",
"appid" : "__UNI__F877C47", "appid" : "__UNI__96CC1F5",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",

31
package-lock.json generated
View File

@ -1,38 +1,53 @@
{ {
"name": "dianbiao", "name": "dianbiao",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 1, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": {
"": {
"name": "dianbiao",
"version": "1.0.0",
"license": "ISC",
"dependencies": { "dependencies": {
"echarts": { "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", "version": "5.4.3",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.3.tgz", "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.3.tgz",
"integrity": "sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA==", "integrity": "sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA==",
"requires": { "dependencies": {
"tslib": "2.3.0", "tslib": "2.3.0",
"zrender": "5.4.4" "zrender": "5.4.4"
} }
}, },
"js-base64": { "node_modules/js-base64": {
"version": "3.7.5", "version": "3.7.5",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz",
"integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==" "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
}, },
"tslib": { "node_modules/tslib": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}, },
"uview-ui": { "node_modules/uview-ui": {
"version": "1.8.8", "version": "1.8.8",
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.8.8.tgz", "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.8.8.tgz",
"integrity": "sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg==" "integrity": "sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg=="
}, },
"zrender": { "node_modules/zrender": {
"version": "5.4.4", "version": "5.4.4",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.4.4.tgz", "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.4.4.tgz",
"integrity": "sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw==", "integrity": "sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw==",
"requires": { "dependencies": {
"tslib": "2.3.0" "tslib": "2.3.0"
} }
} }

View File

@ -18,6 +18,7 @@
}, },
"homepage": "https://github.com/lchighpass/lchighpass-speaking#readme", "homepage": "https://github.com/lchighpass/lchighpass-speaking#readme",
"dependencies": { "dependencies": {
"dianbiao": "file:",
"echarts": "^5.4.0", "echarts": "^5.4.0",
"js-base64": "^3.7.3", "js-base64": "^3.7.3",
"uview-ui": "^1.8.8" "uview-ui": "^1.8.8"

View File

@ -1099,6 +1099,7 @@ function init() {
}; };
mDeviceEvent.notifyDeviceMsgEvent(obj); mDeviceEvent.notifyDeviceMsgEvent(obj);
}); });
console.log("初始化!!!!!!!!!!!!")
mDeviceEvent.listenStartDiscoverBle(true, function (options) { mDeviceEvent.listenStartDiscoverBle(true, function (options) {
if (options.isStart) { if (options.isStart) {
//第一步检查蓝牙适配器是否可用 //第一步检查蓝牙适配器是否可用
@ -1109,12 +1110,12 @@ function init() {
uni.closeBluetoothAdapter({ uni.closeBluetoothAdapter({
complete: function (res) complete: function (res)
{ {
// console.log("这里蓝牙数据") console.log("这里蓝牙数据")
uni.openBluetoothAdapter({ wx.openBluetoothAdapter({
success: function (res) { success: function (res) {
uni.getBluetoothAdapterState({ uni.getBluetoothAdapterState({
success: function (res) { success: function (res) {
// console.log("这里蓝牙数据222") console.log("这里蓝牙数据222")
{ {
let devicesList = []; let devicesList = [];
let countsTimes = 0; let countsTimes = 0;
@ -1145,7 +1146,8 @@ function init() {
// && devices.devices[0].name != 'SMART_R2XS' // && devices.devices[0].name != 'SMART_R2XS'
// && 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){ // 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) // console.log("跳过",devices.devices[0].name)
// isnotexist = false; // isnotexist = false;
isnotexist = true; isnotexist = true;
@ -1170,6 +1172,13 @@ function init() {
if (isnotexist) { if (isnotexist) {
devicesList.push(devices.devices[0]); 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]) { } else if (devices[0]) {
if (devices[0].advertisData) { if (devices[0].advertisData) {
@ -1186,6 +1195,13 @@ function init() {
if (isnotexist) { if (isnotexist) {
devicesList.push(devices[0]); 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);
} }
} }

View File

@ -50,6 +50,7 @@ function initXBlufi(type) {
break; break;
case XMQTT_SYSTEM.WeChat: case XMQTT_SYSTEM.WeChat:
console.log("初始化@@@@@@@")
if(once==0) if(once==0)
{ {
once = 1; once = 1;

View File

@ -326,6 +326,8 @@
}, },
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
this.deviceId = option.deviceId
this.name = option.name
this.$u.put(`/app/bill/${this.id}/refreshPayResult`).then(res => { this.$u.put(`/app/bill/${this.id}/refreshPayResult`).then(res => {
this.getDevice() this.getDevice()
}) })
@ -349,9 +351,16 @@
clearInterval(this.timerone); clearInterval(this.timerone);
this.timerone= null this.timerone= null
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
wx.closeBLEConnection({ // wx.closeBLEConnection({
// deviceId: this.deviceId,
// })
xBlufi.notifyConnectBle({
isStart: false,
deviceId: this.deviceId, deviceId: this.deviceId,
}) name: this.name
});
}, },
mounted() { mounted() {
// //
@ -580,11 +589,11 @@
duration: 2000 duration: 2000
}) })
} else { } else {
if (this.ver_data == null) { if (this.ver_data == null&&this.ver_dataflag != 3) {
let that = this let that = this
uni.showModal({ uni.showModal({
title: '温馨提示', title: '温馨提示',
content: '正在连接蓝牙,请尽量靠近设备', content: '正在连接蓝牙,请尽量靠近设备',
showCancel: false, showCancel: false,
success: function(res) { success: function(res) {
@ -597,10 +606,6 @@
uni.getNetworkType({ uni.getNetworkType({
success(res) { success(res) {
if (res.networkType !== 'none') { if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
// console.log('close');
that.tdtxt = '关闭' that.tdtxt = '关闭'
that.imgflag = false that.imgflag = false
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
@ -616,13 +621,33 @@
result:'成功' result:'成功'
} }
console.log(datas,'111'); console.log(datas,'111');
that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {})
}, 1000) // uni.getConnectedBluetoothDevices({
}, // success(res) {
fail(err) { // setTimeout(() => {
console.error('获取已连接蓝牙设备信息失败:', err) // // 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,10 +656,6 @@
uni.getNetworkType({ uni.getNetworkType({
success(res) { success(res) {
if (res.networkType !== 'none') { if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
// console.log('open');
that.tdtxt = '开启' that.tdtxt = '开启'
that.imgflag = true that.imgflag = true
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
@ -649,15 +670,36 @@
command:'11open', command:'11open',
result:'成功' result:'成功'
} }
console.log(datas,'111');
that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {}) that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {})
}, 1000)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} }
// 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(){ getlanya(){
this.ver_dataflag = 2 this.ver_dataflag = 3
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent) xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
xBlufi.notifyStartDiscoverBle({ // this.ver_dataflag = 2
'isStart': true // xBlufi.initXBlufi(1)
}) // xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
// // xBlufi.notifyStartDiscoverBle({
setTimeout(() => { // 'isStart': true
xBlufi.notifyStartDiscoverBle({ // })
'isStart': false // //
}) // setTimeout(() => {
xBlufi.notifyConnectBle({ // xBlufi.notifyStartDiscoverBle({
isStart: true, // 'isStart': false
deviceId: this.deviceId, // })
name: this.name // xBlufi.notifyConnectBle({
}) // isStart: true,
xBlufi.notifyInitBleEsp32({ // deviceId: this.deviceId,
deviceId: this.deviceId // name: this.name
}) // })
if (this.sbobj.powerStatus == 0) { // xBlufi.notifyInitBleEsp32({
this.imgflag = false // deviceId: this.deviceId
} else { // })
this.imgflag = true // if (this.sbobj.powerStatus == 0) {
} // this.imgflag = false
}, 2000) // } else {
setTimeout(()=>{ // this.imgflag = true
if(this.ver_data == null){ // }
this.ver_dataflag = 1 // }, 2000)
setTimeout(()=>{ // setTimeout(()=>{
this.getlanya() // if(this.ver_data == null){
},3000) // this.ver_dataflag = 1
} // setTimeout(()=>{
},15000) // this.getlanya()
// },3000)
// }
// },15000)
}, },
@ -776,11 +820,11 @@
} }
}) })
} else { } else {
if (this.ver_data == null) { if (this.ver_data == null&&this.ver_dataflag != 3) {
let that = this let that = this
uni.showModal({ uni.showModal({
title: '温馨提示', title: '温馨提示',
content: '正在连接蓝牙,请尽量靠近设备', content: '正在连接蓝牙,请尽量靠近设备',
showCancel: false, showCancel: false,
success: function(res) { success: function(res) {
@ -879,7 +923,7 @@
} }
}) })
} else { } else {
if (this.ver_data == null) { if (this.ver_data == null&&this.ver_dataflag != 3) {
let that = this let that = this
uni.showModal({ uni.showModal({
title: '温馨提示', title: '温馨提示',
@ -1144,7 +1188,7 @@
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START: case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
if (!options.result) { if (!options.result) {
this.lanyaflag = true this.lanyaflag = true
this.ver_dataflag = 1 // this.ver_dataflag = 1
return return
} else { } else {
this.lanyaflag = false this.lanyaflag = false

File diff suppressed because it is too large Load Diff

View File

@ -1162,12 +1162,12 @@
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
if (options.result) { if (options.result) {
let devicesarr = options.data let devicesarr = options.data
console.log(devicesarr, this.mac, '111');
devicesarr.forEach(device => { devicesarr.forEach(device => {
const mac = device.name.substring(4); const mac = device.name.substring(4);
if (device.name.slice(5, 17) == this.qrResult) { if (device.name.slice(5, 17) == this.qrResult) {
this.deviceId = device.deviceId this.deviceId = device.deviceId
this.name = device.name this.name = device.name
console.log(this.deviceId, '11221');
// console.log(device.name,this.mac,'222'); // console.log(device.name,this.mac,'222');
this.devicesList.push(device); this.devicesList.push(device);
let uniqueDevicesList = Array.from(new Set(this.devicesList)); let uniqueDevicesList = Array.from(new Set(this.devicesList));

View File

@ -160,6 +160,8 @@
</template> </template>
<script> <script>
var xBlufi = require("@/page_components/blufi/xBlufi.js");
export default { export default {
data() { data() {
return { return {
@ -216,9 +218,14 @@
wx.openBluetoothAdapter({ wx.openBluetoothAdapter({
success: function (res) { success: function (res) {
console.log('蓝牙适配器初始化成功') console.log('蓝牙适配器初始化成功')
// API xBlufi.initXBlufi(1)
}, },
fail: function (err) { fail: function (err) {
uni.showToast({
title: '蓝牙权限获取失败,请打开系统蓝牙和定位',
icon: 'none',
duration:3000
})
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err) console.error('蓝牙适配器初始化失败,可能是因为没有权限', err)
} }
}) })