新版Clever前端请求接口格式

2018-06-23  本文已影响0人  环零弦
private httpDemo() {
  const incrementParams: IncrementParams = {
    route: '/login/test22222',
    uid: '6',
    orderBy: [{
      colIndex: 1,
      orderType: 'DESC'
    }, {
      colIndex: 2,
      orderType: 'ASC'
    }]
  };
  const reqStructure: RequsetStructure = {
    reqParams: {
      name: 'randy',
      number: '123456'
    },
    withCredentials: true
  };
  const reqStructure2: RequsetStructure = {
    reqParams: {
      name: 'vivian',
      number: 'qwerasdf'
    },
    withCredentials: true
  };
  // const submitUrl = 'https://www.sojson.com/open/api/weather/json.shtml?city=长春';
  this.submitService.getHttpSubmit('/req-template/test1111', true, reqStructure)
    .subscribe(data => alert(JSON.stringify(data)), error => {
      console.log(error)
    });
  this.submitService.postHttpSubmit('/req-template/test1111', true, reqStructure2)
    .subscribe(data => alert(JSON.stringify(data)), error => {
      console.log(error)
    });
  this.submitService.getHttpSubmit('/req-template/test2222', true, reqStructure, incrementParams)
    .subscribe(data => alert(JSON.stringify(data)), error => {
      console.log(error)
    });
  this.submitService.postHttpSubmit('/req-template/test2222', true, reqStructure2, incrementParams)
    .subscribe(data => alert(JSON.stringify(data)), error => {
      console.log(error)
    });
}
上一篇下一篇

猜你喜欢

热点阅读