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

View File

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