set.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <!DOCTYPE html>
  2. <html lang="en" class="no-js">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>期权管理系统</title>
  8. <meta name="description" content="期权管理系统" />
  9. <meta name="keywords" content="期权管理系统" />
  10. <link rel="stylesheet" type="text/css" href="../script/lib/layui/css/layui.css" />
  11. <script src="../script/lib/jquery/jquery.min.js"></script>
  12. <script src="../script/lib/layui/layui.js"></script>
  13. <script src="../script/lib/echarts/echarts.common.min.js"></script>
  14. <script><{Dever::script()}></script>
  15. <script src="../script/dever/core.js"></script>
  16. <link rel="stylesheet" type="text/css" href="../css/main.css" />
  17. <link rel="stylesheet" type="text/css" href="../css/custom-bars.css" />
  18. <style>
  19. .layui-progress-big, .layui-progress-big .layui-progress-bar{
  20. height: 50px;
  21. }
  22. .layui-progress-text {
  23. font-size: 30px;
  24. line-height: 45px;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div class="container">
  30. <header class="codrops-header">
  31. <h1 style="font-size:30px">期权管理系统</h1>
  32. </header>
  33. <section class="content" style="margin:0 auto;width:1000px;">
  34. <article class="flexy-grid">
  35. <h3 style="font-size: 50px;">点击开始进行期权导入</h3>
  36. </article>
  37. <div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="main">
  38. <div class="layui-progress-bar layui-bg-blue" lay-percent="0%"></div>
  39. </div>
  40. </section>
  41. <!-- Related demos -->
  42. <div style="margin:0 auto;width: 100px;">
  43. <div class="site-main-button" style="margin-top: 20px; margin-bottom: 0;">
  44. <button class="layui-btn layui-btn-danger site-main-active" data-type="set" style="display:none;">设置</button>
  45. <button class="layui-btn layui-btn-danger site-main-active" data-type="loading">开始</button>
  46. </div>
  47. </div>
  48. </div>
  49. <script>
  50. var data = <{$list}>;
  51. var total = '<{$total}>';
  52. var n = 0;
  53. var j;
  54. var DISABLED = 'layui-btn-disabled';
  55. layui.use(['element','layer'], function(){
  56. var $ = layui.jquery
  57. ,element = layui.element; //Tab的切换功能,切换事件监听等,需要依赖element模块
  58. var layer = layui.layer;
  59. function loop(i,othis)
  60. {
  61. if (data[i]) {
  62. $('h3').html(data[i]['name']);
  63. i = i+1;
  64. n = parseInt(parseFloat(i) * parseFloat(j));
  65. if (n >= 100) {
  66. n = 100;
  67. othis.removeClass(DISABLED);
  68. }
  69. element.progress('main', n+'%');
  70. setTimeout(function(){loop(i,othis)}, 1000);
  71. } else {
  72. $('h3').html('完成');
  73. othis.removeClass(DISABLED);
  74. element.progress('main', '100%');
  75. }
  76. }
  77. function showAlert(msg, func, title, index, t)
  78. {
  79. if (!title) {
  80. title = '温馨提示';
  81. }
  82. var type = 0;
  83. if (msg.indexOf('<') != -1) {
  84. type = 1;
  85. }
  86. if (t) {
  87. type = t;
  88. }
  89. var config = {
  90. type: 0,
  91. title: title,
  92. shade: 0.1,
  93. shadeClose : true,
  94. content: msg
  95. };
  96. if (index) {
  97. config.zIndex = index;
  98. }
  99. config.scrollbar = false;
  100. if (type == 1) {
  101. config.type = 1;
  102. config.btn = ['保存', '关闭'];
  103. config.area = '500px';
  104. }
  105. config.cancel = config.btn2 = function(index)
  106. {
  107. layer.close(index);
  108. };
  109. if (func) {
  110. config.yes = function(index)
  111. {
  112. func(index);
  113. };
  114. } else {
  115. config.yes = config.cancel;
  116. }
  117. config.success = function() {
  118. //$('.layui-layer-content').css('padding', '10px');
  119. }
  120. config.end = function() {
  121. $('.layui-layer-content').css('overflow-x', 'auto');
  122. $('#update_button').show();
  123. }
  124. var index = layer.open(config);
  125. }
  126. function setIndex()
  127. {
  128. var value = $("#setIndex").val().split('-');
  129. var url = '<{$url}>';
  130. var start = value[0];
  131. var end = value[1];
  132. $.getJSON(url, {start:start,end:end}, function(t) {
  133. total = t.data.total;
  134. data = t.data.list;
  135. layer.closeAll();
  136. });
  137. }
  138. //触发事件
  139. var active = {
  140. set: function(){
  141. //element.progress('main', '50%')
  142. showAlert('<form class="layui-form" style="margin:10px"><div class="layui-form-item"><label class="layui-form-label">索引</label><div class="layui-input-block"><input type="text" id="setIndex" name="" placeholder="请输入账户索引,间隔用-隔开" autocomplete="off" class="layui-input"></div></div></form>', function() {setIndex()});
  143. }
  144. ,loading: function(othis) {
  145. if (total <= 0) {
  146. alert('请先设置');
  147. return;
  148. }
  149. if(othis.hasClass(DISABLED)) return;
  150. othis.addClass(DISABLED);
  151. j = 100/total;
  152. element.progress('main', '0%');
  153. loop(0, othis);
  154. return;
  155. if (n < 100) {
  156. n = 100;
  157. element.progress('main', n+'%');
  158. othis.removeClass(DISABLED);
  159. }
  160. },
  161. };
  162. $('.site-main-active').on('click', function(){
  163. var othis = $(this), type = $(this).data('type');
  164. active[type] ? active[type].call(this, othis) : '';
  165. });
  166. });
  167. </script>
  168. </body>
  169. </html>