Explorar el Código

Merge branch 'develop/3.2.4_黑胶' of http://60.205.190.38:9000/zhaoheqing/wxmini into develop/3.2.4_黑胶

332777428@qq.com hace 6 meses
padre
commit
d803ce7026
Se han modificado 4 ficheros con 47 adiciones y 18 borrados
  1. 13 13
      pages/index/index.js
  2. 20 0
      pages/ota/ota.js
  3. 6 4
      pages/piano/cropper/cropper.js
  4. 8 1
      pages/piano/wallpaper/wallpaper.js

+ 13 - 13
pages/index/index.js

@@ -41,11 +41,11 @@ Page({
     isLogin: false,
     greeting: "",
     bannerList: [{
-        "pic": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20241028142233669038262.png"
-      },
-      {
-        "pic": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20240823145816541223911.png"
-      }
+      "pic": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20241028142233669038262.png"
+    },
+    {
+      "pic": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20240823145816541223911.png"
+    }
     ],
     autoplay: true,
     interval: 3000, // 切换时间间隔
@@ -235,7 +235,7 @@ Page({
       ///监听蓝牙设备
       BtHelper.getInstance().initBluetoothAdapter();
       BtHelper.getInstance().getBluetoothDevices();
-      BtHelper.getInstance().startScan(null, null, function (res) {});
+      BtHelper.getInstance().startScan(null, null, function (res) { });
       var isFirst = true;
       console.log("开始监听蓝牙设备");
       ///再秒再对比一次
@@ -244,12 +244,12 @@ Page({
       that.data.intervalId1 = setInterval(async function () {
         isFirst = false;
         that.compareList();
-        if (count > 4) {
-          that.stopIntervalId1();
-        } else {
-          count++;
-        }
-      }, isFirst ? 6 * 1000 : 12 * 1000);
+        // if (count > 4) {
+        that.stopIntervalId1();
+        // } else {
+        //   count++;
+        // }
+      }, isFirst ? 3 * 1000 : 10 * 1000);
     }
   },
 
@@ -319,7 +319,7 @@ Page({
       case "connect":
         lexin_subscribe.subscribeAllDevice();
         break;
-        ///再走有在线
+      ///再走有在线
       case "message_onoffline":
         lexin_connect.searchOnlineDevice(payloads, function (list) {
           that.updateDeviceList(list, false, false);

+ 20 - 0
pages/ota/ota.js

@@ -439,6 +439,16 @@ Page({
             // _this.sendOtaCmd(0)
             _this.otaSuccess()
             // BtHelper.getInstance().otaUrl(BtCmd.stringToUint8Array(_this.data._otaData.url))
+          } else if (otaCmd === 0 && kind == 3) {
+            wx.showModal({
+              title: 'OTA升级失败,请重启设备再试试吧',
+              showCancel: false,
+              success: function (res) {
+                if (res.confirm) {
+                  console.log('用户点击确定')
+                }
+              }
+            })
           } else {
             _this.otaFailure()
           }
@@ -453,6 +463,16 @@ Page({
               mask: true
             });
             _this.sendUrlData()
+          } else if (otaCmd === 0 && kind == 3) {
+            wx.showModal({
+              title: 'OTA升级失败,请重启设备再试试吧',
+              showCancel: false,
+              success: function (res) {
+                if (res.confirm) {
+                  console.log('用户点击确定')
+                }
+              }
+            })
           } else {
             // wifi失败
             _this.otaFailure()

+ 6 - 4
pages/piano/cropper/cropper.js

@@ -5,6 +5,7 @@ import EventManager from '../../../utils/event_bus'
 import { EnumCmdEvent, CmdEvent } from '../../../devices/cmd_key_event';
 import js_md5 from '../../../utils/js_md5';
 import store from '../../../utils/store';
+import route_util from '../../../utils/route_util';
 const { BtHelper } = require('../../../devices/bt_helper');
 
 Page({
@@ -34,6 +35,7 @@ Page({
     _imgNext: 0,
     max_scale: 2,
     _hasPermission: false,
+    _hasShowModal: false,
     wallpaper: {},
   },
   cropper: null,
@@ -518,16 +520,16 @@ Page({
   disconnect(event) {
     let _this = this;
     console.log("断开连接", event.commonValue, event.deviceId);
-    if (event.commonValue === "offline") {
+    if (event.commonValue === "offline" && !_this.data._hasShowModal) {
+      _this.data._hasShowModal = true
       wx.showModal({
         title: '提示',
         content: '设备断开连接,请重新连接设备',
         showCancel: false,
         success: function (res) {
+          _this.data._hasShowModal = false;
           if (res.confirm) {
-            wx.navigateBack({
-              delta: 1
-            })
+            route_util.goBackHomePage()
           }
         }
       })

+ 8 - 1
pages/piano/wallpaper/wallpaper.js

@@ -109,6 +109,13 @@ Page({
     let newImg = {
       "pic": topUrl, "id": "0"
     }
+    let myImgList = store.getStore(_this.data._localImgPicKey)
+    myImgList = myImgList ?? []
+    let myIndex = myImgList.findIndex(img => img.pic === findImg.pic);
+    if (myIndex < 0) {
+      myImgList.unshift(newImg)
+    }
+
     let imgList = _this.data._locImageList
     console.log("updateTopImg1", imgList)
     let findImg = imgList.find(function (img) { return img.pic === topUrl })
@@ -131,7 +138,7 @@ Page({
       image4List: _this.data._locImageList.slice(0, 4),
       topImg: newImg
     })
-    store.setStore(_this.data._localImgPicKey, imgList)
+    store.setStore(_this.data._localImgPicKey, myImgList)
     // }
   },
   hideCut(e) {