Browse Source

feature: 蓝牙几个步骤分包

332777428@qq.com 6 months ago
parent
commit
4ba8ef95ff

+ 9 - 5
app.json

@@ -8,9 +8,6 @@
     "pages/channelDetails/channelDetails",
     "pages/download/download",
     "pages/wakeList/wakeList",
-    "pages/aboutInfo/aboutInfo",
-    "pages/deviceConMode/index",
-    "pages/connectBle/connectBle",
     "pages/deviceDetail/detail",
     "pages/piano/wallpaper/wallpaper",
     "pages/ota/ota",
@@ -22,11 +19,19 @@
       "root": "pages/pageB/",
       "pages": [
         "about/about",
+        "pages/deviceConMode/deviceConMode",
+        "connectBle/connectBle",
         "deviceConnect0/deviceConnect0",
         "deviceConnect1/deviceConnect1",
         "deviceConnect2/deviceConnect2",
         "deviceConnect3/deviceConnect3"
       ]
+    },
+    {
+      "root": "pages/pageC/",
+      "pages": [
+        "aboutInfo/aboutInfo"
+      ]
     }
   ],
   "window": {
@@ -47,6 +52,5 @@
   "sitemapLocation": "sitemap.json",
   "requiredPrivateInfos": [
     "getFuzzyLocation"
-  ],
-  "deviceOrientation": "portrait"
+  ]
 }

+ 0 - 84
pages/aboutInfo/aboutInfo.js

@@ -1,84 +0,0 @@
-// pages/aboutInfo/aboutInfo.js
-const { protocol, privacy } = require('./text.js');
-const app = getApp();
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    navBarHeight: app.globalData.navBarHeight,
-    MenuButtonTop: app.globalData.MenuButtonTop,
-    nvabarData: {
-      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
-      title: '关于我们', //导航栏 中间的标题
-    },
-    data: [],
-    text: {
-      0: protocol,
-      1: privacy
-    },
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad(options) {
-    this.setData({
-      data: this.data.text[options.type].info,
-      nvabarData: {
-        showCapsule: 1,
-        title: this.data.text[options.type].title
-      }
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
-  }
-})

+ 0 - 5
pages/aboutInfo/aboutInfo.json

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

+ 0 - 10
pages/aboutInfo/aboutInfo.wxml

@@ -1,10 +0,0 @@
-<!--pages/aboutInfo/aboutInfo.wxml-->
-<view class="aboutInfo">
-  <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" style="height: calc(100vh - {{navBarHeight}}px - 62rpx);">
-    <view class="time">本版更新时间:2022年10月31日</view>
-    <view class="time">本版生效时间:2022年10月31日</view>
-    <text wx:for="{{data}}" class="{{item.fontWeight ? 'fontWeight' : ''}}">{{item.text}}</text>
-  </view>
-</view>

+ 0 - 27
pages/aboutInfo/aboutInfo.wxss

@@ -1,27 +0,0 @@
-/* pages/aboutInfo/aboutInfo.wxss */
-.aboutInfo{
-  background-color: #fffaf3;
-}
-.content{
-  display: flex;
-  flex-direction: column;
-  padding: 30rpx;
-  overflow: auto;
-}
-.aboutInfo .content .time{
-  text-align: center;
-}
-.aboutInfo .content text{
-  text-align: justify;
-}
-.aboutInfo .content .time, .aboutInfo .content text{
-  line-height: 44rpx;
-  font-size: 30rpx;
-  margin: 0 0 30rpx;
-  font-weight: 400;
-  color: #000;
-}
-.aboutInfo .content .fontWeight{
-  font-weight: 700;
-  font-size: 36rpx;
-}

File diff suppressed because it is too large
+ 0 - 889
pages/aboutInfo/text.js


File diff suppressed because it is too large
+ 0 - 207
pages/connectBle/connectBle.js


+ 0 - 5
pages/connectBle/connectBle.json

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

+ 0 - 10
pages/connectBle/connectBle.wxml

