Forráskód Böngészése

Merge branch 'develop/3.2.5' into develop/3.2.4_黑胶

* develop/3.2.5:
  feature: 调整首页UI
  feature: 适配ios15和华为的banner
  feature: 调整首页banner UI
  feature: 调整首页banner UI
  feature: 解决频道界面有些图片出现闪屏的问题
  feature: 解决频道界面有些图片出现闪屏的问题
  feature: 删除无用注释文字
  feature: 对设备电量格数做兼容处理,添加电量格数注解
  feature: 处理多个设备在线,关闭当前连接的设备,会假连接其他设备的问题
  feature: 处理多个设备在线,关闭当前连接的设备,会假连接其他设备的问题
  feature: 环境默认正式环境
zeng.chen 6 hónapja
szülő
commit
3b710280a7
6 módosított fájl, 72 hozzáadás és 27 törlés
  1. 1 1
      app.js
  2. 8 1
      pages/index/index.js
  3. 14 5
      pages/index/index.wxml
  4. 15 8
      pages/index/index.wxss
  5. 13 2
      utils/lexin/connect.js
  6. 21 10
      utils/lexin/message.js

+ 1 - 1
app.js

@@ -14,7 +14,7 @@ App({
   globalData: {
     isRelease: true,
     is_debug: 2, // 1 测试环境 // 2正式环境
-    baseUrl: env.test.baseUrl,
+    baseUrl: env.prod.baseUrl,
 
     userInfo: null,
     classifyProducts: "",

+ 8 - 1
pages/index/index.js

@@ -217,6 +217,7 @@ Page({
     var deviceList = store.getStore("deviceList");
 
     if (!strings.isEmpty(deviceList)) {
+      // deviceList = deviceList.concat(deviceList);
       that.updateDeviceList(deviceList, true, false);
     }
 
@@ -244,7 +245,6 @@ Page({
         }
       }, isFirst ? 6 * 1000 : 12 * 1000);
     }
-
   },
 
   /// 对比蓝牙数据
@@ -322,6 +322,13 @@ Page({
             deviceListSelect: null,
             indexPage: indexPage == 1 ? 0 : indexPage,
           });
+        }, function () {
+          var indexPage = that.data.indexPage;
+          that.setData({
+            actionIndex: null,
+            deviceListSelect: null,
+            indexPage: indexPage == 1 ? 0 : indexPage,
+          });
         });
         break;
 

+ 14 - 5
pages/index/index.wxml

@@ -9,7 +9,6 @@
 
       <!-- banner -->
       <view wx:if="{{bannerList.length>0}}" class="banner_container">
-
         <swiper class="swiper" indicator-dots="{{bannerList.length>1}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="{{circular}}" indicator-active-color="#FFFFFF" indicator-color="#999999">
           <block wx:for="{{bannerList}}" wx:key="index">
             <swiper-item>
@@ -18,16 +17,26 @@
           </block>
         </swiper>
       </view>
+      <!-- banner -->
+      <!-- <view wx:if="{{bannerList.length>0}}" class="banner_container" style="width: calc(100vw - 64rpx);   border-radius: 16rpx;">
+        <swiper style="width: calc(100vw - 64rpx);   border-radius: 16rpx;" indicator-dots="{{bannerList.length>1}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="{{circular}}" indicator-active-color="#FFFFFF" indicator-color="#999999">
+          <block wx:for="{{bannerList}}" wx:key="index">
+            <swiper-item style="width: calc(100vw - 64rpx); border-radius: 16rpx;">
+              <image class="banner_item" style="width: calc(100vw - 64rpx); border-radius: 16px;" src="{{item.pic}}" mode="aspectFill" bindtap="onTapBanner" data-item="{{item}}" lazy-load="true"></image>
+            </swiper-item>
+          </block>
+        </swiper>
+      </view> -->
 
       <view class="add_device_public" bind:tap="jumpToAddDevice">
         <image mode="heightFix" src="./../../img/add_device.png" style="width: 48rpx;height: 48rpx;"></image>
         <view style="color: white; margin-left: 8rpx; font-size: 32rpx;">添加设备</view>
       </view>
 
