Blame view

common/requestServer.js 2.3 KB
4b045f7c   刘淇   江阴初始化项目
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  import common from "./common.js";
  
  //js中处理数据
  const searchOrderWithCarNum = function nameCanHidden(CarNum, parkState) {
      return new Promise(resolve => {
          // setTimeout(() => {
          //   resolve('resolved1111111111');
          // }, 2000);
          var me = this;
          uni.showLoading({
              mask: true,
              title: "请稍后..."
          });
          uni.showNavigationBarLoading();
  
          var ParkingrecoderUrl = common.ParkingrecoderUrl;
  
          var jsondata = {
              carNumber: CarNum,
              terminalSource: '11',
              pageNum: '1',
              pageSize: '500',
              parkState: parkState
          }
  
          uni.request({
              url: ParkingrecoderUrl,
              data: JSON.stringify(common.requestSign(jsondata)),
  
              header: { 'content-type': 'application/json' },
              dataType: "json",
              method: "POST",
              success: (res) => {
                  console.log(JSON.stringify(res.data));
                  uni.hideNavigationBarLoading();
                  uni.hideLoading();
                  if (res.data.code == 0) {
                      resolve(res.data);
                  }
                  else if (res.data.code == -10000) {
                      uni.showModal({
                          title: '提示',
                          content: res.data.message,
                          showCancel: false,
                          success: function (res) {
                              if (res.confirm) {
                                  console.log('登录失效');
                                  uni.clearStorageSync();
                              }
                          }
                      });
                  }
              },
              complete: () => {
  
                  uni.hideNavigationBarLoading();
                  uni.hideLoading();
              }
          });
  
      });
  
  }
  
  //js中处理数据
  //  const requestSs =function nameCanHidden() {
  //   return new Promise(resolve => {
  //     setTimeout(() => {
  //       resolve('resolved1111111111');
  //     }, 2000);
  //   });
  // }
  
  //vue中接收处理后的数据
  //           async function asyncCall() {
  // console.log('calling');
  // var result = await requestServer.requestSs();
  // console.log(result);
  // // expected output: 'resolved'
  // }
  // asyncCall();
  
  export default {
      searchOrderWithCarNum
  }