@@ -1,10 +0,0 @@
-<!-- pages/connectBle/connectBle.wxml -->
-<view class="container">
-  <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>
-  <image class="device_pic" src="{{deviceImg}}" mode="aspectFill" />
-  <view class="top_tips main_black">{{searchTips}}</view>
-  <view style="font-size: 28rpx; color: #666666; margin-top: 32rpx; display: flex; justify-content: center; align-items: center;margin-inline: 32rpx;">
-    {{subTips}}
-  </view>
-  <view class="main_color connect_button" bind:tap="connectDeviceTap">{{buttonTips}}</view>
-</view>

+ 0 - 39
pages/connectBle/connectBle.wxss

@@ -1,39 +0,0 @@
-/* pages/connectBle/connectBle.wxss */
-.container {
-	position: relative;
-	height: 100vh;
-}
-
-.device_pic {
-	margin-top: 128rpx;
-	margin-left: 140rpx;
-	/* margin-right: 140rpx; */
-	width: 470rpx;
-	height: 432rpx;
-	background: #F2F5F7;
-	border-radius: 24rpx;
-}
-
-.top_tips {
-	margin-top: 128rpx;
-	margin-inline: 20rpx;
-	font-size: 28rpx;
-	text-align: center;
-	justify-content: center;
-	align-items: center;
-
-}
-
-.connect_button {
-	margin-top: 456rpx;
-	display: flex;
-	justify-content: center;
-	align-items: center;
-	margin-inline: 64rpx;
-	font-size: 32rpx;
-	font-weight: Medium;
-	color: white;
-	text-align: center;
-	border-radius: 44rpx;
-	height: 88rpx;
-}

+ 0 - 148
pages/deviceConMode/index.js

@@ -1,148 +0,0 @@
-import routeUtil from '../../utils/route_util'
-import route_constant from '../../utils/route_constant.js'
-Page({
-
-  data: {
-    scopeBluetooth: false,
-    userFuzzyLocation: true,
-    nvabarData: {
-      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
-      title: '配网模式选择', //导航栏 中间的标题
-    },
-    isNotruter: false,
-    model: "",
-    connectDevice: {},
-    typeList: [{
-        "icon": "../../images/device/mode_2.png",
-        "text": "WiFi模式",
-        "type": 2,
-      },
-      {
-        "icon": "../../images/device/mode_1.png",
-        "text": "蓝牙模式",
-        "type": 1,
-      },
-      {
-        "icon": "../../images/device/mode_4.png",
-        "text": "4G模式",
-        "type": 4,
-      },
-    ],
-  },
-
-  getModeName(curItem) {
-    // 设备类型:1-蓝牙,2-Wifi,3-传统蓝牙,4-4G
-    var str = "";
-    if (curItem.type == 4) {
-      str = "移动数据模式";
-    } else if (curItem.type == 2) {
-      str = "WiFi模式";
-    } else if (curItem.type == 1) {
-      str = "蓝牙模式";
-    }
-    return str;
-  },
-
-  nextTap(e) {
-    if (this.nullTips()) {
-      return
-    }
-    let device = this.data.typeList[0];
-    let type = device.type ?? 0;
-    console.log("选择模式", type)
-    ///蓝牙模式
-    if (type == 1) {
-      // let device = e.currentTarget.dataset.data
-      let json = JSON.stringify(this.data.connectDevice)
-      routeUtil.jumpParam(route_constant.connectBle, json)
-      // wx.navigateTo({
-      //   url: './../deviceDetail/detail',
-      // });
-    }
-    ///Wifi模式
-    else if (type == 2) {
-      wx.navigateTo({
-        url: './../deviceConnect0/deviceConnect0',
-      });
-    } else if (type == 3) {
-      // btHelper.stopSearch()
-    }
-    ///4G模式
-    else {
-
-    }
-  },
-
-  async selectDeviceModelTap(e) {
-    let device = e.currentTarget.dataset.device;
-    // console.log(e)
-    let type = device.type;
-    if (type == 1) {
-      // this.getConnectedDevices()
-    } else if (type == 2) {
-
-    } else if (type == 3) {
-      // btHelper.stopSearch()
-    } else {
-
-    }
-    var list = []
-    list.push(device)
-    this.data.typeList.forEach(element => {
-      if (element.type != type) {
-        list.push(element)
-      }
-    });
-    this.setData({
-      typeList: list,
-      model: this.getModeName(device)
-    })
-
-  },
-  nullTips() {
-    if (this.data.typeList.length === 0) {
-      wx.showToast({
-        title: '暂不支持该设备配网',
-        icon: 'none',
-      })
-      return true
-    }
-    return false
-  },
-  onLoad: function (options) {
-    let device = JSON.parse(options.param) || {}
-    console.log("配网配对的设备:", device)
-    if (Object.keys(device).length === 0) {
-      wx.showToast({
-        title: '设备数据为空,返回刷新列表试试看',
-      })
-      return;
-    }
-    let _this = this
-    let isWifi = device.clientType != "MW-S2";
-    let isS2 = device.clientType === "MW-S2";
-
-    let _typeList = device.typeList
-      .filter(e => (isWifi && e.type == 2) || isS2)
-      .map(e => ({
-        icon: "../../images/device/mode_" + e.type + ".png",
-        text: _this.getModeName(e),
-        type: e.type
-      }));
-
-    var list = []
-
-    this.data.typeList.forEach(element => {
-      if (_typeList.find(_type => _type.type === element.type)) {
-        list.push(element)
-      }
-    });
-    this.setData({
-      typeList: list,
-      connectDevice: device
-    })
-    this.nullTips()
-
-  },
-
-})

