|
@ -24,7 +24,8 @@
|
|
|
server = "http://172.19.103.88:9092/wlyy/"
|
|
|
imserver = "http://172.19.103.88:3000/api/v2";
|
|
|
socketUrl = "http://172.19.103.88:3000";
|
|
|
|
|
|
// server = "http://192.168.131.154:8080/"
|
|
|
articleServer="http://172.19.103.88:9092/wlyy/"
|
|
|
// server = "http://192.168.131.133:8080/";
|
|
|
|
|
|
// server = "http://192.168.131.127:8060/"; //逸祥
|
|
@ -37,7 +38,7 @@
|
|
|
imgServer = "http://172.19.103.54/";
|
|
|
}
|
|
|
|
|
|
userAgent = localStorage.getItem(agentName)
|
|
|
userAgent = window.localStorage.getItem(agentName)
|
|
|
|
|
|
|
|
|
if(userAgent) {
|
|
@ -55,7 +56,7 @@
|
|
|
if(isRelogined && location.href.indexOf("login.html") < 0){
|
|
|
sessionStorage.removeItem('wlyy_relogin')
|
|
|
}
|
|
|
|
|
|
|
|
|
function httpGet(url, options) {
|
|
|
//发送ajax请求
|
|
|
return new Promise(function(resolve, reject) {
|
|
@ -80,7 +81,30 @@
|
|
|
}, options));
|
|
|
})
|
|
|
}
|
|
|
|
|
|
function articleGet(url, options) {
|
|
|
//发送ajax请求
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
$.ajax(articleServer + url,
|
|
|
$.extend({}, {
|
|
|
type: 'GET',
|
|
|
dataType: 'JSON',
|
|
|
beforeSend: function(request) {
|
|
|
var agent = userAgent || {
|
|
|
imei: localStorage.getItem('WLYY_IMEI'),
|
|
|
platform: 4
|
|
|
}
|
|
|
request.setRequestHeader("userAgent", JSON.stringify(agent));
|
|
|
},
|
|
|
error: function(res) {
|
|
|
reject(res)
|
|
|
},
|
|
|
success: function(res) {
|
|
|
failCodeHandle(res)
|
|
|
resolve(res)
|
|
|
}
|
|
|
}, options));
|
|
|
})
|
|
|
}
|
|
|
function httpPost(url, options) {
|
|
|
//发送ajax请求
|
|
|
return new Promise(function(resolve, reject) {
|
|
@ -104,6 +128,29 @@
|
|
|
}, options));
|
|
|
})
|
|
|
}
|
|
|
function articlePost(url, options) {
|
|
|
//发送ajax请求
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
$.ajax(articleServer + url,
|
|
|
$.extend({}, {
|
|
|
type: 'POST',
|
|
|
dataType: 'JSON',
|
|
|
beforeSend: function(request) {
|
|
|
var agent = userAgent || {
|
|
|
imei: localStorage.getItem('WLYY_IMEI')
|
|
|
}
|
|
|
request.setRequestHeader("userAgent", JSON.stringify(agent));
|
|
|
},
|
|
|
error: function(res) {
|
|
|
reject(res)
|
|
|
},
|
|
|
success: function(res) {
|
|
|
failCodeHandle(res)
|
|
|
resolve(res)
|
|
|
}
|
|
|
}, options));
|
|
|
})
|
|
|
}
|
|
|
|
|
|
function imHttpGet(url, options) {
|
|
|
//发送ajax请求
|
|
@ -148,6 +195,7 @@
|
|
|
}
|
|
|
|
|
|
function toLoginPage() {
|
|
|
return
|
|
|
if(location.href.indexOf('login.html') > -1) {
|
|
|
return;
|
|
|
}
|
|
@ -242,6 +290,8 @@
|
|
|
imHttpPost: imHttpPost,
|
|
|
getImgUrl: getImgUrl,
|
|
|
imgServer:imgServer,
|
|
|
articleGet:articleGet,
|
|
|
articlePost:articlePost,
|
|
|
failCodeHandle: failCodeHandle,
|
|
|
loginIm: function(data){
|
|
|
return imHttpPost('/users/login', data);
|