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