+ 0 - 4
pages/deviceConMode/index.json

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

+ 0 - 22
pages/deviceConMode/index.wxml

@@ -1,22 +0,0 @@
-<!-- pages/deviceConMode/index.wxml -->
-<!-- pages/deviceRoter0/deviceRoter0.wxml -->
-<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" />
-  <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>
-          <view class="device_text">
-            <image class="model_icon" src="{{item.icon}}"></image>
-            <text class="model_text">{{item.text}}</text>
-          </view>
-        </view>
-      </block>
-    </view>
-  </view>
-  <view wx:if="{{typeList.length > 0}}" class="setDeviceModelTips">开启后点击“下一步”</view>
-  <view class="main_color connect_button" bind:tap="nextTap">连接设备</view>
-</view>

+ 0 - 119
pages/deviceConMode/index.wxss

@@ -1,119 +0,0 @@
-/* pages/deviceConMode/index.wxss */
-
-.main {
-  position: relative;
-  height: 100vh;
-}
-
-.model_bg {
-  top: 80;
-  left: 0;
-  position: absolute;
-  width: 100%;
-  height: 100%;
-  z-index: -1;
-  background-size: cover;
-
-}
-
-.select_tips {
-  position: relative;
-  z-index: 1;
-  padding: 20px;
-}
-
-.devicePicItem {
-  display: flex;
-  align-items: center;
-  padding: 10px;
-
-}
-
-.setDeviceModel {
-  padding: 10px;
-  text-align: center;
-  left: 0;
-  font-size: 32rpx;
-}
-
-.setDeviceModelTips {
-  color: #FFFFFFB3;
-  text-align: center;
-  font-size: 24rpx;
-}
-
-.deviceList {
-  margin-top: 60px;
-}
-
-.devicePicItem {
-  position: relative;
-
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: center;
-
-  border-radius: 5px;
-  height: 100rpx;
-  margin-top: 32rpx;
-  background-color: #ffffff0d;
-}
-
-.select_icon {
-  width: 32rpx;
-  height: 32rpx;
-  position: absolute;
-  z-index: 1;
-  top: 16rpx;
-  right: 16rpx;
-}
-
-.device_text {
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: center;
-}
-
-.model_icon {
-  width: 48rpx;
-  height: 48rpx;
-  margin-right: 10rpx;
-}
-
-.model_text {
-  font-size: 32rpx;
-  color: white;
-}
-
-.devicePicItem_0 {
-  margin-left: 32rpx;
-  margin-right: 32rpx;
-}
-
-.devicePicItem_1 {
-  margin-left: 64rpx;
-  margin-right: 64rpx;
-}
-
-.devicePicItem_2 {
-  margin-left: 96rpx;
-  margin-right: 96rpx;
-}
-
-.connect_button {
-  position: fixed;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  bottom: 100rpx;
-  left: 60rpx;
-  right: 60rpx;
-  font-size: 32rpx;
-  font-weight: Medium;
-  color: white;
-  text-align: center;
-  border-radius: 44rpx;
-  height: 88rpx;
-}

