Commit 87116914 by 王榕

修改电池健康度

parent 1b0f1c7d
......@@ -58,11 +58,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getCarDetail()
clearInterval(timer)
setInterval(() => {
this.getCarDetail()
}, 4000)
// this.getCarDetail()
// clearInterval(timer)
// setInterval(() => {
// this.getCarDetail()
// }, 4000)
},
drawProgressbg: function() {
......@@ -125,6 +125,36 @@ Page({
onUnload: function() {
clearInterval(timer)
},
openBattery(){
api.post('device/base/lockAndUnLock?state=1', {
state: 1
}, true)
.then(res => {
// alertTip('开锁成功')
// this.setData({
// 'ui.lockState': 1,
// })
toastTip('发送指令成功')
})
.catch(err => {
alertTip(err)
})
},
closeBattery(){
api.post('device/base/lockAndUnLock?state=1', {
state: 1
}, true)
.then(res => {
// alertTip('开锁成功')
// this.setData({
// 'ui.lockState': 1,
// })
toastTip('发送指令成功')
})
.catch(err => {
alertTip(err)
})
},
getCarDetail() {
api.get('device/base/deviceDetailNew', {}, true)
.then(res => {
......
......@@ -49,6 +49,16 @@
</view>
</view>
<view class="sep-dot"></view>
<view class="btn-body">
<view bindtap="openBattery">
<image src="http://ruiju.oss-cn-hangzhou.aliyuncs.com/jindun/batteryOpen.png"></image>
<text>启动电池</text>
</view>
<view bindtap="closeBattery">
<image src="http://ruiju.oss-cn-hangzhou.aliyuncs.com/jindun/batteryClose.png"></image>
<text>关闭电池</text>
</view>
</view>
<view class="info-body">
<view class="info-title">单节电压
<text>(单位:V)</text>
......
......@@ -129,4 +129,33 @@
}
.vos-item text:nth-of-type(2){
color: #587699;
}
.btn-body{
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 40rpx;
}
.btn-body >view{
border: 1rpx solid #004482;
background-color: #5876992a;
border-radius: 8rpx;
height: 123rpx;
width: 340rpx;
display: flex;
align-items: center;
justify-content: center;
}
.btn-body >view:active{
opacity: 0.8;
}
.btn-body >view image{
width: 62rpx;
height: 62rpx;
margin-right: 20rpx;
}
.btn-body >view text{
font-size: 28rpx;
font-weight: bold;
color: #E5E5E5;
}
\ No newline at end of file
......@@ -5,19 +5,27 @@
<canvas class="cvs progress_canvas" canvas-id="canvasProgress"> </canvas>
<view class="progress_text">
<view class="iv ab it">
<text wx:if="{{auth&&hasBattery}}">{{bmsVolt}}V</text>
<text>
<block wx:if="{{auth&&hasBattery}}">{{bmsVolt}}V</block>
</text>
<text>电压</text>
</view>
<view class="ia ab it">
<text wx:if="{{auth&&hasBattery}}">{{bmsCurrent}}A</text>
<text>
<block wx:if="{{auth&&hasBattery}}">{{bmsCurrent}}A</block>
</text>
<text>电流</text>
</view>
<view class="is ab it">
<text wx:if="{{auth&&hasBattery}}">{{bmsState}}</text>
<text>
<block wx:if="{{auth&&hasBattery}}">{{bmsState}}</block>
</text>
<text>状态</text>
</view>
<view class="ix ab it">
<text wx:if="{{auth&&hasBattery}}">{{bmsCycles}}次</text>
<text>
<block wx:if="{{auth&&hasBattery}}">{{bmsCycles}}次</block>
</text>
<text>电池循环</text>
</view>
<view class="ic ab">
......@@ -27,7 +35,9 @@
</block>
<block wx:else>
<text wx:if="{{hasBattery}}">剩余电量</text>
<view wx:if="{{!hasBattery}}" class="no-battery">您还未绑定电池</view>
<view wx:if="{{!hasBattery}}" class="no-battery">
<image src="http://ruiju.oss-cn-hangzhou.aliyuncs.com/jindun/defaultAvator.png"></image>
</view>
<view wx:if="{{hasBattery}}">
{{bmsSoc}}
<text>%</text>
......@@ -74,8 +84,8 @@
<text>良好的电池使用习惯可以延长电池寿命</text>
</view>
<view class="b-right">
<text>{{batteryDeatil.health}}</text>
<text>分</text>
<!-- <text>{{batteryDeatil.health}}</text>
<text>分</text> -->
</view>
</view>
</view>
......
......@@ -36,6 +36,11 @@ page {
height: 200rpx;
font-size: 12px !important;
}
.no-battery image{
width: 200rpx;
height: 200rpx;
border-radius: 50%;
}
.bind-btn{
display: flex;
justify-content: center;
......@@ -157,25 +162,28 @@ page {
color: #587699;
margin-top: 2px;
}
.it>text:first-child {
font-size: 30rpx;
}
.iv {
left: 84rpx;
top: 140rpx;
top: 132rpx;
}
.ia {
left: 110rpx;
top: 250rpx;
top: 242rpx;
}
.ix {
left: 536rpx;
top: 250rpx;
top: 242rpx;
}
.is {
left: 590rpx;
top: 140rpx;
top: 132rpx;
}
.ic {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment