From 4e44bc1fd7806a6c1611302120882b91d96640b5 Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Mon, 27 Apr 2020 17:50:19 +0800
Subject: [PATCH] bug修复

---
 SunshineLnsMinApp/pages/zscqdxal/zscqdxal.js |  111 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 77 insertions(+), 34 deletions(-)

diff --git a/SunshineLnsMinApp/pages/zscqdxal/zscqdxal.js b/SunshineLnsMinApp/pages/zscqdxal/zscqdxal.js
index a1dc494..e0b32c7 100644
--- a/SunshineLnsMinApp/pages/zscqdxal/zscqdxal.js
+++ b/SunshineLnsMinApp/pages/zscqdxal/zscqdxal.js
@@ -1,9 +1,9 @@
 // pages/dxal/dxal.js
-import {
-  $startWuxRefresher,
-  $stopWuxRefresher,
-  $stopWuxLoader
-} from '../../templeteDist/wuxDist/index';
+// import {
+//   $startWuxRefresher,
+//   $stopWuxRefresher,
+//   $stopWuxLoader
+// } from '../../templeteDist/wuxDist/index';
 
 var app = getApp();
 
@@ -18,17 +18,39 @@
     dongtai3_1: app.globalData.imgUrl + '/image/dongtai3-1.jpg',
     inputShowed: false,
     inputVal: "",
-
+    value: '知识产权',
     items: [],
-    count: 0,
+    count: 1000,
     scrollTop: 0,
   },
 
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function(options) {
-    $startWuxRefresher();
+
+  onShow: function(options) {
+    this.showList()
+  },
+
+  showList: function() {
+    var that = this;
+    wx.showLoading();
+    wx.request({
+      url: app.globalData.url + '/api/v1/searchLaw/caseSearch?page=1&size=' + this.data.count + '&words=' + this.data.value,
+      success: function(res) {
+        wx.hideLoading();
+        console.log('res.data.data', res.data.data.data)
+        console.log('res', res)
+        if (res.data.code == 0) {
+          that.setData({
+            items: [...res.data.data.data]
+          })
+          // $stopWuxRefresher()
+          // $stopWuxLoader('#wux-refresher', this, true)
+        } else {
+          wx.showToast({
+            title: res.data.msg,
+          })
+        }
+      }
+    })
   },
   onPageScroll(e) {
     this.setData({
@@ -38,32 +60,23 @@
   onRefresh() {
     console.log('onRefresh')
 
-    this.setData({
-      count: 10
-    })
+    // this.setData({
+    //   count: 10
+    // })
 
-    setTimeout(() => {
-      this.setData({
-        items: this.getList()
-      })
-      $stopWuxRefresher()
-    }, 1000)
+    this.showList();
+
+
+    // setTimeout(() => {
+    //   this.setData({
+    //     items: this.getList()
+    //   })
+    //   $stopWuxRefresher()
+    // }, 1000)
   },
   onLoadmore() {
     console.log('onLoadmore')
-    setTimeout(() => {
-      this.setData({
-        items: [...this.data.items, ...this.getList(10, this.data.count)],
-        count: this.data.count + 10,
-      })
-
-      if (this.data.items.length < 30) {
-        $stopWuxLoader()
-      } else {
-        console.log('没有更多数据')
-        $stopWuxLoader('#wux-refresher', this, true)
-      }
-    }, 1000)
+    this.showList();
   },
 
   getList: (count = 10, step = 0) => [...new Array(count)].map((n, i) => ({
@@ -96,4 +109,34 @@
       inputVal: ""
     }, () => {});
   },
+
+  searchIcon(e) {
+    console.log('onChange', e)
+    this.setData({
+      value: e.detail.value,
+    })
+  },
+  onFocus(e) {
+    console.log('onFocus', e)
+  },
+  onBlur(e) {
+    console.log('onBlur', e);
+    this.showList()
+  },
+  onConfirm(e) {
+    console.log('onConfirm', e);
+    this.showList()
+  },
+  onClear(e) {
+    console.log('onClear', e)
+    this.setData({
+      value: '',
+    })
+  },
+  onCancel(e) {
+    console.log('onCancel', e)
+    this.setData({
+      value: '',
+    })
+  },
 })
\ No newline at end of file

--
Gitblit v1.8.0