+ 22 - 22
pages/pageA/deviceList/deviceList.wxss

@@ -1,38 +1,38 @@
 .container {
-    display: flex;
-    flex-wrap: wrap;
+  display: flex;
+  flex-wrap: wrap;
 }
 
 .grid-container {
-    display: grid;
-    grid-template-columns: repeat(2, 1fr);
-    grid-column-gap: 32rpx;
-    /* grid-row: 32rpx; */
-    padding-inline: 32rpx;
-    padding-top: 16rpx;
+  display: grid;
+  grid-template-columns: repeat(2, 1fr);
+  grid-column-gap: 32rpx;
+  /* grid-row: 32rpx; */
+  padding-inline: 32rpx;
+  padding-top: 16rpx;
 }
 
 .cell {
-    overflow: hidden;
-    /* margin-bottom: 16rpx; */
-    display: flex;
-    flex-direction: column;
-    align-items: center;
+  overflow: hidden;
+  /* margin-bottom: 16rpx; */
+  display: flex;
+  flex-direction: column;
+  align-items: center;
 
 }
 
 .device_img {
-    width: 100%;
-    height: 300rpx;
-    border-radius: 16rpx;
-    background-color: #F2F5F7;
+  width: 100%;
+  height: 300rpx;
+  border-radius: 16rpx;
+  background-color: #F2F5F7;
 }
 
 .device_text {
-    margin-top: 16rpx;
-    text-align: center;
-    width: 100%;
-    font-size: 28rpx;
-    margin-bottom: 72rpx;
+  margin-top: 16rpx;
+  text-align: center;
+  width: 100%;
+  font-size: 28rpx;
+  margin-bottom: 72rpx;
 
 }

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

