电动车
This commit is contained in:
parent
1251d00722
commit
b3872e12bd
|
|
@ -84,6 +84,8 @@
|
||||||
permissionConfig: {
|
permissionConfig: {
|
||||||
'查看运营区': 'area:view',
|
'查看运营区': 'area:view',
|
||||||
'操作运营区': 'area:edit',
|
'操作运营区': 'area:edit',
|
||||||
|
'查看子区域': 'areaSub:view',
|
||||||
|
'操作子区域': 'areaSub:edit',
|
||||||
'查看故障': 'fault:view',
|
'查看故障': 'fault:view',
|
||||||
'故障审核': 'fault:edit',
|
'故障审核': 'fault:edit',
|
||||||
'查看订单': 'order:view',
|
'查看订单': 'order:view',
|
||||||
|
|
@ -113,84 +115,96 @@
|
||||||
txt: 2
|
txt: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '查看故障',
|
name: '查看子区域',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 3
|
txt: 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '故障审核',
|
name: '操作子区域',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 4
|
txt: 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '查看订单',
|
name: '查看故障',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 5
|
txt: 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '操作订单',
|
name: '故障审核',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 6
|
txt: 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '查看车辆',
|
name: '查看订单',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 7
|
txt: 7
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '操作车辆',
|
name: '操作订单',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 8
|
txt: 8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '查看客服',
|
name: '查看车辆',
|
||||||
|
tit: '是否允许',
|
||||||
|
checked: false,
|
||||||
|
txt: 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '操作车辆',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 10
|
txt: 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '操作客服',
|
name: '查看客服',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 11
|
txt: 11
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '操作客服',
|
||||||
|
tit: '是否允许',
|
||||||
|
checked: false,
|
||||||
|
txt: 12
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: '查看卡券',
|
name: '查看卡券',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 12
|
txt: 13
|
||||||
},{
|
},{
|
||||||
name: '操作卡券',
|
name: '操作卡券',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 13
|
txt: 14
|
||||||
},{
|
},{
|
||||||
name: '查看卡券订单',
|
name: '查看卡券订单',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 14
|
txt: 15
|
||||||
},{
|
},{
|
||||||
name: '操作卡券订单',
|
name: '操作卡券订单',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 15
|
txt: 16
|
||||||
},{
|
},{
|
||||||
name: '查看用户卡券',
|
name: '查看用户卡券',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 16
|
txt: 17
|
||||||
},{
|
},{
|
||||||
name: '操作用户卡券',
|
name: '操作用户卡券',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 17
|
txt: 18
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
@ -228,20 +242,22 @@
|
||||||
const permissionMap = {
|
const permissionMap = {
|
||||||
'area:view': 0,
|
'area:view': 0,
|
||||||
'area:edit': 1,
|
'area:edit': 1,
|
||||||
'fault:view': 2,
|
'areaSub:view':2,
|
||||||
'fault:edit': 3,
|
'areaSub:edit':3,
|
||||||
'order:view': 4,
|
'fault:view': 4,
|
||||||
'order:edit': 5,
|
'fault:edit': 5,
|
||||||
'device:view': 6,
|
'order:view': 6,
|
||||||
'device:edit': 7,
|
'order:edit': 7,
|
||||||
'customerService:view': 8,
|
'device:view': 8,
|
||||||
'customerService:edit': 9,
|
'device:edit': 9,
|
||||||
'vip:view': 10,
|
'customerService:view': 10,
|
||||||
'vip:edit': 11,
|
'customerService:edit': 11,
|
||||||
'vipOrder:view': 12,
|
'vip:view': 12,
|
||||||
'vipOrder:edit': 13,
|
'vip:edit': 13,
|
||||||
'vipUser:view': 14,
|
'vipOrder:view': 14,
|
||||||
'vipUser:edit': 15
|
'vipOrder:edit': 15,
|
||||||
|
'vipUser:view': 16,
|
||||||
|
'vipUser:edit': 17
|
||||||
}
|
}
|
||||||
|
|
||||||
permissions.forEach(permission => {
|
permissions.forEach(permission => {
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@
|
||||||
permissionConfig: {
|
permissionConfig: {
|
||||||
'查看运营区': 'area:view',
|
'查看运营区': 'area:view',
|
||||||
'操作运营区': 'area:edit',
|
'操作运营区': 'area:edit',
|
||||||
|
'查看子区域': 'areaSub:view',
|
||||||
|
'操作子区域': 'areaSub:edit',
|
||||||
'查看故障': 'fault:view',
|
'查看故障': 'fault:view',
|
||||||
'故障审核': 'fault:edit',
|
'故障审核': 'fault:edit',
|
||||||
'查看订单': 'order:view',
|
'查看订单': 'order:view',
|
||||||
|
|
@ -110,82 +112,96 @@
|
||||||
txt: 2
|
txt: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '查看故障',
|
name: '查看子区域',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 3
|
txt: 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '故障审核',
|
name: '操作子区域',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 4
|
txt: 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '查看订单',
|
name: '查看故障',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 5
|
txt: 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '操作订单',
|
name: '故障审核',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 6
|
txt: 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '查看车辆',
|
name: '查看订单',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 7
|
txt: 7
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '操作车辆',
|
name: '操作订单',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 8
|
txt: 8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '查看客服',
|
name: '查看车辆',
|
||||||
|
tit: '是否允许',
|
||||||
|
checked: false,
|
||||||
|
txt: 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '操作车辆',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 10
|
txt: 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '操作客服',
|
name: '查看客服',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 11
|
txt: 11
|
||||||
},{
|
},
|
||||||
name: '查看卡券',
|
{
|
||||||
|
name: '操作客服',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 12
|
txt: 12
|
||||||
},{
|
},
|
||||||
name: '操作卡券',
|
|
||||||
|
{
|
||||||
|
name: '查看卡券',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 13
|
txt: 13
|
||||||
},{
|
},{
|
||||||
name: '查看卡券订单',
|
name: '操作卡券',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 14
|
txt: 14
|
||||||
},{
|
},{
|
||||||
name: '操作卡券订单',
|
name: '查看卡券订单',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 15
|
txt: 15
|
||||||
},{
|
},{
|
||||||
name: '查看用户卡券',
|
name: '操作卡券订单',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 16
|
txt: 16
|
||||||
},{
|
},{
|
||||||
name: '操作用户卡券',
|
name: '查看用户卡券',
|
||||||
tit: '是否允许',
|
tit: '是否允许',
|
||||||
checked: false,
|
checked: false,
|
||||||
txt: 17
|
txt: 17
|
||||||
|
},{
|
||||||
|
name: '操作用户卡券',
|
||||||
|
tit: '是否允许',
|
||||||
|
checked: false,
|
||||||
|
txt: 18
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
@ -222,20 +238,22 @@
|
||||||
const permissionMap = {
|
const permissionMap = {
|
||||||
'area:view': 0,
|
'area:view': 0,
|
||||||
'area:edit': 1,
|
'area:edit': 1,
|
||||||
'fault:view': 2,
|
'areaSub:view':2,
|
||||||
'fault:edit': 3,
|
'areaSub:edit':3,
|
||||||
'order:view': 4,
|
'fault:view': 4,
|
||||||
'order:edit': 5,
|
'fault:edit': 5,
|
||||||
'device:view': 6,
|
'order:view': 6,
|
||||||
'device:edit': 7,
|
'order:edit': 7,
|
||||||
'customerService:view': 8,
|
'device:view': 8,
|
||||||
'customerService:edit': 9,
|
'device:edit': 9,
|
||||||
'vip:view': 10,
|
'customerService:view': 10,
|
||||||
'vip:edit': 11,
|
'customerService:edit': 11,
|
||||||
'vipOrder:view': 12,
|
'vip:view': 12,
|
||||||
'vipOrder:edit': 13,
|
'vip:edit': 13,
|
||||||
'vipUser:view': 14,
|
'vipOrder:view': 14,
|
||||||
'vipUser:edit': 15
|
'vipOrder:edit': 15,
|
||||||
|
'vipUser:view': 16,
|
||||||
|
'vipUser:edit': 17
|
||||||
}
|
}
|
||||||
|
|
||||||
permissions.forEach(permission => {
|
permissions.forEach(permission => {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@
|
||||||
<view class="park" @click="showdevList=!showdevList" style="bottom: 600rpx;">
|
<view class="park" @click="showdevList=!showdevList" style="bottom: 600rpx;">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uP0Jd1XAgfjBj4NM9a8g" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uP0Jd1XAgfjBj4NM9a8g" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="park" @click="btnshuaixn" style="bottom: 700rpx;width: 82rpx;height: 82rpx;border-radius: 50%;background-color: #fff;text-align: center;line-height: 82rpx;">
|
||||||
|
刷新
|
||||||
|
</view>
|
||||||
|
|
||||||
<view @touchmove.stop.prevent="() => {}">
|
<view @touchmove.stop.prevent="() => {}">
|
||||||
<view class="btn_box">
|
<view class="btn_box">
|
||||||
|
|
@ -236,6 +239,10 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
btnshuaixn(){
|
||||||
|
this.getqb()
|
||||||
|
this.getmarks()
|
||||||
|
},
|
||||||
// 请求全部运营统计数据
|
// 请求全部运营统计数据
|
||||||
getqb() {
|
getqb() {
|
||||||
let StatKeys = 'device_status_count,device_online_status_count,device_count'
|
let StatKeys = 'device_status_count,device_online_status_count,device_count'
|
||||||
|
|
@ -787,10 +794,10 @@
|
||||||
this.status9 = []
|
this.status9 = []
|
||||||
this.status6 = []
|
this.status6 = []
|
||||||
// 如果已经有数据,直接使用本地筛选
|
// 如果已经有数据,直接使用本地筛选
|
||||||
if (this.allDeviceData.length > 0) {
|
// if (this.allDeviceData.length > 0) {
|
||||||
this.filterDevicesByPowerRange()
|
// this.filterDevicesByPowerRange()
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
if (this.statusidx != 7 && this.statusidx != 20 && this.statusidx != 10) {
|
if (this.statusidx != 7 && this.statusidx != 20 && this.statusidx != 10) {
|
||||||
this.$u.get(`/bst/device/all?areaId=${this.areaId}&status=${this.statusidx}&powerRange=${this.rangeValue[0] + ',' + this.rangeValue[1]}&refresh=true`).then((res) => {
|
this.$u.get(`/bst/device/all?areaId=${this.areaId}&status=${this.statusidx}&powerRange=${this.rangeValue[0] + ',' + this.rangeValue[1]}&refresh=true`).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
|
@ -931,6 +938,7 @@
|
||||||
const type2Data = []
|
const type2Data = []
|
||||||
const type3Data = []
|
const type3Data = []
|
||||||
res.data.forEach(row => {
|
res.data.forEach(row => {
|
||||||
|
if(row.status == 0){
|
||||||
if (row.type == 1) {
|
if (row.type == 1) {
|
||||||
type1Data.push(row)
|
type1Data.push(row)
|
||||||
} else if (row.type == 2) {
|
} else if (row.type == 2) {
|
||||||
|
|
@ -958,6 +966,8 @@
|
||||||
isParking: true
|
isParking: true
|
||||||
})
|
})
|
||||||
console.log(newMarkers,'newMarkersnewMarkersnewMarkers')
|
console.log(newMarkers,'newMarkersnewMarkersnewMarkers')
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
this.$set(this, 'markers', [...this.markers, ...newMarkers])
|
this.$set(this, 'markers', [...this.markers, ...newMarkers])
|
||||||
const validBoundaries1 = type1Data.map(row => row.boundaryStr).filter(boundary =>
|
const validBoundaries1 = type1Data.map(row => row.boundaryStr).filter(boundary =>
|
||||||
|
|
|
||||||
|
|
@ -237,15 +237,15 @@
|
||||||
<view class="card_li">
|
<view class="card_li">
|
||||||
<view class="tops">
|
<view class="tops">
|
||||||
<view class="card_left">
|
<view class="card_left">
|
||||||
运营区外调度费
|
运营区外管理费
|
||||||
</view>
|
</view>
|
||||||
<view class="card_right">
|
<view class="card_right">
|
||||||
<input type="number" v-model="form.dispatchFee" placeholder=" " class="input"
|
<input type="number" v-model="form.vehicleManagementFee" placeholder=" " class="input"
|
||||||
placeholder-style="color:#C7CDD3" style="width: 100rpx;">元
|
placeholder-style="color:#C7CDD3" style="width: 100rpx;">元
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tips" style="text-align: left;">
|
<view class="tips" style="text-align: left;">
|
||||||
设置车辆超出运营区外产生的调度费用
|
设置车辆超出运营区外产生的管理费用
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="card_li">
|
<view class="card_li">
|
||||||
|
|
@ -254,7 +254,7 @@
|
||||||
停车点外调度费
|
停车点外调度费
|
||||||
</view>
|
</view>
|
||||||
<view class="card_right">
|
<view class="card_right">
|
||||||
<input type="number" v-model="form.vehicleManagementFee" placeholder=" " class="input"
|
<input type="number" v-model="form.dispatchFee" placeholder=" " class="input"
|
||||||
placeholder-style="color:#C7CDD3" style="width: 100rpx;">元
|
placeholder-style="color:#C7CDD3" style="width: 100rpx;">元
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -307,11 +307,11 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedItems = []
|
this.selectedItems = []
|
||||||
this.$u.get(`/bst/device/list?pageNum=${this.pageNum}&pageSize=999`, data).then((res) => {
|
this.$u.get(`//bst/device/all`, data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.total = res.total
|
this.total = res.data.length
|
||||||
this.deviceList = res.rows
|
this.deviceList = res.data
|
||||||
this.filteredList = res.rows
|
this.filteredList = res.data
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
|
|
@ -322,32 +322,6 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// // 搜索
|
|
||||||
// search() {
|
|
||||||
// this.pageNum = 1
|
|
||||||
// let data = {
|
|
||||||
// isAsc: this.scidx,
|
|
||||||
// status: this.typeidx,
|
|
||||||
// areaId: this.areaId,
|
|
||||||
// orderByColumn: this.typeSort,
|
|
||||||
// refresh:true,
|
|
||||||
// Keyword:this.searchKeyword
|
|
||||||
// }
|
|
||||||
// this.selectedItems = []
|
|
||||||
// this.$u.get(`/bst/device/list?pageNum=${this.pageNum}&pageSize=999`, data).then((res) => {
|
|
||||||
// if (res.code == 200) {
|
|
||||||
// this.total = res.total
|
|
||||||
// this.deviceList = res.rows
|
|
||||||
// this.filteredList = res.rows
|
|
||||||
// } else {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: res.msg,
|
|
||||||
// icon: 'none',
|
|
||||||
// duration: 2000
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
todetail(item) {
|
todetail(item) {
|
||||||
if (this.stepindex == 0) {
|
if (this.stepindex == 0) {
|
||||||
console.log(item.id,item);
|
console.log(item.id,item);
|
||||||
|
|
@ -368,7 +342,7 @@ export default {
|
||||||
key: 'typeSortLabel',
|
key: 'typeSortLabel',
|
||||||
data: e[0].label,
|
data: e[0].label,
|
||||||
})
|
})
|
||||||
this.pageNum = 1
|
// this.pageNum = 1
|
||||||
this.getDevice()
|
this.getDevice()
|
||||||
},
|
},
|
||||||
// 车辆禁用
|
// 车辆禁用
|
||||||
|
|
@ -558,25 +532,59 @@ export default {
|
||||||
getDevice() {
|
getDevice() {
|
||||||
console.log(this.typeSort)
|
console.log(this.typeSort)
|
||||||
let data = {
|
let data = {
|
||||||
isAsc: this.scidx,
|
// isAsc: this.scidx,
|
||||||
status: this.typeidx,
|
status: this.typeidx,
|
||||||
areaId: this.areaId,
|
areaId: this.areaId,
|
||||||
orderByColumn: this.typeSort,
|
// orderByColumn: this.typeSort,
|
||||||
// refresh:true,
|
// refresh:true,
|
||||||
Keyword:this.searchKeyword
|
Keyword:this.searchKeyword
|
||||||
}
|
}
|
||||||
this.selectedItems = []
|
this.selectedItems = []
|
||||||
this.$u.get(`/bst/device/list?pageNum=${this.pageNum}&pageSize=10`, data).then((res) => {
|
this.$u.get(`/bst/device/all`, data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.total = res.total
|
this.total = res.data.length
|
||||||
if(this.pageNum == 1){
|
this.deviceList = res.data
|
||||||
this.deviceList = res.rows
|
this.filteredList = res.data
|
||||||
this.filteredList = res.rows
|
if (!this.filteredList || this.filteredList.length === 0) return;
|
||||||
}else{
|
|
||||||
this.deviceList = this.deviceList.concat(res.rows)
|
// 如果没有设置排序字段或方向,使用默认值
|
||||||
this.filteredList = this.filteredList.concat(res.rows)
|
const sortField = this.typeSort || 'remainingPower';
|
||||||
|
const isDesc = this.scidx === 'desc';
|
||||||
|
|
||||||
|
this.filteredList.sort((a, b) => {
|
||||||
|
// 获取比较值(处理可能不存在的字段)
|
||||||
|
let valueA = a[sortField] || '';
|
||||||
|
let valueB = b[sortField] || '';
|
||||||
|
|
||||||
|
// 特殊处理数字类型(如电量)
|
||||||
|
if (sortField === 'remainingPower') {
|
||||||
|
valueA = parseFloat(valueA) || 0;
|
||||||
|
valueB = parseFloat(valueB) || 0;
|
||||||
}
|
}
|
||||||
this.pageNum++
|
|
||||||
|
// 执行比较
|
||||||
|
if (isDesc) {
|
||||||
|
// 降序排列
|
||||||
|
if (valueA > valueB) return -1;
|
||||||
|
if (valueA < valueB) return 1;
|
||||||
|
} else {
|
||||||
|
// 升序排列
|
||||||
|
if (valueA < valueB) return -1;
|
||||||
|
if (valueA > valueB) return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 更新视图
|
||||||
|
this.$forceUpdate();
|
||||||
|
// if(this.pageNum == 1){
|
||||||
|
// this.deviceList = res.rows
|
||||||
|
// this.filteredList = res.rows
|
||||||
|
// }else{
|
||||||
|
// this.deviceList = this.deviceList.concat(res.rows)
|
||||||
|
// this.filteredList = this.filteredList.concat(res.rows)
|
||||||
|
// }
|
||||||
|
// this.pageNum++
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
<view class="tap_cont" :class="zhuangtai=='PROCESSING'?'act1':''" @click="changeidx('PROCESSING')">
|
<view class="tap_cont" :class="zhuangtai=='PROCESSING'?'act1':''" @click="changeidx('PROCESSING')">
|
||||||
进行中
|
进行中
|
||||||
</view>
|
</view>
|
||||||
<view class="tap_cont" :class="zhuangtai=='WAIT_PAY'?'act1':''" @click="changeidx('WAIT_PAY')">
|
<view class="tap_cont" style="width: 200rpx;" :class="zhuangtai=='RIDE_WAIT_PAY'?'act1':''" @click="changeidx('RIDE_WAIT_PAY')">
|
||||||
待支付
|
骑行待支付
|
||||||
</view>
|
</view>
|
||||||
<view class="tap_cont" :class="zhuangtai=='FINISHED'?'act1':''" @click="changeidx('FINISHED')">
|
<view class="tap_cont" :class="zhuangtai=='FINISHED'?'act1':''" @click="changeidx('FINISHED')">
|
||||||
已完成
|
已完成
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
<view class="top_info_right" v-if="item.status== 'WAIT_PAY'"
|
<view class="top_info_right" v-if="item.status== 'WAIT_PAY'"
|
||||||
style="color: orangered;">
|
style="color: orangered;">
|
||||||
<view class="yuan" style="background: orangered;"></view>
|
<view class="yuan" style="background: orangered;"></view>
|
||||||
待支付
|
押金待支付
|
||||||
</view>
|
</view>
|
||||||
<view class="top_info_right" v-if="item.status=='FINISHED'" style="color: green;">
|
<view class="top_info_right" v-if="item.status=='FINISHED'" style="color: green;">
|
||||||
<view class="yuan" style="background: green;"></view>
|
<view class="yuan" style="background: green;"></view>
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@
|
||||||
<cover-image class="img" src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW"
|
<cover-image class="img" src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW"
|
||||||
mode=""></cover-image>
|
mode=""></cover-image>
|
||||||
</cover-view>
|
</cover-view>
|
||||||
<cover-view class="park" style="bottom: 240rpx;width: 70rpx;height: 70rpx;right: 40rpx;" @click="btnsjyc">
|
<!-- <cover-view class="park" style="bottom: 240rpx;width: 70rpx;height: 70rpx;right: 40rpx;" @click="btnsjyc">
|
||||||
<cover-image class="img" src="https://api.ccttiot.com/smartmeter/img/static/uBluMsnJyV5Judyx7SYx"
|
<cover-image class="img" src="https://api.ccttiot.com/smartmeter/img/static/uBluMsnJyV5Judyx7SYx"
|
||||||
mode=""></cover-image>
|
mode=""></cover-image>
|
||||||
</cover-view>
|
</cover-view> -->
|
||||||
<!-- <cover-view class="track" @click="toTrack">
|
<!-- <cover-view class="track" @click="toTrack">
|
||||||
<cover-image class="img" src="https://lxnapi.ccttiot.com/bike/img/static/ufaAAtlirJYs1QwJF25P"
|
<cover-image class="img" src="https://lxnapi.ccttiot.com/bike/img/static/ufaAAtlirJYs1QwJF25P"
|
||||||
mode=""></cover-image>
|
mode=""></cover-image>
|
||||||
|
|
@ -27,13 +27,6 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="" style="display: flex;justify-content: space-between;">
|
<view class="" style="display: flex;justify-content: space-between;">
|
||||||
<view class="cent">
|
<view class="cent">
|
||||||
<view class="lypic" v-if="ver_dataflag == 3" @click="btnly">
|
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uLw46jus4X9fposAvVD7" mode=""></image>
|
|
||||||
</view>
|
|
||||||
<view class="lypic" v-if="ver_dataflag == 1" @click="btnly">
|
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uCdHjNaNfD9aikVg9Cuk" mode=""></image>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="lypic" v-if="deviceInfos.music == 0" @click="btnsy">
|
<view class="lypic" v-if="deviceInfos.music == 0" @click="btnsy">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uDORYeTuc2EQ1lSI2dbe" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uDORYeTuc2EQ1lSI2dbe" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -43,6 +36,21 @@
|
||||||
<view class="lypic" v-if="deviceInfos.music == 2" @click="btnsy">
|
<view class="lypic" v-if="deviceInfos.music == 2" @click="btnsy">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uP7BOVsjvWaGItgHtoKV" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uP7BOVsjvWaGItgHtoKV" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="lypic" v-if="ver_dataflag == 3" @click="btnly">
|
||||||
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uLw46jus4X9fposAvVD7" mode=""></image>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="lypic" v-if="ver_dataflag == 1" @click="btnly">
|
||||||
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uCdHjNaNfD9aikVg9Cuk" mode=""></image>
|
||||||
|
</view> -->
|
||||||
|
<view class="lypic" v-if="ver_dataflag == 1" @click="btnly">
|
||||||
|
<image
|
||||||
|
class="glow-image"
|
||||||
|
src="https://api.ccttiot.com/smartmeter/img/static/uCdHjNaNfD9aikVg9Cuk"
|
||||||
|
mode="aspectFit"
|
||||||
|
:class="{ 'visible': isVisible, 'hidden': !isVisible }"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="rt">
|
<view class="rt">
|
||||||
|
|
@ -362,6 +370,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { showLoading } from "../../components/blufi/util"
|
||||||
|
|
||||||
const app = getApp()
|
const app = getApp()
|
||||||
var xBlufi = require("@/components/blufi/xBlufi.js")
|
var xBlufi = require("@/components/blufi/xBlufi.js")
|
||||||
let _this = null
|
let _this = null
|
||||||
|
|
@ -444,7 +454,10 @@
|
||||||
findDeviceTimer: null,
|
findDeviceTimer: null,
|
||||||
jieliuflag:true,
|
jieliuflag:true,
|
||||||
|
|
||||||
isMarkerVisible: true
|
isMarkerVisible: true,
|
||||||
|
|
||||||
|
isVisible: true,
|
||||||
|
glowInterval: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
|
@ -456,6 +469,14 @@
|
||||||
this.getyunying()
|
this.getyunying()
|
||||||
|
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
// 开启呼吸灯效果
|
||||||
|
this.startGlowEffect();
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 清除定时器
|
||||||
|
clearInterval(this.glowInterval);
|
||||||
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
xBlufi.notifyConnectBle({
|
xBlufi.notifyConnectBle({
|
||||||
isStart: false,
|
isStart: false,
|
||||||
|
|
@ -468,6 +489,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
startGlowEffect() {
|
||||||
|
// 每1.5秒切换一次显隐状态
|
||||||
|
this.glowInterval = setInterval(() => {
|
||||||
|
this.isVisible = !this.isVisible;
|
||||||
|
}, 1500);
|
||||||
|
},
|
||||||
// 点击隐藏手机定位
|
// 点击隐藏手机定位
|
||||||
btnsjyc() {
|
btnsjyc() {
|
||||||
this.isMarkerVisible = !this.isMarkerVisible;
|
this.isMarkerVisible = !this.isMarkerVisible;
|
||||||
|
|
@ -603,7 +630,7 @@
|
||||||
this.getlanya()
|
this.getlanya()
|
||||||
}else if (num == 1) {
|
}else if (num == 1) {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11open@"
|
customData: "11opensub5@"
|
||||||
})
|
})
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '发送成功',
|
title: '发送成功',
|
||||||
|
|
@ -612,7 +639,7 @@
|
||||||
})
|
})
|
||||||
} else if (num == 2) {
|
} else if (num == 2) {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11close@"
|
customData: "11closesub200@"
|
||||||
})
|
})
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '发送成功',
|
title: '发送成功',
|
||||||
|
|
@ -649,7 +676,7 @@
|
||||||
}
|
}
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.jieliuflag = true
|
this.jieliuflag = true
|
||||||
},1000)
|
},3000)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getlanya() {
|
getlanya() {
|
||||||
|
|
@ -706,12 +733,6 @@
|
||||||
if (options.result == true) {
|
if (options.result == true) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.ver_dataflag = 3
|
this.ver_dataflag = 3
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '连接成功',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}, 2000)
|
}, 2000)
|
||||||
xBlufi.notifyInitBleEsp32({
|
xBlufi.notifyInitBleEsp32({
|
||||||
deviceId: this.deviceid
|
deviceId: this.deviceid
|
||||||
|
|
@ -719,12 +740,7 @@
|
||||||
this.deviceid = options.data.deviceId
|
this.deviceid = options.data.deviceId
|
||||||
this.name = this.name
|
this.name = this.name
|
||||||
}else{
|
}else{
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '连接失败',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||||
|
|
@ -935,31 +951,33 @@
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
||||||
this.deviceInfo()
|
this.deviceInfo()
|
||||||
uni.showToast({
|
|
||||||
title: '操作成功',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.jieliuflag = true
|
this.jieliuflag = true
|
||||||
},2000)
|
},2000)
|
||||||
} else if(res.code == 20001){
|
} else if(res.code == 20001){
|
||||||
setTimeout(()=>{
|
if(this.ver_dataflag == 3){
|
||||||
this.jieliuflag = true
|
xBlufi.notifySendCustomData({
|
||||||
},2000)
|
customData: "11opensub5@"
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.lanya(0)
|
||||||
let that = this
|
let that = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '正在尝试使用蓝牙控制,蓝牙连接需尽可能靠近车辆!',
|
content: res.msg,
|
||||||
showCancel: true,
|
showCancel: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
that.lanya(0)
|
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.jieliuflag = true
|
||||||
|
},2000)
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -984,28 +1002,47 @@
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '操作成功',
|
title: '操作成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 2000
|
duration: 3000
|
||||||
})
|
})
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.jieliuflag = true
|
this.jieliuflag = true
|
||||||
},2000)
|
},2000)
|
||||||
}else if(res.code == 20001){
|
}else if(res.code == 20001){
|
||||||
setTimeout(()=>{
|
if(this.ver_dataflag == 3){
|
||||||
this.jieliuflag = true
|
xBlufi.notifySendCustomData({
|
||||||
},2000)
|
customData: "11closesub200@"
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.lanya(0)
|
||||||
let that = this
|
let that = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '正在尝试使用蓝牙控制,蓝牙连接需尽可能靠近车辆!',
|
content: res.msg,
|
||||||
showCancel: true,
|
showCancel: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
that.lanya(0)
|
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.jieliuflag = true
|
||||||
|
},2000)
|
||||||
|
// let that = this
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '提示',
|
||||||
|
// content: '正在尝试使用蓝牙控制,蓝牙连接需尽可能靠近车辆!',
|
||||||
|
// showCancel: true,
|
||||||
|
// success: function(res) {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// that.lanya(0)
|
||||||
|
// } else if (res.cancel) {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}else{
|
}else{
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -1062,6 +1099,7 @@
|
||||||
this.jieliuflag = true
|
this.jieliuflag = true
|
||||||
},2000)
|
},2000)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|
@ -1087,6 +1125,8 @@
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.jieliuflag = true
|
this.jieliuflag = true
|
||||||
},2000)
|
},2000)
|
||||||
|
} else if(res.code == 200001){
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -1255,6 +1295,9 @@
|
||||||
}
|
}
|
||||||
this.deviceInfos = res.data
|
this.deviceInfos = res.data
|
||||||
this.mac = res.data.mac
|
this.mac = res.data.mac
|
||||||
|
if(this.ver_dataflag != 3){
|
||||||
|
this.getlanya()
|
||||||
|
}
|
||||||
if (this.getnum == 0) {
|
if (this.getnum == 0) {
|
||||||
this.getArea()
|
this.getArea()
|
||||||
}
|
}
|
||||||
|
|
@ -1263,23 +1306,23 @@
|
||||||
this.getModelList()
|
this.getModelList()
|
||||||
this.latitude = this.deviceInfos.latitude
|
this.latitude = this.deviceInfos.latitude
|
||||||
this.longitude = this.deviceInfos.longitude
|
this.longitude = this.deviceInfos.longitude
|
||||||
this.markers.push({
|
// this.markers.push({
|
||||||
id: 0.1,
|
// id: 0.1,
|
||||||
latitude: this.deviceInfos.mobileLat,
|
// latitude: this.deviceInfos.mobileLat,
|
||||||
longitude: this.deviceInfos.mobileLon,
|
// longitude: this.deviceInfos.mobileLon,
|
||||||
width: 40,
|
// width: 40,
|
||||||
height: 47,
|
// height: 47,
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uvMzjOvKi58e8VAAS8t6',
|
// iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uvMzjOvKi58e8VAAS8t6',
|
||||||
callout: {
|
// callout: {
|
||||||
content: '手机定位', // 修改为你想要显示的文字内容
|
// content: '手机定位', // 修改为你想要显示的文字内容
|
||||||
color: '#ffffff', // 修改为文字颜色
|
// color: '#ffffff', // 修改为文字颜色
|
||||||
fontSize: 10, // 修改为文字大小
|
// fontSize: 10, // 修改为文字大小
|
||||||
borderRadius: 10, // 修改为气泡圆角大小
|
// borderRadius: 10, // 修改为气泡圆角大小
|
||||||
bgColor: '#000000', // 修改为气泡背景颜色
|
// bgColor: '#000000', // 修改为气泡背景颜色
|
||||||
padding: 2, // 修改为气泡内边距
|
// padding: 2, // 修改为气泡内边距
|
||||||
display: 'ALWAYS', // 修改为气泡的显示策略
|
// display: 'ALWAYS', // 修改为气泡的显示策略
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
if (this.deviceInfos.status == 0) {
|
if (this.deviceInfos.status == 0) {
|
||||||
this.markers.push({
|
this.markers.push({
|
||||||
id: parseFloat(this.deviceInfos.sn),
|
id: parseFloat(this.deviceInfos.sn),
|
||||||
|
|
@ -1638,7 +1681,7 @@
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
background-color: #F6F8FA; // 更改背景色为更柔和的色调
|
background-color: #F6F8FA;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
|
|
@ -1648,8 +1691,6 @@
|
||||||
.new_infocard{
|
.new_infocard{
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
height: 80vh;
|
height: 80vh;
|
||||||
// overflow: scroll;
|
|
||||||
// padding-bottom: 100rpx;
|
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 30rpx;
|
border-radius: 30rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
|
|
@ -1776,19 +1817,47 @@
|
||||||
}
|
}
|
||||||
.cent{
|
.cent{
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
.lypic {
|
.lypic {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 24rpx;
|
}
|
||||||
color: #3D3D3D;
|
|
||||||
margin-right: 22rpx;
|
|
||||||
image{
|
image{
|
||||||
width: 36rpx;
|
width: 36rpx;
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
margin-right: 8rpx;
|
margin-right: 8rpx;
|
||||||
}
|
}
|
||||||
|
.glow-image {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
transition: all 1s ease-in-out;
|
||||||
|
filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.7)); /* 青色外发光 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.visible {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
filter: drop-shadow(0 0 5px rgba(255, 50, 50, 1)); /* 增强发光 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
opacity: 0.3;
|
||||||
|
transform: scale(0.95);
|
||||||
|
filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.3)); /* 减弱发光 */
|
||||||
|
}
|
||||||
|
// .lypic{
|
||||||
|
// display: flex;
|
||||||
|
// align-items: center;
|
||||||
|
// font-size: 24rpx;
|
||||||
|
// color: #3D3D3D;
|
||||||
|
// margin-right: 22rpx;
|
||||||
|
// image{
|
||||||
|
// width: 36rpx;
|
||||||
|
// height: 36rpx;
|
||||||
|
// margin-right: 8rpx;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
.bikexx{
|
.bikexx{
|
||||||
margin-top: 26rpx;
|
margin-top: 26rpx;
|
||||||
|
|
@ -1833,7 +1902,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.topsn{
|
.topsn{
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
@ -1875,8 +1943,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.tip_box {
|
.tip_box {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 72rpx;
|
left: 72rpx;
|
||||||
|
|
@ -1886,7 +1952,6 @@
|
||||||
border-radius: 30rpx 30rpx 30rpx 30rpx;
|
border-radius: 30rpx 30rpx 30rpx 30rpx;
|
||||||
z-index: 110;
|
z-index: 110;
|
||||||
padding-bottom: 100rpx;
|
padding-bottom: 100rpx;
|
||||||
|
|
||||||
.saveQr {
|
.saveQr {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
|
|
@ -1901,10 +1966,8 @@
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
padding: 52rpx 38rpx 42rpx 36rpx;
|
padding: 52rpx 38rpx 42rpx 36rpx;
|
||||||
|
|
||||||
.ipt_box {
|
.ipt_box {
|
||||||
margin-top: 22rpx;
|
margin-top: 22rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="iptbox" @click="show=true">
|
<view class="iptbox" @click="show=true">
|
||||||
<view class="" v-if="hardwareInfo.version">
|
<view class="" v-if="hardwareInfo.version">
|
||||||
版本:{{hardwareInfo.version}} 版本id:{{hardwareInfo.id}}
|
版本:{{hardwareInfo.version}}
|
||||||
</view>
|
</view>
|
||||||
<view class="" v-else>
|
<view class="" v-else>
|
||||||
请点击选择版本
|
请点击选择版本
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
<!-- <view class="btn1" @click="btngx()">
|
<!-- <view class="btn1" @click="btngx()">
|
||||||
设备更新
|
设备更新
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="btn1" @click="Binddevice()">
|
<view class="btn1" @click="findDevice()">
|
||||||
蓝牙链接
|
蓝牙链接
|
||||||
</view>
|
</view>
|
||||||
<view class="btn1" @click="ring()" v-if="carstause">
|
<view class="btn1" @click="ring()" v-if="carstause">
|
||||||
|
|
@ -104,6 +104,7 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
devicesarr:[],
|
||||||
devicesList: [
|
devicesList: [
|
||||||
// {name:'110000',
|
// {name:'110000',
|
||||||
// mac:'11111'}
|
// mac:'11111'}
|
||||||
|
|
@ -139,39 +140,43 @@
|
||||||
show: false,
|
show: false,
|
||||||
list: [],
|
list: [],
|
||||||
hardwareInfo: {},
|
hardwareInfo: {},
|
||||||
showbind:false
|
showbind:false,
|
||||||
|
deviceid:''
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
'isStart': true
|
||||||
|
})
|
||||||
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
||||||
this.mac = e.mac
|
this.mac = e.mac
|
||||||
this.Binddevice()
|
this.findDevice()
|
||||||
this.isbands = false
|
this.isbands = false
|
||||||
this.carstause = false
|
this.carstause = false
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getlist()
|
this.getlist()
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
// onUnload: function() {
|
||||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
// xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
||||||
xBlufi.notifyStartDiscoverBle({
|
// xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': false
|
// 'isStart': false
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
onHide() {
|
// onHide() {
|
||||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
// xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
||||||
xBlufi.notifyStartDiscoverBle({
|
// xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': false
|
// 'isStart': false
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
onBeforeUnmount() {
|
// onBeforeUnmount() {
|
||||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
// xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
||||||
xBlufi.notifyStartDiscoverBle({
|
// xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': false
|
// 'isStart': false
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
watch: {
|
watch: {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -209,7 +214,8 @@
|
||||||
getlist() {
|
getlist() {
|
||||||
this.$u.get('/bst/hardwareVersion/all').then((res) => {
|
this.$u.get('/bst/hardwareVersion/all').then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.Versionlist = res.data
|
this.Versionlist = res.data.filter(item => item.parentId !== 0);
|
||||||
|
|
||||||
const hardwareVersionId = uni.getStorageSync('hardwareVersionId');
|
const hardwareVersionId = uni.getStorageSync('hardwareVersionId');
|
||||||
|
|
||||||
if (hardwareVersionId) {
|
if (hardwareVersionId) {
|
||||||
|
|
@ -220,10 +226,13 @@
|
||||||
this.hardwareInfo = matchedVersion;
|
this.hardwareInfo = matchedVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.list = res.data.map(item => ({
|
this.list = res.data
|
||||||
|
.filter(item => item.parentId != 0) // 改用 != 兼容字符串 "0"
|
||||||
|
.map(item => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.version
|
label: item.version
|
||||||
}))
|
}));
|
||||||
|
console.log(JSON.stringify(this.list, null, 2));
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
|
|
@ -349,50 +358,110 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Binddevice() {
|
findDevice() {
|
||||||
uni.showLoading({
|
// 使用 find 方法查找匹配的设备
|
||||||
title: '连接中..'
|
const matchedDevice = this.devicesarr.find(device => {
|
||||||
|
console.log(this.mac, '111')
|
||||||
|
return device.name.slice(-12) == this.mac.slice(-12)
|
||||||
})
|
})
|
||||||
console.log("xBlufi", xBlufi.XMQTT_SYSTEM)
|
if (matchedDevice) {
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
// 找到匹配的设备
|
||||||
xBlufi.notifyStartDiscoverBle({
|
|
||||||
'isStart': true
|
|
||||||
})
|
|
||||||
// 两秒后停止蓝牙搜索
|
|
||||||
setTimeout(() => {
|
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': false
|
'isStart': false
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
xBlufi.notifyConnectBle({
|
||||||
uni.hideLoading()
|
isStart: true,
|
||||||
if (this.devicesList.length == 0) {
|
deviceId: matchedDevice.deviceId,
|
||||||
uni.showToast({
|
name: matchedDevice.name
|
||||||
title: '暂无发现对应设备,请靠近设备',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
})
|
||||||
|
this.deviceid = matchedDevice.deviceId
|
||||||
} else {
|
} else {
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
this.findDeviceTimer = setTimeout(this.findDevice.bind(this), 1000) // 使用 bind 保持 this 上下文
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
|
||||||
this.devicesList = uniqueDevicesList
|
|
||||||
this.devicesList.forEach(device => {
|
|
||||||
// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
|
|
||||||
let macFromName = device.name.substring(device.name.length - 12)
|
|
||||||
console.log(macFromName, 'macFromNamemacFromName')
|
|
||||||
// 与 this.mac 进行比较
|
|
||||||
if (macFromName == this.mac) {
|
|
||||||
// 如果相同,则将 this.ishave 设置为 true
|
|
||||||
console.log(device)
|
|
||||||
this.deviceInfoss = device
|
|
||||||
this.createBLEConnection(device)
|
|
||||||
console.log('对比正确1111111111')
|
|
||||||
} else {
|
|
||||||
console.log('对比错误')
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
|
||||||
}, 200)
|
|
||||||
}, 2000)
|
|
||||||
},
|
},
|
||||||
|
// 获取附近蓝牙设备列表
|
||||||
|
funListenDeviceMsgEvent: function(options) {
|
||||||
|
switch (options.type) {
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
||||||
|
if (!options.result) {
|
||||||
|
this.carstause = false
|
||||||
|
console.log('断开断开');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||||||
|
if (options.result) {
|
||||||
|
this.devicesarr = options.data
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
||||||
|
console.log("连接回调:" + JSON.stringify(options))
|
||||||
|
if (options.result == true) {
|
||||||
|
this.carstause = true
|
||||||
|
xBlufi.notifyInitBleEsp32({
|
||||||
|
deviceId: this.deviceid
|
||||||
|
})
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||||
|
console.log("1收到设备发来的自定义数据结果:", options.data)
|
||||||
|
break;
|
||||||
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||||
|
if (!options.result) {
|
||||||
|
console.log('蓝牙未开启')
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Binddevice() {
|
||||||
|
// uni.showLoading({
|
||||||
|
// title: '连接中..'
|
||||||
|
// })
|
||||||
|
// console.log("xBlufi", xBlufi.XMQTT_SYSTEM)
|
||||||
|
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||||
|
// xBlufi.notifyStartDiscoverBle({
|
||||||
|
// 'isStart': true
|
||||||
|
// })
|
||||||
|
// // 两秒后停止蓝牙搜索
|
||||||
|
// setTimeout(() => {
|
||||||
|
// xBlufi.notifyStartDiscoverBle({
|
||||||
|
// 'isStart': false
|
||||||
|
// })
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uni.hideLoading()
|
||||||
|
// if (this.devicesList.length == 0) {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '暂无发现对应设备,请靠近设备',
|
||||||
|
// icon: 'none'
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
||||||
|
// // 将去重后的数组重新赋值给 this.devicesList
|
||||||
|
// this.devicesList = uniqueDevicesList
|
||||||
|
// this.devicesList.forEach(device => {
|
||||||
|
// // 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
|
||||||
|
// let macFromName = device.name.substring(device.name.length - 12)
|
||||||
|
// console.log(macFromName, 'macFromNamemacFromName')
|
||||||
|
// // 与 this.mac 进行比较
|
||||||
|
// if (macFromName == this.mac) {
|
||||||
|
// // 如果相同,则将 this.ishave 设置为 true
|
||||||
|
// console.log(device)
|
||||||
|
// this.deviceInfoss = device
|
||||||
|
// this.createBLEConnection(device)
|
||||||
|
// console.log('对比正确1111111111')
|
||||||
|
// } else {
|
||||||
|
// console.log('对比错误')
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }, 200)
|
||||||
|
// }, 2000)
|
||||||
|
// },
|
||||||
reboot() {
|
reboot() {
|
||||||
let vm = this // 将外部的 this 绑定到 vm 上
|
let vm = this // 将外部的 this 绑定到 vm 上
|
||||||
uni.getNetworkType({
|
uni.getNetworkType({
|
||||||
|
|
@ -511,90 +580,90 @@
|
||||||
btnyc() {
|
btnyc() {
|
||||||
this.titleflag = false
|
this.titleflag = false
|
||||||
},
|
},
|
||||||
// 解析自定义数据
|
// // 解析自定义数据
|
||||||
funListenDeviceMsgEvent: function(options) {
|
// funListenDeviceMsgEvent: function(options) {
|
||||||
switch (options.type) {
|
// switch (options.type) {
|
||||||
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
|
// this.devicesarr = options.data
|
||||||
devicesarr.forEach(device => {
|
// // devicesarr.forEach(device => {
|
||||||
this.devicesList.push(device)
|
// // this.devicesList.push(device)
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
// // let uniqueDevicesList = Array.from(new Set(this.devicesList))
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
// // // 将去重后的数组重新赋值给 this.devicesList
|
||||||
this.devicesList = uniqueDevicesList
|
// // this.devicesList = uniqueDevicesList
|
||||||
})
|
// // })
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
|
||||||
console.log("连接回调:" + JSON.stringify(options));
|
|
||||||
if (options.result) {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: '连接成功',
|
|
||||||
icon: 'none'
|
|
||||||
}); {
|
|
||||||
|
|
||||||
xBlufi.notifyInitBleEsp32({
|
|
||||||
deviceId: options.data.deviceId
|
|
||||||
});
|
|
||||||
|
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents);
|
|
||||||
|
|
||||||
this.deviceIds = options.data.deviceId
|
|
||||||
this.name = options.data.name
|
|
||||||
// 连接成功绑定设备
|
|
||||||
// let params = {
|
|
||||||
// mac: this.Bluetoothmac,
|
|
||||||
// userId: this.$store.state.user.userId
|
|
||||||
// }
|
// }
|
||||||
let systemInfo = uni.getSystemInfoSync();
|
// break;
|
||||||
if (systemInfo.platform === 'android') {
|
|
||||||
// 当前设备是 Android
|
|
||||||
|
|
||||||
} else if (systemInfo.platform === 'ios') {
|
// case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
||||||
// 当前设备是 iOS
|
// console.log("连接回调:" + JSON.stringify(options));
|
||||||
// uni.navigateTo({
|
// if (options.result) {
|
||||||
// url: '/pages/wifilist/index?deviceId=' + options
|
// uni.hideLoading();
|
||||||
// .data.deviceId + '&name=' + options.data.name
|
// uni.showToast({
|
||||||
// })
|
// title: '连接成功',
|
||||||
}
|
// icon: 'none'
|
||||||
}
|
// }); {
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
// xBlufi.notifyInitBleEsp32({
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
// deviceId: options.data.deviceId
|
||||||
|
|
||||||
// this.ver_data = this.parseCustomData(options.data)
|
|
||||||
if (options.data) {
|
|
||||||
this.carstause = true
|
|
||||||
}
|
|
||||||
// console.log("1收到设备发来的自定义数据结果:", this.ver_data);
|
|
||||||
break;
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
|
||||||
if (options.result) {
|
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
|
||||||
|
|
||||||
// 过滤出名称字段的前五个字母为 "CTPOW" 的项
|
|
||||||
let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) ===
|
|
||||||
"BBLE");
|
|
||||||
|
|
||||||
// 将过滤后的数组重新赋值给 this.devicesList
|
|
||||||
this.devicesList = filteredDevices;
|
|
||||||
|
|
||||||
// console.log('蓝牙停止搜索ok',this.devicesList);
|
|
||||||
} else {
|
|
||||||
//蓝牙停止搜索失败
|
|
||||||
// console.log('蓝牙停止搜索失败');
|
|
||||||
}
|
|
||||||
this.searching = false
|
|
||||||
// _this.setData({
|
|
||||||
// searching: false
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
break;
|
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents);
|
||||||
}
|
|
||||||
},
|
// this.deviceIds = options.data.deviceId
|
||||||
|
// this.name = options.data.name
|
||||||
|
// // 连接成功绑定设备
|
||||||
|
// // let params = {
|
||||||
|
// // mac: this.Bluetoothmac,
|
||||||
|
// // userId: this.$store.state.user.userId
|
||||||
|
// // }
|
||||||
|
// let systemInfo = uni.getSystemInfoSync();
|
||||||
|
// if (systemInfo.platform === 'android') {
|
||||||
|
// // 当前设备是 Android
|
||||||
|
|
||||||
|
// } else if (systemInfo.platform === 'ios') {
|
||||||
|
// // 当前设备是 iOS
|
||||||
|
// // uni.navigateTo({
|
||||||
|
// // url: '/pages/wifilist/index?deviceId=' + options
|
||||||
|
// // .data.deviceId + '&name=' + options.data.name
|
||||||
|
// // })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// break;
|
||||||
|
// case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||||
|
|
||||||
|
// // this.ver_data = this.parseCustomData(options.data)
|
||||||
|
// if (options.data) {
|
||||||
|
// this.carstause = true
|
||||||
|
// }
|
||||||
|
// // console.log("1收到设备发来的自定义数据结果:", this.ver_data);
|
||||||
|
// break;
|
||||||
|
// case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
||||||
|
// if (options.result) {
|
||||||
|
// let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
|
|
||||||
|
// // 过滤出名称字段的前五个字母为 "CTPOW" 的项
|
||||||
|
// let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) ===
|
||||||
|
// "BBLE");
|
||||||
|
|
||||||
|
// // 将过滤后的数组重新赋值给 this.devicesList
|
||||||
|
// this.devicesList = filteredDevices;
|
||||||
|
|
||||||
|
// // console.log('蓝牙停止搜索ok',this.devicesList);
|
||||||
|
// } else {
|
||||||
|
// //蓝牙停止搜索失败
|
||||||
|
// // console.log('蓝牙停止搜索失败');
|
||||||
|
// }
|
||||||
|
// this.searching = false
|
||||||
|
// // _this.setData({
|
||||||
|
// // searching: false
|
||||||
|
// // });
|
||||||
|
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
|
||||||
|
|
||||||
//4、建立连接
|
//4、建立连接
|
||||||
|
|
@ -663,59 +732,59 @@
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
funListenDeviceMsgEvents: function(options) {
|
// funListenDeviceMsgEvents: function(options) {
|
||||||
let that = this;
|
// let that = this;
|
||||||
switch (options.type) {
|
// switch (options.type) {
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
|
// case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
|
||||||
console.log('状态', options.result)
|
// console.log('状态', options.result)
|
||||||
if (options.result == false) {
|
// if (options.result == false) {
|
||||||
this.carstause = false
|
// this.carstause = false
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: '设备断开链接,请重新点击蓝牙链接',
|
// title: '设备断开链接,请重新点击蓝牙链接',
|
||||||
icon: 'none'
|
// icon: 'none'
|
||||||
});
|
|
||||||
// uni.showModal({
|
|
||||||
// title: '很抱歉提醒你!',
|
|
||||||
// content: '小程序与设备异常断开',
|
|
||||||
// showCancel: false,
|
|
||||||
// success: function(res) {
|
|
||||||
// // uni.navigateBack({
|
|
||||||
// // url: '../search/search'
|
|
||||||
// // });
|
|
||||||
// }
|
|
||||||
// });
|
// });
|
||||||
// this.statusflag = false
|
// // uni.showModal({
|
||||||
uni.hideLoading();
|
// // title: '很抱歉提醒你!',
|
||||||
}
|
// // content: '小程序与设备异常断开',
|
||||||
}
|
// // showCancel: false,
|
||||||
break;
|
// // success: function(res) {
|
||||||
|
// // // uni.navigateBack({
|
||||||
|
// // // url: '../search/search'
|
||||||
|
// // // });
|
||||||
|
// // }
|
||||||
|
// // });
|
||||||
|
// // this.statusflag = false
|
||||||
|
// uni.hideLoading();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_MY_DATA:
|
// case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_MY_DATA:
|
||||||
this.loadPercent = options.data;
|
// this.loadPercent = options.data;
|
||||||
this.loadText = '文件读取中'
|
// this.loadText = '文件读取中'
|
||||||
console.log("文件读取中", options.data);
|
// console.log("文件读取中", options.data);
|
||||||
break;
|
// break;
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
// case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||||
// this.isband = true
|
// // this.isband = true
|
||||||
// this.ver_data = this.parseCustomData(options.data)
|
// // this.ver_data = this.parseCustomData(options.data)
|
||||||
console.log("1收到设备发来的自定义数据结果:", options.data);
|
// console.log("1收到设备发来的自定义数据结果:", options.data);
|
||||||
if (options.data) {
|
// if (options.data) {
|
||||||
this.carstause = true
|
// this.carstause = true
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT:
|
// case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT:
|
||||||
uni.hideLoading();
|
// uni.hideLoading();
|
||||||
if (options.result) {
|
// if (options.result) {
|
||||||
console.log('初始化成功');
|
// console.log('初始化成功');
|
||||||
} else {
|
// } else {
|
||||||
console.log('初始化失败');
|
// console.log('初始化失败');
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
// 点击隐藏没有设备提示
|
// 点击隐藏没有设备提示
|
||||||
btnhd() {
|
btnhd() {
|
||||||
this.tishiflag = false
|
this.tishiflag = false
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,10 @@
|
||||||
重置页面
|
重置页面
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uCfe9273aC89tGOT7n1G" mode="widthFix"></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uCfe9273aC89tGOT7n1G" mode="widthFix"></image>
|
||||||
<text class="sm">{{texts}}</text>
|
<text class="sm">{{texts}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="dblist" v-for="(item, index) in devicesList" :key="index" @tap="choose(item)">
|
<view class="dblist" v-for="(item, index) in devicesList" :key="index" @tap="choose(item)">
|
||||||
<!-- <view class="lt">
|
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uoQO0pUZ1UHcW5uVKkuR" mode=""></image>
|
|
||||||
</view> -->
|
|
||||||
<view class="cen">
|
<view class="cen">
|
||||||
<view class="name">
|
<view class="name">
|
||||||
MAC:{{item.localName.substring(5)}}
|
MAC:{{item.localName.substring(5)}}
|
||||||
|
|
@ -35,22 +29,13 @@
|
||||||
蓝牙信号:{{item.RSSI}} <span style="margin-left: 20rpx;" v-if="item.isBand "> SN:{{item.sn}}</span>
|
蓝牙信号:{{item.RSSI}} <span style="margin-left: 20rpx;" v-if="item.isBand "> SN:{{item.sn}}</span>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="rt">
|
|
||||||
<text :id="item.deviceId" @tap="openConfirmModal(item)">绑定</text>
|
|
||||||
</view> -->
|
|
||||||
<view class="rt" style="margin-right: 10rpx;">
|
<view class="rt" style="margin-right: 10rpx;">
|
||||||
<text :id="item.deviceId">选择</text>
|
<text :id="item.deviceId">选择</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="anniu" @click="Search">
|
<view class="anniu" @click="Search">
|
||||||
<button>重新扫描</button>
|
<button>重新扫描</button>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="anniu2 " @click="send">
|
|
||||||
响铃
|
|
||||||
</view> -->
|
|
||||||
|
|
||||||
<view v-if="showConfirmModal" class="modal-overlay">
|
<view v-if="showConfirmModal" class="modal-overlay">
|
||||||
<view class="modal">
|
<view class="modal">
|
||||||
<view class="modal-content">
|
<view class="modal-content">
|
||||||
|
|
@ -83,10 +68,7 @@
|
||||||
bgc: {
|
bgc: {
|
||||||
backgroundColor: "#F7FAFE",
|
backgroundColor: "#F7FAFE",
|
||||||
},
|
},
|
||||||
devicesList: [
|
devicesList: [],
|
||||||
// {name:'110000',
|
|
||||||
// mac:'11111'}
|
|
||||||
],
|
|
||||||
devicesLists: [],
|
devicesLists: [],
|
||||||
searching: false,
|
searching: false,
|
||||||
texts: '正在扫描蓝牙设备...',
|
texts: '正在扫描蓝牙设备...',
|
||||||
|
|
@ -112,55 +94,47 @@
|
||||||
xBlufi.initXBlufi(1)
|
xBlufi.initXBlufi(1)
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
this.bluthlist = [];
|
this.bluthlist = []
|
||||||
this.devicesList = [];
|
this.devicesList = []
|
||||||
this.devicesLists = [];
|
this.devicesLists = []
|
||||||
|
|
||||||
// 强制视图更新
|
// 强制视图更新
|
||||||
this.$forceUpdate();
|
this.$forceUpdate()
|
||||||
|
|
||||||
// 后续的蓝牙初始化和扫描逻辑
|
// 后续的蓝牙初始化和扫描逻辑
|
||||||
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
|
xBlufi.notifyStartDiscoverBle({ 'isStart': true })
|
||||||
xBlufi.notifyStartDiscoverBle({ 'isStart': true });
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
xBlufi.notifyStartDiscoverBle({ 'isStart': false });
|
xBlufi.notifyStartDiscoverBle({ 'isStart': false })
|
||||||
if (this.devicesList.length == 0) {
|
if (this.devicesList.length == 0) {
|
||||||
this.tishiflag = true;
|
this.tishiflag = true
|
||||||
this.texts = '扫描完毕,暂无发现电动车设备';
|
this.texts = '扫描完毕,请操作'
|
||||||
} else {
|
} else {
|
||||||
this.texts = '扫描到以下设备,请点击连接!';
|
this.texts = '扫描到以下设备,请点击连接!'
|
||||||
}
|
}
|
||||||
this.status = true;
|
this.status = true
|
||||||
|
|
||||||
// 再次强制更新
|
// 再次强制更新
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
}, 2000);
|
}, 2000)
|
||||||
|
|
||||||
},
|
},
|
||||||
onUnload: function() {
|
onUnload: function() {
|
||||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent)
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': false
|
'isStart': false
|
||||||
});
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent)
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': false
|
'isStart': false
|
||||||
});
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
onBeforeUnmount() {
|
onBeforeUnmount() {
|
||||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent)
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': false
|
'isStart': false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.videoContext = uni.createVideoContext('myVideo', this)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
replay(){
|
replay(){
|
||||||
|
|
@ -180,48 +154,41 @@
|
||||||
},
|
},
|
||||||
fetchDevicesBoundStatus() {
|
fetchDevicesBoundStatus() {
|
||||||
// 提取所有设备的 MAC 地址,并通过 Set 去重
|
// 提取所有设备的 MAC 地址,并通过 Set 去重
|
||||||
let uniqueDevices = Array.from(new Set(this.devicesList.map(item => item.localName.substring(5))));
|
let uniqueDevices = Array.from(new Set(this.devicesList.map(item => item.localName.substring(5))))
|
||||||
|
|
||||||
// 重新构建去重后的 devicesList
|
// 重新构建去重后的 devicesList
|
||||||
this.devicesList = uniqueDevices.map(mac => {
|
this.devicesList = uniqueDevices.map(mac => {
|
||||||
return this.devicesList.find(item => item.localName.substring(5) === mac);
|
return this.devicesList.find(item => item.localName.substring(5) === mac)
|
||||||
});
|
})
|
||||||
|
|
||||||
// 拼接成字符串
|
// 拼接成字符串
|
||||||
const macs = uniqueDevices;
|
const macs = uniqueDevices
|
||||||
|
|
||||||
// 向批量接口请求录入状态
|
// 向批量接口请求录入状态
|
||||||
let data = macs
|
let data = macs
|
||||||
this.$u.post(`/bst/device/listSnByMac`,data).then((res) => {
|
this.$u.post(`/bst/device/listSnByMac`,data).then((res) => {
|
||||||
const resultList = res.data; // 获取接口返回的数据数组
|
const resultList = res.data // 获取接口返回的数据数组
|
||||||
console.log(res,'请求');
|
console.log(res,'请求')
|
||||||
// 遍历 devicesList 并对比 mac 地址
|
// 遍历 devicesList 并对比 mac 地址
|
||||||
this.devicesList.forEach(device => {
|
this.devicesList.forEach(device => {
|
||||||
const mac = device.localName.substring(5);
|
const mac = device.localName.substring(5)
|
||||||
|
|
||||||
// 查找返回结果中是否有与该设备 MAC 地址相同的项
|
// 查找返回结果中是否有与该设备 MAC 地址相同的项
|
||||||
const matchingResult = resultList.find(result => result.mac === mac);
|
const matchingResult = resultList.find(result => result.mac === mac)
|
||||||
|
|
||||||
// 如果找到了匹配的 MAC 地址项,则更新设备的 sn 和 isBand
|
// 如果找到了匹配的 MAC 地址项,则更新设备的 sn 和 isBand
|
||||||
if (matchingResult) {
|
if (matchingResult) {
|
||||||
device.sn = matchingResult.sn;
|
device.sn = matchingResult.sn
|
||||||
device.isBand = true
|
device.isBand = true
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
// 对 devicesList 进行排序,将 isBand 为 false 的设备排在前面
|
// 对 devicesList 进行排序,将 isBand 为 false 的设备排在前面
|
||||||
this.devicesList.sort((a, b) => {
|
this.devicesList.sort((a, b) => {
|
||||||
return (a.isBand === false ? -1 : 1) - (b.isBand === false ? -1 : 1);
|
return (a.isBand === false ? -1 : 1) - (b.isBand === false ? -1 : 1)
|
||||||
});
|
})
|
||||||
|
this.$forceUpdate() // 强制更新视图
|
||||||
this.$forceUpdate(); // 强制更新视图
|
console.log(this.devicesList, 'Updated devicesList')
|
||||||
console.log(this.devicesList, 'Updated devicesList');
|
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error('批量获取设备录入状态失败', error);
|
console.error('批量获取设备录入状态失败', error)
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
choose(e) {
|
choose(e) {
|
||||||
console.log(e);
|
console.log(e)
|
||||||
let Bluetoothmac = e.name.substring(5)
|
let Bluetoothmac = e.name.substring(5)
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/page_user/luru/bind_mac?mac=' + Bluetoothmac
|
url: '/page_user/luru/bind_mac?mac=' + Bluetoothmac
|
||||||
|
|
@ -236,17 +203,16 @@
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
openConfirmModal(e) {
|
openConfirmModal(e) {
|
||||||
this.deviceinfo = e
|
this.deviceinfo = e
|
||||||
this.showConfirmModal = true;
|
this.showConfirmModal = true
|
||||||
},
|
},
|
||||||
|
|
||||||
closeConfirmModal() {
|
closeConfirmModal() {
|
||||||
this.showConfirmModal = false;
|
this.showConfirmModal = false
|
||||||
},
|
},
|
||||||
confirmBind() {
|
confirmBind() {
|
||||||
this.closeConfirmModal();
|
this.closeConfirmModal();
|
||||||
|
|
@ -256,131 +222,113 @@
|
||||||
this.titleflag = false
|
this.titleflag = false
|
||||||
},
|
},
|
||||||
sing() {
|
sing() {
|
||||||
let vm = this; // 将外部的 this 绑定到 vm 上
|
let vm = this // 将外部的 this 绑定到 vm 上
|
||||||
uni.getNetworkType({
|
uni.getNetworkType({
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.networkType !== 'none') {
|
if (res.networkType !== 'none') {
|
||||||
uni.getConnectedBluetoothDevices({
|
uni.getConnectedBluetoothDevices({
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log('已连接的蓝牙设备信息:', res);
|
console.log('已连接的蓝牙设备信息:', res)
|
||||||
// vm.dl = (vm.orderinfo.deviceAmount / vm.orderinfo.unitPrice).toFixed(2); // 使用 vm 访问 Vue 实例的属性
|
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11play1@"
|
customData: "11play1@"
|
||||||
});
|
})
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
vm.remakr()
|
vm.remakr()
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
console.error('获取已连接蓝牙设备信息失败:', err);
|
console.error('获取已连接蓝牙设备信息失败:', err)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log('手机未连接网络');
|
console.log('手机未连接网络')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
remakr() {
|
remakr() {
|
||||||
let vm = this; // 将外部的 this 绑定到 vm 上
|
let vm = this // 将外部的 this 绑定到 vm 上
|
||||||
uni.getNetworkType({
|
uni.getNetworkType({
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.networkType !== 'none') {
|
if (res.networkType !== 'none') {
|
||||||
uni.getConnectedBluetoothDevices({
|
uni.getConnectedBluetoothDevices({
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log('已连接的蓝牙设备信息:', res);
|
console.log('已连接的蓝牙设备信息:', res)
|
||||||
// vm.dl = (vm.orderinfo.deviceAmount / vm.orderinfo.unitPrice).toFixed(2); // 使用 vm 访问 Vue 实例的属性
|
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11reboot"
|
customData: "11reboot"
|
||||||
});
|
})
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1 // delta值为1时表示返回的页面层数
|
delta: 1 // delta值为1时表示返回的页面层数
|
||||||
});
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
console.error('获取已连接蓝牙设备信息失败:', err);
|
console.error('获取已连接蓝牙设备信息失败:', err)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log('手机未连接网络');
|
console.log('手机未连接网络')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
funListenDeviceMsgEvent: function(options) {
|
funListenDeviceMsgEvent: function(options) {
|
||||||
switch (options.type) {
|
switch (options.type) {
|
||||||
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
|
this.devicesLists = options.data
|
||||||
// this.devicesList = options.data
|
// let devicesarr = options.data
|
||||||
// console.log(devicesarr, 'devicesarrdevicesarr');
|
// // this.devicesList = options.data
|
||||||
devicesarr.forEach(device => {
|
// // console.log(devicesarr, 'devicesarrdevicesarr');
|
||||||
const mac = device.name.substring(6);
|
// devicesarr.forEach(device => {
|
||||||
|
// const mac = device.name.substring(6);
|
||||||
|
|
||||||
if (device.name.indexOf("BBLE") != -1) {
|
// if (device.name.indexOf("BBLE") != -1) {
|
||||||
// this.$u.get(`/app/device/${mac}/isBind`).then((res) => {
|
// // this.$u.get(`/app/device/${mac}/isBind`).then((res) => {
|
||||||
// if (res.data == false) {
|
// // if (res.data == false) {
|
||||||
this.devicesLists.push(device);
|
// this.devicesLists.push(device);
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesLists));
|
// let uniqueDevicesList = Array.from(new Set(this.devicesLists));
|
||||||
|
|
||||||
|
// // 将去重后的数组重新赋值给 this.devicesList
|
||||||
|
// this.devicesLists = uniqueDevicesList;
|
||||||
|
// // }
|
||||||
|
// // })
|
||||||
|
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
|
||||||
this.devicesLists = uniqueDevicesList;
|
|
||||||
// }
|
// }
|
||||||
// })
|
// // getisband(mac).then(res => {
|
||||||
|
// // console.log(res);
|
||||||
}
|
// // if (res.data == true) {
|
||||||
// getisband(mac).then(res => {
|
// // console.log(`MAC 地址 ${mac} 已经绑定`);
|
||||||
// console.log(res);
|
// // } else {
|
||||||
// if (res.data == true) {
|
// // this.devicesList.push(device)
|
||||||
// console.log(`MAC 地址 ${mac} 已经绑定`);
|
// // }
|
||||||
// } else {
|
// // }).catch(error => {
|
||||||
// this.devicesList.push(device)
|
// // console.error(`检查 MAC 地址 ${mac} 是否绑定的过程中出错:`, error);
|
||||||
// }
|
// // });
|
||||||
// }).catch(error => {
|
|
||||||
// console.error(`检查 MAC 地址 ${mac} 是否绑定的过程中出错:`, error);
|
|
||||||
// });
|
// });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
break;
|
break
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
||||||
console.log("连接回调:" + JSON.stringify(options));
|
console.log("连接回调:" + JSON.stringify(options))
|
||||||
if (options.result) {
|
if (options.result) {
|
||||||
uni.hideLoading();
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '连接成功',
|
title: '连接成功',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
}); {
|
}); {
|
||||||
console.log("连接回调options.data.deviceId:" + options.data.deviceId,
|
console.log("连接回调options.data.deviceId:" + options.data.deviceId,
|
||||||
"连接回调options.data.name:" + options.data.name);
|
"连接回调options.data.name:" + options.data.name);
|
||||||
// 连接成功绑定设备
|
|
||||||
// let params = {
|
|
||||||
// mac: this.Bluetoothmac,
|
|
||||||
// userId: this.$store.state.user.userId
|
|
||||||
// }
|
|
||||||
xBlufi.notifyInitBleEsp32({
|
xBlufi.notifyInitBleEsp32({
|
||||||
deviceId: options.data.deviceId
|
deviceId: options.data.deviceId
|
||||||
});
|
})
|
||||||
|
|
||||||
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents);
|
|
||||||
// setTimeout(() => {
|
|
||||||
// this.sing()
|
|
||||||
// }, 3000)
|
|
||||||
|
|
||||||
let systemInfo = uni.getSystemInfoSync();
|
let systemInfo = uni.getSystemInfoSync();
|
||||||
if (systemInfo.platform === 'android') {
|
if (systemInfo.platform === 'android') {
|
||||||
// 当前设备是 Android
|
// 当前设备是 Android
|
||||||
|
|
||||||
} else if (systemInfo.platform === 'ios') {
|
} else if (systemInfo.platform === 'ios') {
|
||||||
// 当前设备是 iOS
|
// 当前设备是 iOS
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||||
if (!options.result) {
|
if (!options.result) {
|
||||||
console.log("蓝牙未开启", options);
|
console.log("蓝牙未开启", options);
|
||||||
|
|
@ -397,18 +345,12 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.searching = true
|
this.searching = true
|
||||||
//蓝牙搜索开始
|
|
||||||
// _this.setData({
|
|
||||||
// searching: true
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
||||||
if (options.result) {
|
if (options.result) {
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesLists));
|
let uniqueDevicesList = Array.from(new Set(this.devicesLists));
|
||||||
|
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
// 将去重后的数组重新赋值给 this.devicesList
|
||||||
this.devicesLists = uniqueDevicesList;
|
this.devicesLists = uniqueDevicesList;
|
||||||
let list = []
|
let list = []
|
||||||
|
|
@ -418,19 +360,10 @@
|
||||||
// console.log(macFromName);
|
// console.log(macFromName);
|
||||||
// 与 this.mac 进行比较
|
// 与 this.mac 进行比较
|
||||||
list.push(device)
|
list.push(device)
|
||||||
// this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => {
|
|
||||||
// if (res.data == false) {
|
|
||||||
// list.push(device)
|
|
||||||
// } else {
|
|
||||||
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.devicesList = list
|
this.devicesList = list
|
||||||
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
let uniqueDevicesList = Array.from(new Set(this.devicesList));
|
||||||
|
|
||||||
// 将去重后的数组重新赋值给 this.devicesList
|
// 将去重后的数组重新赋值给 this.devicesList
|
||||||
this.devicesList = uniqueDevicesList;
|
this.devicesList = uniqueDevicesList;
|
||||||
this.fetchDevicesBoundStatus();
|
this.fetchDevicesBoundStatus();
|
||||||
|
|
@ -552,7 +485,7 @@
|
||||||
// 判断是否存在浇花器设备
|
// 判断是否存在浇花器设备
|
||||||
if (this.devicesList.length == 0) {
|
if (this.devicesList.length == 0) {
|
||||||
this.tishiflag = true
|
this.tishiflag = true
|
||||||
this.texts = '扫描完毕,暂无发现电动车设备'
|
this.texts = '扫描完毕,请操作'
|
||||||
} else {
|
} else {
|
||||||
this.texts = '扫描到以下设备,请点击连接!'
|
this.texts = '扫描到以下设备,请点击连接!'
|
||||||
}
|
}
|
||||||
|
|
@ -619,6 +552,8 @@
|
||||||
// padding-top: 136rpx !important;
|
// padding-top: 136rpx !important;
|
||||||
padding: 0 66rpx;
|
padding: 0 66rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
padding-bottom: 200rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-overlay {
|
.modal-overlay {
|
||||||
|
|
@ -752,7 +687,6 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
|
|
||||||
.lt {
|
.lt {
|
||||||
padding-left: 10rpx;
|
padding-left: 10rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user