创想开关

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" : { "permission" : {
"scope.userLocation" : { "scope.userLocation" : {
"desc" : "你的位置信息将用来记录位置" "desc" : "小程序将获取您的位置信息来查询附近可用设备"
} }
}, },
"requiredPrivateInfos" : [ "getLocation", "chooseAddress", "chooseLocation" ] "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))); // 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 let that = this
if (that.deviceId != '') { if (that.deviceId != '') {
let systemInfo = uni.getSystemInfoSync() that.findDevice()
if (systemInfo.platform == 'android') { // let systemInfo = uni.getSystemInfoSync()
if(that.modelId == 'LX'){ // if (systemInfo.platform == 'android') {
console.log('有wifi配网'); // if(that.modelId == 'LX'){
let zuih = '' // console.log('wifi');
if(that.deviceId.slice(-1) == 8){ // let zuih = ''
zuih = 'A' // if(that.deviceId.slice(-1) == 8){
}else if(that.deviceId.slice(-1) == 9){ // zuih = 'A'
zuih = 'B' // }else if(that.deviceId.slice(-1) == 9){
}else if(that.deviceId.slice(-1) == 'A'){ // zuih = 'B'
zuih = 'C' // }else if(that.deviceId.slice(-1) == 'A'){
}else if(that.deviceId.slice(-1) == 'B'){ // zuih = 'C'
zuih = 'D' // }else if(that.deviceId.slice(-1) == 'B'){
}else if(that.deviceId.slice(-1) == 'C'){ // zuih = 'D'
zuih = 'E' // }else if(that.deviceId.slice(-1) == 'C'){
}else if(that.deviceId.slice(-1) == 'D'){ // zuih = 'E'
zuih = 'F' // }else if(that.deviceId.slice(-1) == 'D'){
} else{ // zuih = 'F'
zuih = Number(that.deviceId.slice(-1)) + 2 // } 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),'...........') // that.deviceId = that.deviceId.slice(0, -1) + zuih
xBlufi.notifyStartDiscoverBle({ // console.log(that.modelId,zuih,that.deviceId.slice(0, -1),'...........')
'isStart': false // xBlufi.notifyStartDiscoverBle({
}) // 'isStart': false
console.log("进入蓝牙连接", that.deviceId) // })
console.log("进入that.name", that.name) // console.log("", that.deviceId)
xBlufi.notifyConnectBle({ // console.log("that.name", that.name)
isStart: true, // xBlufi.notifyConnectBle({
deviceId: that.deviceId, // isStart: true,
name: that.name // deviceId: that.deviceId,
}) // name: that.name
}else{ // })
console.log('无wifi配网'); // }else{
xBlufi.notifyStartDiscoverBle({ // console.log('wifi');
'isStart': false // xBlufi.notifyStartDiscoverBle({
}) // 'isStart': false
console.log("进入蓝牙连接", that.deviceId) // })
console.log("进入that.name", that.name) // console.log("", that.deviceId)
xBlufi.notifyConnectBle({ // console.log("that.name", that.name)
isStart: true, // xBlufi.notifyConnectBle({
deviceId: that.deviceId, // isStart: true,
name: that.name // deviceId: that.deviceId,
}) // name: that.name
} // })
} else if (systemInfo.platform == 'ios') { // }
// iOS // } else if (systemInfo.platform == 'ios') {
that.findDevice() // // iOS
} // that.findDevice()
// }
} }
} }
}, },
findDevice() { findDevice() {
// 使 find // 使 find
console.log(this.devicesarr,'所有设备');
const matchedDevice = this.devicesarr.find(device => { const matchedDevice = this.devicesarr.find(device => {
console.log(device.name, this.mac, '111') console.log(device.name, this.mac, '111')
console.log("IOSMAC", device) console.log("IOSMAC", device)

View File

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

View File

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

View File

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

View File

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