check.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
  2. <div class="main-content-inner">
  3. <ul class="clearfix main-content-inner-ul">
  4. <?php if(Yii::app()->session['coachInfo']['leader']==1){?>
  5. <li class="pull-left">
  6. <button onclick='location.href="<?php echo $this->createUrl("semester/index");?>"' class="button button_normal button_group button_arrow" data-button="red">学期管理</button>
  7. <img src="/images/line.jpg" style="height:45px;" />
  8. </li>
  9. <?php }?>
  10. <li class="pull-left">
  11. <button onclick='location.href="<?php echo $this->createUrl("teacher/index");?>"' class="button button_normal button_group button_arrow" data-button="red">教师管理</button>
  12. <img src="/images/line.jpg" style="height:45px;" />
  13. </li>
  14. <li class="pull-left">
  15. <button onclick='location.href="<?php echo $this->createUrl("classes/index");?>"' class="button button_normal button_group button_arrow" data-button="red">班级管理</button>
  16. <img src="/images/line.jpg" style="height:45px;" />
  17. </li>
  18. <li class="pull-left">
  19. <button onclick='location.href="<?php echo $this->createUrl("studentinfo/index");?>"' class="button button_normal button_group button_arrow button_active" data-button="red">学生管理</button>
  20. <img src="/images/line.jpg" style="height:45px;" />
  21. </li>
  22. <li class="pull-left">
  23. <button onclick='location.href="<?php echo $this->createUrl("classes/export");?>"' class="button button_normal button_group button_arrow " data-button="red">导出学生</button>
  24. <img src="/images/line.jpg" style="height:45px;" />
  25. </li>
  26. </ul>
  27. <div class="layout-gap">
  28. <section class="anc-top flex status_1 <?php if(isset($is_last) && $is_last==1) echo 'hide'?>">
  29. <div class="flex-one flex">
  30. <p class="anc-title">学生账号异常检测</p>
  31. </div>
  32. <div class="anc-opt-btn green-font pointer reback" ><a href="<?php echo $this->createUrl('studentinfo/index');?>">返回</a></div>
  33. </section>
  34. <?php
  35. if(isset($is_last) && $is_last==1){
  36. if($count==0){
  37. echo '<section class="anc-top flex status_2" >';
  38. }else{
  39. echo '<section class="anc-top flex status_2 hide" >';
  40. }
  41. }else{
  42. echo '<section class="anc-top flex status_2 hide" >';
  43. }
  44. ?>
  45. <div class="flex-one flex">
  46. <div><img src="/images/finish.png" alt="" class="anc-status-icon"></div>
  47. <div class="flex-one title-center">
  48. <p class="anc-title">学生账号全部正常</p>
  49. <p class="anc-title-explain">点击完成使结果生效</p>
  50. </div>
  51. </div>
  52. <div class="anc-opt-btn green-font pointer give-up-check">放弃检测</div>
  53. <?php
  54. if($is_last==1 && $count==0){
  55. echo '&nbsp;&nbsp;&nbsp;&nbsp;<div class="anc-opt-btn green-font pointer give-up-check">重新检测</div>';
  56. }
  57. ?>
  58. </section>
  59. <?php
  60. if(isset($is_last) && $is_last==1){
  61. if($count==0){
  62. echo '<section class="anc-top flex status_3 hide" >';
  63. }else{
  64. echo '<section class="anc-top flex status_3 " >';
  65. }
  66. }else{
  67. echo '<section class="anc-top flex status_3 hide" >';
  68. }
  69. ?>
  70. <div class="flex-one flex">
  71. <div><img src="/images/warn.png" alt="" class="anc-status-icon"></div>
  72. <div class="flex-one title-center">
  73. <p class="anc-title">检测到异常账号</p>
  74. <p class="anc-title-explain">处理完重名学生,才能完成生效</p>
  75. </div>
  76. </div>
  77. <div class="anc-opt-btn green-font pointer give-up-check">放弃检测</div>
  78. </section>
  79. <section class="anc-main-con">
  80. <?php
  81. if(!isset($is_last) || $is_last==0){
  82. ?>
  83. <div class="anc-index-msg">该功能可实现重名检测;若同一学生有多个账号,可绑定账号,使学生的考试成绩汇总到一个账号</div>
  84. <div class="begain-check-btn pointer">开始检测</div>
  85. <?php
  86. }
  87. ?>
  88. <!-- 检测状态部分 -->
  89. <ul class="anc-status-con <?php if(!isset($is_last) || !$is_last) echo 'hide'?>" >
  90. <li class="anc-status-list now-status first <?php if(isset($is_last) && $is_last==1) echo 'finish-status'?>">
  91. <p class="status-top-msg">读取学生</p>
  92. <p class="gray-font status-charact "><?php if(isset($is_last) && $is_last==1){ echo '读取完成';}else{echo '正在读取学校全部学生账号...';}?></p>
  93. </li>
  94. <li class="anc-status-list second <?php if(isset($is_last) && $is_last==1) echo 'finish-status'?>">
  95. <p class="status-top-msg">姓名异常(学生姓名中包含非汉字字符)</p>
  96. <p class="gray-font status-charact"></p>
  97. </li>
  98. <li class="anc-status-list third <?php if(isset($is_last) && $is_last==1) echo 'finish-status'?>">
  99. <p class="status-top-msg">自动修复(若同一姓名的学生有多个账号且不重名,自动关联为一人)</p>
  100. <p class="gray-font status-charact"></p>
  101. </li>
  102. <li class="anc-status-list fourth <?php if(isset($count) && $count>0){ echo 'error-status';}elseif($is_last==1){echo 'finish-status';}?>">
  103. <p class="status-top-msg">重名学生</p>
  104. <?php if(isset($count) && $count>0){
  105. echo '<p class="gray-font status-charact href-underline">检测完成,共有'.$count.'组重名学生&gt;&gt;</p>';
  106. }elseif($is_last==1){
  107. echo '<p class="gray-font status-charact href-underline">检测完成,未发现重名学生</p>';
  108. }else{
  109. echo '<p class="gray-font status-charact "></p>';
  110. }
  111. ?>
  112. </li>
  113. </ul>
  114. </section>
  115. <section class="anc-finish-opt gray-border-top" >
  116. <div class="anc-finish-btn save_result <?php if( $count>0 || $is_last==0) {echo 'hide';}?>" >完成</div>
  117. <div class="anc-finish-btn forbidden-btn <?php if(isset($count) && $count==0) {echo 'hide';}?>" >完成</div>
  118. </section>
  119. </div>
  120. </div>
  121. <div class="anc-pop">
  122. <div class="confirm-pop-con">
  123. <div class="need-pop-top clearfix">
  124. <div class="npt-title put-need fl">提示</div>
  125. <div class="npt-close fr">×</div>
  126. </div>
  127. <div class="confirm-msg red-font tac">
  128. 确认要放弃本次检测吗?
  129. </div>
  130. <div class="pop-btns">
  131. <div class="confirm-pop-btn-sure">确认</div>
  132. <div class="confirm-pop-btn-cancel cancel-btn">取消</div>
  133. </div>
  134. </div>
  135. </div>
  136. <script>
  137. $(function(){
  138. $('.begain-check-btn').click(function(){
  139. $('.anc-status-con').removeClass('hide');
  140. $(this).hide();
  141. $('.anc-index-msg').hide();
  142. loadStudent();
  143. //relation();
  144. });
  145. //保存结果
  146. $('.save_result').click(function(){
  147. //更新姓名
  148. $.ajax({
  149. url:'<?php echo $this->createUrl('checkstudent/ajaxupdaterealname')?>',
  150. dataType:'json',
  151. type:'POST',
  152. success:function(res){
  153. if(res.status==1){
  154. layer.msg('更新完成',function(){
  155. window.location.href="<?php echo $this->createUrl('studentinfo/index')?>";
  156. });
  157. }
  158. }
  159. });
  160. });
  161. $('.fourth').on('click','.href-underline',function(){
  162. window.location.href='<?php echo $this->createUrl('checkstudent/handledata')?>';
  163. });
  164. //第一步,读取数据
  165. function loadStudent(){
  166. var count=0;
  167. $.ajax({
  168. url:'<?php echo $this->createUrl('checkstudent/ajaxloaddata')?>',
  169. dataType:'json',
  170. type:'POST',
  171. success:function(res){
  172. if(res.status==1){
  173. count=res.data;
  174. //return count;
  175. $('.first .status-charact').html('读取完成,共读取需检测学生账号'+count+'名');
  176. $('.first').addClass('finish-status');
  177. $('.first').removeClass('now-status');
  178. checkAbnormal();
  179. }
  180. }
  181. });
  182. }
  183. //第二步,姓名异常
  184. function checkAbnormal(){
  185. $('.second .status-charact').html('正在检测...');
  186. $('.second').addClass('now-status');
  187. $.ajax({
  188. url:'<?php echo $this->createUrl('checkstudent/ajaxcheckdata')?>',
  189. dataType:'json',
  190. type:'POST',
  191. success:function(res){
  192. if(res.status==1){
  193. count=res.count;
  194. $('.second .status-charact').html('检测完成,已为'+count+'名学生去除姓名中的非汉字字符');
  195. $('.second').addClass('finish-status');
  196. $('.second').removeClass('now-status');
  197. relation();
  198. }else{
  199. $('.second .status-charact').html('检测失败');
  200. $('.second').addClass('error-status');
  201. $('.second').removeClass('now-status');
  202. }
  203. }
  204. });
  205. }
  206. //第三步,关联账号
  207. function relation(){
  208. $('.third .status-charact').html('正在自动修复...');
  209. $('.third').addClass('now-status');
  210. $.ajax({
  211. url:'<?php echo $this->createUrl('checkstudent/ajaxrelation')?>',
  212. dataType:'json',
  213. type:'POST',
  214. success:function(res){
  215. if(res.status==1){
  216. count=res.count;
  217. $('.third .status-charact').html('修复完成,已修复'+count+'名学生的账号');
  218. $('.third').addClass('finish-status');
  219. $('.third').removeClass('now-status');
  220. checkRepeat();
  221. }else{
  222. $('.third .status-charact').html('没有可自动修复的数据');
  223. $('.third').addClass('error-status');
  224. $('.third').removeClass('now-status');
  225. checkRepeat();
  226. }
  227. }
  228. });
  229. }
  230. //第四步
  231. function checkRepeat(){
  232. $('.fourth .status-charact').html('正在检测...');
  233. $('.fourth').addClass('now-status');
  234. $.ajax({
  235. url:'<?php echo $this->createUrl('checkstudent/ajaxrepeat')?>',
  236. dataType:'json',
  237. type:'POST',
  238. success:function(res){
  239. if(res.status==1){
  240. count=res.count;
  241. if(count==0){
  242. $('.fourth .status-charact').html('检测完成,未发现重名学生');
  243. $('.fourth').addClass('finish-status');
  244. $('.fourth').removeClass('now-status');
  245. $('.status_1').hide();
  246. $('.status_2').removeClass('hide');
  247. $('.save_result').removeClass('hide');
  248. }else{
  249. $('.fourth .status-charact').html('检测完成,共有'+count+'组重名学生&gt;&gt;');
  250. $('.fourth .status-charact').addClass('href-underline');
  251. $('.fourth').addClass('error-status');
  252. $('.fourth').removeClass('now-status');
  253. $('.forbidden-btn').removeClass('hide');
  254. $('.status_1').hide();
  255. $('.status_3').removeClass('hide');
  256. }
  257. }else{
  258. $('.fourth .status-charact').html('检测失败,请稍后再试');
  259. $('.fourth').addClass('error-status');
  260. $('.fourth').removeClass('now-status');
  261. }
  262. }
  263. });
  264. }
  265. $('.give-up-check').click(function(){
  266. $('.anc-pop').show()
  267. })
  268. $('.npt-close,.confirm-pop-btn-cancel').click(function(){
  269. $('.anc-pop').hide()
  270. })
  271. $('.confirm-pop-btn-sure').click(function () {
  272. $.ajax({
  273. url:'<?php echo $this->createUrl('checkstudent/giveup')?>',
  274. dataType:'json',
  275. type:'POST',
  276. success:function(res){
  277. if(res.status==1){
  278. $('.anc-pop').hide();
  279. location.reload();
  280. }else{
  281. $('.anc-pop').hide();
  282. }
  283. }
  284. });
  285. });
  286. })
  287. </script>