chenyi406 1 year ago
parent
commit
391014650f
3 changed files with 21 additions and 3 deletions
  1. 1 1
      app.js
  2. 18 0
      pages/menu/devices/devices.js
  3. 2 2
      pages/menu/devices/devices.wxml

+ 1 - 1
app.js

@@ -91,7 +91,7 @@ App({
         data: params,
         success: function (res) {
           that.success(url, resolve, res);
-          wx.hideLoading();
+          // wx.hideLoading();
         },
         fail: function () {
           wx.hideLoading();

+ 18 - 0
pages/menu/devices/devices.js

@@ -54,4 +54,22 @@ Page({
     })
   },
 
+  unbind(event) {
+    const that = this;
+    const params = {
+      openNum: event.currentTarget.dataset.opennum
+    }
+    wx.showModal({
+      title: '提示',
+      content: '确定解绑该设备吗?',
+      success(res) {
+        if (res.confirm) {
+          APP.Post(APP.Url.unbind, params).then(res => {
+            APP.Modal.tips("解除成功");
+            that.list();
+          })
+        }
+      }
+    })
+  }
 })

+ 2 - 2
pages/menu/devices/devices.wxml

@@ -3,10 +3,10 @@
   <van-swipe-cell right-width="40" wx:for="{{devices}}" wx:key="openNum">
     <van-cell-group>
       <van-cell title="{{item.deviceName}}" icon="/imgs/phone_icon.png" label="{{item.openNum}}" clickable data-opennum="{{item.openNum}}" bind:click="changeDevice">
-        <van-radio slot="right-icon" name="{{item.isDefault}}" /> 
+        <van-radio slot="right-icon" name="{{item.isDefault}}" />
       </van-cell>
     </van-cell-group>
-    <view class="delete" slot="right">删除</view>
+    <view class="delete" slot="right" bindtap="unbind" data-opennum="{{item.openNum}}">删除</view>
   </van-swipe-cell>
 
 </van-radio-group>