k.zhang 4 rokov pred
rodič
commit
04b744289c
1 zmenil súbory, kde vykonal 56 pridanie a 2 odobranie
  1. 56 2
      pages/shouye/shouye.js

+ 56 - 2
pages/shouye/shouye.js

@@ -116,7 +116,7 @@ Page({
     that.pageSize = 18
         
     wx.request( { 
-      url: "http://127.0.0.1:8081/v1/set", 
+      url: "http://49.234.19.130:8081/v1/set", 
       header: { 
        "Content-Type": "application/json"
       }, 
@@ -305,7 +305,61 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    var that = this
+    wx.getClipboardData({
+      success (res){
+        console.log(res.data)
+        var da = res.data
+        if (res.data != 0){
+          console.log('不为0')
+          wx.showModal({  
+            title: '搜索产品',  
+            content: res.data,  
+            success: function(res) {  
+                if (res.confirm) {  
+                console.log('用户点击确认')  
+                //搜索数据
+                that.page = 1
+                that.pageSize = 18
+                that.pid = "9112489_209622235"
+                that.keyword = da
+                that.activity_tags = ""
+
+                 wx.request( { 
+                 url: "http://49.234.19.130:8081/v1/pdd/ddk/search", 
+                 header: { 
+                   "Content-Type": "application/json"
+                 }, 
+                 method: "POST",
+                //  data:  { page: that.page.toString(), page_size: that.pageSize.toString(),with_coupon:"true", activity_tags: that.activity_tags}, 
+                data: { page: that.page.toString(), page_size: that.pageSize.toString(),with_coupon:"true", pid:that.pid, activity_tags: that.activity_tags,keyword: that.keyword}, 
+                 complete: function( res ) { 
+                   wx.hideLoading();
+                  
+                   console.log(res)
+                   that.totalCount = res.data.data.goods_search_response.total_count
+                   that.data.goodsList = res.data.data.goods_search_response.goods_list
+
+                 that.setData({
+                   goodsList: that.data.goodsList,
+                 })
+             
+                   console.log(res.data.data.goods_search_response)
+                   if( res == null || res.data == null ) { 
+                   console.error( '网络请求失败' ); 
+                   return; 
+                   } 
+                 } 
+                 })
+
+                } else if (res.cancel) {  
+                console.log('用户点击取消')  
+                }  
+            }  
+        })  
+        }
+      }
+    })
   },
 
   /**