@@ -69,7 +69,7 @@ Page({
     ////我的界面
     loginStatus: true,
     nickName: "未登录",
-    userPic: './../../img/head_pic.png',
+    userPic: '../../../img/head_pic.png',
     intervalId: null,
     /// 是否第一次自动连接过
     autoConnected: false,
@@ -453,7 +453,7 @@ Page({
       isLogin: false,
       greeting: greeting,
       nickName: nickName,
-      userPic: "./../../img/head_pic.png",
+      userPic: "../../../img/head_pic.png",
     });
 
     var deviceList = that.getDeviceList();

+ 0 - 4
pages/pageB/about/about.js

@@ -6,10 +6,6 @@ Page({
     },
   },
 
-  onLoad(options) {
-
-  },
-
   go(e) {
     wx.navigateTo({
       url: './../aboutInfo/aboutInfo?type=' + e.currentTarget.dataset.index,

+ 1 - 1
pages/pageB/about/about.wxss

@@ -1,4 +1,4 @@
-/* pages/about/about.wxss */
+
 .about-li{
   width: calc(100vw - 34rpx);
   height: 102rpx;

+ 1 - 2
pages/pageB/deviceConnect1/deviceConnect1.wxml

@@ -1,5 +1,4 @@
-<!--pages/deviceRoter1/deviceRoter1.wxml-->
-<!--pages/deviceRoter0/deviceRoter0.wxml-->
+
 <view class="deviceRoter deviceRoter1">
   <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>

+ 1 - 1
pages/pageB/deviceConnect1/deviceConnect1.wxss

@@ -1,4 +1,4 @@
-/* pages/deviceRoter1/deviceRoter1.wxss */
+
 .deviceRoter1 .wifiInfo {
   padding: 0 66rpx;
 }

+ 1 - 1
pages/pageB/deviceConnect3/deviceConnect3.js

@@ -1,4 +1,4 @@
-// pages/deviceConnect3/deviceConnect3.ts
+
 const app = getApp();
 let xBlufi = require("../../../utils/blufi/xBlufi.js");
 import strings from '../../../utils/strings.js';

+ 1 - 1
pages/pageB/deviceConnect3/deviceConnect3.wxss

@@ -1,4 +1,4 @@
-/* pages/deviceRoter3/deviceRoter3.wxss */
+
 .lodRuter{
   margin-top: 54rpx;
 }

File diff suppressed because it is too large
+ 0 - 472
utils/js_md5.js


+ 0 - 36
utils/permission_util.js

@@ -1,36 +0,0 @@
-module.exports = {
-  openBluetoothAdapter: openBluetoothAdapter,
-}
-
-// 打开蓝牙权限
-function openBluetoothAdapter() {
-  return new Promise((resolve, reject) => {
-    wx.openBluetoothAdapter({
-      success: function (res) {
-        resolve(true);
-      },
-      fail: function (res) {
-        if (res.errno == 103) {
-          wx.showModal({
-            title: '提示',
-            content: '需要您的蓝牙权限才能使用此功能,是否前往设置授权?',
-            showCancel: true,
-            success: (modalRes) => {
-              if (modalRes.confirm) {
-                wx.openSetting({
-                  success: (settingRes) => {
-                    resolve(settingRes.authSetting['scope.bluetooth'] ? true : false);
-                  }
-                });
-              } else if (modalRes.cancel) {
-                resolve(false);
-              }
-            }
-          });
-        } else {
-          resolve(false);
-        }
-      }
-    })
-  });
-}

+ 13 - 9
utils/route_constant.js

@@ -1,7 +1,10 @@
 ///路由
+///****************** pageA ********************/
 const indexRoot = "pages/pageA/index/index";
 const loginRoot = "pages/pageA/login/login";
-const connectBleRoot = "pages/connectBle/connectBle";
+
+///****************** pageB ********************/
+const connectBleRoot = "pages/pageB/connectBle/connectBle";
 
 ///跳转路径
 ///****************** pageA ********************/
@@ -11,16 +14,16 @@ const deviceList = "../deviceList/deviceList";
 
 ///****************** pageB ********************/
 const about = "./../../pageB/about/about";
+const connectMode = "./../../pageB/deviceConMode/deviceConMode";
+const connectBle = "./../../pageB/connectBle/connectBle";
 const deviceConnect0 = "./../../pageB/deviceConnect0/deviceConnect0";
 const deviceConnect1 = "./../../pageB/deviceConnect1/deviceConnect1";
 const deviceConnect2 = "./../../pageB/deviceConnect2/deviceConnect2";
-const deviceConnect3 = "./../../pageB/deviceConnect2/deviceConnect3";
-
-const setWifi = "../setWifi/setWifi";
 
+///****************** pageB ********************/
+const aboutInfo = "./../../pageC/aboutInfo/aboutInfo";
 
-const connectMode = "../deviceConMode/index";
-const connectBle = "../connectBle/connectBle";
+const setWifi = "../setWifi/setWifi";
 
 module.exports = {
   ///路由
@@ -31,12 +34,13 @@ module.exports = {
   ///跳转路径
   index: index,
   login: login,
+  deviceList: deviceList,
   about: about,
+  connectMode: connectMode,
+  connectBle: connectBle,
   deviceConnect0: deviceConnect0,
   deviceConnect1: deviceConnect1,
   deviceConnect2: deviceConnect2,
-  deviceList: deviceList,
-  connectMode: connectMode,
-  connectBle: connectBle,
+  aboutInfo: aboutInfo,
   setWifi: setWifi,
 }