12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- const baseUrl="https://oa.g107.com/";
- var header={
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'A-Token':'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvb2EuZzEwNy5jb21cL2FwaVwvaW50ZWdyYWxcL3dvcmtcL2xpc3QiLCJpYXQiOjE1OTM2NzYwNTQsImV4cCI6MTU5Mzg2NzExMiwibmJmIjoxNTkzODMxMTEyLCJqdGkiOiJlWXM0QWpUNXZDa3I3cTNHIiwic3ViIjoxNDMsInBydiI6ImNhNjQ4OWQ1MGYyNDA3YTY3ODMwZTgwOTBkMDE0ODgzNTY4NTk2MmIiLCJyb2xlIjoiZW1wbG95ZWUifQ.R3Y_3zr4BWpuuEmXKr2H3mvmI7wzHxPI0-lIw59Kvbk'
- }
- export function post(url,data,onsuccess,onfail,oncomplete=function(){}){
- // Content-Type为application/x-www-form-urlencoded即默认的接口请求方式
- dd.httpRequest({
- url: baseUrl+url,
- method: 'POST',
- headers:header,
- data:data,
- dataType: 'json',
- success: function(res) {
- onsuccess(res);
- },
- fail: function(res) {
- onfail(res);
- },
- complete: function(res) {
- oncomplete(res);
- }
- });
- };
- export function get(url,data,onsuccess,onfail,oncomplete=function(){}){
- // Content-Type为application/x-www-form-urlencoded即默认的接口请求方式
- dd.httpRequest({
- url: baseUrl+url,
- method: 'GET',
- headers:header,
- data:data,
- dataType: 'json',
- success: function(res) {
- onsuccess(res);
- },
- fail: function(res) {
- onfail(res);
- },
- complete: function(res) {
- oncomplete(res);
- }
- });
- };
|