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