瀏覽代碼

Merge remote-tracking branch 'origin/master' into develop/3.2.5

Damon 6 月之前
父節點
當前提交
b4df60a19c
共有 6 個文件被更改,包括 58 次插入44 次删除
  1. 1 1
      app.js
  2. 7 1
      pages/index/index.js
  3. 6 7
      pages/index/index.wxml
  4. 10 23
      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: "",

+ 7 - 1
pages/index/index.js

@@ -238,7 +238,6 @@ Page({
         that.compareList();
       }, isFirst ? 6 * 1000 : 12 * 1000);
     }
-
   },
 
   /// 对比蓝牙数据
@@ -276,6 +275,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;
 

+ 6 - 7
pages/index/index.wxml

@@ -8,12 +8,11 @@
       <view style="font-size: 32rpx; color: #333333; margin-top: 14rpx;">{{greeting}}</view>
 
       <!-- 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">
+      <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>
-              <image mode="widthFix" class="swiper_image" src="{{item.pic}}" data-item="{{item}}" bind:tap="onTapBanner" />
+            <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>
@@ -69,11 +68,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>

+ 10 - 23
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;
@@ -731,23 +728,14 @@
 
 /************************ banner ************************/
 .banner_container {
-  width: 100%;
-  height: 264rpx;
-  margin-top: 32rpx;
-  /* 根据需要调整高度 */
-  overflow: hidden;
-  position: relative;
-  border-radius: 16rpx;
+  margin-top: 24rpx;
+  height: 270rpx;
+  background-color: transparent;
 }
 
-.swiper {
-  width: 100%;
-  height: 264rpx;
-}
-
-.swiper_image {
-  width: 100%;
-  display: block;
+.banner_item {
+  height: 270rpx;
+  background-color: transparent;
 }
 
 /* 设置指示点的大小和颜色 */
@@ -776,12 +764,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;