This commit is contained in:
sentsin
2017-11-02 22:57:10 +08:00
parent b9bb7ae8d3
commit d12b73f3e3
40 changed files with 245 additions and 82 deletions

View File

@@ -277,7 +277,7 @@ layui.define('jquery', function(exports){
child.addClass(NAV_ANIM);
bar.css({
left: othis.position().left + parseFloat(othis.css('marginLeft'))
,top: othis.position().top + othis.height() - 5
,top: othis.position().top + othis.height() - bar.height()
});
timer[index] = setTimeout(function(){
@@ -373,17 +373,20 @@ layui.define('jquery', function(exports){
//进度条
,progress: function(){
var ELEM = 'layui-progress';
$('.' + ELEM + elemFilter).each(function(){
var othis = $(this)
,elemBar = othis.find('.layui-progress-bar')
,width = elemBar.attr('lay-percent');
elemBar.css('width', width);
,percent = elemBar.attr('lay-percent');
elemBar.css('width', function(){
return /^.+\/.+$/.test(percent)
? (new Function('return '+ percent)() * 100) + '%'
: percent;
}());
if(othis.attr('lay-showPercent')){
setTimeout(function(){
var percent = Math.round(elemBar.width()/othis.width()*100);
if(percent > 100) percent = 100;
elemBar.html('<span class="'+ ELEM +'-text">'+ percent +'%</span>');
elemBar.html('<span class="'+ ELEM +'-text">'+ percent +'</span>');
},350);
}
});

View File

@@ -1,6 +1,6 @@
/**
@Name : layDate 5.0.7 日期时间控件
@Name : layDate 5.0.8 日期时间控件
@Author: 贤心
@Sitehttp://www.layui.com/laydate/
@LicenseMIT
@@ -55,7 +55,7 @@
}
,laydate = {
v: '5.0.7'
v: '5.0.8'
,config: {} //全局配置项
,index: (window.laydate && window.laydate.v) ? 100000 : 0
,path: ready.getPath
@@ -705,7 +705,7 @@
}
//移除上一个控件
that.remove(Class.thisElem);
that.remove(Class.thisElemDate);
//如果是静态定位则插入到指定的容器中否则插入到body
isStatic ? options.elem.append(elem) : (
@@ -716,8 +716,8 @@
that.checkDate().calendar(); //初始校验
that.changeEvent(); //日期切换
Class.thisElem = that.elemID;
Class.thisElemDate = that.elemID;
typeof options.ready === 'function' && options.ready(lay.extend({}, options.dateTime, {
month: options.dateTime.month + 1
}));
@@ -728,7 +728,7 @@
var that = this
,options = that.config
,elem = lay('#'+ (prev || that.elemID));
if(elem[0] && !elem.hasClass(ELEM_STATIC)){
if(!elem.hasClass(ELEM_STATIC)){
that.checkDate(function(){
elem.remove();
});
@@ -1006,8 +1006,8 @@
//计算当前月第一天的星期
thisDate.setFullYear(dateTime.year, dateTime.month, 1);
startWeek = thisDate.getDay();
prevMaxDate = laydate.getEndDate(dateTime.month, dateTime.year); //计算上个月的最后一天
prevMaxDate = laydate.getEndDate(dateTime.month || 12, dateTime.year); //计算上个月的最后一天
thisMaxDate = laydate.getEndDate(dateTime.month + 1, dateTime.year); //计算当前月的最后一天
//赋值日

View File

@@ -177,7 +177,18 @@ layui.define('layer' , function(exports){
//高级浏览器处理方式,支持跨域
,ajaxSend = function(){
layui.each(files || that.files || that.chooseFiles || elemFile.files, function(index, file){
var successful = 0, aborted = 0
,items = files || that.files || that.chooseFiles || elemFile.files
,allDone = function(){ //多文件全部上传完毕的回调
if(options.multiple && successful + aborted === that.fileLength){
typeof options.allDone === 'function' && options.allDone({
total: that.fileLength
,successful: successful
,aborted: aborted
});
}
};
layui.each(items, function(index, file){
var formData = new FormData();
formData.append(options.field, file);
@@ -186,7 +197,8 @@ layui.define('layer' , function(exports){
layui.each(options.data, function(key, value){
formData.append(key, value);
});
//提交文件
$.ajax({
url: options.url
,type: options.method
@@ -195,11 +207,15 @@ layui.define('layer' , function(exports){
,processData: false
,dataType: 'json'
,success: function(res){
successful++;
done(index, res);
allDone();
}
,error: function(){
aborted++;
that.msg('请求上传接口出现异常');
error(index);
allDone();
}
});
});
@@ -431,6 +447,7 @@ layui.define('layer' , function(exports){
//文件选择
that.elemFile.off('upload.change').on('upload.change', function(){
var files = this.files || [];
that.fileLength = files.length;
setChooseFile(files);
options.auto ? that.upload() : setChooseText(files); //是否自动触发上传
});