开关
This commit is contained in:
parent
f6c48dbecb
commit
4caed43416
|
@ -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
|
||||
})
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue
Block a user