Kaynağa Gözat

feature: 兼容小王子otr-x wifi版本

Damon 8 ay önce
ebeveyn
işleme
3bf4d4c3a2
2 değiştirilmiş dosya ile 17 ekleme ve 8 silme
  1. 12 3
      pages/index/index.js
  2. 5 5
      pages/index/index.wxml

+ 12 - 3
pages/index/index.js

@@ -15,8 +15,6 @@ import route_constant from '../../utils/route_constant.js'
 
 
 Page({
-
-
   data: {
     bannerList: [{
         imgUrl: 'http://img1.baidu.com/it/u=2343623234,438083234&fm=253&app=138&f=JPEG?w=684&h=1216'
@@ -676,7 +674,18 @@ Page({
   },
 
   ///点击item
-  onTapIem() {},
+  // [{"deviceId":"BLUFI_7cdfa1fcbb24","name":"BLUFI_7cdfa1fcbb24","state":"online","ProdModel":"MW-2AX(WIFI-N)","devName":"猫王小王子OTR-X"}]
+  onTapIem(e) {
+    var that = this;
+    var item = e.currentTarget.dataset.item;
+    var devName = item.devName;
+    if (devName == "猫王小王子OTR-X") {
+      that.setData({
+        indexPage: 1
+      });
+      return;
+    }
+  },
 
   deleteDevice(e) {
     wx.showModal({

+ 5 - 5
pages/index/index.wxml

@@ -28,14 +28,14 @@
 
       <view wx:if="{{deviceList}}">
         <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' ? '2rpx solid #6546A3' : '2rpx solid #F2F5F7'}};" bind:tap="{{item.state && item.state === 'online' ? 'onTapIem' : ''}}">
+          <view class="item_public" style="border: {{item.state && item.state === 'online'&&deviceListIndex === index  ? '4rpx solid #6546A3' : item.state && item.state === 'online'?'2rpx solid #6546A3':'2rpx solid #F2F5F7'}};" data-item="{{item}}" bind:tap="{{item.state && item.state === 'online' ? 'onTapIem' : ''}}">
             <image class="item_public_image" mode="heightFix" src="./../../img/min.png" style="opacity: {{item.state && item.state === 'online' ? '1' : '0.5'}};"></image>
             <view class="item_public_right" style="margin-right: 26rpx; opacity: {{item.state && item.state === 'online' ? '1' : '0.5'}};">
               <view style="height: 190rpx; margin-top: 37rpx; margin-left: 32rpx; flex-direction: column; display: flex;">
                 <view style="flex: 1;">
                   <view style="display: flex;">
                     <view style="color: #333333; font-size: 28rpx; flex: 1;padding-right: 5rpx;">{{item.devName}}</view>
-                    <image mode="heightFix" src="./../../img/add_device_arrow.png" style="width: 48rxp;height: 48rpx;"></image>
+                    <image wx:if="{{item.state && item.state === 'online'&&deviceListIndex === index }}" mode="heightFix" src="./../../img/add_device_arrow.png" style="width: 48rxp;height: 48rpx;"></image>
                   </view>
                   <view style="color: #666666; font-size: 24rpx;">{{item.state && item.state === "online" ? "在线" : "离线"}}</view>
                 </view>
@@ -52,7 +52,7 @@
 
   <view wx:else>
     <!-- 连接设备启用以下版本 -->
-    <view wx:if="{{indexPage==1}}" class="mair" style="height: calc(100vh - 118rpx - {{navBarHeight}}px);">
+    <view wx:if="{{indexPage==1&&deviceListIndex!=null&&deviceList.length>deviceListIndex&&deviceList[deviceListIndex].devName==='猫王小王子OTR-X'}}" class="mair" style="height: calc(100vh - 118rpx - {{navBarHeight}}px);">
       <view class="play-info">
         <view class="info">
           <image src="./../../img/blak.png" class="black" mode="scaleToFill"></image>
@@ -126,7 +126,7 @@
         </view>
       </view>
 
-      <view wx:else class="me" style="height: calc(100vh - 100rpx - {{navBarHeight}}px);">
+      <view wx:elif="{{indexPage==2}}" class="me" style="height: calc(100vh - 100rpx - {{navBarHeight}}px);">
         <view class="head-logo">
           <image mode="scaleToFill" src="{{userPic}}"></image>
           <text class="userName" wx:if="{{userName}}">{{userName}}</text>
@@ -166,7 +166,7 @@
         <image class="bottom_image" mode="widthFix" src="{{indexPage==0?'./../../img/index_action.png':'./../../img/index_unaction.png'}}"></image>
         <view style="font-size: 20rpx;color: {{indexPage==0?'#A4D099':'black'}}; padding-top: 0rpx;margin-top: 0rpx;"> 首页</view>
       </view>
-      <view class="bottom_view" data-index="1" bind:tap="onTapIndex">
+      <view wx:if="{{deviceListIndex!=null&&deviceList.length>deviceListIndex&&deviceList[deviceListIndex].devName==='猫王小王子OTR-X'}}" class="bottom_view" data-index="1" bind:tap="onTapIndex">
         <image class="bottom_image" mode="widthFix" src="{{indexPage==1?'./../../img/channel_action.png':'./../../img/channel_unaction.png'}}"></image>
         <view style="font-size: 20rpx;color: {{indexPage==1?'#A4D099':'black'}};"> 频道</view>
       </view>