teach_progress.php 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437
  1. <link href="/css/base.css" rel="stylesheet">
  2. <link rel="stylesheet" type="text/css" href="/css/jquery.datetimepicker.css" />
  3. <script src="/js/jquery.validate.min.js"></script>
  4. <style>
  5. body{
  6. position: initial;
  7. }
  8. .screen{
  9. margin: 0 30px;
  10. font-size: 16px;
  11. color: #666666;
  12. }
  13. .screen-rows{
  14. margin: 20px 0;
  15. line-height: 30px;
  16. /*overflow: hidden;*/
  17. }
  18. .screen-rows-title{
  19. line-height: 25px;
  20. font-size: 18px;
  21. color: #333;
  22. }
  23. .subject{
  24. margin-right: 50px;
  25. }
  26. .subject>select, .grade>select{
  27. width: 120px;
  28. height: 30px;
  29. }
  30. .go-back{
  31. font-size: 16px;
  32. border: none;
  33. color: #2977ff;
  34. outline: none;
  35. background: #fff;
  36. cursor: pointer;
  37. }
  38. .teaching-class{
  39. display: flex;
  40. }
  41. .active-class-box{
  42. /*display: flex;*/
  43. padding: 5px;
  44. background: #F8F8F8;
  45. }
  46. #classSelected{
  47. margin: 5px;
  48. }
  49. .active-class{
  50. margin: 5px;
  51. padding: 0 20px;
  52. border: 1px solid #2977ff;
  53. border-radius: 2px;
  54. }
  55. .add-active-class{
  56. margin: 5px;
  57. font-size: 16px;
  58. color: #2977ff;
  59. cursor: pointer;
  60. }
  61. .add-active-class>img{
  62. display: inline-block;
  63. width: 18px;
  64. height: 18px;
  65. vertical-align: middle;
  66. margin-right: 2px;
  67. }
  68. .btn-delete, .btn-delete-chapter {
  69. display: inline-block;
  70. margin-left: 10px;
  71. font-size: 14px;
  72. color: red;
  73. cursor: pointer;
  74. }
  75. .screen .date input {
  76. height: 30px;
  77. border-radius: 4px;
  78. border: 1px solid #ccc;
  79. box-shadow: none;
  80. text-indent: 10px;
  81. }
  82. .look-history{
  83. width: 120px;
  84. line-height: 30px;
  85. border: 1px solid #2977ff;
  86. color: #2977ff;
  87. outline: none;
  88. background: #fff;
  89. cursor: pointer;
  90. }
  91. .screen-msg{
  92. font-size: 14px;
  93. color: #2977ff;
  94. }
  95. .img-add-versions{
  96. margin-left: 10px;
  97. vertical-align:middle;
  98. cursor: pointer;
  99. }
  100. .chapter-box-wrap{
  101. width: 100%;
  102. border: 1px solid #333;
  103. padding: 10px;
  104. overflow-x: auto;
  105. overflow-y: hidden;
  106. }
  107. .chapter-box{
  108. display: inline-flex;
  109. overflow-x: auto;
  110. overflow-y: hidden;
  111. }
  112. .chapter{
  113. margin: 5px;
  114. padding: 10px;
  115. width: 20px;
  116. height: 380px;
  117. line-height: 30px;
  118. color: #fff;
  119. font-size: 22px;
  120. text-align: center;
  121. box-sizing: content-box !important;
  122. -moz-box-sizing: content-box;
  123. -webkit-box-sizing: content-box;
  124. -o-box-sizing: content-box;
  125. -ms-box-sizing: content-box;
  126. word-break: break-all;
  127. }
  128. .chapter-box .type-versions{
  129. background-color: #52596A;;
  130. }
  131. .chapter-box .type-chapter{
  132. background-color: #747E9A;
  133. }
  134. .chapter-box .type-knowledge{
  135. background-color: #99B7D6;
  136. }
  137. .chapter:hover{
  138. background-color: #f2988f;
  139. cursor: pointer;
  140. }
  141. .chapter-box .active{
  142. background-color: #f2988f;
  143. }
  144. .active-chapter-box{
  145. /*display: flex;*/
  146. padding: 10px;
  147. }
  148. .active-chapter{
  149. float:left;
  150. margin-right: 10px;
  151. margin-bottom: 10px;
  152. padding: 0 20px;
  153. border: 1px solid #619aff;
  154. }
  155. .btn-box{
  156. padding: 10px 0;
  157. /*border-top: 1px solid #dcdcdc;
  158. border-bottom:1px solid #dcdcdc;*/
  159. text-align: center;
  160. }
  161. .generating-teaching-schedule{
  162. padding: 6px 12px;
  163. line-height: 30px;
  164. border: 1px solid #2977ff;
  165. border-radius: 5px;
  166. font-size: 14px;
  167. color: #fff;
  168. background: #2977ff;
  169. outline: none;
  170. cursor: pointer;
  171. }
  172. .bottom-msg{
  173. text-indent: 2em;
  174. font-size: 14px;
  175. color: #999;
  176. }
  177. .layer-add-class{
  178. position: relative;
  179. display: none;
  180. width: 740px;
  181. height: 460px;
  182. font-size: 16px;
  183. line-height: 30px;
  184. }
  185. .class-type-box{
  186. height: 400px;
  187. overflow: auto;
  188. }
  189. .class-type{
  190. margin: 20px 10px;
  191. overflow: hidden;
  192. }
  193. .class-type-title >span{
  194. font-size: 16px;
  195. color: #619aff;
  196. }
  197. .class-type-title >label{
  198. font-size: 16px;
  199. color: #333333;
  200. }
  201. .class-type-checkbox{
  202. font-size: 14px;
  203. color: #333333;
  204. }
  205. .class-type-checkbox label{
  206. position: relative;
  207. display: inline-block;
  208. width: 100px;
  209. margin-right: 10px;
  210. overflow: hidden;
  211. text-overflow:ellipsis;
  212. white-space: nowrap;
  213. }
  214. .classTextbookVersions{
  215. display: inline-block;
  216. position: absolute;
  217. left: 0;
  218. top: -200px;
  219. }
  220. .layer-add-class label{
  221. cursor: pointer;
  222. }
  223. .layer-add-class input[type='checkbox']{
  224. width: 16px;
  225. height: 16px;
  226. vertical-align: sub;
  227. }
  228. .layer-err-msg{
  229. display: none;
  230. color: red;
  231. text-align: center;
  232. }
  233. .button-btn-box{
  234. position: absolute;
  235. bottom: 0;
  236. width: 100%;
  237. height: 45px;
  238. line-height: 45px;
  239. text-align: center;
  240. border-top: 1px solid #dcdcdc;
  241. /*border-bottom: 1px solid #dcdcdc;*/
  242. }
  243. .button-btn-box button{
  244. width: 88px;
  245. line-height: 30px;
  246. border-radius: 3px;
  247. outline: none;
  248. cursor: pointer;
  249. }
  250. .layer-btn-add-class{
  251. color: #fff;
  252. background-color: #619aff;
  253. border: 1px solid #619aff;
  254. }
  255. .layer-btn-cancel-class{
  256. color: #333;
  257. background-color: #fff;
  258. border: 1px solid #333;
  259. }
  260. .btn-box-show-2{
  261. display: none;
  262. }
  263. .layer-choice-teaching-material-type{
  264. position: relative;
  265. display: none;
  266. width: 478px;
  267. height: 200px;
  268. color: #717171;
  269. text-align: center;
  270. }
  271. .layer-teaching-material-type-title{
  272. margin-bottom: 20px;
  273. color: #333;
  274. font-size: 16px;
  275. }
  276. .layer-choice-teaching-material-type p{
  277. line-height: 22px;
  278. color: #333;
  279. font-size: 16px;
  280. }
  281. .layer-teaching-material-type-btn-box{
  282. position: absolute;
  283. bottom: 0;
  284. width: 100%;
  285. /*margin-top: 20px;
  286. margin-bottom: 20px;*/
  287. }
  288. .step-tips{
  289. margin-top: 20px;
  290. }
  291. .step-tips .line{
  292. display: inline-block;
  293. width: 30px;
  294. /*margin: 10px;*/
  295. border-bottom: 1px solid #619aff;
  296. vertical-align: middle
  297. }
  298. .layer-teaching-material-type-btn-box button{
  299. width: 88px;
  300. line-height: 30px;
  301. color: #619aff;
  302. background-color: #fff;
  303. border: 1px solid #619aff;
  304. border-radius: 3px;
  305. outline: none;
  306. cursor: pointer;
  307. }
  308. #btnLayerStepThreeCancel{
  309. color: #dcdcdc;
  310. border: 1px solid #dcdcdc;
  311. }
  312. .teaching-material-type-box{
  313. height: 72px;
  314. overflow: auto;
  315. }
  316. .teaching-material-type-box button{
  317. margin: 5px;
  318. width: 80px;
  319. line-height: 26px;
  320. color: #999;
  321. background-color: #fff;
  322. border: 1px solid #999;
  323. border-radius: 3px;
  324. outline: none;
  325. cursor: pointer;
  326. }
  327. .btn-teaching-material-type.active{
  328. color: #fff;
  329. background: #619aff;
  330. border-radius: 2px;
  331. border: 1px solid #619aff;
  332. }
  333. .layer-choice-teaching-material-type .step-2{
  334. display: none;
  335. }
  336. .layer-choice-teaching-material-type .step-3{
  337. display: none;
  338. }
  339. .confirm-layer-box{
  340. margin: 20px;
  341. line-height: 20px;
  342. text-align: center;
  343. }
  344. .layui-layer-btn .layui-layer-btn0{
  345. border-color: #619aff !important ;
  346. background-color: #619aff!important;
  347. }
  348. .chapter-msg{
  349. width: 100%;
  350. text-align: center;
  351. font-size: 40px;
  352. color: #2977ff;
  353. line-height: 394px;
  354. }
  355. .secher-versions-box{
  356. position: absolute;
  357. right: 10px;
  358. width: 290px;
  359. height: 34px;
  360. border: 1px solid #ddd;
  361. border-radius: 17px;
  362. }
  363. .input-search-versions-text{
  364. width: 216px;
  365. margin-left: 20px;
  366. line-height: 32px;
  367. font-size: 16px;
  368. color: #666;
  369. border: none;
  370. outline: none!important;
  371. }
  372. input:focus {
  373. outline: none;
  374. border: none;}
  375. .btn-search-versions{
  376. font-size: 16px;
  377. color: #2977ff;
  378. border: none;
  379. outline: none;
  380. background: #fff;
  381. cursor: pointer;
  382. }
  383. .layui-layer-title{
  384. background-color:#619aff!important;
  385. color: #fff!important;
  386. border-bottom:none!important;
  387. font-size:18px;
  388. }
  389. .layer-btn-teaching-material-type {
  390. background-color:#619aff!important;
  391. color: #fff!important;
  392. }
  393. </style>
  394. <div class="teaching-progress">
  395. <div class="screen">
  396. <form action="">
  397. <div class="screen-rows clearfix">
  398. <div class="subject fl">
  399. <span class="screen-rows-title">科目:</span>
  400. <select name="select-subject">
  401. <option value="3" <?php echo $subjectId == 3?"selected='selected'":'';?>>数学</option>
  402. <option value="8" <?php echo $subjectId == 8?"selected='selected'":'';?>>英语</option>
  403. </select>
  404. </div>
  405. <div class="grade fl">
  406. <span class="screen-rows-title">年级:</span>
  407. <select name="select-grade">
  408. <option value="1" <?php echo $grade == 1?"selected='selected'":'';?>>高一</option>
  409. <option value="2" <?php echo $grade == 2?"selected='selected'":'';?>>高二</option>
  410. <option value="3" <?php echo $grade == 3?"selected='selected'":'';?>>高三</option>
  411. </select>
  412. </div>
  413. <?php if($edit):?>
  414. <button type="button" class="go-back fr" id="goBack" onclick='location.href="<?php echo $this->createUrl("classes/viewHistoryProgress");?>"'>返回</button>
  415. <?php else:?>
  416. <button type="button" class="go-back fr" id="goBack" onclick='location.href="<?php echo $this->createUrl("classes/index");?>"'>返回</button>
  417. <?php endif;?>
  418. </div>
  419. <div class="screen-rows clearfix">
  420. <div class="teaching-class fl">
  421. <span class="screen-rows-title">班级(已选<i id="classSelectedLength"><?php echo $edit ==1?1:0;?></i>):</span>
  422. </div>
  423. <button type="button" class="look-history fr" id="lookHistory">查看历史</button>
  424. </div>
  425. <div class="screen-rows">
  426. <div class="active-class-box">
  427. <!--<span id="classSelected"></span>-->
  428. <!-- <span class="active-class">高一1班<i class="btn-delete" >X</i></span>
  429. <span class="active-class">高一2班</span>
  430. <span class="active-class">高一3班</span>
  431. <span class="active-class">高一4班</span> -->
  432. <?php if($edit ==1):?>
  433. <span class="active-class"><?php echo $className;?><i class="btn-delete" value="<?php echo $classId;?>">X</i></span>;
  434. <?php endif;?>
  435. <span class="add-active-class">
  436. <img src="/images/add-active-class.png" alt="">
  437. <span>添加班级</span>
  438. </span>
  439. </div>
  440. </div>
  441. <div class="screen-rows">
  442. <div class="date">
  443. <span class="screen-rows-title">时间:</span>
  444. <input type="text" class="some_class" value="" id="some_class_1" /> --
  445. <input type="text" class="some_class" value="" id="some_class_2" />
  446. <span class="screen-msg">(温馨提示:请严格按照校方教学进度时间设置)</span>
  447. </div>
  448. </div>
  449. <div class="screen-rows">
  450. <div class="versions">
  451. <span class="screen-rows-title">教材版本:</span>
  452. <?php if($edit == 1):?>
  453. <span class="select-textbook" textbookId="<?php echo $textbookId;?>" textbookName="<?php echo $textbook_name;?>"><?php echo $textbook_name;?></span>
  454. <?php else:?>
  455. <span class="select-textbook">— —</span>
  456. <?php endif;?>
  457. <img src="/images/img-add-versions-1.png" class="img-add-versions" alt="">
  458. <span class="secher-versions-box">
  459. <input type="text" class="input-search-versions-text" placeholder="请输入章节关键字检索">
  460. <button type="button" class="btn-search-versions" id="btnSearchVersions">搜索</button>
  461. </span>
  462. </div>
  463. </div>
  464. <div class="screen-rows section-content">
  465. <div class="chapter-box-wrap">
  466. <p class="chapter-msg">请选择教材版本,再设置教学进度</p>
  467. <div class="chapter-box">
  468. </div>
  469. </div>
  470. </div>
  471. <div class="screen-rows clearfix">
  472. <span class="screen-rows-title">已选内容:</span>
  473. <div class="active-chapter-box clearfix">
  474. <!-- <span class="active-chapter">函数<i class="btn-delete-chapter" >X</i></span>
  475. <span class="active-chapter">函数</span>
  476. <span class="active-chapter">函数</span> -->
  477. </div>
  478. </div>
  479. </form>
  480. </div>
  481. <div class="btn-box">
  482. <button type="button" class="generating-teaching-schedule" id="generatingTeachingSchedule" active="true">生成教学进度</button>
  483. </div>
  484. <!-- <div class="bottom-msg">
  485. <span>所属学校:史莱克</span>
  486. </div> -->
  487. <!-- 选择班级弹窗 开始 -->
  488. <div class="layer-add-class">
  489. <p class="layer-err-msg"><img src="/images/icon-warning-red.png" alt=""> 已选班级使用的教材版本不一致,是否继续?</p>
  490. <div class="button-btn-box">
  491. <div class="btn-box-show-1">
  492. <button type="button" class="layer-btn-add-class " id="btnLayerAddClassOne">确定</button>
  493. </div>
  494. <div class="btn-box-show-2">
  495. <button type="button" class="layer-btn-add-class " id="btnLayerAddClassTwo">继续</button>
  496. <button type="button" class="layer-btn-cancel-class " id="btnLayerCancelClass">取消</button>
  497. </div>
  498. </div>
  499. </div>
  500. <!-- 选择班级弹窗 结束 -->
  501. <!-- 选择教材弹窗 开始 -->
  502. <div class="layer-choice-teaching-material-type">
  503. <p class="layer-teaching-material-type-title">提示</p>
  504. <div class="step-1">
  505. <p>请确保选择正确的教材</p>
  506. <p>若修改教材将重置教学进度</p>
  507. <div class="step-tips">
  508. <img src="/images/step-tips-completed.png" alt="">
  509. <i class="line"></i>
  510. <img src="/images/step-tips-unfinished.png" alt="">
  511. <i class="line"></i>
  512. <img src="/images/step-tips-unfinished.png" alt="">
  513. </div>
  514. <div class="layer-teaching-material-type-btn-box">
  515. <button type="button" class="layer-btn-teaching-material-type " id="btnLayerStepOne">下一步</button>
  516. </div>
  517. </div>
  518. <div class="step-2">
  519. <div class="teaching-material-type-box">
  520. <?php if(isset($textbookName) && $textbookName):?>
  521. <?php $i = 1;?>
  522. <?php foreach($textbookName as $k=>$v):?>
  523. <button type="button" class="btn-teaching-material-type" textbookId="<?php echo $k;?>"><?php echo $v;?></button>
  524. <?php $i++;?>
  525. <?php endforeach;?>
  526. <?php endif;?>
  527. </div>
  528. <div class="step-tips">
  529. <img src="/images/step-tips-completed.png" alt="">
  530. <i class="line"></i>
  531. <img src="/images/step-tips-completed.png" alt="">
  532. <i class="line"></i>
  533. <img src="/images/step-tips-unfinished.png" alt="">
  534. </div>
  535. <div class="layer-teaching-material-type-btn-box">
  536. <button type="button" class="layer-btn-teaching-material-type " id="btnLayerStepTwo">下一步</button>
  537. </div>
  538. </div>
  539. <div class="step-3">
  540. <p>当前选择为:<span class="text-no-now"></span></p>
  541. <p>请再次确认是否修改版本</p>
  542. <div class="step-tips">
  543. <img src="/images/step-tips-completed.png" alt="">
  544. <i class="line"></i>
  545. <img src="/images/step-tips-completed.png" alt="">
  546. <i class="line"></i>
  547. <img src="/images/step-tips-completed.png" alt="">
  548. </div>
  549. <div class="layer-teaching-material-type-btn-box">
  550. <button type="button" class="layer-btn-teaching-material-type " id="btnLayerStepThreeConfirm">确认</button>
  551. <button type="button" class="layer-btn-teaching-material-type " id="btnLayerStepThreeCancel">取消</button>
  552. </div>
  553. </div>
  554. </div>
  555. <!-- 选择教材弹窗 结束 -->·
  556. </div>
  557. <script src="/js/jquery.datetimepicker.js"></script>
  558. <script src="/js/layer/layer.js"></script>
  559. <script>
  560. $(document).ready(function(){
  561. //$('#lookHistory').trigger("click");
  562. var date=new Date;
  563. var year=date.getFullYear();
  564. var month=date.getMonth()+1;
  565. if(month<10){
  566. month ='0'+month;
  567. }
  568. var day = date.getDate(); //获取当前日(1-31)
  569. if(day<10){
  570. day ='0'+day
  571. }
  572. var minD = year +'-'+month +'-'+ '01';
  573. var maxD = year +'-'+month +'-' +day;
  574. var minD = '<?php echo $start_time;?>';
  575. var maxD = '<?php echo $end_time;?>';
  576. <?php if($edit == 1):?>
  577. getSctionsByTextbookId(<?php echo $textbookId;?>,<?php echo $subjectId;?>,1,'',0);
  578. <?php endif;?>
  579. // 显示默认时间
  580. $("#some_class_1").attr("value",minD);
  581. $("#some_class_2").attr("value",maxD);
  582. $('.some_class').datetimepicker({
  583. format: "Y-m-d", //格式化日期
  584. timepicker: false, //关闭时间选项
  585. minDate:"<?php echo $sem_start_time;?>",
  586. maxDate:"<?php echo $sem_end_time;?>"
  587. });
  588. $("#generatingTeachingSchedule[active='true']").on("click", function() {
  589. $(this).attr("active","false");
  590. var d1 = $("#some_class_1").val();
  591. //dateTmp = d1.replace(/-/g,'/') //为了兼容IOS,需先将字符串转换为'2018/9/11 9:11:23'
  592. timestamp = Date.parse(d1)
  593. var d2 = $("#some_class_2").val();
  594. console.log(timestamp,d2)
  595. var error = [];
  596. var moduleArr = [];
  597. var chapterArr = [];
  598. var sectionArr = [];
  599. var subjectId = $("select[name='select-subject']").val();
  600. var grade = $("select[name='select-grade']").val();
  601. var startTime = $("#some_class_1").val();
  602. var endTime = $("#some_class_2").val();
  603. var textbookId = $('.select-textbook').attr("textbookId");
  604. var textbookName = $('.select-textbook').attr("textbookName");
  605. var classIds = [];
  606. var className = '';
  607. var selectSectionIds = [];
  608. $('.active-class-box .active-class').each(function(){
  609. if(className == ''){
  610. className = $(this).text().substr(0,$(this).text().length-1);
  611. }
  612. classIds.push($(this).find("i").attr("value"));
  613. });
  614. $('.active-chapter-box .active-chapter i').each(function(){
  615. if($(this).attr('type') == 1){
  616. moduleArr.push($(this).attr('saveId'));
  617. }else if($(this).attr('type') == 2){
  618. chapterArr.push($(this).attr('saveId'));
  619. }else if($(this).attr('type') == 3){
  620. sectionArr.push($(this).attr('saveId'));
  621. }
  622. // for(var b =0;b++;b<$(this).attr('selectSectionIds').split(',').length){
  623. // selectSectionIds.push($(this).attr('selectSectionIds').split(',')[b]);
  624. // }
  625. selectSectionIds.push($(this).attr('selectSectionIds').split(','));
  626. });
  627. if(moduleArr.length == 0 && chapterArr.length == 0 && sectionArr.length == 0){
  628. error.push("请选择模块章节");
  629. }
  630. if(!textbookId){
  631. error.push("请指定教材");
  632. }
  633. if(classIds.length == 0 ){
  634. error.push("请选择班级");
  635. }
  636. if(!startTime){
  637. error.push("请设置开始时间");
  638. }
  639. if(!endTime){
  640. error.push("请设置结束时间");
  641. }
  642. var startTimeUnix = Date.parse(startTime) / 1000;
  643. var endTimeUnix = Date.parse(endTime) / 1000;
  644. var date_start = new Date(startTimeUnix * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  645. var start_M = date_start.getMonth()+1 + '.';
  646. var start_D = date_start.getDate();
  647. var startTimeStr = start_M + start_D;
  648. var date_end = new Date(endTimeUnix * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  649. var end_M = date_end.getMonth()+1 + '.';
  650. var end_D = date_end.getDate();
  651. var endTimeStr = end_M + end_D;
  652. if(startTimeUnix > endTimeUnix){
  653. error.push("开始时间不能大于结束时间");
  654. }
  655. if(error.length == 0){
  656. layer.open({
  657. type: 1,
  658. title: '提示',
  659. btn: ['确定', '取消'],
  660. area: ['420px', '190px'], //宽高
  661. btnAlign: 'c',
  662. content: '<div class="confirm-layer-box"><span>确认要生成'+className+'等共'+classIds.length+'个班级在'+startTimeStr+'~'+endTimeStr+'的数学教学进度表吗?</span></div>',
  663. yes: function(index, layero) {
  664. var data = {
  665. subjectId : subjectId,
  666. grade:grade,
  667. classIds:classIds,
  668. startTimeUnix:startTimeUnix,
  669. endTimeUnix:endTimeUnix,
  670. moduleArr:moduleArr,
  671. chapterArr:chapterArr,
  672. sectionArr:sectionArr,
  673. textbookId:textbookId,
  674. textbookName:textbookName,
  675. selectSectionIds:selectSectionIds
  676. };
  677. $.post("<?php echo Yii::app()->createUrl('classes/ajaxInsertTeachProgress')?>",data,function(flags){
  678. var m = JSON.parse(flags);
  679. console.log(m);
  680. if(m.status == 0)
  681. {
  682. layer.msg(m.error);
  683. $(this).attr("active","true");
  684. }else{
  685. var params = "grade="+grade+"&subjectId="+subjectId;
  686. location.href="<?php echo $this->createUrl("classes/viewHistoryProgress?");?>"+params;
  687. // location.reload();
  688. }
  689. });
  690. //提交
  691. layer.closeAll();
  692. },
  693. btn2: function(index, layero) {
  694. //取消按钮
  695. console.log(111)
  696. //return false 开启该代码可禁止点击该按钮关闭
  697. }
  698. });
  699. }else{
  700. $(this).attr("active","true");
  701. layer.msg(error.join('<br>'));
  702. }
  703. });
  704. // 弹窗选择班级
  705. $(".add-active-class").on("click", function() {
  706. var selectClassIds = [];
  707. $(".active-class-box .btn-delete").each(function(k,v){
  708. selectClassIds.push($(this).attr('value'));
  709. });
  710. console.log(selectClassIds);
  711. var grade = $("select[name='select-grade']").val();
  712. var subjectId = $("select[name='select-subject']").val();
  713. if(grade > 0){
  714. $.post("<?php echo Yii::app()->createUrl('classes/ajaxGetClassesBylevel')?>",{grade:grade,subjectId:subjectId},function(flags){
  715. var m = JSON.parse(flags);
  716. console.log(m);
  717. var html = "";
  718. var levelName = {1:'A',2:'B',3:'C'};
  719. if(m.status>0)
  720. {
  721. html += "<div class='class-type-box'>";
  722. for(var k in m.data){
  723. html += '<div class="class-type">';
  724. html += ' <div class="class-type-title clearfix">';
  725. html += ' <span class="fl">'+levelName[k]+'层班级:</span>';
  726. html += ' <label for="all'+levelName[k]+'" class="fr"><input type="checkbox" name="class-name-all" value="1" id="all'+levelName[k]+'">全选</label>';
  727. html += ' </div>';
  728. html += ' <div class="class-type-checkbox">';
  729. html += ' <form action="">';
  730. for(var j = 0;j<m.data[k].length;j++){
  731. if($.inArray(m.data[k][j].class_id,selectClassIds) > -1){
  732. html += '<label for="'+m.data[k][j].class_id+'"><input type="checkbox" name="class-name" value="'+m.data[k][j].class_id+'" id="'+m.data[k][j].class_id+'" checked="checked" textbookId="'+m.data[k][j].textbook_id+'" textbookName="'+m.data[k][j].textbook_name+'" className="'+m.data[k][j].class_name+'">'+m.data[k][j].class_name+'</label>';
  733. }else{
  734. html += '<label for="'+m.data[k][j].class_id+'"><input type="checkbox" name="class-name" value="'+m.data[k][j].class_id+'" id="'+m.data[k][j].class_id+'" textbookId="'+m.data[k][j].textbook_id+'" textbookName="'+m.data[k][j].textbook_name+'" className="'+m.data[k][j].class_name+'">'+m.data[k][j].class_name+'</label>';
  735. }
  736. }
  737. html += ' </form>';
  738. html += ' </div>';
  739. html += '</div>';
  740. }
  741. html += "</div>";
  742. }
  743. html += '<p class="layer-err-msg"><img src="/images/icon-warning-red.png" alt=""> 已选班级使用的教材版本不一致,是否继续?</p>';
  744. html += '<div class="button-btn-box">';
  745. html += ' <div class="btn-box-show-1">';
  746. html += ' <button type="button" class="layer-btn-add-class " id="btnLayerAddClassOne">确定</button>';
  747. html += ' </div>';
  748. html += ' <div class="btn-box-show-2">';
  749. html += ' <button type="button" class="layer-btn-add-class " id="btnLayerAddClassTwo">继续</button>';
  750. html += ' <button type="button" class="layer-btn-cancel-class " id="btnLayerCancelClass">取消</button>';
  751. html += ' </div>';
  752. html += '</div>';
  753. $('.layer-add-class').html(html);
  754. });
  755. layer.open({
  756. type: 1,
  757. title: '添加班级',
  758. area: ['760px', '500px'], //宽高
  759. content: $('.layer-add-class'),
  760. });
  761. }else{
  762. alert("班级错误");
  763. }
  764. });
  765. // 弹出修改教材版本
  766. $(".img-add-versions").on("click", function() {
  767. $('.step-2').hide();
  768. $('.step-3').hide();
  769. $('.step-1').show();
  770. // var $(this)
  771. layer.open({
  772. type: 1,
  773. title: '教材设置',
  774. area: ['480px', '250px'], //宽高
  775. content: $('.layer-choice-teaching-material-type'),
  776. });
  777. });
  778. // 单选按钮
  779. $("body").on('change',"input[name='class-name']",function() {
  780. getsClassSelected();
  781. });
  782. // 全选按钮
  783. $("body").on('change',"input[name='class-name-all']",function() {
  784. var isChecked = $(this).prop("checked");
  785. if(isChecked){
  786. $(this).parents('.class-type').find("input").prop("checked", true);
  787. getsClassSelected();
  788. return false;
  789. }else{
  790. $(this).parents('.class-type').find("input").prop("checked", false);
  791. getsClassSelected();
  792. return false;
  793. }
  794. });
  795. var selectedData=[];
  796. var selectedDataValue = [];
  797. var selectedDataList = [];
  798. function getsClassSelected() {
  799. selectedData = $("input[name='class-name']:checked"); //获取所有选中
  800. selectedDataList = [];
  801. var className = '';
  802. selectedDataValue = [];
  803. for (var i = 0; i < selectedData.length; i++) {
  804. className = $(selectedData[i]).parent().text();
  805. //添加已选择班级
  806. selectedDataList.push('<span class="active-class">'+className+'<i class="btn-delete" value="' + selectedData[i].value + '">X</i></span>');
  807. selectedDataValue.push(selectedData[i].value);
  808. }
  809. //判断班级教材版本是否一致
  810. // let testType = ture;
  811. // isClassTextbook(testType);
  812. };
  813. function isClassTextbook(type){
  814. if(type==false){
  815. $('.layer-err-msg').show();
  816. $('.btn-box-show-1').hide();
  817. $('.btn-box-show-2').show();
  818. }else{
  819. $('.layer-err-msg').hide();
  820. $('.btn-box-show-2').hide();
  821. $('.btn-box-show-1').show();
  822. }
  823. }
  824. // 确定已选班级
  825. $("body").on("click",'#btnLayerAddClassOne', function() {
  826. //$('#classSelected').html(selectedDataList);
  827. var isRepeat = 0;
  828. var nowTextbookId = 0;
  829. $('.class-type-box .class-type-checkbox input:checked').each(function(){
  830. if($(this).attr("textbookId") != 0){
  831. if(nowTextbookId == 0){
  832. nowTextbookId = $(this).attr("textbookId");
  833. }
  834. if(nowTextbookId != $(this).attr("textbookId")){
  835. isRepeat = 1;
  836. }
  837. }
  838. });
  839. //alert(isRepeat);
  840. if(isRepeat == 1){
  841. $('.btn-box-show-2').show();
  842. $('.layer-err-msg').show();
  843. $('.btn-box-show-1').hide();
  844. }else{
  845. $('.active-class-box .active-class').remove();
  846. $('.active-class-box').prepend(selectedDataList);
  847. $('#classSelectedLength').text(selectedData.length);
  848. $('.btn-teaching-material-type').removeClass('active');
  849. $('.btn-teaching-material-type[textbookId="'+nowTextbookId+'"]').addClass('active');
  850. if(!$('.select-textbook').attr('textbookId') || $('.select-textbook').attr('textbookId')==0){
  851. $('.select-textbook').html('— —');
  852. }
  853. layer.closeAll();
  854. }
  855. });
  856. $("body").on("click",'#btnLayerAddClassTwo', function() {
  857. $('.active-class-box .active-class').remove();
  858. $('.active-class-box').prepend(selectedDataList);
  859. $('#classSelectedLength').text(selectedData.length);
  860. $('.select-textbook').text("已选班级教材不一致");
  861. $('.select-textbook').attr("textbookId",0);
  862. $('.select-textbook').attr("textbookName",'');
  863. $('.section-content .chapter-msg').html('<p class="chapter-msg">请选择教材版本,再设置教学进度</p>');
  864. $('.active-chapter-box').html('');
  865. $('.chapter-box').html('');
  866. $('.btn-teaching-material-type').removeClass('active');
  867. layer.closeAll();
  868. });
  869. $("body").on("click",'#btnLayerCancelClass', function() {
  870. layer.closeAll();
  871. })
  872. //显示班级教材版本
  873. $("body").on("mouseover",".class-type-checkbox label",function () {
  874. //alert(1);
  875. var versions = $(this).attr('versions');
  876. var className = $(this).find("input").attr("className");
  877. var textbookName = $(this).find("input").attr("textbookName");
  878. console.log(className);
  879. var classId ='#'+$(this).children('input').attr('id');
  880. if(textbookName == ''){
  881. textbookName = "无教材";
  882. }
  883. // if(textbookName){
  884. layer.tips(className+'</br>'+textbookName, classId, {
  885. tips: [1, '#619aff'],
  886. time: 2000
  887. });
  888. // }
  889. })
  890. $("body").on("mouseover",".chapter",function () {
  891. //alert(1);
  892. var textbookName = $(this).html();
  893. var classId ='#'+$(this).attr('id');
  894. // if(textbookName){
  895. layer.tips(textbookName, classId, {
  896. tips: [1, '#747E9A'],
  897. time: 2000
  898. });
  899. // }
  900. })
  901. //清除已选班级
  902. $("body").on("click", ".btn-delete", function() {
  903. $(this).parent().remove();
  904. var classValue = $(this).attr('value');
  905. $(".layer-add-class input[value='" + classValue + "']").prop("checked", false);
  906. $(".layer-add-class input[name='class-name-all']").prop("checked", false);
  907. $('#classSelectedLength').text($('#classSelected span').length);
  908. getsClassSelected();
  909. return false;
  910. });
  911. // 教材设置步骤
  912. $("#btnLayerStepOne").on("click", function() {
  913. $('.step-1').hide();
  914. $('.step-2').show();
  915. });
  916. $("#btnLayerStepTwo").on("click", function() {
  917. var textbookId = $('.teaching-material-type-box button.active').attr("textbookId");
  918. if(typeof(textbookId)!="undefined"){
  919. var textbookName = $('.teaching-material-type-box button.active').text();
  920. $('.text-no-now').text(textbookName);
  921. $('.text-no-now').attr("textbookId",textbookId);
  922. $('.step-2').hide();
  923. $('.step-3').show();
  924. }else{
  925. layer.msg('请选择教材');
  926. }
  927. });
  928. //确认教材
  929. $("#btnLayerStepThreeConfirm").on("click", function() {
  930. var textbookId = $('.text-no-now').attr("textbookId");
  931. var subjectId = $('select[name="select-subject"]').val();
  932. $('.select-textbook').html($('.text-no-now').text());
  933. $('.select-textbook').attr("textbookId",textbookId);
  934. $('.select-textbook').attr("textbookName",$('.text-no-now').text());
  935. getSctionsByTextbookId(textbookId,subjectId,0,'',0);
  936. layer.closeAll();
  937. });
  938. //取消教材
  939. $("#btnLayerStepThreeCancel").on("click", function() {
  940. layer.closeAll();
  941. });
  942. //点击知识点
  943. //点击知识点
  944. $(".chapter-box").on("click", ".chapter", function() {
  945. var isActiveChapter = $(this).hasClass('active');
  946. var mcode = '';
  947. var zcode = '';
  948. var code = '';
  949. var codeall =[];
  950. var zcodeall = [];
  951. //判断是否已选择
  952. if(isActiveChapter){
  953. mcode = $(this).attr('mcode');
  954. $(this).removeClass('active show-btn');
  955. //判断点击类型 knowledge:节;chapter:章;versions:模块;
  956. if($(this).hasClass('type-knowledge')){
  957. //清除节时 删除当前章和模块的选中状态
  958. zcode = $(this).attr('zcode');
  959. $('#z'+zcode).removeClass('active show-btn');
  960. $('#m'+mcode).removeClass('active show-btn');
  961. //给未清除的节与章添加取消按钮
  962. $(".chapter-box .active[zcode='" + zcode + "']").addClass('show-btn');
  963. $(".chapter-box .type-chapter.active[mcode='" + mcode + "']").addClass('show-btn');
  964. }else if($(this).hasClass('type-chapter')){
  965. zcode = $(this).attr('zcode');
  966. $('#m'+mcode).removeClass('active show-btn');
  967. $(".chapter-box .chapter[zcode='" + zcode + "']").removeClass('active');
  968. $(".chapter-box .type-chapter.active[mcode='" + mcode + "']").addClass('show-btn');
  969. }else if($(this).hasClass('type-versions')){
  970. $('#m'+mcode).removeClass('active show-btn');
  971. $(".chapter-box .chapter[mcode='" + mcode + "']").removeClass('active');
  972. }
  973. getCapterList();
  974. }else{
  975. //添加选中效果和清除按钮
  976. $(this).addClass('active show-btn');
  977. mcode = $(this).attr('mcode');
  978. //判断点击类型 knowledge:节;chapter:章;versions:模块;
  979. if($(this).hasClass('type-knowledge')){
  980. zcode = $(this).attr('zcode');
  981. code = $(this).attr('code');
  982. codeall = $('#z'+zcode).attr('codeall');
  983. zcodeall = $('#m'+mcode).attr('zcodeall');
  984. //获取当前章已选中的节
  985. var isActiveKnowledgeAll = [];
  986. // for (var i = 0; i < $(".chapter-box .chapter[zcode='" + zcode + "']").length; i++) {
  987. // $(".chapter-box .chapter[zcode='" + zcode + "']")[i]
  988. // }
  989. $(".chapter-box .active[zcode='" + zcode + "']").each(function( index ) {
  990. if($(this).attr('code')){
  991. isActiveKnowledgeAll.push($(this).attr('code'));
  992. }
  993. });
  994. // 判断是否已全选当前章里的所有节
  995. if(codeall.toString()==isActiveKnowledgeAll.toString()){
  996. console.log(6)
  997. //删除当前章里所有节的清除按钮
  998. $(".chapter-box .chapter[zcode='" + zcode + "']").removeClass('show-btn');
  999. //给当前章添加清除按钮
  1000. $('#z'+zcode).addClass('active show-btn');
  1001. // 获取当前模块已选中的章
  1002. var isActiveChapterAll=[];
  1003. $(".chapter-box .active[mcode='" + mcode + "']").each(function( index ) {
  1004. if($(this).hasClass('type-chapter')){
  1005. isActiveChapterAll.push($(this).attr('zcode'));
  1006. }
  1007. });
  1008. // 判断是否已全选当前模块里的所有章
  1009. if(zcodeall.toString()==isActiveChapterAll.toString()){
  1010. console.log(16)
  1011. $('#m'+mcode).addClass('active');
  1012. $(".chapter-box .chapter[mcode='" + mcode + "']").removeClass('show-btn');
  1013. $('#m'+mcode).addClass('show-btn');
  1014. }else{
  1015. console.log(18)
  1016. }
  1017. }else{
  1018. console.log(8)
  1019. }
  1020. }else if($(this).hasClass('type-chapter')){
  1021. zcode = $(this).attr('zcode');
  1022. zcodeall = $('#m'+mcode).attr('zcodeall');
  1023. $(".chapter-box .chapter[zcode='" + zcode + "']").addClass('active');
  1024. $(".chapter-box .chapter[zcode='" + zcode + "']").removeClass('show-btn');
  1025. $(this).addClass('show-btn');
  1026. var isActiveChapterAll=[];
  1027. $(".chapter-box .active[mcode='" + mcode + "']").each(function( index ) {
  1028. if($(this).hasClass('type-chapter')){
  1029. isActiveChapterAll.push($(this).attr('zcode'));
  1030. }
  1031. });
  1032. if(zcodeall.toString()==isActiveChapterAll.toString()){
  1033. console.log(16)
  1034. $('#m'+mcode).addClass('active');
  1035. $(".chapter-box .chapter[mcode='" + mcode + "']").removeClass('show-btn');
  1036. $('#m'+mcode).addClass('show-btn');
  1037. }else{
  1038. console.log(18)
  1039. }
  1040. }else if($(this).hasClass('type-versions')){
  1041. $(".chapter-box .chapter[mcode='" + mcode + "']").addClass('active');
  1042. $(".chapter-box .chapter[mcode='" + mcode + "']").removeClass('show-btn');
  1043. $('#m'+mcode).addClass('show-btn');
  1044. }
  1045. getCapterList();
  1046. }
  1047. });
  1048. function getSctionsByTextbookId(textbookId,subjectId,isEdit,keywords,isSearch){
  1049. selectIcon = $('.active-chapter-box .active-chapter .btn-delete-chapter');
  1050. $.post("<?php echo Yii::app()->createUrl('classes/ajaxGetSectionsByTextbookId')?>",{textbookId:textbookId,subjectId:subjectId},function(flags){
  1051. var m = JSON.parse(flags);
  1052. var html = "";
  1053. var iconhtml = "";
  1054. var levelName = {1:'A',2:'B',3:'C'};
  1055. var isSearchIconHtml = $('.active-chapter-box').html();
  1056. if(m.status>0)
  1057. {
  1058. if(isEdit == 1){
  1059. var selectModuleArr = '<?php echo $module_id;?>'.split(',');
  1060. var selectChapterArr = '<?php echo $chapter_id;?>'.split(',');
  1061. var selectSectionArr = '<?php echo $section_id;?>'.split(',');
  1062. }else{
  1063. var selectModuleArr = [];
  1064. var selectChapterArr = [];
  1065. var selectSectionArr = [];
  1066. $.each(selectIcon,function(k,v){
  1067. // $('.active-chapter-box .active-chapter .btn-delete-chapter').each(function(k,v){
  1068. console.log($(this).attr('type'));
  1069. if($(this).attr('type') == 1){
  1070. selectModuleArr.push($(this).attr('saveId'));
  1071. }
  1072. if($(this).attr('type') == 2){
  1073. selectChapterArr.push($(this).attr('saveId'));
  1074. }
  1075. if($(this).attr('type') == 3){
  1076. selectSectionArr.push($(this).attr('saveId'));
  1077. }
  1078. });
  1079. }
  1080. var n = 1;
  1081. for(var k in m.data){
  1082. var mcodeall = [];
  1083. if($.inArray(m.data[k].module_id.toString(),selectModuleArr) > -1){
  1084. var modeleShowBtn = 1;
  1085. var moduleSelectArr = [];
  1086. var modulestyle = "active show-btn";
  1087. }else{
  1088. var modeleShowBtn = 0;
  1089. var modulestyle = "";
  1090. }
  1091. if(keywords){
  1092. if(m.data[k].module_name.indexOf(keywords) != -1){
  1093. html += '<span class="chapter type-versions '+modulestyle+'" moduleId="'+m.data[k].module_id+'" type="1" mcode="'+m.data[k].module_id+'" id="m'+m.data[k].module_id+'" zcodeall="tempChapter">'+m.data[k].module_name+'</span>';
  1094. }else{
  1095. html += '<span class="chapter type-versions hide '+modulestyle+'" moduleId="'+m.data[k].module_id+'" type="1" mcode="'+m.data[k].module_id+'" id="m'+m.data[k].module_id+'" zcodeall="tempChapter">'+m.data[k].module_name+'</span>';
  1096. }
  1097. }else{
  1098. html += '<span class="chapter type-versions '+modulestyle+'" moduleId="'+m.data[k].module_id+'" type="1" mcode="'+m.data[k].module_id+'" id="m'+m.data[k].module_id+'" zcodeall="tempChapter">'+m.data[k].module_name+'</span>';
  1099. }
  1100. if(m.data[k].chapters && m.data[k].chapters.length>0){
  1101. for(var x=0;x<m.data[k].chapters.length;x++){
  1102. var scodeall=[];
  1103. if($.inArray(m.data[k].chapters[x].chapter_id.toString(),selectChapterArr) > -1){
  1104. var chapterShowBtn = 1;
  1105. var chapterSelectArr = [];
  1106. var chapterstyle = "active show-btn";
  1107. }else{
  1108. var chapterShowBtn = 0;
  1109. if(modeleShowBtn == 0){
  1110. var chapterstyle = "";
  1111. }else{
  1112. chapterstyle = "active";
  1113. }
  1114. }
  1115. mcodeall.push(m.data[k].chapters[x].chapter_id);
  1116. if(keywords){
  1117. if(m.data[k].chapters[x].chapter_name.indexOf(keywords) != -1){
  1118. html += '<span class="chapter type-chapter '+chapterstyle+'" id="z'+m.data[k].chapters[x].chapter_id+'" codeall="tempSection" zcode="'+m.data[k].chapters[x].chapter_id+'" mcode="'+m.data[k].module_id+'" chapterId="'+m.data[k].chapters[x].chapter_id+'" type="2">'+m.data[k].chapters[x].chapter_name+'</span>';
  1119. }else{
  1120. html += '<span class="chapter type-chapter hide '+chapterstyle+'" id="z'+m.data[k].chapters[x].chapter_id+'" codeall="tempSection" zcode="'+m.data[k].chapters[x].chapter_id+'" mcode="'+m.data[k].module_id+'" chapterId="'+m.data[k].chapters[x].chapter_id+'" type="2">'+m.data[k].chapters[x].chapter_name+'</span>';
  1121. }
  1122. }else{
  1123. html += '<span class="chapter type-chapter '+chapterstyle+'" id="z'+m.data[k].chapters[x].chapter_id+'" codeall="tempSection" zcode="'+m.data[k].chapters[x].chapter_id+'" mcode="'+m.data[k].module_id+'" chapterId="'+m.data[k].chapters[x].chapter_id+'" type="2">'+m.data[k].chapters[x].chapter_name+'</span>';
  1124. }
  1125. if(m.data[k].chapters[x].sections && m.data[k].chapters[x].sections.length>0){
  1126. for(var y=0;y<m.data[k].chapters[x].sections.length;y++){
  1127. if($.inArray(m.data[k].chapters[x].sections[y].section_id.toString(),selectSectionArr) > -1){
  1128. var sectionShowBtn = 1;
  1129. var sectionstyle = "active show-btn";
  1130. iconhtml+= '<span class="active-chapter">'+m.data[k].chapters[x].sections[y].section_name.replace(/<[^>]+>/g,"")+'<i class="btn-delete-chapter" code="'+m.data[k].chapters[x].sections[y].section_id+'" type="3" saveid="'+m.data[k].chapters[x].sections[y].section_id+'" selectsectionids="'+m.data[k].chapters[x].sections[y].section_id+'">X</i></span>';
  1131. }else{
  1132. var sectionShowBtn = 0;
  1133. if(modeleShowBtn == 1 || chapterShowBtn == 1){
  1134. var sectionstyle = "active";
  1135. }else{
  1136. sectionstyle = "";
  1137. }
  1138. }
  1139. if(chapterShowBtn == 1){
  1140. chapterSelectArr.push(m.data[k].chapters[x].sections[y].section_id.toString());
  1141. }
  1142. if(modeleShowBtn == 1){
  1143. moduleSelectArr.push(m.data[k].chapters[x].sections[y].section_id.toString());
  1144. }
  1145. scodeall.push(m.data[k].chapters[x].sections[y].section_id);
  1146. if(keywords){
  1147. if(m.data[k].chapters[x].sections[y].section_name.indexOf(keywords) != -1){
  1148. html += '<span class="chapter type-knowledge '+sectionstyle+'" id="c'+m.data[k].chapters[x].sections[y].section_id+'" mcode="'+m.data[k].module_id+'" zcode="'+m.data[k].chapters[x].chapter_id+'" code="'+m.data[k].chapters[x].sections[y].section_id+'" sectionId="'+m.data[k].chapters[x].sections[y].section_id+'" type="3" moduleId="'+m.data[k].module_id+'" chapterId="'+m.data[k].chapters[x].chapter_id+'">'+m.data[k].chapters[x].sections[y].section_name+'</span>';
  1149. }else{
  1150. html += '<span class="chapter type-knowledge hide '+sectionstyle+'" id="c'+m.data[k].chapters[x].sections[y].section_id+'" mcode="'+m.data[k].module_id+'" zcode="'+m.data[k].chapters[x].chapter_id+'" code="'+m.data[k].chapters[x].sections[y].section_id+'" sectionId="'+m.data[k].chapters[x].sections[y].section_id+'" type="3" moduleId="'+m.data[k].module_id+'" chapterId="'+m.data[k].chapters[x].chapter_id+'">'+m.data[k].chapters[x].sections[y].section_name+'</span>';
  1151. }
  1152. }else{
  1153. html += '<span class="chapter type-knowledge '+sectionstyle+'" id="c'+m.data[k].chapters[x].sections[y].section_id+'" mcode="'+m.data[k].module_id+'" zcode="'+m.data[k].chapters[x].chapter_id+'" code="'+m.data[k].chapters[x].sections[y].section_id+'" sectionId="'+m.data[k].chapters[x].sections[y].section_id+'" type="3" moduleId="'+m.data[k].module_id+'" chapterId="'+m.data[k].chapters[x].chapter_id+'">'+m.data[k].chapters[x].sections[y].section_name+'</span>';
  1154. }
  1155. }
  1156. html = html.replace(/tempSection/g,scodeall.join(','));
  1157. }
  1158. if(chapterShowBtn == 1){
  1159. iconhtml += '<span class="active-chapter">'+m.data[k].chapters[x].chapter_name.replace(/<[^>]+>/g,"")+'<i class="btn-delete-chapter" zcode="'+m.data[k].chapters[x].chapter_id+'" type="2" saveid="'+m.data[k].chapters[x].chapter_id+'" selectsectionids="'+chapterSelectArr.join(',')+'">X</i></span>';
  1160. }
  1161. }
  1162. html = html.replace(/tempChapter/g,mcodeall.join(','));
  1163. if(modeleShowBtn == 1){
  1164. iconhtml += '<span class="active-chapter">'+m.data[k].module_name.replace(/<[^>]+>/g,"")+'<i class="btn-delete-chapter" mcode="'+m.data[k].module_id+'" type="1" saveid="'+m.data[k].module_id+'" selectsectionids="'+moduleSelectArr.join(',')+'">X</i></span>';
  1165. }
  1166. }
  1167. //html += '</div>';
  1168. }
  1169. console.log(iconhtml);
  1170. if(isSearch == 0){
  1171. $('.active-chapter-box').html(iconhtml);
  1172. }
  1173. $('.chapter-msg').html('');
  1174. if(html == ''){
  1175. $('.section-content .chapter-box').prev().html('<p class="chapter-msg">暂无教材内容</p>');
  1176. }
  1177. $('.section-content .chapter-box').html(html);
  1178. }else{
  1179. layer.msg(m.error);
  1180. }
  1181. });
  1182. }
  1183. var capterValueList =[]
  1184. function getCapterList (){
  1185. var capterList = $(".chapter-box .show-btn"); //获取所有选中学生
  1186. var capterDataList = [];
  1187. var capterName, code = '';
  1188. capterValueList = [];
  1189. for (var i = 0; i < capterList.length; i++) {
  1190. var selectSectionIds = [];
  1191. capterName = $(capterList[i]).text();
  1192. //code = $(capterList[i]).attr('code');
  1193. if($(capterList[i]).hasClass('type-knowledge')){
  1194. code = $(capterList[i]).attr('code');
  1195. var saveId = $(capterList[i]).attr('sectionId');
  1196. selectSectionIds.push($(capterList[i]).attr('sectionId'));
  1197. capterDataList.push('<span class="active-chapter">'+capterName+'<i class="btn-delete-chapter" code="' + code + '" type="'+$(capterList[i]).attr('type')+'" saveId = "'+saveId+'" selectSectionIds="'+selectSectionIds.join(',')+'">X</i></span>');
  1198. capterValueList.push(code);
  1199. }else if($(capterList[i]).hasClass('type-chapter')){
  1200. code = $(capterList[i]).attr('zcode');
  1201. var saveId = $(capterList[i]).attr('chapterId');
  1202. $('.type-knowledge[chapterId="'+saveId+'"]').each(function(){
  1203. selectSectionIds.push($(this).attr('sectionId'));
  1204. });
  1205. capterDataList.push('<span class="active-chapter">'+capterName+'<i class="btn-delete-chapter" zcode="' + code + '" type="'+$(capterList[i]).attr('type')+'" saveId = "'+saveId+'" selectSectionIds="'+selectSectionIds.join(',')+'">X</i></span>');
  1206. capterValueList.push(code);
  1207. } else if($(capterList[i]).hasClass('type-versions')){
  1208. code = $(capterList[i]).attr('mcode');
  1209. var saveId = $(capterList[i]).attr('moduleId');
  1210. $('.type-knowledge[moduleId="'+saveId+'"]').each(function(){
  1211. selectSectionIds.push($(this).attr('sectionId'));
  1212. });
  1213. capterDataList.push('<span class="active-chapter">'+capterName+'<i class="btn-delete-chapter" mcode="' + code + '" type="'+$(capterList[i]).attr('type')+'" saveId = "'+saveId+'" selectSectionIds="'+selectSectionIds.join(',')+'">X</i></span>');
  1214. capterValueList.push(code);
  1215. }
  1216. // if($(capterList[i]).attr('type') == 1){
  1217. // var saveId = $(capterList[i]).attr('moduleId');
  1218. // $('.type-knowledge[moduleId="'+saveId+'"]').each(function(){
  1219. // selectSectionIds.push($(this).attr('sectionId'));
  1220. // });
  1221. // }else if($(capterList[i]).attr('type') == 2){
  1222. // var saveId = $(capterList[i]).attr('chapterId');
  1223. // $('.type-knowledge[chapterId="'+saveId+'"]').each(function(){
  1224. // selectSectionIds.push($(this).attr('sectionId'));
  1225. // });
  1226. // }else if($(capterList[i]).attr('type') == 3){
  1227. // var saveId = $(capterList[i]).attr('sectionId');
  1228. // selectSectionIds.push($(capterList[i]).attr('sectionId'));
  1229. // }
  1230. // capterDataList.push('<span class="active-chapter">'+capterName+'<i class="btn-delete-chapter" code="' + code + '" type="'+$(capterList[i]).attr('type')+'" saveId = "'+saveId+'" selectSectionIds="'+selectSectionIds.join(',')+'">X</i></span>');
  1231. // capterValueList.push(code);
  1232. }
  1233. $('.active-chapter-box').html(capterDataList);
  1234. }
  1235. //清除已选知识点
  1236. $(".active-chapter-box").on("click", ".btn-delete-chapter", function() {
  1237. $(this).parent().remove();
  1238. var classValue='';
  1239. if($(this).attr('code')){
  1240. classValue = $(this).attr('code');
  1241. $(".chapter-box .chapter[code='" + classValue + "']").removeClass('active show-btn');
  1242. }else if($(this).attr('zcode')){
  1243. classValue = $(this).attr('zcode');
  1244. $(".chapter-box .chapter[zcode='" + classValue + "']").removeClass('active show-btn');
  1245. } else if($(this).attr('mcode')){
  1246. classValue = $(this).attr('mcode');
  1247. $(".chapter-box .chapter[mcode='" + classValue + "']").removeClass('active show-btn');
  1248. }
  1249. return false;
  1250. });
  1251. //选择教材版本
  1252. $(".teaching-material-type-box").on("click", ".btn-teaching-material-type", function() {
  1253. $(".teaching-material-type-box .btn-teaching-material-type").removeClass('active');
  1254. $(this).addClass('active');
  1255. });
  1256. //切换年级
  1257. $("select[name='select-grade']").change(function(){
  1258. var grade = $(this).val();
  1259. var subjectId = $("select[name='select-subject']").val();
  1260. var params = "grade="+grade+"&subjectId="+subjectId;
  1261. location.href = "<?php echo $this->createUrl("classes/settingProgress?");?>"+params;
  1262. //$('#classSelectedLength').text(0);
  1263. //$('#classSelected').html('');
  1264. });
  1265. //查看历史
  1266. $('#lookHistory').click(function(){
  1267. var grade = $("select[name='select-grade']").val();
  1268. var subjectId = $("select[name='select-subject']").val();
  1269. var params = "grade="+grade+"&subjectId="+subjectId;
  1270. location.href="<?php echo $this->createUrl("classes/viewHistoryProgress?");?>"+params;
  1271. });
  1272. //切换科目
  1273. $("select[name='select-subject']").change(function(){
  1274. var subjectId = $(this).val();
  1275. var grade = 1;
  1276. var params = "grade="+grade+"&subjectId="+subjectId;
  1277. location.href = "<?php echo $this->createUrl("classes/settingProgress?");?>"+params;
  1278. //$('#classSelectedLength').text(0);
  1279. });
  1280. //搜索btnSearchVersions
  1281. $('#btnSearchVersions').click(function(){
  1282. var keywords = $(this).prev().val();
  1283. var textbookId = $('.select-textbook').attr("textbookId");
  1284. var subjectId = $('select[name="select-subject"]').val();
  1285. // if(keywords && textbookId && subjectId){
  1286. getSctionsByTextbookId(textbookId,subjectId,0,keywords,1);
  1287. // }
  1288. });
  1289. });
  1290. </script>