-      <scroll-view scroll-y="true" style="height: calc(100vh - 152rpx - 296rpx - 46rpx - 105rpx - {{safeBottomHeight}}rpx - 5rpx - {{navBarHeight}}px); padding-top: 10rpx; padding-bottom: 10rpx;">
+      <scroll-view scroll-y="true" style="height: calc(100vh - 152rpx - 296rpx - 46rpx - 105rpx - {{safeBottomHeight}}rpx - 5rpx - {{navBarHeight}}px);">
         <block wx:key="key" wx:for-item="item" wx:for-index="index" wx:for="{{deviceList}}">
 
-          <view class="item_public" style="border: {{item.state && item.state === 'online'&&deviceListSelect === index  ? '6rpx solid #6546A3' : item.state && item.state === 'online'?'2rpx solid #6546A3':'2rpx solid #F2F5F7'}};  flex-direction: row; display: flex;" data-item="{{item}}" data-index="{{index}}" bind:tap="onTapItem">
+          <view class="item_public" style="border: {{item.state && item.state === 'online'&&deviceListSelect === index  ? '6rpx solid #6546A3' : item.state && item.state === 'online'?'2rpx solid #6546A3':'2rpx solid #F2F5F7'}};  flex-direction: row; display: flex; margin-top: 10rpx; margin-bottom: {{index==0?deviceList.length-1:0}}rpx; " data-item="{{item}}" data-index="{{index}}" bind:tap="onTapItem">
 
             <view style="width: 264rpx; height: 200rpx;">
               <image class="item_public_image" src="{{item.imageUrl}}" style="opacity: {{item.state && item.state === 'online' ? '1' : '0.5'}};" mode="aspectFit" lazy-load="true" webp="true"></image>
@@ -69,11 +78,11 @@
     <view wx:else>
 
       <!-- 频道 -->
-      <view wx:if="{{indexPage==1&&deviceListSelect!=null&&deviceList.length>deviceListSelect&&deviceList[deviceListSelect].connectType===3}}" class="mair" style="height: calc(100vh - 105rpx - {{safeBottomHeight}}rpx - 22rpx - {{navBarHeight}}px);">
+      <view wx:if="{{deviceListSelect!=null&&deviceList.length>deviceListSelect&&deviceList[deviceListSelect].connectType===3}}" class="mair" style="height: calc(100vh - 105rpx - {{safeBottomHeight}}rpx - 22rpx - {{navBarHeight}}px);">
         <view class="play-info">
           <view class="info">
             <image src="./../../img/blak.png" class="black" mode="scaleToFill"></image>
-            <image src="./../../img/mm.png" class="mode" mode="scaleToFill"></image>
+            <image src="./../../img/mm.png" class="mode" mode="widthFix"></image>
             <image class="logo" mode="heightFix" src="./../../img/logo.png"></image>
             <view wx:if="{{actionIndex !== null}}" style="opacity: 0.8; text-shadow:0px 0px 4px #6D00FF;" class="fm">
               FM.{{actionIndex !== null ? (actionIndex + 1 < 10 ? "0" + (actionIndex + 1) : actionIndex + 1) : 00}} </view>

+ 15 - 8
pages/index/index.wxss

@@ -107,7 +107,7 @@
   top: 0;
   left: 0;
   width: 96rpx;
-  height: 152rpx;
+  height: 148rpx;
   z-index: 999;
 }
 
@@ -169,6 +169,7 @@
 }
 
 .mair .play-info .info .fm .gochnnalList {
+  width: 50rpx;
   height: 50rpx;
   position: absolute;
   top: 8rpx;
@@ -506,6 +507,7 @@
 
 .wake {
   height: 48rpx;
+  width: 48rpx;
   z-index: 1000;
 }
 
@@ -683,11 +685,6 @@
   right: 0rpx;
 }
 
