Commit 87116914 by 王榕

修改电池健康度

parent 1b0f1c7d
...@@ -58,11 +58,11 @@ Page({ ...@@ -58,11 +58,11 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function(options) { onLoad: function(options) {
this.getCarDetail() // this.getCarDetail()
clearInterval(timer) // clearInterval(timer)
setInterval(() => { // setInterval(() => {
this.getCarDetail() // this.getCarDetail()
}, 4000) // }, 4000)
}, },
drawProgressbg: function() { drawProgressbg: function() {
...@@ -125,6 +125,36 @@ Page({ ...@@ -125,6 +125,36 @@ Page({
onUnload: function() { onUnload: function() {
clearInterval(timer) 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() { getCarDetail() {
api.get('device/base/deviceDetailNew', {}, true) api.get('device/base/deviceDetailNew', {}, true)
.then(res => { .then(res => {
......
...@@ -49,6 +49,16 @@ ...@@ -49,6 +49,16 @@
</view> </view>
</view> </view>
<view class="sep-dot"></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-body">
<view class="info-title">单节电压 <view class="info-title">单节电压
<text>(单位:V)</text> <text>(单位:V)</text>
......
...@@ -129,4 +129,33 @@ ...@@ -129,4 +129,33 @@
} }
.vos-item text:nth-of-type(2){ .vos-item text:nth-of-type(2){
color: #587699; 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 @@ ...@@ -5,19 +5,27 @@
<canvas class="cvs progress_canvas" canvas-id="canvasProgress"> </canvas> <canvas class="cvs progress_canvas" canvas-id="canvasProgress"> </canvas>
<view class="progress_text"> <view class="progress_text">
<view class="iv ab it"> <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> <text>电压</text>
</view> </view>
<view class="ia ab it"> <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> <text>电流</text>
</view> </view>
<view class="is ab it"> <view class="is ab it">
<text wx:if="{{auth&&hasBattery}}">{{bmsState}}</text> <text>
<block wx:if="{{auth&&hasBattery}}">{{bmsState}}</block>
</text>
<text>状态</text> <text>状态</text>
</view> </view>
<view class="ix ab it"> <view class="ix ab it">
<text wx:if="{{auth&&hasBattery}}">{{bmsCycles}}次</text> <text>
<block wx:if="{{auth&&hasBattery}}">{{bmsCycles}}次</block>
</text>
<text>电池循环</text> <text>电池循环</text>
</view> </view>
<view class="ic ab"> <view class="ic ab">
...@@ -27,7 +35,9 @@ ...@@ -27,7 +35,9 @@
</block> </block>
<block wx:else> <block wx:else>
<text wx:if="{{hasBattery}}">剩余电量</text> <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}}"> <view wx:if="{{hasBattery}}">
{{bmsSoc}} {{bmsSoc}}
<text>%</text> <text>%</text>
...@@ -74,8 +84,8 @@ ...@@ -74,8 +84,8 @@
<text>良好的电池使用习惯可以延长电池寿命</text> <text>良好的电池使用习惯可以延长电池寿命</text>
</view> </view>
<view class="b-right"> <view class="b-right">
<text>{{batteryDeatil.health}}</text> <!-- <text>{{batteryDeatil.health}}</text>
<text>分</text> <text>分</text> -->
</view> </view>
</view> </view>
</view> </view>
......
...@@ -36,6 +36,11 @@ page { ...@@ -36,6 +36,11 @@ page {
height: 200rpx; height: 200rpx;
font-size: 12px !important; font-size: 12px !important;
} }
.no-battery image{
width: 200rpx;
height: 200rpx;
border-radius: 50%;
}
.bind-btn{ .bind-btn{
display: flex; display: flex;
justify-content: center; justify-content: center;
...@@ -157,25 +162,28 @@ page { ...@@ -157,25 +162,28 @@ page {
color: #587699; color: #587699;
margin-top: 2px; margin-top: 2px;
} }
.it>text:first-child {
font-size: 30rpx;
}
.iv { .iv {
left: 84rpx; left: 84rpx;
top: 140rpx; top: 132rpx;
} }
.ia { .ia {
left: 110rpx; left: 110rpx;
top: 250rpx; top: 242rpx;
} }
.ix { .ix {
left: 536rpx; left: 536rpx;
top: 250rpx; top: 242rpx;
} }
.is { .is {
left: 590rpx; left: 590rpx;
top: 140rpx; top: 132rpx;
} }
.ic { .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