This commit is contained in:
3321822538@qq.com 2025-03-05 17:41:42 +08:00
parent 960523e7e5
commit 49547f4c46
2 changed files with 38 additions and 2 deletions

View File

@ -1476,7 +1476,20 @@
break
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
this.ver_dataflag = 3
console.log("1收到设备发来的自定义数据结果", options.data)
let arrobj = this.parseStringToObject(options.data)
let data ={
v:arrobj.bat,
S:arrobj.sw,
mac:this.qrResult,
time:arrobj.time,
version:arrobj.ver
}
this.$u.put(`/app/device/bltSyncIot`,data).then(res => {
if(res.code == 200){
// console.log(data);
}
})
console.log("1收到设备发来的自定义数据结果", options.data,arrobj)
break
case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT:
if (options.result) {
@ -1488,6 +1501,29 @@
break
}
},
parseStringToObject(str) {
//
const parts = str.split('@').filter(part => part.trim() !== '');
const result = {};
parts.forEach(part => {
// key:value
if (part.includes(':')) {
const [key, value] = part.split(':');
result[key.trim()] = value.trim();
} else {
// keyvalue
const key = part.match(/[a-zA-Z]+/)?.[0]; //
const value = part.match(/\d+/)?.[0]; //
if (key && value !== undefined) {
result[key.trim()] = value.trim();
}
}
});
return result;
}
}
}
</script>

View File

@ -6,7 +6,7 @@
<view class="top_box">
<view class="tip">账户余额()</view>
<view class="txt">
{{userinfo.balance == undefined ? '' : Number(userinfo.balance) + Number(userinfo.waitBonusAmount)}} <text style="margin-left: 20rpx;">{{'待结算(¥' + waitBonusAmount + ')'}}</text>
{{userinfo.balance == undefined ? '' : userinfo.balance}} <text style="margin-left: 20rpx;">{{'待结算(¥' + waitBonusAmount + ')'}}</text>
</view>
<view class="tip" style="display: flex;justify-content: space-between;align-items: center;">
<text>累计提现{{userinfo.withDrawlAmount == undefined ? '' : userinfo.withDrawlAmount}}</text>