-.me .list .li .button image.logo {
-  height: 34rpx;
-  margin-left: 12rpx;
-}
-
 .login {
   position: fixed;
   bottom: 184rpx;
@@ -750,6 +747,17 @@
   display: block;
 }
 
+/* .banner_container {
+  margin-top: 24rpx;
+  height: 270rpx;
+  background-color: transparent;
+}
+
+.banner_item {
+  height: 270rpx;
+  background-color: transparent;
+} */
+
 /* 设置指示点的大小和颜色 */
 .swiper_dot {
   width: 10px;
@@ -776,12 +784,11 @@
   /* 当前选中指示点的高度(可以比未选中时稍大) */
 }
 
-
 .add_device_public {
   background-color: #6546A3;
   width: 80vw;
   height: 88rpx;
-  margin-top: 64rpx;
+  margin-top: 32rpx;
   margin-left: 5%;
   border-radius: 72rpx;
   display: flex;

+ 13 - 2
utils/lexin/connect.js

@@ -9,7 +9,7 @@ module.exports = {
 ///更新在线状态,连接第一个在线设备
 // deviceId: BLUFI_7cdfa1fd3af0
 // uuid: AIrSMArT_7cdfa1fd3af0
-function searchOnlineDevice(payloads, changeCallback, resetCallback) {
+function searchOnlineDevice(payloads, changeCallback, offlineConnectedCallback, resetCallback) {
   var isChanged = false;
   const strings = require('../strings');
   const lexin_util = require('../lexin/util');
@@ -17,6 +17,7 @@ function searchOnlineDevice(payloads, changeCallback, resetCallback) {
   var deviceList = pages[0].getDeviceList();
 
   /// 处理在线设备
+  var isOfflineCurrent = false;
   if (!strings.isEmpty(deviceList)) {
     for (var i = 0; i < deviceList.length; i++) {
       if (payloads && payloads.uuid) {
@@ -28,9 +29,16 @@ function searchOnlineDevice(payloads, changeCallback, resetCallback) {
           var index = payloads.uuid.indexOf(mac);
           if (index !== -1) {
             var connectDeviceIding = pages[0].getConnectDeviceIding();
-            if (connectDeviceIding != device.deviceId && device.state != payloads.state) {
+            if (connectDeviceIding != deviceId && device.state != payloads.state) {
               isChanged = true;
               device.state = payloads.state;
+              /// 离线的设备正好是当前设备
+              if (device.state == "offline") {
+                var currentConnnectDeviceId = pages[0].getCurrentDeviceId();
+                if (currentConnnectDeviceId == deviceId) {
+                  isOfflineCurrent = true;
+                }
+              }
             }
             break;
           }
@@ -42,6 +50,9 @@ function searchOnlineDevice(payloads, changeCallback, resetCallback) {
   if (isChanged) {
     changeCallback(deviceList);
   }
+  if (isOfflineCurrent) {
+    offlineConnectedCallback();
+  }
   _connectToDevice(resetCallback);
 };
 

+ 21 - 10
utils/lexin/message.js

@@ -107,17 +107,28 @@ function getDeviceInfo(payloads) {
 ///获取电量
 function getBattery(battery) {
   var b = 0;
+  ///0格 10
   if (battery < 20) {
-    _babttery = 0
-  } else if (20 <= battery && battery < 40) {
-    b = 1
-  } else if (40 <= battery && battery < 60) {
-    b = 2
-  } else if (60 <= battery && battery < 80) {
-    b = 3
-  } else if (80 <= battery && battery <= 100) {
-    b = 4
-  } else if (battery > 100) {
+    b = 0;
+  }
+  ///1格 20、30
+  else if (20 <= battery && battery < 40) {
+    b = 1;
+  }
+  ///2格 40、50
+  else if (40 <= battery && battery < 60) {
+    b = 2;
+  }
+  ///3格 60、70
+  else if (60 <= battery && battery < 80) {
+    b = 3;
+  }
+  ///满格 4格 80、90
+  else if (80 <= battery && battery <= 100) {
+    b = 4;
+  }
+  /// 充电中
+  else if (battery > 100) {
     b = 5
   };
   return b;