Commit 7483bfcf by chenweisong

添加带token的post方法

parent e6395235
......@@ -57,6 +57,27 @@
}
});
},
getHttpResultByPOSTWithToken: function (url, param, token, successCallback, async) {
$.showIndicator();
$.ajax({
type: "POST",
url: url,
headers: {'Access-Token': token},
contentType: 'application/x-www-form-urlencoded',
data: param,
async: async, // 默认为true, 即是异步请求函数
beforeSend: function (XMLHttpRequest) {
},
success: function (data) {
successCallback(data);
$.hideIndicator();
},
error: function (data) {
$.hideIndicator();
$.toast("请求出错");
}
});
},
//获取QueryString的数组
getQueryString: function () {
var result = location.search.match(new RegExp("[\?\&][^\?\&]+=[^\?\&]+", "g"));
......
......@@ -53,15 +53,13 @@ $(function () {
});
// getMissionWorkOrder();
function getMissionWorkOrder() {
requestin = true;
Utils.getHttpResultByPOST(context + '/mobile/workordermgr/missionWorkOrder', {
Utils.getHttpResultByPOSTWithToken(context + '/mobile/workordermgr/missionWorkOrder', {
'pageNumber': pageNumber
}, function (res) {
}, token, function (res) {
requestin = false;
res = JSON.parse(res)
if (res.type === '200') {
......@@ -362,7 +360,13 @@ $(function () {
</header>',
onChange: function (e) {
var val = e.value;
var newTime = moment().set({ 'year': val[0], 'month': parseInt(val[1]), 'date': parseInt(val[2]), 'hour': parseInt(val[3]), 'minute': parseInt(val[4]) });
var newTime = moment().set({
'year': val[0],
'month': parseInt(val[1]),
'date': parseInt(val[2]),
'hour': parseInt(val[3]),
'minute': parseInt(val[4])
});
if (!newTime.isAfter(value, "minute")) {
pickerDom.picker("setValue", arr);
}
......@@ -388,7 +392,6 @@ $(function () {
});
// 对口人按钮
$("#xperson1").parent().off("click");
$("#xperson1").parent().on("click", function () {
......@@ -1015,8 +1018,7 @@ $(function () {
$(".counterpart-item").on("click", function () {
$(".person-list-block").html("");
// 获取厂商对口人员信息
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {
}, function (res) {
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {}, function (res) {
res = JSON.parse(res)
if (res.type === '200') {
var list = res.data;
......@@ -1098,8 +1100,7 @@ $(function () {
$(".counterpart-item").on("click", function () {
$(".person-list-block").html("");
// 获取厂商对口人员信息
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {
}, function (res) {
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {}, function (res) {
res = JSON.parse(res)
if (res.type === '200') {
var list = res.data;
......@@ -1286,8 +1287,7 @@ $(function () {
$(".person-list-block").html("");
pid = 0;
// 获取厂商需求处理人
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {
}, function (res) {
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {}, function (res) {
res = JSON.parse(res)
if (res.type === '200') {
var list = res.data;
......@@ -1360,7 +1360,6 @@ $(function () {
}
// 报表数要从1开始
function colsFactory(type) {
if (type === "report") {
......@@ -1799,7 +1798,13 @@ $(function () {
</header>',
onChange: function (e) {
var val = e.value;
var newTime = moment().set({ 'year': val[0], 'month': parseInt(val[1]), 'date': parseInt(val[2]), 'hour': parseInt(val[3]), 'minute': parseInt(val[4]) });
var newTime = moment().set({
'year': val[0],
'month': parseInt(val[1]),
'date': parseInt(val[2]),
'hour': parseInt(val[3]),
'minute': parseInt(val[4])
});
if (!newTime.isAfter(xvalue, "minute")) {
xpickerDom.picker("setValue", xvalueArr);
}
......@@ -1939,6 +1944,7 @@ $(function () {
}
return flag;
}
$(".create-submit-btn").html("提交");
$(".create-submit-btn").off("click")
$(".create-submit-btn").on("click", function () {
......@@ -1989,7 +1995,6 @@ $(function () {
$.init();
function getToken() {
if (!code) {
$.toast("缺少code值");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment