开关 蓝牙全面优化 新增弹窗公告

This commit is contained in:
3321822538@qq.com 2025-01-16 18:03:08 +08:00
parent 0e2daa3b00
commit 93300872e2
13 changed files with 2468 additions and 545 deletions

View File

@ -19,8 +19,8 @@ const install = (Vue, vm) => {
// },
// });
Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://192.168.1.4:10002',
baseUrl: 'https://kg.chuangtewl.com/prod-api',
baseUrl: 'http://192.168.1.4:10002',
// baseUrl: 'https://kg.chuangtewl.com/prod-api',
// loadingText: '加载中...',
// loadingTime: 1000,
// 设置自定义头部content-type

View File

@ -1145,7 +1145,7 @@ function init() {
// && devices.devices[0].name != 'SMART_R2XS'
// && devices.devices[0].name != 'SMART_R2XS'
// )
if (devices.devices[0].name.indexOf("CTKG") != -1 || devices.devices[0].name.indexOf("CTPO") != -1 || devices.devices[0].name.indexOf("gjkg") != -1){
if (devices.devices[0].name.indexOf("CTKG") != -1 || devices.devices[0].name.indexOf("CTPO") != -1 || devices.devices[0].name.indexOf("gjkg") != -1 || devices.devices[0].name.indexOf("CCYK") != -1){
// console.log("跳过",devices.devices[0].name)
// isnotexist = false;
isnotexist = true;

View File

@ -34,6 +34,20 @@
</view>
</view>
</view>
<view class="wz" v-if="onlineStatus == 0">
<view v-if="ver_dataflag == 1" style="color: #8883F0;">
<image src="https://api.ccttiot.com/smartmeter/img/static/u6akzRBuxxP94XlUcMtV" mode=""></image>
未连接
</view>
<view v-if="ver_dataflag == 2" style="color: #8883F0;">
<image src="https://api.ccttiot.com/smartmeter/img/static/u6akzRBuxxP94XlUcMtV" mode=""></image>
连接中
</view>
<view v-if="ver_dataflag == 3" style="color: #8883F0;">
<image src="https://api.ccttiot.com/smartmeter/img/static/usSHAkmok1YIdjsgRECI" mode=""></image>
已连接
</view>
</view>
<!-- 操作 -->
<view class="card2" style="padding-bottom: 30rpx;box-sizing: border-box;margin-top: 0;" v-if="detaobj.suitFeeType == 1 || detaobj.suitFeeType == 4">
<view class="" style="display: flex;box-sizing: border-box;width: 100%;
@ -56,15 +70,7 @@
<view class="time_list">
<view class="time_top">
<!-- <view class="" v-if="detaobj.suitEndTime && detaobj.suitFeeType == 1">
{{formattedTime}}
</view> -->
<!-- <view class="" v-if="detaobj.suitEndTime && detaobj.suitFeeType != 1">
已结束
</view> -->
<view class="">
<!-- <text
v-if="detaobj.suitFeeType == 3 || detaobj.suitFeeType == 4">{{timeDifferenceString == '' ? '1分' : timeDifferenceString}}</text> -->
<text v-if="detaobj.suitFeeType == 2 || detaobj.suitFeeType == 3">{{du}}</text>
<text v-if="detaobj.suitFeeType == 1 || detaobj.suitFeeType == 4">{{formattedTime == '1秒' ? '0' : formattedTime}}</text>
</view>
@ -78,7 +84,6 @@
</view>
<view class="time_bot" v-if="!detaobj.suitEndTime || detaobj.suitFeeType == 1">
<view class="">
<!-- <text v-if="detaobj.suitFeeType == 3 || detaobj.suitFeeType == 4">已使用时长</text> -->
<text >订单剩余</text>
</view>
<view class="">
@ -143,14 +148,6 @@
{{detaobj.suitStartTime == null ? '--' : detaobj.suitStartTime}}
</view>
</view>
<!-- <view class="emilist">
<view class="">
结束时间
</view>
<view class="">
{{detaobj.suitEndTime == null ? '--' : detaobj.suitEndTime}}
</view>
</view> -->
<view class="emilist">
<view class="">
店铺名称
@ -322,21 +319,23 @@
timerone:null,
hasCalledGetczly:false,
timerIds: null ,
formattedTime:''
formattedTime:'',
ver_data:null,
ver_dataflag:1
}
},
onLoad(option) {
let id = option.id
this.id = id
this.id = option.id
this.$u.put(`/app/bill/${this.id}/refreshPayResult`).then(res => {
this.getDevice()
})
if(this.ver_data == null){
this.getlanya()
}
if (option.flag) {
this.opflag = option.flag
}
setTimeout(()=>{
// this.shuaxin()
// this.gethuidaio()
this.startTimerone()
},1500)
@ -408,9 +407,21 @@
methods: {
//
btnxudan(){
uni.navigateTo({
url:'/page_components/fuwu/index?id=' + this.sbobj.deviceNo
})
let that = this
uni.showModal({
title: '温馨提示',
content: '您是否需要前去续单?',
showCancel: true,
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url:'/page_components/fuwu/index?id=' + that.sbobj.deviceNo
})
} else if (res.cancel) {
console.log('取消'); //
}
}
})
},
start() {
this.timerIds = setInterval(() => {
@ -512,6 +523,7 @@
})
},
//
btnkq() {
if (this.onlineStatus == 1) {
@ -570,39 +582,15 @@
})
} else {
if (this.ver_data == null) {
this.jieshufalg = true
uni.showLoading({
title: '切换中'
})
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
//
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
xBlufi.notifyConnectBle({
isStart: true,
deviceId: this.deviceId,
name: this.name
})
xBlufi.notifyInitBleEsp32({
deviceId: this.deviceId
})
let name = ''
let index = this.name.indexOf('-')
if (index !== -1) {
name = this.name.slice(index + 1)
}
if (this.sbobj.powerStatus == 0) {
this.imgflag = false
} else {
this.imgflag = true
}
}, 1000)
let that = this
uni.showModal({
title: '温馨提示',
content: '正在连接蓝牙,请尽量靠近设备',
showCancel: false,
success: function(res) {
}
})
} else {
// console.log(this.tdtxt,'020202');
if (this.tdtxt == '开启') {
@ -616,6 +604,9 @@
// console.log('close');
that.tdtxt = '关闭'
that.imgflag = false
xBlufi.notifySendCustomData({
customData: 'close'
})
xBlufi.notifySendCustomData({
customData: '11close'
})
@ -647,6 +638,9 @@
// console.log('open');
that.tdtxt = '开启'
that.imgflag = true
xBlufi.notifySendCustomData({
customData: 'open'
})
xBlufi.notifySendCustomData({
customData: '11open'
})
@ -670,7 +664,43 @@
}
}
}
}
},
getlanya(){
this.ver_dataflag = 2
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
//
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
xBlufi.notifyConnectBle({
isStart: true,
deviceId: this.deviceId,
name: this.name
})
xBlufi.notifyInitBleEsp32({
deviceId: this.deviceId
})
if (this.sbobj.powerStatus == 0) {
this.imgflag = false
} else {
this.imgflag = true
}
}, 2000)
setTimeout(()=>{
if(this.ver_data == null){
this.ver_dataflag = 1
setTimeout(()=>{
this.getlanya()
},3000)
}
},15000)
},
@ -699,15 +729,6 @@
}
})
},
// channelId
getzfqd(){
// this.$u.get(`/app/channel/recharge/enabledList`).then(res =>{
// if(res.code == 200){
// this.channelId = res.data[0].channelId
// }
// })
},
//
btns() {
uni.reLaunch({
@ -752,29 +773,16 @@
}
})
} else {
if (this.temperature == null) {
this.jieshufalg = true
if (this.ver_data == null) {
let that = this
xBlufi.initXBlufi(1);
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (that.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
}
}, 2000)
uni.showLoading({
title: '正在连接蓝牙'
})
uni.showModal({
title: '温馨提示',
content: '正在连接蓝牙,请尽量靠近设备',
showCancel: false,
success: function(res) {
}
})
} else {
this.jieshufalg = true
let data = {
@ -820,124 +828,6 @@
}
}
},
//
// btnbox() {
// this.trueboxfalg = false
// this.jieshuflag = true
// if (this.onlineStatus == 1) {
// let data = {
// billId: this.billId
// }
// this.$u.put(`/app/bill/endUse`, data).then(res => {
// if (res.code == 200) {
// uni.showToast({
// title: res.msg,
// icon: 'success',
// duration: 1000
// })
// setTimeout(() => {
// this.jieshuflag = false
// uni.reLaunch({
// url: '/pages/shouye/index'
// })
// }, 1500)
// } else {
// this.getDevice()
// this.jieshuflag = false
// uni.showToast({
// title: res.msg,
// icon: 'none',
// duration: 2000
// })
// }
// })
// } else {
// // console.log(this.temperature,'this.temperature');
// if (this.temperature == null) {
// uni.showLoading({
// title: ''
// })
// let that = this
// xBlufi.initXBlufi(1)
// xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
// xBlufi.notifyStartDiscoverBle({
// 'isStart': true
// })
// setTimeout(() => {
// xBlufi.notifyStartDiscoverBle({
// 'isStart': false
// })
// if (that.devicesList.length > 0) {
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: that.deviceId,
// name: that.name
// })
// }
// }, 2000)
// uni.showModal({
// title: '',
// content: `,,,`,
// showCancel: false,
// success: function(res) {
// }
// })
// } else {
// let data = {
// billId: this.billId,
// totalEle: this.temperature
// }
// let that = this
// this.$u.put(`/app/bill/endUse`, data).then(res => {
// if (res.code == 200) {
// uni.getNetworkType({
// success(res) {
// if (res.networkType !== 'none') {
// uni.getConnectedBluetoothDevices({
// success(res) {
// setTimeout(() => {
// xBlufi.notifySendCustomData({
// customData: "time@" + 0
// })
// let datas = {
// mac:that.qrResult,
// reason:'',
// command:'11close',
// result:''
// }
// console.log(datas,'111');
// that.$u.post(`/app/commandLog/bluetooth`,datas).then(res => {})
// setTimeout(() => {
// that.jieshuflag = false
// uni.reLaunch({
// url: '/pages/shouye/index'
// })
// }, 1000)
// }, 1500)
// },
// fail(err) {
// console.error('', err)
// }
// })
// } else {
// console.log('')
// }
// }
// })
// } else {
// this.jieshuflag = false
// uni.showToast({
// title: res.msg,
// icon: 'none',
// duration: 2000
// })
// }
// })
// }
// }
// },
//
startTimers() {
//
@ -1031,7 +921,6 @@
}
this.onlineStatus = res.data.onlineStatus
this.qrResult = res.data.mac
// getApp().set_ble_mac(this.qrResult)
this.totalElectriQuantity = res.data.totalElectriQuantity
}
})
@ -1087,41 +976,6 @@
seconds: seconds
}
},
opendevice() {
let stause = 0
if (this.deviceInfo.powerStatus == 1) {
stause = 0
} else {
stause = 1
}
this.$u.put(`/app/device/${this.deviceInfo.deviceId}/changePower?status=` + stause).then((res) => {
if (res.code == 200) {
setTimeout(() => {
this.getDevice()
}, 2000)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
opendevices() {
},
swiperchange(e) {
this.curtitidx = e.detail.current
// console.log(e, 'aaaa');
},
changeidx(index) {
this.curtitidx = index
},
toydfx() {
uni.navigateTo({
url: "/page_components/eletj?id=" + this.id
})
},
funListenDeviceMsgEvent: function(options) {
switch (options.type) {
@ -1166,6 +1020,7 @@
this.temperature = this.ver_data.temperature / 1000
setTimeout(() => {
// this.czflag = false
this.ver_dataflag = 3
this.jieshuflag = false
this.jieshufalg = false
uni.hideLoading()
@ -1182,11 +1037,7 @@
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
if (!options.result) {
this.lanyaflag = true
uni.showToast({
title: '蓝牙未开启',
icon: 'none',
duration: 3000
})
this.ver_dataflag = 1
return
} else {
this.lanyaflag = false
@ -1258,6 +1109,20 @@
padding-bottom: 300rpx;
overflow: scroll;
}
.wz {
font-weight: 400;
font-size: 32rpx;
margin-top: 30rpx;
view{
display: flex;
align-items: center;
image{
width: 80rpx;
height: 80rpx;
margin-right: 10rpx;
}
}
}
.card2 {
padding-top: 40rpx;

View File

@ -5,14 +5,23 @@
<text style="width: 80%;text-align: center;display: inline-block;">{{deviceobj.deviceName == undefined ? '--' : deviceobj.deviceName}}</text>
<view class="" style="display: flex;justify-content: space-between;">
<view class="wz" v-if="onlineStatus == 0">
<text v-if="ver_dataflag == 1" style="color: red;padding: 6rpx;border: 1px solid red;box-sizing: border-box;border-radius: 10rpx;">蓝牙未连接</text>
<text v-if="ver_dataflag == 2" style="color: aquamarine;padding: 6rpx;border: 1px solid aquamarine;box-sizing: border-box;border-radius: 10rpx;">蓝牙连接中</text>
<text v-if="ver_dataflag == 3" style="color: aquamarine;padding: 6rpx;border: 1px solid aquamarine;box-sizing: border-box;border-radius: 10rpx;">蓝牙已连接</text>
<view v-if="ver_dataflag == 1" style="color: #fff;">
<image src="https://api.ccttiot.com/smartmeter/img/static/u6akzRBuxxP94XlUcMtV" mode=""></image>
未连接
</view>
<view v-if="ver_dataflag == 2" style="color: #fff;">
<image src="https://api.ccttiot.com/smartmeter/img/static/u6akzRBuxxP94XlUcMtV" mode=""></image>
连接中
</view>
<view v-if="ver_dataflag == 3" style="color: #fff;">
<image src="https://api.ccttiot.com/smartmeter/img/static/usSHAkmok1YIdjsgRECI" mode=""></image>
已连接
</view>
</view>
<view class="wz" @click="call" style="text-align: right;padding-right: 20rpx;" v-if="deviceobj.storeContactMobile == null">
<view class="wz" @click="call" style="text-align: right;padding-right: 20rpx;margin-top: 50rpx;" v-if="deviceobj.storeContactMobile == null">
联系客服
</view>
<view class="wz" @click="call" style="text-align: right;padding-right: 20rpx;" v-else>
<view class="wz" @click="call" style="text-align: right;padding-right: 20rpx;margin-top: 50rpx;" v-else>
联系客服
</view>
</view>
@ -298,7 +307,7 @@
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
},
},
methods: {
//
btnactive(item) {
@ -340,13 +349,15 @@
//
btnswindleflag(){
this.swindleflag = false
if(this.ver_data == ''){
uni.showLoading({
title: '蓝牙连接中'
})
}else{
this.ver_dataflag = 3
uni.hideLoading()
if(this.onlineStatus == 0){
if(this.ver_data == ''){
// uni.showLoading({
// title: ''
// })
}else{
this.ver_dataflag = 3
uni.hideLoading()
}
}
},
getzfqd(){
@ -380,44 +391,7 @@
that.onlineStatus = res.data.onlineStatus
that.mac = 'CTKG-' + res.data.mac
if(that.onlineStatus == 0){
if (this.ver_data == '') {
this.czflag = true
this.ver_dataflag = 2
let that = this
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (that.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
}
}, 2000)
setTimeout(()=>{
if(this.ver_data == ''){
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 5000
// })
this.ver_dataflag = 1
this.czflag = false
this.zhifuflag = false
setTimeout(()=>{
uni.hideLoading()
},5000)
}
},13000)
}
that.getlanya()
}
}
})
@ -436,7 +410,40 @@
this.gettaoc()
},
getlanya(){
if (this.ver_data == '') {
this.czflag = true
this.ver_dataflag = 2
let that = this
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (that.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
}
}, 2000)
setTimeout(()=>{
if(this.ver_data == ''){
this.ver_dataflag = 1
this.czflag = false
this.zhifuflag = false
setTimeout(()=>{
this.getlanya()
},3000)
}
},15000)
}
},
btnshouye(){
uni.reLaunch({
@ -445,23 +452,7 @@
},
btnjxcz() {
this.czflag = false
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (this.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: this.deviceId,
name: this.name
})
}
}, 2000)
this.getlanya()
},
call() {
@ -606,27 +597,27 @@
icon: 'none',
duration: 1000
})
}else if(this.ver_data == ''){
}else if(this.ver_data == '' && this.onlineStatus == 0){
let that = this
uni.showModal({
title: '温馨提示',
content: '您是否要重新连接蓝牙?',
showCancel: true,
content: '蓝牙连接中,请尽量靠近设备!',
showCancel: false,
success: function(res) {
if (res.confirm) {
that.ver_data = ''
that.ver_dataflag = 2
that.getzhifu()
} else if (res.cancel) {
console.log('取消')
}
// if (res.confirm) {
// that.ver_data = ''
// that.ver_dataflag = 2
// that.getzhifu()
// } else if (res.cancel) {
// console.log('')
// }
}
})
}else if(this.checked == false) {
let that = this
uni.showModal({
title: '温馨提示',
content: '是否确定勾选用户服务协议',
content: '是否同意《用户服务协议》及《隐私政策》',
showCancel: true,
success: function(res) {
if (res.confirm) {
@ -706,7 +697,7 @@
that.$u.put(`/app/bill/${that.payNo}/refreshPayResult`).then(res => {})
//
uni.reLaunch({
url:'/page_components/eletj?id=' + that.orderno
url:'/page_components/eletj?id=' + that.orderno + '&ver_data=' + this.ver_data
})
uni.setStorageSync('time', that.expireTimeStr)
},
@ -753,7 +744,7 @@
that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res => {})
//
uni.reLaunch({
url:'/page_components/eletj?id=' + that.orderno
url:'/page_components/eletj?id=' + that.orderno + '&ver_data=' + this.ver_data
})
uni.setStorageSync('time', that.expireTimeStr)
},
@ -792,52 +783,7 @@
})
} else {
if (this.ver_data == '') {
this.ver_dataflag = 2
this.czflag = true
let that = this
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (that.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
}
}, 2000)
uni.showModal({
title: '温馨提示',
content: '检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙',
showCancel: false,
//
success: function(res) {
uni.showLoading({
title: '蓝牙连接中'
})
}
})
setTimeout(()=>{
if(this.ver_data == ''){
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 5000
// })
this.czflag = false
this.zhifuflag = false
this.ver_dataflag = 1
setTimeout(()=>{
uni.hideLoading()
},5000)
}
},10000)
} else {
uni.showLoading({
title: '准备支付中...'
@ -917,7 +863,7 @@
setTimeout(() => {
that.zhifuflag = false
uni.reLaunch({
url:'/page_components/eletj?id=' + that.orderno
url:'/page_components/eletj?id=' + that.orderno + '&ver_data=' + this.ver_data
})
},1000)
},1500)
@ -1078,7 +1024,7 @@
}else{
that.zhifuflag = false
uni.reLaunch({
url:'/page_components/eletj?id=' + that.orderno
url:'/page_components/eletj?id=' + that.orderno + '&ver_data=' + this.ver_data
})
}
},1000)
@ -1246,11 +1192,11 @@
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
if (!options.result) {
this.lanyaflag = true
uni.showToast({
title: '蓝牙未开启',
icon: 'none',
duration: 3000
});
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 3000
// });
return
} else {
this.lanyaflag = false
@ -1459,7 +1405,8 @@
// padding-bottom: 41rpx;
// }
page {
background: linear-gradient(180deg, #8883F0 0%, rgba(255, 255, 255, 0) 100%);
background: linear-gradient(180deg,rgb(136, 131,240) 30%, rgba(255, 255, 255, 0) 100%);
// background-color: rgb(136, 131,240);
}
.active {
@ -1539,7 +1486,7 @@
font-weight: 600;
font-size: 40rpx;
color: #fff;
margin-bottom: 30rpx;
margin-bottom: 45rpx;
margin-top: 110rpx;
height: 126rpx;
@ -1547,6 +1494,15 @@
font-weight: 400;
font-size: 32rpx;
margin-top: 30rpx;
view{
display: flex;
align-items: center;
image{
width: 80rpx;
height: 80rpx;
margin-right: 10rpx;
}
}
}
}

View File

@ -51,7 +51,7 @@
</view>
<view class="swiper" :current='curtitidx' @change="swiperchange" @scrolltolower="onReachBottom">
<view class="swiper-item ">
<view class="card_box" v-for="(item,index) in wateringList" :key="index">
<view class="card_box" v-for="(item,index) in wateringList" :key="index" @click="btnitem(item.deviceId)">
<view class="card">
<view class="card_left">
<view class="card_left_tit">
@ -158,6 +158,11 @@
}
},
methods: {
btnitem(id){
uni.navigateTo({
url:'/pages/shebeione?id=' + id
})
},
getlist() {
this.$u.get(`/app/device/list?storeId=${this.storeId}&pageNum=${this.pagenum}&pageSize=${this.pagesize}`)
.then((res) => {

View File

@ -10,8 +10,9 @@
<view class="mid_top">
{{ deviceInfo.deviceName == null ? '' : deviceInfo.deviceName }}
<view class="" v-if="deviceInfo.onlineStatus==0">
<text style="color: #00BA88;border: 1px solid #00BA88;border-radius: 10rpx;" v-if="setMode != null">蓝牙已连接</text>
<text style="color: red;border: 1px solid red;border-radius: 10rpx;" v-else>蓝牙未连接</text>
<text style="color: #00BA88;border: 1px solid #00BA88;border-radius: 10rpx;" v-if="ver_dataflag == 3">蓝牙已连接</text>
<text style="color: red;border: 1px solid red;border-radius: 10rpx;" v-if="ver_dataflag == 2">蓝牙连接中</text>
<text style="color: red;border: 1px solid red;border-radius: 10rpx;" v-if="ver_dataflag == 1">蓝牙未连接</text>
</view>
</view>
<view class="mid_bot">
@ -55,13 +56,13 @@
<view class="card2">
<view class="" style="display: flex;justify-content: space-between;padding-right: 24rpx;box-sizing: border-box;">
<view class="tit" style="border-left: 14rpx solid #8883F0;padding-left: 24rpx;">实时参数</view>
<view @click="shuaxin" style="display: flex;color: #8883F0;justify-content: center;align-items: center;box-sizing: border-box;" v-if="deviceInfo.onlineStatus==1">
<view @click="shuaxin" style="display: flex;color: #8883F0;justify-content: center;align-items: center;box-sizing: border-box;">
点击刷新
<image style="width: 30rpx;height: 30rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uiVZaazpgTY3gE7aYtGb" mode="aspectFit"></image>
</view>
<view v-if="deviceInfo.onlineStatus==0" @click="lianjie" style="display: flex;color: #8883F0;justify-content: center;align-items: center;box-sizing: border-box;">
<!-- <view v-if="deviceInfo.onlineStatus==0" @click="lianjie" style="display: flex;color: #8883F0;justify-content: center;align-items: center;box-sizing: border-box;"v-if="deviceInfo.onlineStatus==1">
点击连接
</view>
</view> -->
</view>
<view class="bot_right">
<view class="cont" style="text-align: center;">
@ -298,16 +299,12 @@
<view v-if="btnmsk"
style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .1;z-index: 999;">
</view>
<view class="maskss" v-if="ljljflag"></view>
</view>
</template>
<script>
var xBlufi = require("@/page_components/blufi/xBlufi.js")
export default {
components: {
// uniEcCanvas
},
data() {
return {
suitSurplus:'',
@ -371,19 +368,21 @@
sklist:{},
sklistflag:false,
ljtype:'2',
ljljflag:false,
userTpye_userid:''
userTpye_userid:'',
ver_dataflag:2
}
},
onLoad(option) {
let id = option.id
this.id = id
if(this.setMode == null){
this.Binddevice()
}
if (option.flag) {
this.opflag = false
} else {
this.opflag = true
}
},
//
onShareAppMessage: function() {
@ -458,7 +457,6 @@
this.shibaiflag = false
this.getshuax()
this.getQiniuToken()
},
mounted() {
this.drawCanvas()
@ -469,28 +467,38 @@
url:'/pages/index/index'
})
},
//
lianjie(){
this.ljljflag = true
this.Binddevice()
this.getljlj()
//
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (this.deviceInfo.powerStatus == 0) {
this.imgflag = false
} else {
this.imgflag = true
}
}, 2000)
},
// mac
// Binddevice(){
// this.ver_dataflag = 2
// xBlufi.initXBlufi(1)
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
// xBlufi.notifyStartDiscoverBle({
// 'isStart': true
// })
// //
// setTimeout(() => {
// xBlufi.notifyStartDiscoverBle({
// 'isStart': false
// })
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: this.deviceId,
// name: this.name
// })
// xBlufi.notifyInitBleEsp32({
// deviceId: this.deviceId
// })
// }, 2000)
// setTimeout(()=>{
// if(this.setMode == null){
// this.ver_dataflag = 1
// setTimeout(()=>{
// this.Binddevice()
// },3000)
// }
// },15000)
// },
Binddevice() {
uni.showLoading({
title: '蓝牙连接中..'
})
xBlufi.initXBlufi(1);
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
xBlufi.notifyStartDiscoverBle({
@ -503,21 +511,14 @@
});
setTimeout(() => {
if (this.devicesList.length == 0) {
uni.showToast({
title: '暂无发现对应设备,请重试',
icon: 'none'
})
this.ljljflag = false
} else {
let uniqueDevicesList = Array.from(new Set(this.devicesList));
this.devicesList = uniqueDevicesList;
// console.log(this.devicesList,'this.devicesListthis.devicesList');
this.devicesList.forEach(device => {
let macFromName = device.name.substring(device.name.length - 12);
console.log(macFromName, 'macFromNamemacFromName');
// this.mac
if (macFromName == this.qrResult) {
// this.ishave true
if (macFromName == this.qrResult) {
console.log(device);
this.deviceInfoss = device
this.createBLEConnection(device)
@ -530,15 +531,22 @@
}
}, 200)
}, 2000)
setTimeout(() =>{
if(this.setMode == null){
setTimeout(() =>{
this.Binddevice()
},3000)
}else{
console.log('已连接11111');
}
},15000)
},
//
createBLEConnection(e) {
console.log('调用了');
xBlufi.notifyStartDiscoverBle({
'isStart': false
});
console.log(e, '蓝牙信息')
const deviceId = e.deviceId
this.deviceId = e.deviceId
this.Bluetoothmac = e.localName.substring(5) // mac
console.log(this.Bluetoothmac, '11111');
@ -548,28 +556,8 @@
isStart: true,
deviceId: e.deviceId,
name
});
})
},
//
getljlj(){
let that = this
setTimeout(() =>{
if(this.setMode == null){
uni.showModal({
title: '温馨提示',
content: '蓝牙连接失败,请重新连接',
showCancel: false,
success: function(res) {
that.ljljflag = false
uni.hideLoading()
}
})
}else{
console.log('32751212');
}
},15000)
},
groupChange(n) {
@ -645,6 +633,7 @@
//
btnconfirm(e) {
console.log(e);
this.danwei = e[0].label
this.damweiid = e[0].value
},
@ -741,20 +730,14 @@
}
} else {
if (this.setMode == null) {
this.ljljflag = true
this.Binddevice()
this.getljlj()
//
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (this.deviceInfo.powerStatus == 0) {
this.imgflag = false
} else {
this.imgflag = true
uni.showModal({
title: '温馨提示',
content: '蓝牙连接中,请尽量靠近设备!',
showCancel: false,
success: function(res) {
}
}, 2000)
})
} else {
this.shibaiflag = false
if (this.tdtxt == '开启') {
@ -840,7 +823,6 @@
let str = JSON.parse(res.data)
_this.userImgs = 'https://api.ccttiot.com/' + str.key
_this.imglist = _this.userImgs
// console.log(_this.imglist,'_this.imglist_this.imglist')
let data = {
deviceId: _this.id,
customPicture: _this.imglist
@ -876,10 +858,10 @@
this.$u.get("/app/device/" + id).then((res) => {
if (res.code == 200) {
this.deviceInfo = res.data
this.qrResult = res.data.mac
this.modelId = res.data.modelTags
this.storeId = res.data.storeId
this.deviceNo = res.data.deviceNo
this.qrResult = res.data.mac
this.getshoukuan()
if (res.data.customPicture != null) {
this.imglist = res.data.customPicture
@ -959,47 +941,6 @@
seconds: seconds
}
},
opendevice() {
let stause = 0
if (this.deviceInfo.powerStatus == 1) {
stause = 0
} else {
stause = 1
}
// console.log(stause, 'stausestause');
this.$u.put(`/app/device/${this.deviceInfo.deviceId}/changePower?status=` + stause).then((res) => {
if (res.code == 200) {
// this.groupList=res.rows
setTimeout(() => {
this.getDevice(this.id)
}, 2000)
// this.loadings=true
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
opendevices() {
},
swiperchange(e) {
this.curtitidx = e.detail.current
// console.log(e, 'aaaa');
},
changeidx(index) {
this.curtitidx = index
},
toydfx() {
uni.navigateTo({
url: "/page_components/eletj?id=" + this.id
})
},
//
topage(num) {
@ -1050,9 +991,14 @@
}else{
this.btnmsk = false
if (this.setMode == null) {
this.ljljflag = true
this.Binddevice()
this.getljlj()
uni.showModal({
title: '温馨提示',
content: '蓝牙连接中,请尽量靠近设备!',
showCancel: false,
success: function(res) {
}
})
} else {
let that = this
uni.showModal({
@ -1231,9 +1177,14 @@
})
} else {
if (this.setMode == null) {
this.ljljflag = true
this.Binddevice()
this.getljlj()
uni.showModal({
title: '温馨提示',
content: '蓝牙连接中,请尽量靠近设备!',
showCancel: false,
success: function(res) {
}
})
} else {
let that = this
uni.getNetworkType({
@ -1303,6 +1254,63 @@
this.cztime = ''
},
//
// funListenDeviceMsgEvent: function(options) {
// switch (options.type) {
// case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
// if (options.result) {
// let devicesarr = options.data
// devicesarr.forEach(device => {
// const mac = device.name.substring(4)
// if (device.name.slice(5, 17) == this.qrResult) {
// this.deviceId = device.deviceId
// this.name = device.name
// this.devicesList.push(device)
// let uniqueDevicesList = Array.from(new Set(this.devicesList))
// this.devicesList = uniqueDevicesList
// }
// })
// }
// break;
// case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
// console.log("" + JSON.stringify(options))
// if (options.result) {
// {
// xBlufi.notifyInitBleEsp32({
// deviceId: this.deviceId
// })
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents)
// this.deviceIds = options.data.deviceId
// this.name = this.name
// }
// } else {
// }
// break;
// case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
// this.setMode = this.parseCustomData(options.data)
// console.log("1", this.setMode)
// setTimeout(() => {
// this.ver_dataflag = 3
// }, 1000)
// break
// case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
// if (options.result) {
// let uniqueDevicesList = Array.from(new Set(this.devicesList));
// let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) === "CTKG");
// // this.devicesList
// this.devicesList = filteredDevices
// }
// break
// case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
// if (!options.result) {
// this.ver_dataflag = 1
// return
// } else {
// }
// break
// }
// },
funListenDeviceMsgEvent: function(options) {
let that = this;
switch (options.type) {
@ -1321,13 +1329,6 @@
console.log("连接回调:" + JSON.stringify(options));
if (options.result) {
setTimeout(()=>{
uni.showToast({
title: '连接成功',
icon: 'success',
duration:2000
})
this.ljljflag = false
uni.hideLoading();
},2000)
{
xBlufi.notifyInitBleEsp32({
@ -1341,6 +1342,7 @@
break;
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
this.setMode = this.parseCustomData(options.data)
this.ver_dataflag = 3
console.log("1收到设备发来的自定义数据结果", this.setMode);
break;
case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT:
@ -1348,6 +1350,7 @@
console.log('初始化成功');
} else {
console.log('初始化失败');
this.ver_dataflag = 1
break;
}
break;

View File

@ -24,6 +24,15 @@
"navigationBarTextStyle": "#FFFFFF",
"navigationStyle": "custom"
}
},{
"path": "pages/shebeione",
"style": {
"navigationBarTitleText": "",
// "enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#8883F0",
"navigationBarTextStyle": "#FFFFFF",
"navigationStyle": "custom"
}
},{
"path": "pages/shopewm",
"style": {

View File

@ -8,12 +8,12 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uCqHftk2W2zEPX03DLcb" mode="aspectFit"></image>
</view>
<view class="tip">
欢迎来到共享开关
欢迎来到创想开关
</view>
<view class="inputbox">
<view class="box1" v-if="syflag">
<view class="input_txt" style="width: 536rpx;font-size: 24rpx;line-height: 32rpx;">
您暂未授权共享开关小程序获取你的信息将无法正常使用小程序的功能如需要正常使用请点击授权按钮打开头像昵称等信息的授权
您暂未授权创想开关小程序获取你的信息将无法正常使用小程序的功能如需要正常使用请点击授权按钮打开头像昵称等信息的授权
</view>
<!-- <button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
style="margin-left: -10rpx;">

1987
pages/shebeione.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,17 @@
<view class="useryonghu">
<u-navbar :is-back="false" title="创想物联" :border-bottom="false" :background="bgc" title-color='#fff'
title-size='44' height='50'></u-navbar>
<view class="gonggao">
<u-icon name="volume-fill" color="#fff" style="position: absolute;left: 20rpx;" size="32"></u-icon>
<view class="container">
<view class="scroll-text">
<view class="scroll-item">
{{announcements.noticeTitle == null ? '暂无最新公告!!!' : announcements.noticeTitle}}
</view>
</view>
</view>
<u-icon name="arrow-right" color="#fff" style="position: absolute;right: 10rpx;" size="32"></u-icon>
</view>
<view class="ditu">
<view class="dtxs">
<map class='map' id="map" :latitude="latitude" :longitude="longitude" @markertap="handleMarkerClick"
@ -60,8 +71,11 @@
</view>
</view>
<view class="guangg" @click="btnad">
<image :src="imgad" mode="aspectFit"></image>
<image :src="imgad" mode="aspectFill"></image>
</view>
<!-- <view class="guangg">
<image src="https://api.ccttiot.com/smartmeter/img/static/u0htqJ2dRrag4RrrZmJM" mode="aspectFill"></image>
</view> -->
<view class="saoma" @click="scanQRCode">
<view>
<image src="https://api.ccttiot.com/smartmeter/img/static/uBh15vzRx6gV0wRQj7gi" mode="aspectFit"></image>
@ -123,6 +137,19 @@
</view>
<view class="shenfentcflag" @click="btnyc" v-if="xuanzeflag"></view>
<!-- 公告弹窗 -->
<view class="noticetc">
<view class="name">
创想物联公告
</view>
<view class="biaoti">
公告标题
</view>
<view class="" v-html="">
</view>
</view>
</view>
</template>
@ -169,11 +196,12 @@
iconflag: false,
xuanzeflag:false,
isStaff:null,
dlflag:false
};
dlflag:false,
announcements: {},
gonggaoxq:{}
}
},
onLoad(option) {
console.log(option,'000');
if (option.id) {
let id = option.id
let that = this
@ -251,6 +279,7 @@
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err);
}
})
this.getgonggao()
this.getad()
this.getzf()
this.gethuidaio()
@ -277,6 +306,19 @@
},
methods: {
//
getgonggao(){
this.$u.get("/app/notice/new").then(res =>{
if(res.code == 200){
this.announcements = res.data
this.$u.get(`/app/notice/${res.data.noticeId}`).then(resp =>{
if(resp.code == 200){
this.gonggaoxq = res.data
}
})
}
})
},
btnyc(){
this.xuanzeflag = false
},
@ -880,6 +922,51 @@
</script>
<style lang="scss">
.gonggao{
width: 680rpx;
height: 60rpx;
position: relative;
display: flex;
align-items: center;
margin-bottom: 10rpx;
background-color: rgba(255, 255, 255, .1);
}
.container {
width: 560rpx;
height: 60rpx; /* 根据需要调整高度 */
display: flex;
align-items: center;
margin: auto;
overflow: hidden;
position: relative;
color: #fff;
box-sizing: border-box;
}
.scroll-text {
width: 100%;
overflow: hidden;
box-sizing: border-box;
display: inline-block;
white-space: nowrap;
animation: scroll 8s linear infinite;
}
.scroll-item {
display: inline-block;
padding: 0 10px;
font-size: 16px;
}
@keyframes scroll {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
}
.shenfentc{
width: 632rpx;
height: 498rpx;
@ -998,9 +1085,7 @@
/deep/ .u-title {
padding-bottom: 22rpx;
}
/deep/ .u-icon__icon {
padding-bottom: 22rpx;
}
/deep/ .map {
width: 100%;
height: 100%;
@ -1026,8 +1111,10 @@
width: 750rpx;
padding-left: 34rpx;
padding-right: 34rpx;
padding-bottom: 430rpx;
box-sizing: border-box;
height: 100%;
overflow: scroll;
height: 100vh;
.tip_box {
position: fixed;
left: 72rpx;
@ -1236,8 +1323,9 @@
width: 750rpx;
height: 166rpx;
background: #FFFFFF;
position: relative;
left: -34rpx;
position: fixed;
left: 0;
bottom: 0;
padding-top: 22rpx;
border-radius: 54rpx 54rpx 0 0;
margin-top: 20rpx;
@ -1263,7 +1351,7 @@
}
.ditu {
width: 100%;
height: 980rpx;
height: 900rpx;
background: #FFFFFF;
border-radius: 38rpx 38rpx 38rpx 38rpx;
padding-top: 16rpx;
@ -1328,7 +1416,7 @@
}
.fujin {
position: absolute;
top: 730rpx;
top: 660rpx;
padding-left: 30rpx;
width: 100%;
image {
@ -1338,7 +1426,7 @@
}
.dtxs {
width: 642rpx;
height: 812rpx;
height: 750rpx;
margin: auto;
border-radius: 30rpx;
overflow: hidden;

View File

@ -18,7 +18,7 @@
},
onShareAppMessage: function() {
return {
title: '创物联',
title: '创物联',
path: '/pages/index/index'
}
},
@ -26,7 +26,7 @@
//
onShareTimeline: function() {
return {
title: '创物联',
title: '创物联',
query: '',
path: '/pages/index/index'
}

View File

@ -18,7 +18,7 @@
},
onShareAppMessage: function() {
return {
title: '创物联',
title: '创物联',
path: '/pages/index/index'
}
},
@ -26,7 +26,7 @@
//
onShareTimeline: function() {
return {
title: '创物联',
title: '创物联',
query: '',
path: '/pages/index/index'
}

View File

@ -33,7 +33,7 @@
<view class="tongji">
<view class="one">
<view class="top">
{{tjobj.withDrawlAmount == null ? '0.00' : tjobj.withDrawlAmount}}
{{userobj.withDrawlAmount == null ? '0.00' : userobj.withDrawlAmount}}
</view>
<view class="bot" style="font-size: 24rpx;">
总收入/
@ -49,7 +49,7 @@
</view>
<view class="one">
<view class="top">
{{tjobj.balance == null ? '0.00' : tjobj.balance}}
{{userobj.balance == null ? '0.00' : userobj.balance}}
</view>
<view class="bot" style="font-size: 24rpx;">
账户余额
@ -204,7 +204,8 @@
formattedCurrentDate:'',
formattedThirtyDaysAgo:'',
zongprice:'',
zongnum:''
zongnum:'',
userobj:{}
}
},
//
@ -238,10 +239,19 @@
this.formattedCurrentDate = this.formatDate(currentDate)
this.formattedThirtyDaysAgo = this.formatDate(thirtyDaysAgo)
console.log(this.formattedCurrentDate,this.formattedThirtyDaysAgo)
this.getinfo()
this.gettimes()
this.gettj()
},
methods: {
getinfo(){
this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) {
this.userobj = res.data
}
})
},
//
btnshouye() {
uni.reLaunch({