创想开关

This commit is contained in:
3321822538@qq.com 2025-04-30 18:08:51 +08:00
parent 405ee259a1
commit 888a699e19
6 changed files with 105 additions and 97 deletions

View File

@ -62,7 +62,7 @@
},
"permission" : {
"scope.userLocation" : {
"desc" : "你的位置信息将用来记录位置"
"desc" : "小程序将获取您的位置信息来查询附近可用设备"
}
},
"requiredPrivateInfos" : [ "getLocation", "chooseAddress", "chooseLocation" ]

View File

@ -526,60 +526,62 @@ export default {
// console.log(this.deviceId,Number(this.deviceId.slice(-1)) + 2,this.deviceId.slice(0, -1),this.deviceId.slice(0, -1) + ((Number(this.deviceId.slice(-1)) + 2)));
let that = this
if (that.deviceId != '') {
let systemInfo = uni.getSystemInfoSync()
if (systemInfo.platform == 'android') {
if(that.modelId == 'LX'){
console.log('有wifi配网');
let zuih = ''
if(that.deviceId.slice(-1) == 8){
zuih = 'A'
}else if(that.deviceId.slice(-1) == 9){
zuih = 'B'
}else if(that.deviceId.slice(-1) == 'A'){
zuih = 'C'
}else if(that.deviceId.slice(-1) == 'B'){
zuih = 'D'
}else if(that.deviceId.slice(-1) == 'C'){
zuih = 'E'
}else if(that.deviceId.slice(-1) == 'D'){
zuih = 'F'
} else{
zuih = Number(that.deviceId.slice(-1)) + 2
}
that.deviceId = that.deviceId.slice(0, -1) + zuih
console.log(that.modelId,zuih,that.deviceId.slice(0, -1),'...........')
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
console.log("进入蓝牙连接", that.deviceId)
console.log("进入that.name", that.name)
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
}else{
console.log('无wifi配网');
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
console.log("进入蓝牙连接", that.deviceId)
console.log("进入that.name", that.name)
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
}
} else if (systemInfo.platform == 'ios') {
// iOS
that.findDevice()
}
// let systemInfo = uni.getSystemInfoSync()
// if (systemInfo.platform == 'android') {
// if(that.modelId == 'LX'){
// console.log('wifi');
// let zuih = ''
// if(that.deviceId.slice(-1) == 8){
// zuih = 'A'
// }else if(that.deviceId.slice(-1) == 9){
// zuih = 'B'
// }else if(that.deviceId.slice(-1) == 'A'){
// zuih = 'C'
// }else if(that.deviceId.slice(-1) == 'B'){
// zuih = 'D'
// }else if(that.deviceId.slice(-1) == 'C'){
// zuih = 'E'
// }else if(that.deviceId.slice(-1) == 'D'){
// zuih = 'F'
// } else{
// zuih = Number(that.deviceId.slice(-1)) + 2
// }
// that.deviceId = that.deviceId.slice(0, -1) + zuih
// console.log(that.modelId,zuih,that.deviceId.slice(0, -1),'...........')
// xBlufi.notifyStartDiscoverBle({
// 'isStart': false
// })
// console.log("", that.deviceId)
// console.log("that.name", that.name)
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: that.deviceId,
// name: that.name
// })
// }else{
// console.log('wifi');
// xBlufi.notifyStartDiscoverBle({
// 'isStart': false
// })
// console.log("", that.deviceId)
// console.log("that.name", that.name)
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: that.deviceId,
// name: that.name
// })
// }
// } else if (systemInfo.platform == 'ios') {
// // iOS
// that.findDevice()
// }
}
}
},
findDevice() {
// 使 find
console.log(this.devicesarr,'所有设备');
const matchedDevice = this.devicesarr.find(device => {
console.log(device.name, this.mac, '111')
console.log("IOSMAC", device)

View File

@ -163,8 +163,8 @@
regiontext: '请选择省市区',
regionvalue: '',
selector: [],
latitude: '请输入纬度',
longitude: '请输入经度',
latitude: '',
longitude: '',
shopname: '',
yetime: '',
lxname: '',
@ -316,12 +316,6 @@
icon: 'none',
duration: 1000
})
} else if (this.longitude == '请输入经度') {
uni.showToast({
title: '请点击地图图标选择位置',
icon: 'none',
duration: 1000
})
} else if (this.xqdz == '') {
uni.showToast({
title: '请输入详细地址',
@ -341,7 +335,7 @@
let data = {
name: this.shopname,
picture: urlString,
address: this.jtdz,
address: this.xqdz,
lng: this.longitude,
lat: this.latitude,
businessTimeStart: this.ksyy,
@ -349,7 +343,7 @@
province: this.province,
city: this.city,
county: this.area,
specificAddress: this.xqdz,
// specificAddress: ,
contactName: this.shopname,
contactMobile: this.lxphone,
typeId: this.selectorvalue,

View File

@ -1437,9 +1437,9 @@
let that = this
uni.openBluetoothAdapter({
success: function (res) {
uni.getLocation({
type: 'wgs84',
success: (res) => {
// uni.getLocation({
// type: 'wgs84',
// success: (res) => {
if(that.deviceInfo.wifi == null){
let systemInfo = uni.getSystemInfoSync()
if (systemInfo.platform == 'android') {
@ -1499,16 +1499,16 @@
})
}
}
},
fail: (err) => {
console.error('获取位置失败:', err)
uni.showToast({
title: '位置信息未打开,无法配网,请授权后重试',
icon: 'none',
duration:2000
})
}
})
// },
// fail: (err) => {
// console.error('', err)
// uni.showToast({
// title: '',
// icon: 'none',
// duration:2000
// })
// }
// })
},
fail: function (err) {
console.error('蓝牙适配器初始化失败', err)

View File

@ -345,7 +345,16 @@
onLoad() {
this.pagenum = 1
this.getgroup()
if(uni.getStorageSync('paixu')){
console.log(uni.getStorageSync('paixu'));
this.paixutxt = uni.getStorageSync('paixu').label
this.pxzt = uni.getStorageSync('paixu').value
this.getlist()
}else{
this.paixutxt = '名称排序'
this.pxzt = 'deviceName'
this.getlist()
}
this.deviceId = uni.getStorageSync('deviceIds')
this.name = uni.getStorageSync('name')
let that = this
@ -388,11 +397,12 @@
console.log(uni.getStorageSync('paixu'));
this.paixutxt = uni.getStorageSync('paixu').label
this.pxzt = uni.getStorageSync('paixu').value
this.getlists()
}else{
this.paixutxt = '名称排序'
this.pxzt = 'deviceName'
}
this.getlists()
}
},1000)
if(uni.getStorageSync('lianjie')){
uni.removeStorageSync({

View File

@ -177,8 +177,8 @@
second: false
},
dateindex: 1,
latitude: '', //
longitude: '', //
latitude: '39.9042', //
longitude: '116.4074', //
covers: [], //
jinweidu: '',
userType: '',
@ -217,21 +217,22 @@
this.bangdingid = option.id
}
let that = this
wx.openBluetoothAdapter({
success: function (res) {
console.log('蓝牙适配器初始化成功')
xBlufi.initXBlufi(1)
that.chushihua = 1
},
fail: function (err) {
uni.showToast({
title: '蓝牙权限获取失败,请打开系统蓝牙和定位',
icon: 'none',
duration:3000
})
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err)
}
})
// wx.openBluetoothAdapter({
// success: function (res) {
// console.log('')
// xBlufi.initXBlufi(1)
// that.chushihua = 1
// },
// fail: function (err) {
// uni.showToast({
// title: ',',
// icon: 'none',
// duration:3000
// })
// console.error('', err)
// }
// })
},
//
onShareAppMessage: function() {
@ -255,9 +256,9 @@
// this.getzf()
this.gethuidaio()
this.getshiy()
setTimeout(()=>{
this.onControltap()
},1000)
// setTimeout(()=>{
// this.onControltap()
// },30000)
},
onReady() {
this.mapContext = uni.createMapContext('map', this)
@ -581,6 +582,7 @@
},
btnindex(num) {
this.onControltap()
if (this.wangluo = true) { //
if (num == 2) {
uni.navigateTo({