This commit is contained in:
sentsin
2018-04-03 06:41:11 +08:00
parent 372fab561e
commit 44663c4ced
34 changed files with 103 additions and 57 deletions

View File

@@ -411,18 +411,18 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
var params = {};
params[request.pageName] = curr;
params[request.limitName] = options.limit;
var tmpdata = "";
if(options.contenttype.indexOf("application/json") == 0){
tmpdata = JSON.stringify($.extend(params, options.where));
} else {
tmpdata = $.extend(params, options.where);
//参数
var data = $.extend(params, options.where);
if(options.contentType && options.contentType.indexOf("application/json") == 0){ //提交 json 格式
data = JSON.stringify(data);
}
$.ajax({
type: options.method || 'get'
,url: options.url
,contentType: options.contenttype
,data: tmpdata
,contentType: options.contentType
,data: data
,dataType: 'json'
,headers: options.headers || {}
,success: function(res){

View File

@@ -88,7 +88,7 @@ layui.define('layer' , function(exports){
var that = this
,options = that.config
,elemFile = that.elemFile = $([
'<input class="'+ ELEM_FILE +'" type="file" accept="'+ options.domAccept +'" name="'+ options.field +'"'
'<input class="'+ ELEM_FILE +'" type="file" accept="'+ options.acceptMime +'" name="'+ options.field +'"'
,(options.multiple ? ' multiple' : '')
,'>'
].join(''))
@@ -134,6 +134,7 @@ layui.define('layer' , function(exports){
options.elem.next('.'+ ELEM_IFRAME).append(function(){
var arr = [];
layui.each(options.data, function(key, value){
value = typeof value === 'function' ? value() : value;
arr.push('<input type="hidden" name="'+ key +'" value="'+ value +'">')
});
return arr.join('');
@@ -196,6 +197,7 @@ layui.define('layer' , function(exports){
//追加额外的参数
layui.each(options.data, function(key, value){
value = typeof value === 'function' ? value() : value;
formData.append(key, value);
});