roose 4 年之前
父節點
當前提交
ff9c62a6bf
共有 5 個文件被更改,包括 77 次插入17 次删除
  1. 5 4
      app.json
  2. 9 5
      pages/index/index.js
  3. 58 3
      pages/visitandinfo/visitandinfo.js
  4. 1 1
      pages/visitandinfo/visitandinfo.wxml
  5. 4 4
      utils/util.js

+ 5 - 4
app.json

@@ -1,15 +1,16 @@
 {
   "pages": [
     "pages/index/index",
-    "pages/love/love",
+    "pages/visitandinfo/visitandinfo",
     "pages/finishInfo/finishInfo",
+    "pages/idCard/idCard",
+    "pages/paiming/paiming",
+    "pages/idCardDetail/idCardDetail",
+    "pages/love/love",
     "pages/login/login",
     "pages/updatepassword/updatepassword",
-    "pages/visitandinfo/visitandinfo",
-    "pages/idCard/idCard",
     "pages/notice/notice",
     "pages/card/card",
-    "pages/paiming/paiming",
     "pages/personInfo/personInfo",
     "pages/collectInfo/collectInfo"
   ],

+ 9 - 5
pages/index/index.js

@@ -44,9 +44,15 @@ Page({
     })
   },
   goTongzhi() {
-    wx.navigateTo({
-      url: '/pages/notice/notice',
-    })
+    if (wx.getStorageSync('user') == '') {
+      wx.redirectTo({
+        url: '/pages/login/login',
+      })
+    } else {
+      wx.navigateTo({
+        url: '/pages/notice/notice',
+      })
+    }
   },
   goPaiming() {
     wx.navigateTo({
@@ -161,8 +167,6 @@ Page({
       })
     }
 
-
-
   },
   onLoad() {
     this.depts();

+ 58 - 3
pages/visitandinfo/visitandinfo.js

@@ -56,6 +56,7 @@ Page({
       // {visitTime: "2020-02-16T11:22:07.697Z",oldInfo:'战三的'},
       // {visitTime: "2020-02-16T11:22:07.697Z",oldInfo:'战三的'},
     ], //探访的数据哈
+    number: null,
   },
   onTabsItemTap: function (event) {
     let index = event.currentTarget.dataset.index;
@@ -95,7 +96,7 @@ Page({
     console.log(e.currentTarget.dataset.infos, "000");
     let photos = e.currentTarget.dataset.infos.visitPhoto.split(",");
     console.log(photos, "打印下锕");
-    
+
     this.setData({
       show: true,
       infos: e.currentTarget.dataset.infos,
@@ -110,12 +111,63 @@ Page({
   //删除
   deletes() {
     console.log("ssss");
+    let that = this;
     wx.showModal({
       content: '该操作会将所有选中数据删除", "是否删除?',
       success(res) {
         if (res.confirm) {
           //确定绑定的操作
-          
+          if (that.data.batchIds.length) {
+            for (let item of that.data.batchIds) {
+              that.deleteById(item);
+            }
+            wx.showToast({
+              title: '删除成功',
+              icon: 'none',
+              duration: 2000,
+              success: function () {
+                switch (that.data.number) {
+                  case 0:
+                    that.openIdInfo();
+                    break;
+                  case 1:
+                    that.openIdInfo({
+                      status: "1"
+                    });
+                    break;
+                  case 2:
+                    that.openIdInfo({
+                      status: "0"
+                    });
+                    break;
+                  case 3:
+                    this.openIdInfo({
+                      status: "2"
+                    });
+                    break;
+                  case 4:
+                    this.openIdInfo({
+                      status: "3"
+                    });
+                    break;
+                  case 5:
+                    that.openIdInfo({
+                      status: "4"
+                    });
+                    break;
+                  default:
+                    that.openIdInfo();
+                }
+              }
+            })
+
+          } else {
+            wx.showToast({
+              title: '请选择要删除的记录',
+              icon: 'none',
+              duration: 2000,
+            })
+          }
 
 
         } else if (res.cancel) {
@@ -165,13 +217,16 @@ Page({
 
   //单选
   checkboxChange: function (e) {
-    console.log(e.detail.value)
+    console.log(e.detail.value, "打印的值是啥呢")
     this.setData({
       batchIds: e.detail.value //单个选中的值
     })
   },
 
   tabsChange(e) {
+    this.setData({
+      number: e.detail.index
+    })
     switch (e.detail.index) {
       case 0:
         this.openIdInfo();

+ 1 - 1
pages/visitandinfo/visitandinfo.wxml

@@ -34,7 +34,7 @@
 						<checkbox-group bindchange="checkboxChange">
 							<view class="tr" wx:for="{{listData}}" wx:key="">
 								<view class="td td22">
-									<checkbox disabled="{{item.status == '3'}}" value="{{item.id}}" checked="{{item.checked}}" />
+									<checkbox disabled="{{item.status == '3'}}" value="{{item._id}}" checked="{{item.checked}}" />
 								</view>
 								<view class="td idcard" value="{{item.text}}" bindtap="cellClick" data-infos='{{item}}'>
 									<view>{{item.name}}</view>

+ 4 - 4
utils/util.js

@@ -1,8 +1,8 @@
 const globalData = {
-  
-  //publicUrl: 'http://info.windd.cn:8080/test',
- publicUrl: 'http://10.16.4.12:7001',
- //publicUrl: 'http://10.16.4.8:7001',
+
+  publicUrl: 'http://info.windd.cn:8080/test',
+  //publicUrl: 'http://10.16.4.12:7001',
+  //publicUrl: 'http://10.16.4.8:7001',
 };
 module.exports = {
   globalData: globalData,