Browse Source

feature: 加入设备模定时设置分包

332777428@qq.com 4 months ago
parent
commit
2881a692b0

+ 1 - 1
app.json

@@ -3,7 +3,6 @@
     "pages/pageA/index/index",
     "pages/pageA/login/login",
     "pages/pageA/deviceList/deviceList",
-    "pages/deviceWake/deviceWake",
     "pages/channelDetail/channelDetail",
     "pages/wakeList/wakeList",
     "pages/connectBle/connectBle",
@@ -17,6 +16,7 @@
       "root": "pages/pageB/",
       "pages": [
         "deviceMode/deviceMode",
+        "deviceWake/deviceWake",
         "deviceConnect0/deviceConnect0",
         "deviceConnect1/deviceConnect1",
         "deviceConnect2/deviceConnect2",

+ 1 - 1
devices/ble_manager.js

@@ -342,7 +342,7 @@ class bleManager {
     const routeUtil = require('../utils/routeUtil');
     const routeRoot = require('../utils/routeRoot');
 
-    const indexRoot = routeRoot.indexRoot;
+    const indexRoot = routeRoot.index;
     const connectBleRoot = routeRoot.connectBleRoot;
     var lastPageRoute = routeUtil.getLastPageRoute();
     if (lastPageRoute != indexRoot && lastPageRoute != connectBleRoot) {

+ 2 - 2
pages/connectBle/connectBle.js

@@ -65,7 +65,7 @@ Page({
     var connectDevice = that.data.connectDevice;
     var isTheSame = getCurrentPages()[0].isTheSameBlue(connectDevice);
     if (isTheSame) {
-      routeUtil.goBackRoute(routeRoot.indexRoot);
+      routeUtil.goBackRoute(routeRoot.index);
       return;
     }
 
@@ -82,7 +82,7 @@ Page({
         device.state = 'online';
         device.imageUrl = device.img;
         getCurrentPages()[0].addBlueDevice(device);
-        routeUtil.goBackRoute(routeRoot.indexRoot);
+        routeUtil.goBackRoute(routeRoot.index);
       }
     }, true);
   },

+ 5 - 5
pages/deviceWake/deviceWake.js

@@ -1,14 +1,14 @@
 const app = getApp();
 const {
   formatNumber
-} = require('../../utils/requestUtil.js');
+} = require('../../../utils/requestUtil.js');
 const {
   deviceWakedetail
-} = require('../../utils/apiUtil.js');
+} = require('../../../utils/apiUtil.js');
 
-import lexin_util from '../../utils/lexin/util.js';
-import routePath from '../../utils/routePath.js';
-import routeUtil from '../../utils/routeUtil.js';
+import lexin_util from '../../../utils/lexin/util.js';
+import routePath from '../../../utils/routePath.js';
+import routeUtil from '../../../utils/routeUtil.js';
 
 Page({
   data: {

+ 0 - 6
pages/deviceWake/deviceWake.json

@@ -1,6 +0,0 @@
-{
-  "usingComponents": {
-    "nav-bar": "./../../components/navbar/navbar",
-    "Toast": "./../../components/toast/toast"
-  }
-}

+ 2 - 3
pages/pageA/index/index.js

@@ -702,9 +702,8 @@ Page({
       return
     };
     var device = deviceList[deviceListSelect];
-    wx.navigateTo({
-      url: './../deviceWake/deviceWake?deviceId=' + device.deviceId + "&clientType=" + device.ProdModel,
-    });
+    var param = '?deviceId=' + device.deviceId + "&clientType=" + device.ProdModel;
+    routeUtil.jumpParam(routePath.deviceWake, param);
   },
 
   ///删除当前设备

+ 2 - 2
pages/pageB/deviceMode/deviceMode.wxml

@@ -1,12 +1,12 @@
 <view class="main">
   <nav-bar class="nav_bar_c" bind:goBack="_goBack" nav-bgc-class="ex-nav-bgc-class" nav-title-class="ex-nav-title-class" ex-back-pre="ex-back-pre" navbar-data='{{nvabarData}}'></nav-bar>
-  <image class="model_bg" src="../../images/device/mode_bg.png" mode="aspectFill" />
+  <image class="model_bg" src="../../../images/device/mode_bg.png" mode="aspectFill" />
   <view class="select_tips">
     <view class="setDeviceModel main_green">开启设备选择{{model}}</view>
     <view wx:if="{{typeList.length > 0}}" class="deviceList">
       <block wx:for="{{typeList}}" wx:key="item">
         <view class="devicePicItem devicePicItem_{{index}}" bindtap="selectDeviceModelTap" data-device="{{item}}">
-          <image class="select_icon" src="{{index === 0 ? '../../images/device/pay_select.png' : '../../images/device/wake_select_no.png'}}"></image>
+          <image class="select_icon" src="{{index === 0 ? '../../../images/device/pay_select.png' : '../../../images/device/wake_select_no.png'}}"></image>
           <view class="device_text">
             <image class="model_icon" src="{{item.icon}}"></image>
             <text class="model_text">{{item.text}}</text>

+ 554 - 0
pages/pageB/deviceWake/deviceWake.js

@@ -0,0 +1,554 @@
+const app = getApp();
+const {
+  formatNumber
+} = require('../../../utils/requestUtil.js');
+const {
+  deviceWakedetail
+} = require('../../../utils/apiUtil.js');
+
+import lexin_util from '../../../utils/lexin/util.js';
+import routePath from '../../../utils/routePath.js';
+import routeUtil from '../../../utils/routeUtil.js';
+
+Page({
+  data: {
+    nvabarData: {
+      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
+      title: '定时设置', //导航栏 中间的标题
+    },
+    switch1Checked: false,
+    alarm_id_0_time: "00:00:00",
+    switch2Checked: false,
+    deviceMac: null,
+    alarm_id_0: {}, // 休眠
+    alarm_id_1: {}, // 唤醒
+    timeindex: 1,
+    timeArray: [{
+        id: 600,
+        name: '10分钟'
+      },
+      {
+        id: 1800,
+        name: '30分钟'
+      },
+      {
+        id: 3600,
+        name: '60分钟'
+      },
+      {
+        id: 5400,
+        name: '90分钟'
+      }
+    ],
+    clientType: "",
+    time0: '00:00:00',
+    time: '07:00:00',
+    repeat: "",
+    repeat0: "",
+    week: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
+    week_actives: [],
+    isOne: true,
+    wakeName: "",
+    toastData: {
+      titlePicUrl: "./../../../img/gt.png",
+      titlePicUrlWidth: 140,
+      title: ["温馨提醒"],
+      info: ["当前设备电量低"],
+      isShowTwoBut: true,
+      twoButText: "好的",
+      footTop: 10,
+    },
+    twoButCallback: () => {},
+    toast_visible: false,
+    // 后续新加需求
+    deviceOther: null,
+    updataDeviceInfo: false,
+    repeatIndex: 0,
+    deviceId: "",
+  },
+
+  onLoad(options) {
+    var that = this;
+
+    var deviceId = options.deviceId;
+    var clientType = options.clientType;
+    var deviceMac = lexin_util.getDeviceMacId(deviceId);
+
+    that.data.deviceId = deviceId;
+    that.data.deviceMac = deviceMac;
+    that.data.clientType = clientType;
+
+    deviceWakedetail({
+      clientType: clientType,
+      deviceMac: deviceMac,
+    }).then((res) => {
+      if (res && res.length > 0) {
+        that.setData({
+          wakeName: res[0].audioName || null
+        });
+      }
+    })
+    app.PubMsg({
+      type: "get_dev_info",
+      DstDeviceName: deviceMac
+    });
+
+    // 赋值按钮回调
+    that.setData({
+      twoButCallback: () => {
+        that.setData({
+          toast_visible: false
+        })
+      }
+    })
+  },
+
+  onShow(options) {
+    var that = this;
+    var deviceMac = that.data.deviceMac;
+    app.PubMsg({
+      type: "get_dev_info",
+      DstDeviceName: deviceMac,
+    });
+  },
+
+  mqttCallback(type, option) {
+    var that = this;
+    let payloads = null;
+    if (option) {
+      payloads = JSON.parse(option.payload);
+    };
+
+    switch (type) {
+      case "message_onoffline":
+        if (payloads.state !== "online") {
+          // option.payload: {"uuid":"AIrSMArT_7cdfa1fcbb24","state":"offline","userid":"1"}
+          var deviceMacId = payloads.uuid;
+          if (deviceMacId == that.data.deviceMac) {
+            wx.showToast({
+              title: '设备已断开连接',
+              icon: 'none',
+              duration: 2000
+            });
+          }
+        }
+        break;
+      case "message":
+        // 设备信息
+        if (payloads.type === "get_dev_info") {
+          that.setData({
+            deviceOther: payloads.other,
+            updataDeviceInfo: true,
+          });
+          if (payloads.other.alarm) {
+            payloads.other.alarm.map((v) => {
+              if (v.alarm_id === "0") {
+                v.action = "update";
+                // 休眠
+                that.setData({
+                  alarm_id_0: v
+                });
+
+                // 定时时间
+                if (v.on_off_timestamp !== "") {
+                  that.setData({
+                    alarm_id_0_time: v.on_off_timestamp
+                  })
+                }
+
+                // 是否启用
+                if (v.enable === "1") {
+                  that.setData({
+                    switch1Checked: true
+                  })
+                } else {
+                  that.setData({
+                    switch1Checked: false
+                  })
+                }
+
+                // 重复
+                if (v.week_actives) {
+                  that.setData({
+                    repeat0: that.repeatText(v.week_actives),
+                  })
+                }
+
+              } else if (v.alarm_id === "1") {
+                // 唤醒
+                that.setData({
+                  alarm_id_1: v
+                });
+                // 定时时间
+                if (v.on_off_timestamp !== "") {
+                  that.setData({
+                    time: v.on_off_timestamp
+                  })
+                }
+                // 是否启用
+                if (v.enable === "1") {
+                  that.setData({
+                    switch2Checked: true
+                  })
+                } else {
+                  that.setData({
+                    switch2Checked: false
+                  })
+                }
+                // 重复
+                if (v.week_actives) {
+                  that.setData({
+                    repeat: that.repeatText(v.week_actives),
+                  })
+                }
+              }
+            })
+          }
+        } else if (payloads.type === "alert_set") {
+          if (payloads.code === 200) {
+            app.PubMsg({
+              type: "get_dev_info",
+              DstDeviceName: that.data.deviceMac
+            });
+          } else {
+            wx.showModal({
+              title: '保存失败',
+              content: '请保持设备网络通畅并检查是否已连接电源?',
+              success(res) {
+                if (res.confirm) {
+                  console.log('用户点击确定')
+                } else if (res.cancel) {
+                  console.log('用户点击取消')
+                }
+              }
+            })
+          }
+        }
+        default:
+    }
+  },
+
+  // 休眠-选择时间
+  switch1Change(e) {
+    var that = this;
+    let other = that.data.alarm_id_0;
+    if (e.detail.value) {
+      that.setData({
+        switch1Checked: e.detail.value
+      });
+      const thisTime = Math.round(new Date() / 1000);
+      other = that.setOther(other, 1);
+      other.on_off_timestamp = that.data.alarm_id_0_time;
+
+      // 有重复
+      if (other.week_actives && other.week_actives.filter((v) => v === 1).length > 0) {
+        // other.week_actives = [0,1,1,1,1,1,0],
+        other.weekly_repeat = "1";
+      } else {
+        other.weekly_repeat = "0";
+      };
+      // 如果跨天了
+      if (!that.compareDate(that.data.alarm_id_0_time, that.formatTime(thisTime, "h:m:s"))) {
+        const date = new Date((that.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
+        other.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
+      };
+      app.PubMsg({
+        type: "alert_set",
+        DstDeviceName: that.data.deviceMac,
+        other
+      });
+    } else {
+      that.setData({
+        switch1Checked: e.detail.value
+      });
+      other = that.setOther(other, 0);
+      app.PubMsg({
+        type: "alert_set",
+        DstDeviceName: that.data.deviceMac,
+        other
+      });
+    }
+  },
+
+  switch2Change(e) {
+    var that = this;
+    that.data.updataDeviceInfo = false;
+    let other = that.data.alarm_id_1;
+    if (e.detail.value) {
+      if (that.data.deviceOther && that.data.deviceOther.Power < 20) {
+        that.setData({
+          toast_visible: true,
+        });
+      };
+      // app.PubMsg({
+      //   type: "get_dev_info",
+      //   DstDeviceName: that.data.deviceMac
+      // });
+      if (!other) {
+        wx.showToast({
+          title: '设备已断开连接',
+          icon: "none"
+        })
+        return
+      }
+      other.on_off_timestamp = that.data.time;
+      other = that.setOther(other, 1);
+      let week_actives = other.week_actives ?? []
+      if (week_actives.filter((v) => v === 1).length > 0) {
+        // other.week_actives = [0,1,1,1,1,1,0],
+        other.weekly_repeat = "1";
+      } else {
+        other.weekly_repeat = "0";
+      };
+
+      app.PubMsg({
+        type: "alert_set",
+        DstDeviceName: that.data.deviceMac,
+        other
+      });
+
+      // 不要循环发送,也不要改alarm_id_0.enable
+      // 循环查询
+      // const Interval = setInterval(() => {
+      //   if (that.data.updataDeviceInfo) {
+      //     clearInterval(Interval);
+      // other.on_off_timestamp = that.data.time;
+      // other = that.setOther(other, 1);
+      // if (other.week_actives.filter((v) => v === 1).length > 0) {
+      //   // other.week_actives = [0,1,1,1,1,1,0],
+      //   other.weekly_repeat = "1";
+      // } else {
+      //   other.weekly_repeat = "0";
+      // };
+      // app.PubMsg({
+      //   type: "alert_set",
+      //   DstDeviceName: that.data.deviceMac,
+      //   other
+      // });
+      // 需打开休眠
+      // if (that.data.alarm_id_0.enable === "0") {
+
+      //   const thisTime = Math.round(new Date() / 1000);
+      //   const alarm_id_0 = that.setOther(that.data.alarm_id_0, 1);
+      //   alarm_id_0.on_off_timestamp = that.data.alarm_id_0_time;
+
+      //   // 有重复
+      //   if (alarm_id_0.week_actives.filter((v) => v === 1).length > 0) {
+      //     alarm_id_0.weekly_repeat = "1";
+      //   } else {
+      //     alarm_id_0.weekly_repeat = "0";
+      //   };;
+      //   // 如果跨天了
+      //   if (!that.compareDate(that.data.alarm_id_0_time, that.formatTime(thisTime, "h:m:s"))) {
+      //     const date = new Date((that.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
+      //     alarm_id_0.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
+      //   };
+      //   app.PubMsg({
+      //     type: "alert_set",
+      //     DstDeviceName: that.data.deviceMac,
+      //     other: alarm_id_0
+      //   });
+      // }
+
+      //   }
+      // }, 500);
+    } else {
+      other = that.setOther(other, 0);
+      app.PubMsg({
+        type: "alert_set",
+        DstDeviceName: that.data.deviceMac,
+        other
+      });
+    }
+  },
+
+  // bindPickerChange(e) {
+  // var that = this;
+  //   let other = that.data.alarm_id_0;
+  //   const thisTime = Math.round(new Date() / 1000);
+  //   other = that.setOther(other, 1);
+  //   other.on_off_timestamp = that.formatTime(thisTime + that.data.timeArray[e.detail.value].id, "h:m:s");
+  //   // 如果跨天了
+  //   if(parseInt(that.formatTime(thisTime + that.data.timeArray[e.detail.value].id, "D")) > parseInt(that.formatTime(thisTime, "D"))) {
+  //     const date = new Date(that.formatTime(thisTime, "Y-M-D") + " 00:00:00");
+  //     other.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
+  //   };
+  //   app.PubMsg({type: "alert_set", DstDeviceName: that.data.deviceMac, other});
+  // },
+
+  bindTimeChange0: function (e) {
+    var that = this;
+    that.setData({
+      alarm_id_0_time: e.detail.value + ":00"
+    });
+    let other = that.data.alarm_id_0;
+    other.on_off_timestamp = e.detail.value + ":00";
+    other = that.setOther(other, 1);
+    // 有重复
+    if (other.week_actives.filter((v) => v === 1).length > 0) {
+      // other.week_actives = [0,1,1,1,1,1,0],
+      other.weekly_repeat = "1";
+    } else {
+      other.weekly_repeat = "0";
+    };
+    // 如果跨天了
+    const thisTime = Math.round(new Date() / 1000);
+    if (!that.compareDate(that.data.alarm_id_0_time, that.formatTime(thisTime, "h:m:s"))) {
+      const date = new Date((that.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
+      other.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
+    };
+    app.PubMsg({
+      type: "alert_set",
+      DstDeviceName: that.data.deviceMac,
+      other
+    });
+  },
+
+  bindTimeChange: function (e) {
+    var that = this;
+    that.setData({
+      time: e.detail.value + ":00"
+    });
+    let other = that.data.alarm_id_1;
+    other.on_off_timestamp = e.detail.value + ":00";
+    other = that.setOther(other, 1);
+    app.PubMsg({
+      type: "alert_set",
+      DstDeviceName: that.data.deviceMac,
+      other
+    });
+  },
+
+  setRepeat(arr) {
+    var that = this;
+    let other = that.data.repeatIndex === "0" ? that.data.alarm_id_0 : that.data.alarm_id_1;
+    other = that.setOther(other, 1);
+    other.week_actives = arr;
+    other.weekly_repeat = arr.filter((v) => v === 1).length > 0 ? "1" : "0";
+    // 倒计时
+    if (that.data.repeatIndex === "0") {
+      // 如果跨天了
+      const thisTime = Math.round(new Date() / 1000);
+      if (!that.compareDate(that.data.alarm_id_0_time, that.formatTime(thisTime, "h:m:s"))) {
+        const date = new Date((that.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
+        other.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
+      };
+    }
+    app.PubMsg({
+      type: "alert_set",
+      DstDeviceName: that.data.deviceMac,
+      other
+    });
+  },
+
+  goWakeList() {
+    var that = this;
+    var deviceId = that.data.deviceId;
+    var clientType = that.data.clientType;
+    ///唤醒的设置特殊,智能这样用
+    var deviceMac = lexin_util.getMacByDeviceId(deviceId);
+    wx.navigateTo({
+      url: './../wakeList/wakeList?clientType=' + clientType + "&deviceMac=" + deviceMac,
+    })
+  },
+
+  gorepeat(e) {
+    var that = this;
+    that.data.repeatIndex = e.currentTarget.dataset.index;
+    that.data.week_actives = e.currentTarget.dataset.index === "0" ? that.data.alarm_id_0.week_actives : that.data.alarm_id_1.week_actives;
+
+    var param = '?week_actives=' + that.data.week_actives;
+    routeUtil.jumpParam(routePath.repeat, param);
+  },
+
+
+  setdeviceWakedetail() {
+    var that = this;
+    deviceWakedetail({
+      clientType: that.data.clientType,
+      deviceMac: that.data.deviceMac,
+    }).then((res) => {
+      that.setData({
+        wakeName: res[0].audioName
+      })
+    })
+  },
+
+  /** 
+   * 时间戳转化为年 月 日 时 分 秒 
+   * number: 传入时间戳 
+   * format:返回格式,支持自定义,但参数必须与formateArr里保持一致 
+   */
+  formatTime(number, format) {
+
+    var formateArr = ['Y', 'M', 'D', 'h', 'm', 's'];
+    var returnArr = [];
+
+    var date = new Date(number * 1000);
+    returnArr.push(date.getFullYear());
+    returnArr.push(formatNumber(date.getMonth() + 1));
+    returnArr.push(formatNumber(date.getDate()));
+
+    returnArr.push(formatNumber(date.getHours()));
+    returnArr.push(formatNumber(date.getMinutes()));
+    returnArr.push(formatNumber(date.getSeconds()));
+
+    for (var i in returnArr) {
+      format = format.replace(formateArr[i], returnArr[i]);
+    }
+    return format;
+  },
+
+  // type: 0 关闭  1 开启
+  setOther(other, type) {
+    var that = this;
+    if (type === 0) {
+      other.enable = "0";
+      other.alarm_name = "close";
+      other.operation = "off";
+    } else if (type === 1) {
+      other.enable = "1";
+      other.alarm_name = "open";
+      other.operation = "on";
+    }
+    const thisTime = Math.round(new Date() / 1000);
+    other.current_timestamp = that.formatTime(thisTime, "Y-M-D h:m:s");
+    other.action = "update",
+      other.song_uri = "-1";
+    other.version = 3;
+    other.is_debug = app.globalData.is_debug
+    return other
+  },
+  // 判断当天时间前后
+  compareDate(t1, t2) {
+    var date = new Date();
+    var a = t1.split(":");
+    var b = t2.split(":");
+    return date.setHours(a[0], a[1]) > date.setHours(b[0], b[1]);
+  },
+
+  repeatText(arr) {
+    var that = this;
+    let text = "";
+    if (arr.toString() === [0, 1, 1, 1, 1, 1, 0].toString()) {
+      text = "工作日";
+    } else if (arr.toString() === [1, 0, 0, 0, 0, 0, 1].toString()) {
+      text = "周末";
+    } else {
+      arr.map((v, index) => {
+        if (v === 1) {
+          if (text === "") {
+            text = text + that.data.week[index]
+          } else {
+            text = text + "、" + that.data.week[index];
+          }
+        }
+      });
+      if (text === "") {
+        text = "不重复";
+      };
+    }
+    return text.length < 20 ? text : "每日";
+  }
+
+})

+ 6 - 0
pages/pageB/deviceWake/deviceWake.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+    "nav-bar": "./../../../components/navbar/navbar",
+    "Toast": "./../../../components/toast/toast"
+  }
+}

+ 8 - 9
pages/deviceWake/deviceWake.wxml

@@ -1,15 +1,14 @@
-<!--pages/deviceWake/deviceWake.wxml-->
 <view class="deviceWake">
   <nav-bar bind:goBack="_goBack" nav-bgc-class="ex-nav-bgc-class" nav-title-class="ex-nav-title-class" ex-back-pre="ex-back-pre" navbar-data='{{nvabarData}}'>
   </nav-bar>
   <view class="content">
     <view class="tip">
-      <image src="./../../img/gt.png" mode="heightFix"></image>
+      <image src="./../../../img/gt.png" mode="heightFix"></image>
       <text>唤醒功能仅在设备进入休眠后生效,请保持设备网络通畅并且电量充足</text>
     </view>
     <view class="waskList">
       <view class="swicth">
-        <image src="./../../img/wk1.png" mode="heightFix"></image>
+        <image src="./../../../img/wk1.png" mode="heightFix"></image>
         <text>倒计时休眠</text>
         <view class="swicth-view">
           <switch color="#6D00FF" checked="{{switch1Checked}}" bindchange="switch1Change" />
@@ -24,7 +23,7 @@
               <text>{{alarm_id_0_time}}</text>
             </view>
           </picker>
-          <image src="./../../img/b.png" mode="heightFix"></image>
+          <image src="./../../../img/b.png" mode="heightFix"></image>
         </view>
       </view>
       <view class="page__bd" style="opacity: {{switch1Checked ? 1 : 0.4}};">
@@ -32,14 +31,14 @@
         <view class="choice">
           <view class="mode" wx:if="{{!switch1Checked}}"></view>
           <text data-index="0" bindtap="gorepeat">{{repeat0}}</text>
-          <image src="./../../img/b.png" mode="heightFix"></image>
+          <image src="./../../../img/b.png" mode="heightFix"></image>
         </view>
       </view>
     </view>
     <view class="hr"></view>
     <view class="waskList">
       <view class="swicth">
-        <image src="./../../img/wk2.png" mode="heightFix"></image>
+        <image src="./../../../img/wk2.png" mode="heightFix"></image>
         <text>定时唤醒</text>
         <view class="swicth-view">
           <switch color="#6D00FF" checked="{{switch2Checked}}" bindchange="switch2Change" />
@@ -54,7 +53,7 @@
               <text>{{time}}</text>
             </view>
           </picker>
-          <image src="./../../img/b.png" mode="heightFix"></image>
+          <image src="./../../../img/b.png" mode="heightFix"></image>
         </view>
       </view>
       <view class="page__bd" style="opacity: {{switch2Checked ? 1 : 0.4}};">
@@ -62,7 +61,7 @@
         <view class="choice">
           <view class="mode" wx:if="{{!switch2Checked}}"></view>
           <text data-index="1" bindtap="gorepeat">{{repeat}}</text>
-          <image src="./../../img/b.png" mode="heightFix"></image>
+          <image src="./../../../img/b.png" mode="heightFix"></image>
         </view>
       </view>
       <!-- <view class="page__bd" style="opacity: {{switch2Checked ? 1 : 0.4}};">
@@ -70,7 +69,7 @@
         <view class="choice">
           <view class="mode" wx:if="{{!switch2Checked}}"></view>
           <text bindtap="goWakeList">{{wakeName}}</text>
-          <image src="./../../img/b.png" mode="heightFix"></image>
+          <image src="./../../../img/b.png" mode="heightFix"></image>
         </view>
       </view> -->
     </view>

+ 0 - 1
pages/deviceWake/deviceWake.wxss

@@ -1,4 +1,3 @@
-/* pages/deviceWake/deviceWake.wxss */
 .content .waskList{
   padding-left: 32rpx;
 }

+ 3 - 2
pages/pageC/repeat/repeat.js

@@ -1,5 +1,6 @@
-Page({
+import routeRoot from '../../../utils/routeRoot.js';
 
+Page({
   data: {
     nvabarData: {
       showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
@@ -43,7 +44,7 @@ Page({
       week_actives: this.data.week_actives
     });
     getCurrentPages().map((v) => {
-      if (v.route === "pages/deviceWake/deviceWake") {
+      if (v.route === routeRoot.deviceWake) {
         v.setRepeat(this.data.week_actives);
       };
     })

+ 3 - 1
pages/wakeList/wakeList.js

@@ -1,4 +1,6 @@
 const app = getApp();
+import routeRoot from '../../utils/routeRoot.js';
+
 let PreselectionIndex = null; // 记录选中的频道
 const {
   deviceWakeList,
@@ -128,7 +130,7 @@ Page({
       // 刷新页面
       that.init();
       getCurrentPages().map((v) => {
-        if (v.route === "pages/deviceWake/deviceWake") {
+        if (v.route === routeRoot.deviceWake) {
           v.setdeviceWakedetail();
         };
       })

+ 2 - 0
utils/routePath.js

@@ -7,6 +7,7 @@ const deviceList = "../../pageA/deviceList/deviceList";
 
 /// B
 const deviceMode = "../../pageB/deviceMode/deviceMode";
+const deviceWake = "../../pageB/deviceWake/deviceWake";
 const deviceConnect0 = "../../pageB/deviceConnect0/deviceConnect0";
 const deviceConnect1 = "../../pageB/deviceConnect1/deviceConnect1";
 const deviceConnect2 = "../../pageB/deviceConnect2/deviceConnect2";
@@ -40,6 +41,7 @@ module.exports = {
   deviceList: deviceList,
   /// B
   deviceMode: deviceMode,
+  deviceWake: deviceWake,
   deviceConnect0: deviceConnect0,
   deviceConnect1: deviceConnect1,
   deviceConnect2: deviceConnect2,

+ 16 - 5
utils/routeRoot.js

@@ -1,11 +1,22 @@
 ///路由
-const indexRoot = "pages/index/index";
-const loginRoot = "pages/login/login";
+
+/// A
+const index = "pages/pageA/index/index";
+const login = "pages/pageA/login/login";
+
+/// B
+const deviceWake = "pages/pageB/deviceWake/deviceWake";
+
+
 const connectBleRoot = "pages/connectBle/connectBle";
 
+
 module.exports = {
-  ///路由
-  indexRoot: indexRoot,
-  loginRoot: loginRoot,
+  /// A
+  index: index,
+  login: login,
+  /// B
+  deviceWake: deviceWake,
+
   connectBleRoot: connectBleRoot,
 }

+ 1 - 1
utils/routeUtil.js

@@ -64,7 +64,7 @@ async function goBack(pages) {
 ///返回到首页,不关闭当前界面
 async function goBackHomePage() {
   const routeRoot = require('./routeRoot.js');
-  await goBackRoute(routeRoot.indexRoot);
+  await goBackRoute(routeRoot.index);
 };
 
 ///返回到某个界面,不替换当前界面