This commit is contained in:
3321822538@qq.com 2025-02-15 14:15:36 +08:00
parent f6c48dbecb
commit 4caed43416
2 changed files with 58 additions and 33 deletions

View File

@ -253,6 +253,7 @@
var xBlufi = require("@/page_components/blufi/xBlufi.js")
import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue'
import * as echarts from '@/components/uni-ec-canvas/echarts'
import { Counter } from './blufi/crypto/aes'
let chart = null
export default {
components: {
@ -323,7 +324,9 @@
ver_data:null,
ver_dataflag:1,
modelId:[],
devicesarr:[]
devicesarr:[],
timedingshi: null, //
countdown: 30, //
}
},
onLoad(option) {
@ -336,6 +339,7 @@
if(option.deviceId){
this.ver_dataflag = 3
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
this.startTimerdingshi()
}else{
xBlufi.notifyStartDiscoverBle({'isStart': true})
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
@ -354,6 +358,7 @@
onUnload: function() {
console.log("unload ");
this.stopTimer();
this.clearTimer()
clearInterval(this.timerone);
this.timerone= null
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
@ -416,6 +421,33 @@
}
},
methods: {
//
startTimerdingshi() {
let that = this
that.clearTimer(); //
that.timedingshi = setInterval(() => {
that.countdown--; // 1
console.log(that.countdown,that.deviceId);
if (that.countdown <= 0) {
xBlufi.notifyConnectBle({
isStart: false,
deviceId: that.deviceId,
name: that.name
})
that.clearTimer() //
uni.reLaunch({
url:'/pages/shouye/index'
})
}
}, 1000); //
},
//
clearTimer() {
if (this.timedingshi) {
clearInterval(this.timedingshi); //
this.timedingshi = null;
}
},
//
btnxudan(){
let that = this
@ -604,6 +636,8 @@
} else {
// console.log(this.tdtxt,'020202');
if (this.tdtxt == '开启') {
this.countdown = 30; //
this.startTimerdingshi()
let that = this
uni.getNetworkType({
success(res) {
@ -627,6 +661,8 @@
}
})
} else {
this.countdown = 30; //
this.startTimerdingshi()
let that = this
uni.getNetworkType({
success(res) {
@ -995,7 +1031,9 @@
}
this.onlineStatus = res.data.onlineStatus
this.qrResult = res.data.mac
this.deviceId = res.data.mac.match(/.{2}/g).reverse().join(':')
if(this.ver_dataflag != 3){
this.deviceId = res.data.mac.match(/.{2}/g).reverse().join(':')
}
this.modelId = res.data.modelTags
if(this.ver_dataflag != 3){
this.getlanya()
@ -1218,6 +1256,7 @@
setTimeout(()=>{
this.ver_dataflag = 3
},2000)
this.startTimerdingshi()
xBlufi.notifyInitBleEsp32({
deviceId: this.deviceId
})

View File

@ -178,15 +178,15 @@
</view>
</view>
<!-- 防诈骗提示 -->
<view class="fangswindle" v-if="swindleflag">
<!-- <view class="fangswindle" v-if="swindleflag">
<image src="https://api.ccttiot.com/smartmeter/img/static/uvJcZhPixU1trBud6xTa" mode="aspectFit"></image>
<view class="zhixiao" @click="btnswindleflag">
我已知晓
</view>
</view>
<view v-if="swindleflag" class=""
</view> -->
<!-- <view v-if="swindleflag" class=""
style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .5;z-index: 98;">
</view>
</view> -->
<view class="mask" v-if="masksss"></view>
<!-- 服务协议弹框 -->
<view class="fuwutc" v-if="yinsiflag">
@ -308,7 +308,7 @@ export default {
zhekou: '',
exit: 0,
modelId:[],
devicesarr:[]
devicesarr:[],
}
},
onLoad(option) {
@ -319,22 +319,8 @@ export default {
}else{
xBlufi.initXBlufi(1)
// wx.openBluetoothAdapter({
// success: function (res) {
// console.log('')
// xBlufi.initXBlufi(1)
// },
// fail: function (err) {
// uni.showToast({
// title: ',',
// icon: 'none',
// duration:3000
// })
// console.error('', err)
// }
// })
}
this.swindleflag = true
// this.swindleflag = true
if (option.q) {
function getQueryParam(url, paramName) {
let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
@ -516,17 +502,17 @@ export default {
console.log(this.jine);
},
//
btnswindleflag() {
this.swindleflag = false
if (this.onlineStatus == 0) {
// if (this.ver_data == '') {
// btnswindleflag() {
// this.swindleflag = false
// if (this.onlineStatus == 0) {
// // if (this.ver_data == '') {
// } else {
// this.ver_dataflag = 3
// uni.hideLoading()
// }
}
},
// // } else {
// // this.ver_dataflag = 3
// // uni.hideLoading()
// // }
// }
// },
//
getzfqd() {
this.$u.get(`/app/channel/recharge/enabledList?mchId=` + this.deviceobj.userId).then(res => {
@ -805,7 +791,7 @@ export default {
this.getzfqd() //
//
if (this.deviceobj.suitList.length == 0 || this.deviceobj.suitList == '') {
this.swindleflag = false
// this.swindleflag = false
if (this.userId == this.deviceobj.userId && this.deviceobj.suitList.length == 0) {
let that = this
uni.showModal({