更新HttpEncryptionRequest.js

pull/70/head
18idc 2021-03-27 23:21:50 +08:00
parent 78acb83e35
commit ebce6ce680
1 changed files with 7 additions and 15 deletions

View File

@ -110,17 +110,13 @@ layui.define(['jquery'], function (exports) {
* }); * });
* request.start(); * request.start();
*/ */
var HttpEncryptionRequest = function (url, method, successCallback, errorCallback) { var HttpEncryptionRequest = function (url, successCallback, errorCallback) {
// 请求的url一般传参时候需要带上contextPath // 请求的url一般传参时候需要带上contextPath
this.url = url; this.url = url;
// http请求的方法默认不传为post一般传 'get' 或 'post' // http请求的方法
if (method === "" || method == null) { this.method = "post";
this.method = "post";
} else {
this.method = method;
}
// 请求成功的回调 // 请求成功的回调
this.successCallback = successCallback; this.successCallback = successCallback;
@ -145,17 +141,13 @@ layui.define(['jquery'], function (exports) {
/** /**
* http * http
*
* @param parseJsonFlag json true
*/ */
start: function (parseJsonFlag) { start: function () {
var me = this; var me = this;
var result = ""; var result = {};
// 如果请求需要转化为json则将data转为json // 将data转为json字符串
if (parseJsonFlag === true) { me.dataObject = JSON.stringify(me.dataObject);
me.dataObject = JSON.stringify(me.dataObject);
}
// 防止http请求缓存 // 防止http请求缓存
if (this.url.indexOf("?") === -1) { if (this.url.indexOf("?") === -1) {