This commit is contained in:
3321822538@qq.com 2025-02-28 16:41:52 +08:00
parent dea2a90df4
commit b708c922d0

View File

@ -31,29 +31,29 @@
</view> </view>
<u-select v-model="show" :list="list" title='选择型号' @confirm="confirm"></u-select> <u-select v-model="show" :list="list" title='选择型号' @confirm="confirm"></u-select>
<view class="lanyasj"> <view class="lanyasj">
<view class="" v-if="ver_data.power"> <view class="">
/V:<text v-if="ver_data.power">{{ver_data.power / 100}}</text> <text v-else>--</text> 池电:<text v-if="ver_data.power">{{ver_data.power / 100}}/V</text> <text v-else>--</text>
</view> </view>
<view class="" v-if="ver_data.MIC"> <view class="">
声音频率/Hz:<text v-if="ver_data.MIC">{{ver_data.MIC}}</text> <text v-else>--</text> 声音频率:<text v-if="ver_data.MIC">{{ver_data.MIC}}/Hz</text> <text v-else>--</text>
</view> </view>
<view class="" v-if="ver_data.temp_n"> <view class="">
内部温度/°C:<text>{{ver_data.temp_n}}</text> 内部温度:<text v-if="ver_data.temp_n">{{ver_data.temp_n}}/°C</text><text v-else>--</text>
</view> </view>
<view class="" v-if="ver_data.temp_w"> <view class="">
外部温度/°C:<text>{{ver_data.temp_w}}</text> 外部温度:<text v-if="ver_data.temp_w">{{ver_data.temp_w}}/°C</text><text v-else>--</text>
</view> </view>
<view class="" v-if="ver_data.hp_n"> <view class="">
内部湿度/%:<text v-if="ver_data.hp_n">{{ver_data.hp_n}}</text> <text v-else>--</text> 内部湿度:<text v-if="ver_data.hp_n">{{ver_data.hp_n}}/%</text> <text v-else>--</text>
</view> </view>
<view class="" v-if="ver_data.hp_w"> <view class="">
外部湿度/%:<text v-if="ver_data.hp_w">{{ver_data.hp_w}}</text> <text v-else>--</text> 外部湿度:<text v-if="ver_data.hp_w">{{ver_data.hp_w}}/%</text> <text v-else>--</text>
</view> </view>
<view class="" v-if="ver_data.weight"> <view class="">
当前重量/g:<text>{{ver_data.weight}}</text> 当前重量:<text v-if="ver_data.weight">{{ver_data.weight}}/g</text> <text v-else>--</text>
</view> </view>
<view class="" v-if="ver_data.out_day"> <view class="">
当天出勤/:<text>{{ver_data.out_day}}</text> 当天出勤:<text v-if="ver_data.out_day">{{ver_data.out_day}}/</text> <text v-else>--</text>
</view> </view>
</view> </view>
<view class="imgs" style="margin-top: 130rpx;"> <view class="imgs" style="margin-top: 130rpx;">
@ -68,15 +68,14 @@
<view class="btn1" @click="Binddevice()"> <view class="btn1" @click="Binddevice()">
蓝牙连接 蓝牙连接
</view> </view>
<!-- <view class="btn1" @click="ring()" v-if="carstause"> <view class="btn1" @click="ring()" v-if="ver_data.temp_n">
响铃寻车 去皮
</view>
<!-- <view class="btn1" @click="fengm()" v-if="ver_data != ''">
蜂鸣
</view> --> </view> -->
<!-- <view class="btn1" @click="open()" v-if="carstause"> <!-- <view class="btn1" @click="open()" v-if="carstause">
蓝牙开启 蓝牙开启
</view>
<view class="btn1" @click="close()" v-if="carstause">
蓝牙关闭
</view> --> </view> -->
<!-- <view class="btn1" @click="reboot()" v-if="carstause"> <!-- <view class="btn1" @click="reboot()" v-if="carstause">
设备重启 设备重启
@ -198,10 +197,20 @@
}, },
watch: { watch: {
}, },
methods: { methods: {
fengm(){
xBlufi.notifySendCustomData({
customData: "11beep@"
})
},
ring() {
xBlufi.notifySendCustomData({
customData: "11clear_weight@"
})
this.ver_data = {}
this.Binddevice()
},
btns(){ btns(){
uni.reLaunch({ uni.reLaunch({
url:'/page_user/luru' url:'/page_user/luru'
@ -473,32 +482,6 @@
} }
}); });
}, },
ring() {
let vm = this; // this vm
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
console.log('已连接的蓝牙设备信息:', res);
// vm.dl = (vm.orderinfo.deviceAmount / vm.orderinfo.unitPrice).toFixed(2); // 使 vm 访 Vue
xBlufi.notifySendCustomData({
customData: "11play1@"
});
// uni.hideLoading()
// vm.remakr()
},
fail(err) {
uni.hideLoading()
console.error('获取已连接蓝牙设备信息失败:', err);
}
});
} else {
console.log('手机未连接网络');
}
}
});
},
btnyc() { btnyc() {
this.titleflag = false this.titleflag = false
}, },
@ -564,23 +547,25 @@
} }
}, },
parseBluetoothData(data) { parseBluetoothData(data) {
const result = {} const result = {};
const parts = data.split('@') const parts = data.split('@');
parts.forEach(part => { parts.forEach(part => {
if (part) { if (part) {
const keyEndIndex = part.search(/[0-9:]/) // // 使
if (keyEndIndex !== -1) { const match = part.match(/^([a-zA-Z_]+):?([^@]+)/);
const key = part.slice(0, keyEndIndex) // if (match) {
const value = part.slice(keyEndIndex) // const key = match[1]; //
result[key] = value const value = match[2]; //
result[key] = value;
} else { } else {
result[part] = '' //
result[part] = '';
} }
} }
}) });
return result return result;
}, },
//4 //4
createBLEConnection(e) { createBLEConnection(e) {
console.log('调用了') console.log('调用了')