handle.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
  2. <style>
  3. html {overflow-y: scroll;}
  4. </style>
  5. <div class="main-content-inner">
  6. <ul class="clearfix main-content-inner-ul">
  7. <?php if(Yii::app()->session['coachInfo']['leader']==1){?>
  8. <li class="pull-left">
  9. <button onclick='location.href="<?php echo $this->createUrl("semester/index");?>"' class="button button_normal button_group button_arrow" data-button="red">学期管理</button>
  10. <img src="/images/line.jpg" style="height:45px;" />
  11. </li>
  12. <?php }?>
  13. <li class="pull-left">
  14. <button onclick='location.href="<?php echo $this->createUrl("teacher/index");?>"' class="button button_normal button_group button_arrow" data-button="red">教师管理</button>
  15. <img src="/images/line.jpg" style="height:45px;" />
  16. </li>
  17. <li class="pull-left">
  18. <button onclick='location.href="<?php echo $this->createUrl("classes/index");?>"' class="button button_normal button_group button_arrow" data-button="red">班级管理</button>
  19. <img src="/images/line.jpg" style="height:45px;" />
  20. </li>
  21. <li class="pull-left">
  22. <button onclick='location.href="<?php echo $this->createUrl("studentinfo/index");?>"' class="button button_normal button_group button_arrow button_active" data-button="red">学生管理</button>
  23. <img src="/images/line.jpg" style="height:45px;" />
  24. </li>
  25. <li class="pull-left">
  26. <button onclick='location.href="<?php echo $this->createUrl("classes/export");?>"' class="button button_normal button_group button_arrow " data-button="red">导出学生</button>
  27. <img src="/images/line.jpg" style="height:45px;" />
  28. </li>
  29. </ul>
  30. <div class="layout-gap">
  31. <section class="hrn-top flex">
  32. <div class="flex-one hrn-top-title fw">重名学生</div>
  33. <div class="green-font pointer" onclick="javascript:history.go(-1);">返回</div>
  34. </section>
  35. <section class="flex hrn-main-con">
  36. <article class="menu-list-con">
  37. <div class="menu-list-top">
  38. <span class="green-font pointer fw prev-menu-page vtm" rel="<?php echo $page;?>">&lt;</span>
  39. <span class="vtm showpage">第<?php echo $page;?>页</span>
  40. <span class="green-font pointer fw next-menu-page vtm" rel="<?php echo $page;?>">&gt;</span>
  41. <span class="vtm totalpage">共<?php echo $total_page;?>页</span>
  42. <input type="hidden" name="total_page" value="<?php if(isset($total_page)) echo $total_page?>">
  43. </div>
  44. <div class="search-opt">
  45. <div class="search-inp vtm">
  46. <input type="text" name="name_like" placeholder="姓名关键字" class="search-key-value">
  47. <div class="clear-search-value pointer">×</div>
  48. </div>
  49. <img src="/images/search.png" alt="" class="search-btn-img pointer vtm">
  50. </div>
  51. <ul class="name-key-datas">
  52. <?php
  53. if(isset($name_group)){
  54. foreach ($name_group as $key=> $val){
  55. ?>
  56. <li class="name-key-list flex">
  57. <div class="flex-one"><?php echo $val['modify_name'];?></div>
  58. <div class="gray-font"><?php echo $val['count'];?></div>
  59. </li>
  60. <?php
  61. }
  62. }
  63. ?>
  64. </ul>
  65. </article>
  66. <article class="flex-one handle-detail-con">
  67. <div class="handle-detail-top flex">
  68. <div class="flex-one">
  69. <p>处理步骤:</p>
  70. <p class="gray-font">第1步、关联账号:若同一学生在不同学期创建了多个账号,请拖动之前学期学生的卡片到最近学期对应的学生卡片上,拖动结束则学生账号关联</p>
  71. <p class="gray-font">第2步、区分重名:当前学期学生若重名,请录入学生身份证号加以区分</p>
  72. <p class="gray-font">第3步、忽略:若是已经毕业的学生,可直接选择忽略本学期操作,不过下次检测还是会出现,但不影响其他功能使用(此功能只针对18年以前的开放)</p>
  73. </div>
  74. <div class="check-btn pointer">检查</div>
  75. </div>
  76. <div class="handle-detail-main">
  77. </div>
  78. </article>
  79. </section>
  80. </div>
  81. </div>
  82. <div class="history-pop">
  83. <div class="history-pop-con">
  84. <div class="need-pop-top clearfix">
  85. <div class="npt-title put-need fl">查看历史成绩</div>
  86. <div class="npt-close fr">×</div>
  87. </div>
  88. <table class="history-mark-table">
  89. <thead class="fw">
  90. <td>考试日期</td>
  91. <td>试卷名称</td>
  92. <td>我的得分</td>
  93. <td>班级平均分</td>
  94. <td>年级平均分</td>
  95. <td>班级排名</td>
  96. <td>年级排名</td>
  97. </thead>
  98. <tbody id="exam_list">
  99. </tbody>
  100. </table>
  101. </div>
  102. </div>
  103. <div class="countermark-pop">
  104. <div class="countermark-pop-con">
  105. <div class="need-pop-top clearfix">
  106. <div class="npt-title put-need fl">查看副号</div>
  107. <div class="npt-close fr">×</div>
  108. </div>
  109. <div class="flex relative">
  110. <img src="/images/prev-arrow.png" alt="" class="prev-arrow-pop arrow-img pointer">
  111. <div class="countermark-datas flex-one">
  112. <ul class="clearfix countermark-list-detail">
  113. </ul>
  114. </div>
  115. <img src="/images/next-arrow.png" alt="" class="next-arrow-pop arrow-img pointer">
  116. </div>
  117. </div>
  118. </div>
  119. <div class="relate-sure-pop">
  120. <div class="relate-sure-pop-con">
  121. <div class="need-pop-top clearfix">
  122. <div class="npt-title put-need fl">提示</div>
  123. <div class="npt-close fr">×</div>
  124. </div>
  125. <div class="confirm-msg red-font tac">
  126. 确认要关联学生的账号吗?
  127. </div>
  128. <div class="pop-btns">
  129. <div class="confirm-pop-btn-sure">确认关联</div>
  130. </div>
  131. </div>
  132. </div>
  133. <div class="pop-sec-time">处理成功!即将进入下一组</div>
  134. <script>
  135. $(function(){
  136. var data,idxStar,idxEnd,startCardId,endCardId;
  137. var now_name; //当前正在处理的哪一组
  138. var now_menu_index=0;
  139. //默认加载第一组
  140. next_name=$('.name-key-datas').find('li').eq(0).find('.flex-one').html();
  141. loadStudent(next_name,now_menu_index);
  142. //分页
  143. $('.prev-menu-page').click(function () {
  144. var page=$(this).attr('rel');
  145. var name_like=$.trim($('input[name=name_like]').val());
  146. if(page==1){
  147. return false;
  148. }
  149. loadmenu(page-1,name_like,'');
  150. });
  151. $('.next-menu-page').click(function(){
  152. var total_page=parseInt($('input[name=total_page]').val());
  153. var page=parseInt($(this).attr('rel'));
  154. var name_like=$.trim($('input[name=name_like]').val());
  155. if((page+1)>total_page){
  156. return false;
  157. }
  158. loadmenu(page+1,name_like,'');
  159. });
  160. $('.search-btn-img').click(function(){
  161. var name_like=$.trim($('.search-key-value').val());
  162. loadmenu(1,name_like,'');
  163. });
  164. $('.name-key-datas')
  165. .on('click','.flex-one',function(){
  166. var name=$(this).html();
  167. loadStudent(name,$(this).closest('.name-key-list').index());
  168. });
  169. function loadmenu(page,name_like,next_name){
  170. page=parseInt(page);
  171. $.ajax({
  172. url:'<?php echo $this->createUrl('checkstudent/handledata')?>',
  173. type:'POST',
  174. data:{'page':page,'name':name_like},
  175. dataType:'json',
  176. success:function(res){
  177. if(res.status==1){
  178. var html='';
  179. for(var i=0;i<res.data.length;i++){
  180. html+='<li class="name-key-list flex">';
  181. html+='<div class="flex-one">'+res.data[i]['modify_name']+'</div>';
  182. html+='<div class="gray-font">'+res.data[i]['count']+'</div>';
  183. html+='</li>';
  184. }
  185. $('.name-key-datas').html(html);
  186. $('.prev-menu-page').attr('rel',page);
  187. $('.next-menu-page').attr('rel',page);
  188. $('.showpage').html('第'+(page)+'页');
  189. $('.totalpage').html('共'+res.total_page+'页');
  190. $('input[name=total_page]').val(res.total_page);
  191. if(next_name!=''){
  192. loadStudent(next_name,now_menu_index);
  193. }
  194. }
  195. }
  196. });
  197. }
  198. function loadStudent(name,index){
  199. if(name==''){
  200. return false;
  201. }
  202. $('.pop-sec-time').html('正在加载中。。。。。。');
  203. $('.pop-sec-time').show();
  204. $.ajax({
  205. url:'<?php echo $this->createUrl('checkstudent/showrepeatstudent')?>',
  206. type:'POST',
  207. data:{'name':name},
  208. dataType:'json',
  209. success:function(res){
  210. if(res.status==1){
  211. $('.handle-detail-main').html(res.data);
  212. now_name=name;
  213. now_menu_index=index;
  214. }
  215. $('.pop-sec-time').hide();
  216. }
  217. });
  218. }
  219. function arrowImgShow() {
  220. $('.handel-term-list').each(function(){
  221. if ($(this).find('.term-card-list').length<4) {
  222. $(this).find('.arrow-img').hide();
  223. } else {
  224. $(this).find('.arrow-img').show();
  225. }
  226. })
  227. }
  228. arrowImgShow();
  229. $(document)
  230. .on('click','.toggle-opt-btn',function(){
  231. if ($(this).text()=='展开') {
  232. $(this).text('收起')
  233. } else {
  234. $(this).text('展开')
  235. }
  236. $(this).closest('.term-card-list').find('.hide-list').toggle();
  237. })
  238. .on('click','.prev-arrow',function(){
  239. var leftNum = $(this).next('.term-card-layout').find('.term-card-detail').position().left-40;
  240. var lisWidth = $(this).next('.term-card-layout').find('.term-card-detail li').width();
  241. if (leftNum==0) {
  242. alert('已经是第一条了')
  243. } else {
  244. $(this).next('.term-card-layout').find('.term-card-detail').css('left',leftNum+lisWidth);
  245. $('.hide-list').hide();
  246. $('.toggle-opt-btn').text('展开');
  247. }
  248. })
  249. .on('click','.next-arrow',function(){
  250. var listLen = $(this).prev('.term-card-layout').find('.term-card-detail li').length;
  251. var leftNum = $(this).prev('.term-card-layout').find('.term-card-detail').position().left-40;
  252. var lisWidth = $(this).prev('.term-card-layout').find('.term-card-detail li').width();
  253. if (listLen<3||listLen==3||leftNum/(listLen-3)==-lisWidth||leftNum/(listLen-3)<-lisWidth) {
  254. alert('已经是最后第一条了')
  255. } else {
  256. $(this).prev('.term-card-layout').find('.term-card-detail').css('left',leftNum-lisWidth);
  257. $('.hide-list').hide();
  258. $('.toggle-opt-btn').text('展开');
  259. }
  260. })
  261. .on('click','.edit-icon',function(){
  262. $(this).hide().next('.edit-self-no').show();
  263. })
  264. .on('blur','.edit-self-no',function(){
  265. var reg=/^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
  266. if (reg.test($(this).val())) {
  267. var student_id=$(this).attr('data');
  268. var id_number=$(this).val();
  269. var obj=$(this);
  270. $.ajax({
  271. url:'<?php echo $this->createUrl('checkstudent/saveidnumber')?>',
  272. type:'POST',
  273. dataType:'json',
  274. data:{'student_id':student_id,'id_number':id_number},
  275. success:function(res){
  276. if(res.status==1){
  277. alert('保存成功!')
  278. }else{
  279. obj.val('');
  280. if(res.msg!=undefined){
  281. layer.msg(res.msg);
  282. }else{
  283. layer.msg('保存失败');
  284. }
  285. }
  286. }
  287. });
  288. } else {
  289. alert('身份证号码有误!')
  290. }
  291. })
  292. .on('click','.browse-history',function(){
  293. var student_id=$(this).attr('rel');
  294. console.log(student_id);
  295. $.ajax({
  296. url:'<?php echo $this->createUrl('checkstudent/gethistoryscore')?>',
  297. type:'POST',
  298. dataType:'json',
  299. data:{'student_id':student_id},
  300. success:function(res){
  301. if(res.status==1){
  302. var list=res.data,html='';
  303. for(var i=0;i<list.length;i++){
  304. html+='<tr>';
  305. html+='<td>'+list[i]['exam_date']+'</td>';
  306. html+='<td>'+list[i]['exam_name']+'</td>';
  307. html+='<td>'+list[i]['score']+'</td>';
  308. html+='<td>'+list[i]['class_avg']+'</td>';
  309. html+='<td>'+list[i]['grade_avg']+'</td>';
  310. html+='<td>'+list[i]['class_rank']+'</td>';
  311. html+='<td>'+list[i]['grade_rank']+'</td>';
  312. html+='</tr>';
  313. }
  314. $('#exam_list').html(html);
  315. $('.history-pop').show();
  316. }
  317. }
  318. });
  319. })
  320. .on('click','.fuhao-lock',function(){
  321. var student_id=$(this).attr('rel');
  322. var fuhao_number=parseInt($(this).html());
  323. if(fuhao_number>0){
  324. $.ajax({
  325. url:'<?php echo $this->createUrl('checkstudent/getslaves')?>',
  326. type:'POST',
  327. dataType:'json',
  328. data:{'student_id':student_id},
  329. success:function(res){
  330. if(res.status==1){
  331. $('.countermark-list-detail').html(res.data);
  332. if ($('.countermark-list-detail li').length<3) {
  333. $('.countermark-pop-con').find('.arrow-img').hide()
  334. }
  335. $('.countermark-pop').show();
  336. }
  337. }
  338. });
  339. }
  340. })
  341. .on('click','.relieve-relate',function(){
  342. var student_id=$(this).attr('rel');
  343. var name=$(this).attr('data');
  344. if(student_id=='' || student_id==undefined){
  345. return false;
  346. }
  347. $.ajax({
  348. url:'<?php echo $this->createUrl('checkstudent/cancelrelation')?>',
  349. dataType:'json',
  350. type:'POST',
  351. data:{'student_id':student_id},
  352. success:function(res){
  353. if(res.status==1){
  354. $('.countermark-pop').hide();
  355. loadStudent(name);
  356. }
  357. }
  358. });
  359. })
  360. .on('click','.term-name span',function(){
  361. //忽略功能
  362. var semester=$(this).attr('semester');
  363. var name=now_name;
  364. var obj=$(this);
  365. layer.msg('忽略后该学期姓名为:'+name+' 的学生将不再参与检测,确定吗?', {
  366. time: 0,
  367. btn: ['确定', '取消'],
  368. yes: function(index){
  369. layer.close(index);
  370. $.ajax({
  371. url:'<?php echo $this->createUrl('checkstudent/ignore')?>',
  372. dataType:'json',
  373. type:'POST',
  374. data:{'name':name,'semester':semester},
  375. success:function(res){
  376. if(res.status==1){
  377. obj.closest('.handel-term-list').remove();
  378. layer.msg('操作成功');
  379. }else{
  380. layer.msg('操作失败');
  381. }
  382. }
  383. });
  384. }
  385. });
  386. })
  387. $('.check-btn').click(function(){
  388. //开始检测
  389. $maxIndex=$('.name-key-datas').find('li').length-1;
  390. var next_name=$('.name-key-datas').find('li').eq(now_menu_index+1).find('.flex-one').html();
  391. $.ajax({
  392. url:'<?php echo $this->createUrl('checkstudent/checkhandle')?>',
  393. data:{'name':now_name},
  394. type:'POST',
  395. dataType:'json',
  396. success:function(res){
  397. if(res.status==1){
  398. if(now_menu_index>=$maxIndex){
  399. $('.pop-sec-time').html('处理成功!');
  400. $('.pop-sec-time').show();
  401. window.location.href='<?php echo $this->createUrl('checkstudent/index')?>';
  402. }else{
  403. $('.pop-sec-time').html('处理成功!即将进入下一组');
  404. $('.pop-sec-time').show();
  405. page=$('.prev-menu-page').attr('rel');
  406. name_like=$.trim($('input[name=name_like]').val());
  407. loadmenu(page,name_like,next_name);
  408. }
  409. setTimeout(function(){
  410. $('.pop-sec-time').fadeOut();
  411. }, 2000);
  412. //进入下一组???
  413. }else if(res.status==2){
  414. $('.pop-sec-time').html('存在重名学生,请继续处理');
  415. $('.pop-sec-time').show();
  416. setTimeout(function(){
  417. $('.pop-sec-time').fadeOut();
  418. }, 2000);
  419. }
  420. }
  421. });
  422. })
  423. $('.npt-close').click(function(){
  424. $('.history-pop,.countermark-pop,.relate-sure-pop').hide();
  425. })
  426. $(document).on('click','.next-arrow-pop',function () {
  427. var listLen = $(this).prev('.countermark-datas').find('.countermark-list-detail li').length;
  428. var leftNum = $(this).prev('.countermark-datas').find('.countermark-list-detail').position().left-60;
  429. if (parseInt(leftNum/(listLen-2))==-282) {
  430. alert('已经是最后第一条了')
  431. } else {
  432. $(this).prev('.countermark-datas').find('.countermark-list-detail').css('left',leftNum-282);
  433. }
  434. })
  435. $(document).on('click','.prev-arrow-pop',function () {
  436. var leftNum = $(this).next('.countermark-datas').find('.countermark-list-detail').position().left-60;
  437. if (leftNum<0) {
  438. $(this).next('.countermark-datas').find('.countermark-list-detail').css('left',leftNum+282);
  439. } else {
  440. alert('已经是第一条了')
  441. }
  442. })
  443. $('.confirm-pop-btn-sure').click(function(){
  444. //合并操作
  445. $.ajax({
  446. url:'<?php echo $this->createUrl('checkstudent/relationhand')?>',
  447. type:'POST',
  448. dataType:'json',
  449. data:{'startCardId':startCardId,'endCardId':endCardId},
  450. success:function(res){
  451. if(res.status==1){
  452. $('#'+endCardId).find('.fuhao-lock').html(res.number);
  453. // 合并成功,删掉拖拽的元素
  454. $('.handel-term-list').eq(idxStar).find('#'+data).remove();
  455. if ($('.handel-term-list').eq(idxStar).find('li').length<4) {
  456. // 如果元素个数小于4,去掉左右箭头
  457. $('.handel-term-list').eq(idxStar).find('.arrow-img').hide();
  458. $('.handel-term-list').eq(idxStar).find('.term-card-detail').css('left',0)
  459. }
  460. }else{
  461. layer.msg(res.msg);
  462. }
  463. $('.relate-sure-pop').hide();
  464. }
  465. });
  466. })
  467. $('.search-key-value').keyup(function(){
  468. if ($('.search-key-value').val()!=="") {
  469. $('.clear-search-value').show()
  470. } else {
  471. $('.clear-search-value').hide()
  472. }
  473. })
  474. $('.clear-search-value').click(function(){
  475. $('.search-key-value').val('');
  476. $(this).hide()
  477. })
  478. var target_id;
  479. $(document).on('dragstart','.term-card-list',function(ev){
  480. // ev.dataTransfer.effectAllowed = "move";
  481. // ev.dataTransfer.setData("elId",ev.target.id);
  482. target_id = ev.target.id;
  483. $("#"+ev.target.id).addClass('moves');
  484. })
  485. $(document).on('drop','.term-card-layout',function(ev){
  486. var ev = ev? ev: window.ev
  487. var srcObj = ev.srcElement ? ev.srcElement : ev.target;
  488. ev.preventDefault();
  489. data=target_id;
  490. idxStar = $('.handel-term-list').index($('#'+data).closest('.handel-term-list'));
  491. idxEnd = $('.handel-term-list').index($(srcObj).closest('.handel-term-list'));
  492. $("#"+data).removeClass('moves');
  493. if (Math.abs(idxStar)>=Math.abs(idxEnd)) {
  494. // 如果是拖拽元素上面的学期的
  495. // 获取被拖拽到的地点卡片元素的id
  496. endCardId = $(srcObj).closest('.term-card-list').attr('id');
  497. startCardId=data;
  498. $('.relate-sure-pop').show();
  499. }
  500. });
  501. $(document).on('dragover','.term-card-layout',function(ev){
  502. ev.preventDefault();
  503. })
  504. })
  505. </script>