setting2.php 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227
  1. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
  2. <link rel="stylesheet" href="/css/alert.css"/>
  3. <?php $imgUrl = Yii::app()->request->hostInfo;?>
  4. <?php $disableImgUrl = Yii::app()->request->hostInfo.'/images/disable.png';?>
  5. <style>
  6. .color-red{
  7. color: red;
  8. }
  9. .en-tfb-grade-1 .date>span{
  10. margin-right: 40px;
  11. }
  12. .option-wrap{
  13. margin-top: 20px;
  14. min-width: 600px;
  15. }
  16. .option-name{
  17. display: inline-block;
  18. width: 100px;
  19. vertical-align: top;
  20. margin-top: 10px;
  21. }
  22. .option-con{
  23. display: inline-block;
  24. width: 80%;
  25. min-width: 490px;
  26. padding: 10px;
  27. border: 1px solid #ccc;
  28. }
  29. .option-con>span{
  30. display: inline-block;
  31. margin-right: 20px;
  32. line-height: 1rem;
  33. cursor: pointer;
  34. }
  35. .select-grade{
  36. width: 150px;
  37. line-height: 30px;
  38. margin-bottom: 10px;
  39. }
  40. .option-con-class label{
  41. display: inline-block;
  42. margin-right: 20px;
  43. }
  44. .active{
  45. color: #619aff;
  46. }
  47. .btn-start{
  48. display: inline-block;
  49. margin-top: 20px;
  50. margin-left: 100px;
  51. padding: 10px 30px;
  52. color: #fff;
  53. background-color: #2977ff;
  54. cursor: pointer;
  55. }
  56. .en-tfb-grade-1{
  57. margin-left: 20px;
  58. }
  59. #selectedUnit{
  60. display: inline-block;
  61. width: 80%;
  62. min-width: 490px;
  63. padding: 10px;
  64. border: 1px solid #ccc;
  65. }
  66. #selectedUnit span{
  67. position: relative;
  68. padding: 5px;
  69. padding-right: 30px;
  70. border: 1px solid #999;
  71. margin-right: 15px;
  72. }
  73. #selectedChapter{
  74. display: inline-block;
  75. width: 80%;
  76. min-width: 490px;
  77. padding: 10px;
  78. border: 1px solid #ccc;
  79. }
  80. #selectedChapter span{
  81. position: relative;
  82. padding: 5px;
  83. padding-right: 30px;
  84. border: 1px solid #999;
  85. display: inline-block;
  86. margin-right: 15px;
  87. margin-top: 5px;
  88. }
  89. .delete-icon{
  90. position: absolute;
  91. top: 50%;
  92. right: 5px;
  93. transform: translateY(-50%);
  94. width: 15px;
  95. height: 15px;
  96. background: url(<?php echo $imgUrl.'/images/icon-delect.png';?>) no-repeat center;
  97. background-size: contain;
  98. cursor: pointer;
  99. }
  100. .teacher-word-group{
  101. color: #619aff;
  102. }
  103. .word-group-hidden{
  104. height: 38px;
  105. overflow: hidden;
  106. }
  107. .hide{
  108. display:none;
  109. }
  110. .margin-left20{
  111. margin-left:20px;
  112. }
  113. .multiline{
  114. display:inline-block;
  115. margin-left:10px;
  116. }
  117. </style>
  118. <div class="main-content-inner">
  119. <!-- 导航栏开始-->
  120. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  121. <!-- 导航栏结束-->
  122. <div class="en-tfb-grade-1">
  123. <h2>生成词汇宝</h2>
  124. <p class="color-red">* 好消息!词汇宝现已支持教师端选词后生成检测卡!【每个班级 每周】最多生成【5次】词汇宝,均不限年级、不限间隔时间。</p>
  125. <p class="date">
  126. <span>当前时间:</span>
  127. <span><?php echo $year;?>年<?php echo $month;?>月第<?php echo $week;?>周</span>
  128. </p>
  129. <div class="option-wrap">
  130. <span class="option-name">班级:</span>
  131. <div class="option-con">
  132. <div>
  133. <select name="grade" class="select-grade">
  134. <option value="1" <?php if(isset($setting['grade']) && $setting['grade']==1) echo 'selected';?>>高一</option>
  135. <option value="2" <?php if(isset($setting['grade']) && $setting['grade']==2) echo 'selected';?>>高二</option>
  136. <option value="3" <?php if(isset($setting['grade']) && $setting['grade']==3) echo 'selected';?>>高三</option>
  137. </select>
  138. </div>
  139. <div class="option-con-class" id="optionClass">
  140. </div>
  141. </div>
  142. </div>
  143. <div class="option-wrap">
  144. <span class="option-name">版本:</span>
  145. <div class="option-con" id="optionEdition">
  146. <?php if(isset($textbooks) && $textbooks):?>
  147. <?php $no =1;?>
  148. <?php foreach($textbooks as $k=>$v):?>
  149. <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></span>
  150. <?php $no++;?>
  151. <?php endforeach;?>
  152. <?php endif;?>
  153. </div>
  154. </div>
  155. <div class="option-wrap">
  156. <span class="option-name">模块:</span>
  157. <div class="option-con" id="optionModular">
  158. <?php if(isset($modules) && $modules):?>
  159. <?php $no =1;?>
  160. <?php foreach($modules as $k=>$v):?>
  161. <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></span>
  162. <?php $no++;?>
  163. <?php endforeach;?>
  164. <?php endif;?>
  165. </div>
  166. </div>
  167. <div class="option-wrap">
  168. <span class="option-name">单元:</span>
  169. <div class="option-con" id="optionUnit">
  170. <?php if(isset($units) && $units):?>
  171. <?php $no =1;?>
  172. <?php foreach($units as $k=>$v):?>
  173. <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></span>
  174. <?php $no++;?>
  175. <?php endforeach;?>
  176. <?php endif;?>
  177. </div>
  178. </div>
  179. <div class="option-wrap">
  180. <span class="option-name">小节:</span>
  181. <div class="option-con" id="optionChapter">
  182. <?php if(isset($chapters) && $chapters):?>
  183. <?php foreach($chapters as $k=>$v):?>
  184. <span code="<?php echo $v['textbook_id'];?>" class=""><?php echo $v['textbook_name'];?></span>
  185. <?php endforeach;?>
  186. <?php endif;?>
  187. </div>
  188. </div>
  189. <div class="option-wrap hide">
  190. <span class="option-name">已选单元:</span>
  191. <div id="selectedUnit">
  192. </div>
  193. </div>
  194. <div class="option-wrap">
  195. <span class="option-name">已选:</span>
  196. <div id="selectedChapter">
  197. </div>
  198. <li style="list-style:none;margin-left:100px;color: red;font-weight: bold">* 高一二年级每次只可选一个单元,高三年级可选1~3个单元。</li>
  199. </div>
  200. <?php if($isWhole):?>
  201. <div class="option-wrap">
  202. <span class="option-name">词汇精讲数量:</span>
  203. <div class="option-con" >
  204. <!-- <span><input type="radio" name="words_count" value="1" >默认数量(<i id="word_default">20</i>)个</span>-->
  205. <span><input value="<?php echo isset($setting['words_count'])?$setting['words_count']:15;?>" style="width: 80px;" name="words_number" type="text" placeholder="最多40个"></span>
  206. <span>共(<i id="word_total">0</i>)个</span>
  207. <span style="margin-left:50px;color: red;font-weight: bold">* 数量限制:10-40个,且不超过所选单元总单词数。</span>
  208. </div>
  209. </div>
  210. <?php else:?>
  211. <div class="option-wrap" style="display: none;">
  212. <span class="option-name">词汇精讲数量:</span>
  213. <div class="option-con" >
  214. <!-- <span><input type="radio" name="words_count" value="1" >默认数量(<i id="word_default">20</i>)个</span>-->
  215. <span><input value="15" style="width: 80px;" name="words_number" type="text" placeholder="最多40个"></span>
  216. <span>共(<i id="word_total">0</i>)个</span>
  217. </div>
  218. </div>
  219. <?php endif;?>
  220. <div class="option-wrap">
  221. <span class="option-name">下载方式:</span>
  222. <div class="option-con">
  223. <?php if(isset($setting['is_answer_separate'])):?>
  224. <span><input type="radio" name="is_answer_separate" value="1" <?php if($setting['is_answer_separate']==1) echo 'checked';?>>分离题目和答案</span>
  225. <span><input type="radio" name="is_answer_separate" value="0" <?php if($setting['is_answer_separate']==0) echo 'checked';?>>合并题目和答案</span>
  226. <?php else:?>
  227. <span><input type="radio" name="is_answer_separate" value="1" checked="checked">分离题目和答案</span>
  228. <span><input type="radio" name="is_answer_separate" value="0">合并题目和答案</span>
  229. <?php endif;?>
  230. <span style="margin-left:50px;color: red;font-weight: bold">* 只影响词汇集训和错词再练板块。</span>
  231. </div>
  232. </div>
  233. <div class="option-wrap">
  234. <span class="option-name">精准训练形式:</span>
  235. <div class="option-con" >
  236. <?php if(isset($setting['practice_type'])):?>
  237. <span><input type="radio" name="practice_type" value="1" <?php if($setting['practice_type']==1) echo 'checked';?>>共性(全班学生题目内容一致)</span>
  238. <span><input type="radio" name="practice_type" value="2" <?php if($setting['practice_type']==2) echo 'checked';?> >个性(根据学生正确率个性化推送题目内容) </span>
  239. <?php else:?>
  240. <span><input type="radio" name="practice_type" value="1" checked="checked">共性(全班学生题目内容一致)</span>
  241. <span><input type="radio" name="practice_type" value="2" >个性(根据学生正确率个性化推送题目内容) </span>
  242. <?php endif;?>
  243. </div>
  244. </div>
  245. <div id="commonSet" style="margin-left: 100px;">
  246. <div class="option-wrap">
  247. <span class="option-name">英汉互译形式:</span>
  248. <div class="option-con" >
  249. <?php if(isset($setting['translate_type'])):?>
  250. <span><input type="radio" name="translate_type" value="1" <?php if($setting['translate_type']==1) echo 'checked';?>>英汉互译</span>
  251. <span><input type="radio" name="translate_type" value="2" <?php if($setting['translate_type']==2) echo 'checked';?>>英译中</span>
  252. <span><input type="radio" name="translate_type" value="3" <?php if($setting['translate_type']==3) echo 'checked';?>>中译英</span>
  253. <?php else:?>
  254. <span><input type="radio" name="translate_type" value="1" checked="checked">英汉互译</span>
  255. <span><input type="radio" name="translate_type" value="2">英译中</span>
  256. <span><input type="radio" name="translate_type" value="3">中译英</span>
  257. <?php endif;?>
  258. </div>
  259. </div>
  260. <div class="option-wrap">
  261. <span class="option-name">班级间内容:</span>
  262. <div class="option-con" >
  263. <?php if(isset($setting['is_class_common'])):?>
  264. <span><input type="radio" name="is_class_common" value="1" <?php if($setting['is_class_common']==1) echo 'checked';?>>相同</span>
  265. <span><input type="radio" name="is_class_common" value="0" <?php if($setting['is_class_common']==0) echo 'checked';?>>不同</span>
  266. <?php else:?>
  267. <span><input type="radio" name="is_class_common" value="1" checked="checked">相同</span>
  268. <span><input type="radio" name="is_class_common" value="0" >不同</span>
  269. <?php endif;?>
  270. </div>
  271. </div>
  272. </div>
  273. <div class="option-wrap">
  274. <span class="option-name">检测卡来源:</span>
  275. <div class="option-con" >
  276. <?php if(isset($setting['card_word_source'])):?>
  277. <span><input type="radio" name="card_word_source" value="1" <?php if($setting['card_word_source']==1) echo 'checked';?>>学管端自选单元对应词汇</span>
  278. <span><input type="radio" name="card_word_source" value="2" <?php if($setting['card_word_source']==2) echo 'checked';?>>教师端自选词汇</span>
  279. <?php else:?>
  280. <span><input type="radio" name="card_word_source" value="1" checked="checked">学管端自选单元对应词汇</span>
  281. <span><input type="radio" name="card_word_source" value="2" >教师端自选词汇</span>
  282. <?php endif;?>
  283. </div>
  284. </div>
  285. <!--<div class="option-wrap card-as2" >
  286. <span class="option-name">检测卡词语数量:</span>
  287. <div class="option-con" >
  288. <?php /*if(isset($setting['card_word_count'])&& !empty($setting['card_word_count'])):*/?>
  289. <span>检测卡词语数量:</span>
  290. <span><input style="width: 80px;" name="card_number" type="text" value="<?php /*echo $setting['card_word_count'];*/?>" placeholder="最多50个"></span><span>共(<i id="card_word_count_total">0</i>)个</span>
  291. <span style="margin-left:50px;color: red;font-weight: bold">*数量限制:10-50个,且不超过所选单元总单词数。优先推送词汇回顾中的课标重点词汇,题型为中译英。</span>
  292. <?php /*else:*/?>
  293. <span>检测卡词语数量:</span>
  294. <span><input style="width: 80px;" name="card_number" type="text" value="30" placeholder="最多50个"></span><span>共(<i id="card_word_count_total">0</i>)个</span>
  295. <span style="margin-left:50px;color: red;font-weight: bold">*数量限制:10-50个,且不超过所选单元总单词数。优先推送词汇回顾中的课标重点词汇,题型为中译英。</span>
  296. <?php /*endif;*/?>
  297. </div>
  298. </div>-->
  299. <div class="option-wrap card-as2">
  300. <!-- mhk -->
  301. <span class="option-name">检测卡词语数量:</span>
  302. <div class="option-con">
  303. <div>
  304. <div style="display: inline-block;">
  305. <span>单词数量:</span>
  306. <span id="card_word_count_total">0</span>
  307. </div>
  308. <div style="display: inline-block; margin-left: 20px;">
  309. <span style="color: #6300BF;font-weight: 700; font-size: 16px;">汉译英:</span>
  310. <span><input style="width: 60px; text-align: center;" name="card_number" min="0" max="40" type="number" value="0" class="word_chinese_english"></span>
  311. </div>
  312. <div style="display: inline-block;margin-left: 10px;">
  313. <span style="color: #6300BF;font-weight: 700; font-size: 16px;">英译汉:</span>
  314. <span><input style="width: 60px; text-align: center;" name="card_number" min="0" max="40" type="number" value="0" class="word_english_chinese"></span>
  315. </div>
  316. </div>
  317. <div style="margin-top: 5px;">
  318. <div style="display: inline-block;">
  319. <span>短语数量:</span>
  320. <span id="card_phrase_count_total">0</span>
  321. </div>
  322. <div style="display: inline-block; margin-left: 20px;">
  323. <span style="color: #6300BF;font-weight: 700; font-size: 16px;">汉译英:</span>
  324. <span><input style="width: 60px; text-align: center;" name="card_number" min="0" max="40" type="number" value="0" class="phrase_chinese_english"></span>
  325. </div>
  326. <div style="display: inline-block;margin-left: 10px;">
  327. <span style="color: #6300BF;font-weight: 700; font-size: 16px;">英译汉:</span>
  328. <span><input style="width: 60px; text-align: center;" name="card_number" min="0" max="40" type="number" value="0" class="phrase_english_chinese"></span>
  329. </div>
  330. <span style="margin-left:30px;color: red;font-weight: bold">*数量限制:10-400个,且不超过所选单元总词汇数。优先推送词汇回顾中的课标重点词汇。</span>
  331. </div>
  332. </div>
  333. </div>
  334. <div class="option-wrap card-teacher">
  335. <span class="option-name">教师端-自选词汇组:</span>
  336. <div class="option-con word-group-hidden" style="position: relative;" id="allTeacherWord">
  337. <?php foreach ($groupList as $group):?>
  338. <span><input type="radio" name="word_group_id" value="<?php echo $group['word_group_id'];?>" <?php if(isset($setting['word_group_id']) && $setting['word_group_id'] == $group['word_group_id']){ echo "checked";}; ?>>&nbsp;<?php echo $group['name'];?>&nbsp;<span class="teacher-word-group"><?php echo sprintf('(%s,%s个)',$group['create_time'],$group['word_count']);?></span></span>
  339. <?php endforeach;?>
  340. <div style="cursor:pointer;position: absolute;right: 5px;top: 5px;color: #619aff;" id="show-teacher-word" is-hold="1" onclick="isHold()">展开</div>
  341. </div>
  342. <p style="margin-left:100px;color: red;font-weight: bold">
  343. *每个词汇组名称后的括号内为生成时间和词汇总数。
  344. </p>
  345. </div>
  346. <div class="option-wrap">
  347. <span class="option-name">附加模式:</span>
  348. <div class="option-con">
  349. <div style="display: inline-block">
  350. <span class="">英译汉批改模式</span>
  351. <select name="correcting-model" class="correcting-model">
  352. <option value="1">广义</option>
  353. <option value="2">教材义</option>
  354. </select>
  355. </div>
  356. <div style="display: inline-block;margin-left:50px;">
  357. <span class="">汉译英检测卡汉语呈现范围</span>
  358. <select name="card-chinese-range" class="card-chinese-range">
  359. <option value="1">仅本单元</option>
  360. <option value="2">全部词义</option>
  361. </select>
  362. </div>
  363. </div>
  364. </div>
  365. <div class="option-wrap">
  366. <!-- mhk -->
  367. <span class="option-name">派生:</span>
  368. <div class="option-con">
  369. <div>
  370. <div style="display: inline-block;">
  371. <span>单词-英译汉:</span>
  372. </div>
  373. <div class="multiline">
  374. <span>
  375. <input type="radio" id="word_english_chinese_one" name="word_english_chinese" value="1">
  376. <label for="word_english_chinese_one">有</label>
  377. </span>
  378. <span class="margin-left20">
  379. <input type="radio" id="word_english_chinese_two" name="word_english_chinese" value="0" checked="checked">
  380. <label for="word_english_chinese_two">无</label>
  381. </span>
  382. </div>
  383. </div>
  384. <div style="margin-top: 5px;">
  385. <div style="display: inline-block;">
  386. <span>单词-汉译英:</span>
  387. </div>
  388. <div class="multiline">
  389. <span>
  390. <input type="radio" id="word_chinese_english_one" name="word_chinese_english" value="1">
  391. <label for="word_chinese_english_one">有</label>
  392. </span>
  393. <span class="margin-left20">
  394. <input type="radio" id="word_chinese_english_two" name="word_chinese_english" value="0" checked="checked">
  395. <label for="word_chinese_english_two">无</label>
  396. </span>
  397. </div>
  398. </div>
  399. </div>
  400. </div>
  401. <div class="option-wrap">
  402. <span class="option-name">扫描方式:</span>
  403. <div class="option-con">
  404. <?php if(isset($setting['scan_type'])):?>
  405. <span><input type="radio" name="scan_type" value="1" <?php if($setting['scan_type']==1) echo 'checked';?>>二维码</span>
  406. <span><input type="radio" name="scan_type" value="2" <?php if($setting['scan_type']==2) echo 'checked';?>>填涂考号</span>
  407. <?php else:?>
  408. <span><input type="radio" name="scan_type" value="1" checked="checked">二维码</span>
  409. <span><input type="radio" name="scan_type" value="2">填涂考号</span>
  410. <?php endif;?>
  411. </div>
  412. </div>
  413. <button class="btn-start" id="confirm" active="true">开始生成</>
  414. </div>
  415. </div>
  416. <input type="hidden" value="1" class="is-new-version"/>
  417. <script src="/js/jquery.ajaxfileupload.js"></script>
  418. <script type="text/javascript">
  419. $(document).ready(function () {
  420. getClassByGrade(<?php echo isset($setting['grade'])?$setting['grade']:1 ;?>);
  421. var optionData={
  422. edition:0,
  423. modular:0,
  424. unit:0,
  425. class:[],
  426. }
  427. <?php if($setting['practice_type']==2){ ?>
  428. commonSet(2);
  429. <?php } ?>
  430. <?php if($setting['card_word_source']==2):?>
  431. $('.card-chinese-range').parent().hide();
  432. <?php endif;?>
  433. //获取版本模块单元
  434. // 版本点击
  435. $("#optionEdition>span").on("click", function(event) {
  436. if(!limitUnit()){
  437. layer.msg('已选单元超出限制');return false;
  438. }
  439. $("#optionEdition>span").removeClass('active')
  440. $(this).addClass('active');
  441. var code = $(this).attr("code");
  442. optionData.edition=code;
  443. console.log('版本',code)
  444. });
  445. // 模块点击
  446. $("#optionModular>span").on("click", function(event) {
  447. if(!limitUnit()){
  448. layer.msg('已选单元超出限制');return false;
  449. }
  450. $("#optionModular>span").removeClass('active')
  451. $(this).addClass('active');
  452. var code = $(this).attr("code");
  453. optionData.modular=code;
  454. console.log('模块',code)
  455. });
  456. // 单元点击
  457. $("body").delegate("#optionUnit>span", "click", function() {
  458. if(!limitUnit()){
  459. layer.msg('已选单元超出限制');return false;
  460. }
  461. // $("#optionUnit>span").on("click", function(event) {
  462. $("#optionUnit>span").removeClass('active')
  463. $(this).addClass('active');
  464. var code = $(this).attr("code");
  465. optionData.unit=code;
  466. console.log('单元',code)
  467. });
  468. // 选择年级
  469. $(".select-grade").change(function() {
  470. console.log($(this).val())
  471. });
  472. // 单选按钮
  473. $("input[name='option-class']").change(function() {
  474. getsClassSelected();
  475. });
  476. //检测卡来源切换
  477. var card_sourse = $("input[name='card_word_source']:checked").val();
  478. if(card_sourse == 1){
  479. $('.card-as2').show();
  480. $('.card-teacher').hide();
  481. }else{
  482. $('.card-as2').hide();
  483. $('.card-teacher').show();
  484. }
  485. $("input[name='card_word_source']").change(function() {
  486. if($(this).val() == 1){
  487. $('.card-teacher').hide();
  488. $('.card-as2').show();
  489. $('.card-chinese-range').parent().show();
  490. $('.card-chinese-range').find('option').eq(0).prop('selected',true);
  491. }else{
  492. $('.card-as2').hide();
  493. $('.card-teacher').show();
  494. $('.card-chinese-range').parent().hide();
  495. $('.card-chinese-range').find('option').eq(0).prop('selected',true);
  496. }
  497. });
  498. function getsClassSelected() {
  499. optionData.class=[];
  500. var selectedData = $("input[name='option-class']:checked"); //获取所以选中学生
  501. for (var i = 0; i < selectedData.length; i++) {
  502. code = $(selectedData[i]).val();
  503. optionData.class.push(code);
  504. }
  505. };
  506. //
  507. $("body").delegate("#optionEdition span", "click", function() {
  508. if(!limitUnit()){
  509. layer.msg('已选单元超出限制');return false;
  510. }
  511. // $('#optionEdition span').on("click", function(event) {
  512. var textbookId = $(this).attr("code");
  513. if(textbookId){
  514. $.ajax({
  515. url: "<?php echo $this->createUrl('print/ajaxNewGetModuleAndUnit');?>",
  516. type: "POST",
  517. dataType: "json",
  518. data: {
  519. version_id: textbookId,
  520. query_type:2
  521. },
  522. success: function (data) {
  523. console.log(data);
  524. if(data.status!=1){
  525. layer.msg('请求失败');return false;
  526. }
  527. var htmlModule = '';
  528. var htmlUnit = '';
  529. if(data.data.modules){
  530. var a = 1;
  531. for(var i in data.data.modules){
  532. var module=data.data.modules[i];
  533. if(a == 1){
  534. htmlModule += '<span code="'+module.textbook_id+'" class="active">'+module.textbook_name+'</span>';
  535. }else{
  536. htmlModule += '<span code="'+module.textbook_id+'">'+module.textbook_name+'</span>';
  537. }
  538. a++;
  539. }
  540. }
  541. if(data.data.units){
  542. var a = 1;
  543. for(var i in data.data.units){
  544. var unit=data.data.units[i];
  545. if(a == 1){
  546. htmlUnit += '<span code="'+unit.textbook_id+'" class="active">'+unit.textbook_name+'</span>';
  547. }else{
  548. htmlUnit += '<span code="'+unit.textbook_id+'">'+unit.textbook_name+'</span>';
  549. }
  550. a++;
  551. }
  552. }
  553. $('#optionModular').html(htmlModule);
  554. $('#optionUnit').html(htmlUnit);
  555. chaptersHtml(data.data.chapters);
  556. }
  557. });
  558. }
  559. })
  560. $("body").delegate("#optionModular span", "click", function() {
  561. if(!limitUnit()){
  562. layer.msg('已选单元超出限制');return false;
  563. }
  564. $("#optionModular>span").removeClass('active')
  565. $(this).addClass('active');
  566. var code = $(this).attr("code");
  567. optionData.modular=code;
  568. var moduleId = $(this).attr("code");
  569. var textbookId = $('#optionEdition span.active').attr("code");
  570. if(textbookId && moduleId){
  571. $.ajax({
  572. url: "<?php echo $this->createUrl('print/ajaxNewGetUnitAndChapters');?>",
  573. type: "POST",
  574. dataType: "json",
  575. data: {
  576. version_id: textbookId,
  577. module_id:moduleId,
  578. query_type:2
  579. },
  580. success: function (data) {
  581. console.log(data);
  582. if(data.status!=1){
  583. layer.msg('请求失败');return false;
  584. }
  585. var htmlUnit = '';
  586. if(data.data.units){
  587. var a = 1;
  588. for(var i in data.data.units){
  589. var unit=data.data.units[i];
  590. if(a == 1){
  591. htmlUnit += '<span code="'+unit.textbook_id+'" class="active">'+unit.textbook_name+'</span>';
  592. }else{
  593. htmlUnit += '<span code="'+unit.textbook_id+'">'+unit.textbook_name+'</span>';
  594. }
  595. a++;
  596. }
  597. }
  598. $('#optionUnit').html(htmlUnit);
  599. chaptersHtml(data.data.chapters);
  600. }
  601. });
  602. }
  603. })
  604. $("body").delegate("#optionUnit span","click",function () {
  605. $("#optionUnit>span").removeClass('active')
  606. $(this).addClass('active');
  607. var code = $(this).attr("code");
  608. optionData.modular=code;
  609. var moduleId = $(this).attr("code");
  610. var textbookId = $('#optionEdition span.active').attr("code");
  611. if(textbookId && moduleId){
  612. $.ajax({
  613. url: "<?php echo $this->createUrl('print/ajaxNewGetChapters');?>",
  614. type: "POST",
  615. dataType: "json",
  616. data: {
  617. version_id: textbookId,
  618. module_id:moduleId,
  619. query_type:2
  620. },
  621. success: function (data) {
  622. console.log(data);
  623. if(data.status!=1){
  624. layer.msg('请求失败');return false;
  625. }
  626. chaptersHtml(data.data.chapters);
  627. }
  628. });
  629. }
  630. });
  631. function chaptersHtml(chapters){
  632. var htmlChapter = '';
  633. var selected_chapter_arr = [];
  634. if($('#selectedChapter span').length > 0){
  635. $('#selectedChapter span').each(function(index){
  636. selected_chapter_arr.push($(this).attr('node'));
  637. });
  638. }
  639. var text_book_id = $("#optionEdition").children(".active").attr("code");
  640. var module_id = $("#optionModular").children(".active").attr("code");
  641. var unit_id =$("#optionUnit").children(".active").attr("code");
  642. var unit_ids = text_book_id + '_' + module_id + '_' + unit_id;
  643. if(chapters){
  644. for(var i in chapters){
  645. var chapter=chapters[i];
  646. var ids=unit_ids+ '_' +chapter.textbook_id;
  647. var classActive='';
  648. if($.inArray(ids, selected_chapter_arr) >= 0){
  649. classActive='active';
  650. }
  651. htmlChapter += '<span code="'+chapter.textbook_id+'" class="'+classActive+'">'+chapter.textbook_name+'</span>';
  652. }
  653. }
  654. $('#optionChapter').html(htmlChapter);
  655. }
  656. $("body").delegate("#optionChapter span","click",function () {
  657. var text_book_id = $("#optionEdition").children(".active").attr("code");
  658. var module_id = $("#optionModular").children(".active").attr("code");
  659. var unit_id =$("#optionUnit").children(".active").attr("code");
  660. var chapter_id=$(this).attr('code');
  661. var unit_ids = text_book_id + '_' + module_id + '_' + unit_id;
  662. var ids=unit_ids+'_'+chapter_id;
  663. var selected_arr = [];
  664. if($('#selectedUnit span').length > 0){
  665. $('#selectedUnit span').each(function(index){
  666. selected_arr.push($(this).attr('node'));
  667. });
  668. }
  669. //单元控制数量
  670. var grade = $('.select-grade').val();
  671. var selected_count = $("#selectedUnit").children("span").length;
  672. if(grade == 3 && selected_count >= 3 && $.inArray(unit_ids, selected_arr) == -1){
  673. layer.msg('已选单元超出限制');
  674. return false;
  675. }
  676. if(grade!=3 && selected_count>=1 && $.inArray(unit_ids, selected_arr) == -1){
  677. layer.msg('已选单元超出限制');
  678. return false;
  679. }
  680. var text_book_name = $("#optionEdition").children(".active").text();
  681. var module_name = $("#optionModular").children(".active").text();
  682. var unit_name = $("#optionUnit").children(".active").text();
  683. var names = text_book_name + '_' + module_name + '_' + unit_name;
  684. if($.inArray(unit_ids, selected_arr) == -1) {
  685. var _html = '<span node="' + unit_ids + '">' + names + '<i class="delete-icon" onclick="deleteUnit(this)"></i></span>';
  686. $("#selectedUnit").append(_html);
  687. }
  688. var selected_chapter_arr = [];
  689. if($('#selectedChapter span').length > 0){
  690. $('#selectedChapter span').each(function(index){
  691. selected_chapter_arr.push($(this).attr('node'));
  692. });
  693. }
  694. if($.inArray(ids, selected_chapter_arr) >= 0){
  695. layer.msg('不能重复添加该小节');
  696. getNumber();
  697. return false;
  698. }
  699. var chapter_name = $(this).text();
  700. var names = names + '_' + chapter_name;
  701. var _html = '<span node="' + ids + '" parent-node="' + unit_ids + '">' + names + '<i class="delete-icon" onclick="deleteChapter(this)"></i></span>';
  702. $("#selectedChapter").append(_html);
  703. $(this).addClass('active');
  704. getNumber();
  705. })
  706. function getNumber(){
  707. var selected_chapter_arr = [];
  708. if($('#selectedChapter span').length > 0){
  709. $('#selectedChapter span').each(function(index){
  710. selected_chapter_arr.push($(this).attr('node'));
  711. });
  712. }
  713. $.ajax({
  714. url: "<?php echo $this->createUrl('magic/ajaxNewWordCount');?>",
  715. type: "POST",
  716. dataType: "json",
  717. data: {
  718. ids: selected_chapter_arr
  719. },
  720. beforeSend:function(){
  721. layer.load(1, {
  722. shade: [0.1,'#fff'] //0.1透明度的白色背景
  723. });
  724. },
  725. success: function (data) {
  726. var index = layer.load();
  727. layer.close(index);
  728. if(data.status!=1){
  729. layer.msg('请稍后再试');
  730. return false;
  731. }
  732. $('#word_total').text(data.data.wordCount);
  733. $('#card_word_count_total').text(data.data.wordCount);
  734. $('#card_phrase_count_total').text(data.data.phraseCount);
  735. setCardNumberMax(data.data.wordCount,data.data.phraseCount);
  736. }
  737. });
  738. }
  739. function setCardNumberMax(wordCount,phraseCount){
  740. $('.word_chinese_english').attr('max',wordCount);
  741. $('.word_english_chinese').attr('max',wordCount);
  742. $('.phrase_chinese_english').attr('max',phraseCount);
  743. $('.phrase_english_chinese').attr('max',phraseCount);
  744. }
  745. $('.select-grade').change(function(){
  746. $('#selectedUnit').empty();
  747. $('#selectedChapter').empty();
  748. var grade = $(this).val();
  749. getClassByGrade(grade);
  750. $('#word_total').text(0);
  751. $('#card_default').text(0);
  752. $('#card_total').text(0);
  753. $('#card_word_count_total').text(0);
  754. $('#card_phrase_count_total').text(0);
  755. if($('#optionChapter span').length > 0){
  756. $('#optionChapter span').each(function(index){
  757. $(this).removeClass('active')
  758. });
  759. }
  760. });
  761. $("#confirm[active='true']").on("click", function() {
  762. $('#confirm').attr('disabled','disabled');
  763. var This = $(this);
  764. This.attr("active","false");
  765. var error = [];
  766. var selectClassIds = [];
  767. var chapterIds = [];
  768. var names = [];
  769. var grade = parseInt($('.select-grade').val());
  770. var is_class_common = $("input[name='is_class_common']:checked").val();
  771. var translate_type = $("input[name='translate_type']:checked").val();
  772. var practice_type = $("input[name='practice_type']:checked").val();
  773. var isAnswerSeparate = $("input[name='is_answer_separate']:checked").val();
  774. var card_word_source = $("input[name='card_word_source']:checked").val();
  775. var word_group_id = $("input[name='word_group_id']:checked").val();
  776. var scan_type = $("input[name='scan_type']:checked").val();
  777. var is_new_version=parseInt($('.is-new-version').val());
  778. var correcting_model=$(".correcting-model option:selected").val();
  779. var card_chinese_range=parseInt($(".card-chinese-range option:selected").val());
  780. var word_english_chinese = $("input[name='word_english_chinese']:checked").val();
  781. var word_chinese_english = $("input[name='word_chinese_english']:checked").val();
  782. var derive_json={};
  783. derive_json.word_english_chinese=word_english_chinese;
  784. derive_json.word_chinese_english=word_chinese_english;
  785. $('#optionClass input:checked').each(function(k,v){
  786. if($(this).attr("status") == 0){
  787. selectClassIds.push($(this).val());
  788. }
  789. });
  790. /*$('#selectedUnit span').each(function(k,v){
  791. unitIds.push($(this).attr('node'));
  792. names.push($(this).text())
  793. });*/
  794. $('#selectedChapter span').each(function(k,v){
  795. chapterIds.push($(this).attr('node'));
  796. names.push($(this).text())
  797. });
  798. if(selectClassIds.length == 0){
  799. error.push("请选择班级");
  800. }
  801. if(grade <= 0 || !grade){
  802. error.push("请选择年级");
  803. }
  804. if(chapterIds.length == 0){
  805. error.push("请选择小节")
  806. }
  807. var word_count = $("input[name='words_number']").val();
  808. if(!isPositiveInteger(word_count)){
  809. error.push("词汇精讲数量请输入正整数")
  810. }
  811. if(word_count > 40){
  812. error.push("词汇精讲数量最多40个")
  813. }
  814. if(word_count <= 0){
  815. error.push("请检查词汇精讲数量")
  816. }
  817. var input_card_count = $("input[name='card_number']").val();
  818. var total_card_count = parseInt($('#card_word_count_total').text());
  819. var card_count = 0;
  820. /*if(card_word_source == 1) {
  821. if (!isPositiveInteger(input_card_count)) {
  822. error.push("词汇检测卡词语数量请输入正整数");
  823. }
  824. card_count = parseInt(input_card_count);
  825. if (card_count > 50 || card_count<10) {
  826. error.push("词汇检测卡词语数量最多50个最少10个");
  827. }
  828. if(card_count>total_card_count){
  829. error.push("词汇检测卡词语数量超出总数");
  830. }
  831. }*/
  832. /*var word_chinese_english=parseInt($('.word_chinese_english').val());
  833. var word_english_chinese=parseInt($('.word_english_chinese').val());
  834. var phrase_chinese_english=parseInt($('.phrase_chinese_english').val());
  835. var phrase_english_chinese=parseInt($('.phrase_english_chinese').val());
  836. var card_word_count_total = parseInt($('#card_word_count_total').text());
  837. var card_phrase_count_total = parseInt($('#card_phrase_count_total').text());*/
  838. var word_chinese_english=$('.word_chinese_english').val();
  839. var word_english_chinese=$('.word_english_chinese').val();
  840. var phrase_chinese_english=$('.phrase_chinese_english').val();
  841. var phrase_english_chinese=$('.phrase_english_chinese').val();
  842. var card_word_count_total =$('#card_word_count_total').text();
  843. var card_phrase_count_total = $('#card_phrase_count_total').text();
  844. var card_count_json={};
  845. if(card_word_source==1){
  846. if (!isPositiveNumber(word_chinese_english)) {
  847. error.push("单词汉译英数量请输入大于或等于0整数");
  848. }
  849. if (!isPositiveNumber(word_english_chinese)) {
  850. error.push("单词英译汉数量请输入大于或等于0整数");
  851. }
  852. if (!isPositiveNumber(phrase_chinese_english)) {
  853. error.push("短语汉译英数量请输入大于或等于0整数");
  854. }
  855. if (!isPositiveNumber(phrase_english_chinese)) {
  856. error.push("短语英译汉数量请输入大于或等于0整数");
  857. }
  858. word_chinese_english=parseInt(word_chinese_english);
  859. word_english_chinese=parseInt(word_english_chinese);
  860. phrase_chinese_english=parseInt(phrase_chinese_english);
  861. phrase_english_chinese=parseInt(phrase_english_chinese);
  862. card_word_count_total = parseInt(card_word_count_total);
  863. card_phrase_count_total = parseInt(card_phrase_count_total);
  864. if(word_chinese_english+word_english_chinese>card_word_count_total){
  865. error.push("单词汉译英和英译汉数量超过单词数量总数");
  866. }
  867. if(phrase_chinese_english+phrase_english_chinese>card_phrase_count_total){
  868. error.push("单词汉译英和英译汉数量超过短语数量总数");
  869. }
  870. var card_total=word_chinese_english+word_english_chinese+phrase_chinese_english+phrase_english_chinese;
  871. if(card_total<10 || card_total>400){
  872. error.push("词汇检测卡词语数量最多400个最少10个");
  873. }
  874. card_count_json.word=card_word_count_total;
  875. card_count_json.word_chinese_english=word_chinese_english;
  876. card_count_json.word_english_chinese=word_english_chinese;
  877. card_count_json.phrase=card_phrase_count_total;
  878. card_count_json.phrase_chinese_english=phrase_chinese_english;
  879. card_count_json.phrase_english_chinese=phrase_english_chinese;
  880. }
  881. if(error.length == 0){
  882. $.ajax({
  883. url: "<?php echo $this->createUrl('magic/ajaxSaveSetting');?>",
  884. type: "POST",
  885. dataType: "json",
  886. data: {
  887. grade: grade,
  888. selectClassIds:selectClassIds,
  889. unitIds: chapterIds,
  890. names: names,
  891. translateType:translate_type,
  892. isClassCommon:is_class_common,
  893. practiceType:practice_type,
  894. wordCount:word_count,
  895. cardWord_count:card_count,
  896. isAnswerSeparate:isAnswerSeparate,
  897. cardWordSource: card_word_source,
  898. wordGroupId: word_group_id,
  899. scanType:scan_type,
  900. card_count_json:JSON.stringify(card_count_json),
  901. is_new_version:is_new_version,
  902. correcting_model:correcting_model,
  903. card_chinese_range:card_chinese_range,
  904. derive_json:JSON.stringify(derive_json)
  905. },
  906. success: function (data) {
  907. if(data.status == 1){
  908. layer.msg('已发送到后台,预计1小时左右生成!', {
  909. time: 2000,
  910. });
  911. setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('magic/index');?>";}, 2000);
  912. }else{
  913. layer.msg(data.error.join('</br>'));
  914. This.attr("active","true");
  915. }
  916. $('#confirm').removeAttr('disabled');
  917. }
  918. });
  919. }else{
  920. $('#confirm').removeAttr('disabled');
  921. This.attr("active","true");
  922. layer.msg(error.join('</br>'));
  923. }
  924. });
  925. function getClassByGrade(grade){
  926. if(grade){
  927. $.ajax({
  928. url: "<?php echo $this->createUrl('magic/ajaxGetClasses');?>",
  929. type: "POST",
  930. dataType: "json",
  931. data: {
  932. grade: grade,
  933. },
  934. beforeSend:function(){
  935. layer.load(1, {
  936. shade: [0.1,'#fff'] //0.1透明度的白色背景
  937. });
  938. },
  939. success: function (data) {
  940. var index = layer.load();
  941. layer.close(index);
  942. var html = '';
  943. if(data && data.length > 0){
  944. for(var i in data){
  945. html +='<label>';
  946. if(data[i].status == 1){
  947. html += '<span title="该班级已达每周生成的最大次数"><img src="<?php echo $disableImgUrl;?>">'+data[i].class_name+'</span><span style="margin-left: 5px;" class="unit_generate_count">(<span>5</span>)</span></label>';
  948. }else{
  949. var isChecked = data[i].selected === true ? 'checked' : '';
  950. html += ' <input type="checkbox" name="option-class" ' + isChecked + ' value="'+data[i].class_id+'" status="0">'+data[i].class_name+'<span style="color:red;margin-left: 5px;" class="unit_generate_count">' + '(' + '<span>'+ data[i].count +'</span>' + ')' + '</span></label>';
  951. }
  952. }
  953. }
  954. html += '<div style="color: red;font-weight: bold">' + '* 提示:每个班级名称后的括号内为本班的本周生成次数。' + '</div>';
  955. $('#optionClass').html(html);
  956. }
  957. });
  958. }
  959. }
  960. });
  961. function deleteUnit(a) {
  962. var ids = $(a).parent().attr('node');
  963. var grade = parseInt($('.select-grade').val());
  964. var generate_class = ".unit"+ ids;
  965. $("span").remove(generate_class);
  966. var units = [];
  967. if($('#selectedUnit span').length > 0){
  968. $('#selectedUnit span').each(function(index){
  969. if(ids!=$(this).attr('node')){
  970. units.push($(this).attr('node'));
  971. }
  972. });
  973. }
  974. if(units.length==0){
  975. $('#word_total').text(0);
  976. $('#card_word_count_total').text(0);
  977. $('#card_phrase_count_total').text(0);
  978. }else{
  979. //动态获取单元关联单词和短语数量
  980. $.ajax({
  981. url: "<?php echo $this->createUrl('magic/ajaxNewWordCount');?>",
  982. type: "POST",
  983. dataType: "json",
  984. data: {
  985. ids: units,
  986. grade: grade
  987. },
  988. beforeSend: function () {
  989. layer.load(1, {
  990. shade: [0.1, '#fff'] //0.1透明度的白色背景
  991. });
  992. },
  993. success: function (data) {
  994. var index = layer.load();
  995. layer.close(index);
  996. if (data.status != 1) {
  997. layer.msg('请稍后再试');
  998. return false;
  999. }
  1000. $('#word_total').text(data.data.wordCount);
  1001. $('#card_word_count_total').text(data.data.wordCount);
  1002. $('#card_phrase_count_total').text(data.data.phraseCount);
  1003. setCardNumberMax(data.data.wordCount,data.data.phraseCount);
  1004. }
  1005. });
  1006. }
  1007. $(a).parent().remove();
  1008. }
  1009. function setCardNumberMax(wordCount,phraseCount){
  1010. $('.word_chinese_english').attr('max',wordCount);
  1011. $('.word_english_chinese').attr('max',wordCount);
  1012. $('.phrase_chinese_english').attr('max',phraseCount);
  1013. $('.phrase_english_chinese').attr('max',phraseCount);
  1014. }
  1015. function deleteChapter(obj) {
  1016. var ids = $(obj).parent().attr('node');
  1017. var chapters = [];
  1018. var chapterParent=[];
  1019. if($('#selectedChapter span').length > 0){
  1020. $('#selectedChapter span').each(function(index){
  1021. if(ids!=$(this).attr('node')){
  1022. chapters.push($(this).attr('node'));
  1023. if($.inArray($(this).attr('parent-node'), chapterParent) == -1) {
  1024. chapterParent.push($(this).attr('parent-node'))
  1025. }
  1026. }
  1027. });
  1028. }
  1029. if($('#selectedUnit span').length > 0){
  1030. $('#selectedUnit span').each(function(index){
  1031. if($.inArray($(this).attr('node'), chapterParent) == -1) {
  1032. $(this).remove();
  1033. }
  1034. });
  1035. }
  1036. if(chapters.length==0){
  1037. $('#word_total').text(0);
  1038. $('#card_word_count_total').text(0);
  1039. $('#card_phrase_count_total').text(0);
  1040. }else{
  1041. //动态获取单元关联单词和短语数量
  1042. $.ajax({
  1043. url: "<?php echo $this->createUrl('magic/ajaxNewWordCount');?>",
  1044. type: "POST",
  1045. dataType: "json",
  1046. data: {
  1047. ids: chapters,
  1048. },
  1049. beforeSend: function () {
  1050. layer.load(1, {
  1051. shade: [0.1, '#fff'] //0.1透明度的白色背景
  1052. });
  1053. },
  1054. success: function (data) {
  1055. var index = layer.load();
  1056. layer.close(index);
  1057. if (data.status != 1) {
  1058. layer.msg('请稍后再试');
  1059. return false;
  1060. }
  1061. $('#word_total').text(data.data.wordCount);
  1062. $('#card_word_count_total').text(data.data.wordCount);
  1063. $('#card_phrase_count_total').text(data.data.phraseCount);
  1064. setCardNumberMax(data.data.wordCount,data.data.phraseCount);
  1065. }
  1066. });
  1067. }
  1068. $(obj).parent().remove();
  1069. var text_book_id = $("#optionEdition").children(".active").attr("code");
  1070. var module_id = $("#optionModular").children(".active").attr("code");
  1071. var unit_id =$("#optionUnit").children(".active").attr("code");
  1072. var unit_ids = text_book_id + '_' + module_id + '_' + unit_id;
  1073. if($('#optionChapter span').length > 0){
  1074. $('#optionChapter span').each(function(index){
  1075. if(unit_ids+'_'+$(this).attr('code')==ids){
  1076. $(this).removeClass('active');
  1077. }
  1078. });
  1079. }
  1080. }
  1081. function limitUnit() {
  1082. /*var grade = $('.select-grade').val();
  1083. var selected_count = $("#selectedUnit").children("span").length;
  1084. if(grade == 3 && selected_count == 3){
  1085. return false;
  1086. }
  1087. if(grade!=3 && selected_count>=1){
  1088. return false;
  1089. }*/
  1090. return true;
  1091. }
  1092. function isPositiveInteger(s){//是否为正整数
  1093. var reg = /^[1-9]\d*$/;
  1094. return reg.test(s)
  1095. }
  1096. function isPositiveNumber(s){//是否为整数
  1097. var reg = /^[0-9]\d*$/;
  1098. return reg.test(s)
  1099. }
  1100. $('input:radio[name="practice_type"]').change(function(){
  1101. var v = $(this).val();
  1102. commonSet(v);
  1103. });
  1104. function commonSet(v){
  1105. if (v ==1){
  1106. $("#commonSet").show();
  1107. }else{
  1108. $("#commonSet").hide();
  1109. }
  1110. }
  1111. function isHold() {
  1112. var is_hold = $('#show-teacher-word').attr('is-hold');
  1113. if(is_hold == 0){
  1114. $('#show-teacher-word').attr('is-hold', 1);
  1115. $('#allTeacherWord').addClass('word-group-hidden');
  1116. $('#show-teacher-word').html('展开');
  1117. }else {
  1118. $('#show-teacher-word').attr('is-hold', 0);
  1119. $('#allTeacherWord').removeClass('word-group-hidden');
  1120. $('#show-teacher-word').html('收起');
  1121. }
  1122. }
  1123. </script>