浏览代码

企业搜索

zhanghongrui 2 年之前
父节点
当前提交
fe27b45e5a
共有 3 个文件被更改,包括 27 次插入4 次删除
  1. 2 2
      base/httputil.js
  2. 23 0
      pages/search/search.js
  3. 2 2
      pages/search/search.wxml

+ 2 - 2
base/httputil.js

@@ -1,7 +1,7 @@
 // let BASE_Server = "http://127.0.0.1:8329"
 
-  // let BASE_Server = "https://192.168.1.100:18080"
-let BASE_Server = "https://sookajs.top:18080"
+   let BASE_Server = "https://192.168.1.100:18080"
+//let BASE_Server = "https://sookajs.top:18080"
 
 
 

+ 23 - 0
pages/search/search.js

@@ -7,6 +7,7 @@ Page({
   data: {
     host: app.globalData.host,
     enterpriseList: [],
+    enterpriseCode:''
   },
   onLoad() {
     this.list(null)
@@ -31,11 +32,33 @@ Page({
     this.list(obj)
   },
 
+  bindViewSearchCode(){
+    let that=this
+    wx.scanCode({
+      onlyFromCamera: true,
+      success: (res) => {
+        that.setData({
+        //['details.code']:res.result,
+        enterpriseCode:res.result
+      })
+      var obj = new Object()
+      obj.enterpriseCode = that.data.enterpriseCode
+      that.list(obj)
+      },
+      fail: (res) => {
+        // wx.showToast({
+        //   title: '扫描失败请重试',
+        //   icon:'none'
+        // })
+      }
+    })
+  },
   list(data) {
     http.post("/system/AppEnterpriseController/getInitEnterpriseList", data, this.getQiyeEnterpriseListSuccess)
   },
 
   getQiyeEnterpriseListSuccess(res) {
+    console.log("@@@",res)
     this.setData({
       enterpriseList: res.rows
     })

+ 2 - 2
pages/search/search.wxml

@@ -2,9 +2,9 @@
   <!-- 搜索 -->
   <view class="search-container">
     <view class="search-left">
-      <input type="text" bindinput="searchEnterprise" placeholder="搜索" />
+      <input type="text" bindinput="searchEnterprise" placeholder="搜索" value="{{enterpriseCode}}" />
     </view>
-    <button bindtap="bindViewSearchEnd" class="search-right">
+    <button bindtap="bindViewSearchCode" class="search-right">
       <text class="iconfont icon-saoyisao1"></text>
     </button>
   </view>