作者 PPPSCN
提交者 Karson

表单增加slider控件

@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 "font-awesome": "^4.6.1", 11 "font-awesome": "^4.6.1",
12 "bootstrap-table": "~1.11.0", 12 "bootstrap-table": "~1.11.0",
13 "jstree": "~3.3.2", 13 "jstree": "~3.3.2",
14 - "moment": "~2.15.2", 14 + "moment": "^2.20.1",
15 "plupload": "~2.2.0", 15 "plupload": "~2.2.0",
16 "toastr": "~2.1.3", 16 "toastr": "~2.1.3",
17 "jcrop": "~2.0.4", 17 "jcrop": "~2.0.4",
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 "fastadmin-dragsort": "~1.0.0", 32 "fastadmin-dragsort": "~1.0.0",
33 "fastadmin-addtabs": "~1.0.3", 33 "fastadmin-addtabs": "~1.0.3",
34 "fastadmin-selectpage": "~1.0.0", 34 "fastadmin-selectpage": "~1.0.0",
35 - "fastadmin-layer": "~3.1.2" 35 + "fastadmin-layer": "~3.1.2",
  36 + "bootstrap-slider": "*"
36 } 37 }
37 } 38 }
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 @import url("../libs/nice-validator/dist/jquery.validator.css"); 11 @import url("../libs/nice-validator/dist/jquery.validator.css");
12 @import url("../libs/bootstrap-select/dist/css/bootstrap-select.min.css"); 12 @import url("../libs/bootstrap-select/dist/css/bootstrap-select.min.css");
13 @import url("../libs/fastadmin-selectpage/selectpage.css"); 13 @import url("../libs/fastadmin-selectpage/selectpage.css");
  14 +@import url("../libs/bootstrap-slider/slider.css");
14 html, 15 html,
15 body { 16 body {
16 height: 100%; 17 height: 100%;
@@ -33,6 +33,7 @@ require.config({ @@ -33,6 +33,7 @@ require.config({
33 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min', 33 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
34 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile', 34 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
35 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN', 35 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  36 + 'bootstrap-slider': '../libs/bootstrap-slider/bootstrap-slider',
36 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min', 37 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
37 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort', 38 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
38 'sortable': '../libs/Sortable/Sortable.min', 39 'sortable': '../libs/Sortable/Sortable.min',
@@ -368,6 +368,20 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U @@ -368,6 +368,20 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
368 }, 368 },
369 bindevent: function (form) { 369 bindevent: function (form) {
370 370
  371 + },
  372 + slider: function (form) {
  373 + if ($(".slider", form).size() > 0) {
  374 + require(['bootstrap-slider'], function () {
  375 + $('.slider').removeClass('hidden').css('width', function (index, value) {
  376 + return $(this).parents('.form-control').width();
  377 + }).slider().on('slide', function (ev) {
  378 + var data = $(this).data();
  379 + if (typeof data.unit !== 'undefined') {
  380 + $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  381 + }
  382 + });
  383 + });
  384 + }
371 } 385 }
372 }, 386 },
373 api: { 387 api: {
@@ -467,6 +481,8 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U @@ -467,6 +481,8 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
467 481
468 events.fieldlist(form); 482 events.fieldlist(form);
469 483
  484 + events.slider(form);
  485 +
470 events.switcher(form); 486 events.switcher(form);
471 }, 487 },
472 custom: {} 488 custom: {}