1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  | <template> 
 |  </template> 
 |    
 |  <script> 
 |      export default { 
 |              data() { 
 |                   return { 
 |                       
 |                  } 
 |              }, 
 |               
 |              methods:{ 
 |                  // 获取url 
 |                  getUrl() { 
 |                      this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl 
 |                  }, 
 |                   
 |                  findMat() { 
 |                      let that = this 
 |                      uni.request({ 
 |                          url: that.commonUrl + '/mat/auth', 
 |                          data: { 
 |                              matnr:that.matnr 
 |                          }, 
 |                          header: { 
 |                              'token':uni.getStorageSync('token') 
 |                          }, 
 |                          success(result) { 
 |                              uni.vibrateShort(); 
 |                              let res = result.data 
 |                              if (res.code === 200 && res.data) { 
 |                                  that.matData = res.data 
 |                                  that.matnr = '' 
 |                                  uni.navigateTo({ 
 |                                      url: "matQuery", 
 |                                      events: { 
 |                                          // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 
 |                                          matList: function(data) { 
 |                                              console.log(data) 
 |                                              that.matList.push(data.data) 
 |                                          }, 
 |                                      }, 
 |                                      success: function(res) { 
 |                                          // 通过eventChannel向被打开页面传送数据 
 |                                          res.eventChannel.emit('matData', { data: that.matData }) 
 |                                      }, 
 |                                  }); 
 |                              } 
 |                               
 |                          } 
 |                      }); 
 |                       
 |                  }, 
 |                   
 |              } 
 |      } 
 |  </script> 
 |    
 |  <style> 
 |  </style> 
 |  
  |