1
0

index.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. {extend name="public/layout"/} {block name="title"}集团-每日学练{/block} {block name="body"}
  2. <style type="text/css">
  3. html,
  4. body {
  5. display: block;
  6. min-width: 1100px;
  7. }
  8. .layui-table thead tr,
  9. .layui-table-header {
  10. background-color: #D8E6F1 !important;
  11. }
  12. .layui-fluid {
  13. display: block;
  14. box-shadow: 0 0 4px 0 #B6CADE;
  15. border-radius: 5px;
  16. margin: 15px;
  17. background-color: #ffffff;
  18. }
  19. .layui-tab-title .layui-this {
  20. background-color: #249EFB !important;
  21. color: #fff;
  22. }
  23. .layui-tab-title .layui-this:after {
  24. border-bottom: none;
  25. border: none;
  26. }
  27. .layui-tab-title li {
  28. background-color: #F2F2F2;
  29. margin: 0px 5px;
  30. }
  31. .clearfix::after {
  32. clear: both;
  33. content: ' ';
  34. display: table;
  35. }
  36. .clearfix::before {
  37. content: ' ';
  38. display: table;
  39. }
  40. .width27{
  41. width: 27%;
  42. }
  43. .width19{
  44. width: 19%;
  45. }
  46. .left{
  47. float: left;
  48. }
  49. .center{
  50. text-align: center;
  51. }
  52. .everytopbox{
  53. padding-top: 16px;
  54. color: 384855;
  55. }
  56. .numbox{
  57. display: inline-block;
  58. font-size: 24px;
  59. font-weight: blod;
  60. line-height: 40px;
  61. }
  62. .relative{
  63. position: relative;
  64. }
  65. .numbox span{
  66. position: absolute;
  67. font-size: 14px;
  68. color: #249EFB;
  69. left: 110%;
  70. line-height: 40px;
  71. white-space: nowrap;
  72. }
  73. .toptextbox{
  74. font-size: 16px;
  75. padding-bottom: 16px;
  76. }
  77. .nowstate{
  78. display: inline-block;
  79. font-size: 18px;
  80. font-weight: bold;
  81. line-height: 40px;
  82. color: #249EFB;
  83. }
  84. .testit{
  85. font-size: 18px;
  86. font-weight: bold;
  87. width: auto;
  88. padding: 10px 10px 10px 0;
  89. }
  90. .layui-form-switch{
  91. height: 24px;
  92. line-height: 24px;
  93. margin-top: 6px;
  94. min-width:56px;
  95. padding:0 5px;
  96. }
  97. .layui-form-switch i{
  98. width: 18px;
  99. height:18px;
  100. }
  101. .layui-form-onswitch i{
  102. margin-left: -25px;
  103. }
  104. .layui-form-onswitch {
  105. border-color: #249efb;
  106. background-color: #249efb;
  107. }
  108. .layui-form-switch em{
  109. margin-left: 26px;
  110. }
  111. .layui-form-onswitch em{
  112. margin-left: 5px;
  113. }
  114. .studybox{
  115. margin-top: 24px;
  116. font-size: 14px;
  117. color: #384855;
  118. line-height: 32px;
  119. }
  120. .studytit{
  121. font-size: 16px;
  122. font-weight: bold;
  123. position: relative;
  124. line-height: 24px;
  125. margin-bottom: 10px;
  126. }
  127. .studytit::before{
  128. content: ' ';
  129. display: block;
  130. width: 4px;
  131. height: 16px;
  132. background: #249efb;
  133. position: absolute;
  134. left: -12px;
  135. top: 4px;
  136. }
  137. .daystudybox{
  138. padding: 6px 20px;
  139. }
  140. .border{
  141. border: 1px solid #d6d6d6;
  142. }
  143. .colorblue{
  144. /*color: #249efb;*/
  145. color: #999;
  146. }
  147. .mr12{margin-right: 12px;}
  148. .setbtnbox{
  149. display: block;
  150. width: 66px;
  151. border: 1px solid #249efb;
  152. height:26px;
  153. line-height: 26px;
  154. text-align: center;
  155. border-radius: 4px;
  156. color: #249efb;
  157. cursor: pointer;
  158. font-size: 12px;
  159. margin-left:10px;
  160. }
  161. .testnum{
  162. display: block;
  163. width: 48px;
  164. height: 28px;
  165. border: 1px solid #d2d2d2 !important;
  166. border-radius: 4px;
  167. padding: 0 4px;
  168. margin-right: 8px;
  169. }
  170. .textbox{
  171. margin-left: 20px;
  172. font-size: 12px;
  173. color: #b4b4b4;
  174. }
  175. .savebtn{
  176. display: block;
  177. width: 88px;
  178. height: 32px;
  179. background-color: #249efb;
  180. color: #fff;
  181. text-align: center;
  182. line-height: 32px;
  183. border: unset;
  184. cursor: pointer;
  185. margin-top: 40px;
  186. border-radius: 4px;
  187. overflow: hidden;
  188. }
  189. .layui-form-item .layui-input-inline{width:75px;}
  190. .checkbox-offs .layui-form-switch{margin:-5px 0 0 10px;}
  191. .layui-form-label{padding:0;text-align: left;line-height: 38px;}
  192. </style>
  193. <body>
  194. <!--<div class="layui-fluid">
  195. <div class="layui-card">
  196. <div class="layui-tab">
  197. <ul class="layui-tab-title">
  198. <li class="layui-this">每日学练</li>
  199. </ul>
  200. </div>
  201. </div>
  202. </div>-->
  203. <div class="layui-fluid daystudybox">
  204. <div class="layui-card">
  205. <div class="layui-tab clearfix ">
  206. <div class="width27 left center everytopbox">
  207. <div class="relative numbox">
  208. {if !empty($data['question_cate_count']) && $data['status'] neq 0}
  209. {$data['question_count']}<span>({$data['question_cate_count']}个场景)</span>
  210. {else /}
  211. 0
  212. {/if}
  213. </div>
  214. <div class="toptextbox">试题库数量</div>
  215. </div>
  216. <div class="width27 left center everytopbox">
  217. <div class="relative numbox">
  218. {if !empty($data['train_type_count']) && $data['status'] != 0}
  219. {$data['train_count']}<span>({$data['train_type_count']}个场景)</span>
  220. {else /}
  221. 0
  222. {/if}
  223. </div>
  224. <div class="toptextbox">课件库数量</div>
  225. </div>
  226. <div class="width27 left center everytopbox">
  227. <div class="relative numbox">
  228. {if !empty($data['amount']) && $data['status'] != 0}
  229. {$data['amount']}
  230. {else /}
  231. 0
  232. {/if}
  233. </div>
  234. <div class="toptextbox">每日学练题量</div>
  235. </div>
  236. <div class="width19 left center everytopbox">
  237. <div class="nowstate">
  238. {if $data['status'] == 1}
  239. 开启中
  240. {elseif $data['status'] == 0 /}
  241. 未开启
  242. {/if}
  243. </div>
  244. <div class="toptextbox">功能运行状态</div>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. <div class="layui-fluid">
  250. <form class="layui-form daystudybox">
  251. <div>
  252. <div class="layui-form-item">
  253. <label class="layui-form-label testit">每日学练</label>
  254. <div class="layui-input-block" style="margin-left:86px;">
  255. {if $data['status'] == 1}
  256. <input type="checkbox" name="switch" lay-skin="switch" lay-filter="switchTest" lay-text="开启|关闭" checked>
  257. {elseif $data['status'] == 0 /}
  258. <input type="checkbox" name="switch" lay-skin="switch" lay-filter="switchTest" lay-text="开启|关闭">
  259. {/if}
  260. </div>
  261. </div>
  262. </div>
  263. {if $data['status'] == 1}
  264. <div class="clearfix studybox">
  265. <div class="studytit" style="margin:-5px 0 40px 0;"><span class="left">学练内容设置</span> <div class="left setbtnbox">设置内容</div></div>
  266. <p style="clear:both;"></p>
  267. <div class="clearfix">
  268. <!--<div class="left mr12">
  269. <div class="left">添加学练内容:</div>
  270. <div class="left setbtnbox">设置内容</div>
  271. </div>-->
  272. <div class="left mr12">
  273. 已设置课件类型:
  274. <span class="colorblue">
  275. {if !empty($data['train_class_type'])}
  276. {$data['train_class_type']}
  277. {else /}
  278. 未设置
  279. {/if}
  280. </span>
  281. </div>
  282. <div class="left">
  283. 已设置试题类型:
  284. <span class="colorblue">
  285. {if condition="!empty($data['question_type'])"}
  286. {$data['question_type']}
  287. {else /}
  288. 未设置
  289. {/if}
  290. </span>
  291. </div>
  292. </div>
  293. </div>
  294. <div class="studybox">
  295. <div class="studytit">随机参数设置</div>
  296. <div class="clearfix">
  297. <div class="clearfix">
  298. <div class="left">每日学练个数:</div>
  299. <div class="left clearfix">
  300. <input class="left testnum" name="amount" id="amount" type="number" value="{:empty($data['amount'])?'0':$data['amount']}" />
  301. <span class="left">个</span>
  302. </div>
  303. </div>
  304. <!--<div class="textbox">每日学练个数设置后,员工“添加学练”是设置的随机数不得大于或者或者小于已经设的总量</div>-->
  305. </div>
  306. </div>
  307. <div class="studybox">
  308. <div class="studytit checkbox-offs">限制学练时间 <input class="checkbox-offs" type="checkbox" name="timelimit" id="timelimit" lay-skin="switch" lay-text="开启|关闭" {if $data['timelimit']} checked {/if}></div>
  309. <div class="layui-form-item" style="margin-bottom: 5px;">
  310. <label class="layui-form-label">设置时间段:</label>
  311. <div class="layui-input-inline ">
  312. <input type="text" class="layui-input layui-input-inline" name="starttime" id="starttime" placeholder="开始时间"
  313. autocomplete="off" lay-verify="" value="{:empty($data['starttime'])?'':$data['starttime']}">
  314. <span style="margin-right: 10px;line-height: 38px;">到</span>
  315. <input type="text" class="layui-input layui-input-inline" name="endtime" id="endtime" placeholder="结束时间"
  316. autocomplete="off" lay-verify="" value="{:empty($data['endtime'])?'':$data['endtime']}">
  317. <span style="margin-right: 20px;line-height: 38px;">点</span>
  318. </div>
  319. </div>
  320. <div class="textbox">开启时间段后,在设置的时间段内员工可以进行学习,开启时间段外,则无法进入</div>
  321. </div>
  322. <button lay-submit="" lay-filter="grant-link-submit" class="savebtn" type="button">保存</button>
  323. {/if}
  324. </form>
  325. </div>
  326. </body>
  327. {/block} {block name="js"}
  328. <script>
  329. layui.use(['form', 'table'], function () {
  330. var form = layui.form,
  331. table = layui.table,
  332. $ = layui.$;
  333. form.on('switch(switchTest)', function (data) {
  334. $.ajax({
  335. url: "{:url('day_study/setting')}",
  336. type: 'post',
  337. data: {
  338. status: this.checked?1:0
  339. },
  340. dataType: 'json',
  341. success: function (res) {
  342. if (res.code === 0) {
  343. location.reload();
  344. } else {
  345. layer.msg(res.msg, {
  346. anim: 6
  347. , time: 2000
  348. });
  349. }
  350. }
  351. });
  352. });
  353. form.on('submit(grant-link-submit)', function (data) {
  354. var timelimit = $("#timelimit").get(0).checked?1:0
  355. var start = parseInt($('#starttime').val());
  356. var end = parseInt($('#endtime').val());
  357. if (timelimit) {
  358. if (isNaN(start) || isNaN(end)) {
  359. layer.msg("学习时间段不对", {
  360. anim: 6
  361. , time: 2000
  362. });
  363. return false;
  364. }
  365. if(start<1|| start>24){
  366. layer.msg("开始时间不对", {
  367. anim: 6
  368. , time: 2000
  369. });
  370. return false;
  371. }
  372. if (end > 24 || end < 1) {
  373. layer.msg("结束时间不对", {
  374. anim: 6
  375. , time: 2000
  376. });
  377. return false;
  378. }
  379. if(end<= start){
  380. layer.msg("结束时间不能小于开始时间", {
  381. anim: 6
  382. , time: 2000
  383. });
  384. return false;
  385. }
  386. }
  387. $.ajax({
  388. url: "{:url('day_study/setting')}",
  389. type: 'post',
  390. data: {
  391. amount:$('#amount').val(),
  392. starttime:$('#starttime').val(),
  393. endtime:$('#endtime').val(),
  394. timelimit: $("#timelimit").get(0).checked?1:0
  395. },
  396. dataType: 'json',
  397. success: function (res) {
  398. if (res.code === 0) {
  399. layer.msg('保存成功', {
  400. anim: 5
  401. , time: 2000
  402. });
  403. setTimeout(function () {
  404. location.reload();
  405. }, 2000)
  406. } else {
  407. layer.msg(res.msg, {
  408. anim: 6
  409. , time: 2000
  410. });
  411. }
  412. }
  413. });
  414. });
  415. $('.setbtnbox').click(function(){
  416. layer.open({
  417. type: 2,
  418. title: ['添加学练', 'color:#333333;background-color:#D8E6F1;'],
  419. content: '{:url("dayStudy/setting")}',
  420. resize: false,
  421. area: ['80%', '80%']
  422. });
  423. })
  424. })
  425. </script>
  426. {/block}