You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
808 B
38 lines
808 B
define(["mui", "app"], function(mui, app) { |
|
var clientid; |
|
try { |
|
clientid = plus.device.uuid; |
|
} catch(e) {} |
|
|
|
function Ajax(ajaxObj, data) { |
|
this.ajaxObj = ajaxObj; |
|
this.data = data; |
|
} |
|
Ajax.prototype.then = function(resolve, reject) { |
|
mui.ajax(this.ajaxObj.getUrl, { |
|
headers: { |
|
"X-Requested-Token": app.getTokenStorage(), // token头部 |
|
"locale": app.getLanguageLocalStorage() // 语种头部 |
|
}, |
|
data: this.data, |
|
dataType: 'json', |
|
type: this.ajaxObj.getType, |
|
timeout: 10000, |
|
success: function(rest) { |
|
resolve(rest); |
|
}, |
|
error: function(xhr, type, errorThrown) { |
|
reject ? reject():function(){ |
|
console.log(type + ":" + errorThrown); |
|
} |
|
} |
|
}); |
|
} |
|
|
|
function send(ajaxObj, data) { |
|
return new Ajax(ajaxObj, data); |
|
} |
|
return { |
|
send: send |
|
} |
|
}) |