add2.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <style>
  2. .addborder{border:1px solid #ccc}
  3. .addheight{height:30px;border-radius:2px;}
  4. .addheight:focus{border-color: #66afe9;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);outline: 0 none;}
  5. .ace{position:relative;top:0px !important;left:0px !important;}
  6. label{font-weight:100 !important;}
  7. </style>
  8. <div class="main-content-inner">
  9. <!-- 导航栏开始-->
  10. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  11. <!-- 导航栏结束-->
  12. <div class="page-content" style="margin-top:15px;">
  13. <div class="row" style="margin:0px">
  14. <div class="col-xs-12">
  15. <!-- PAGE CONTENT BEGINS -->
  16. <form class="form-horizontal" action="<?php echo $this->createUrl('studentinfo/add');?>" method="post" id="userInfoSubmit">
  17. <div class="form-group">
  18. <label class="control-label col-xs-12 col-sm-3 no-padding-right">所属班级<span class="errorMessage">*</span>:</label>
  19. <div class="col-xs-12 col-sm-9">
  20. <div class="clearfix">
  21. <select class="input-medium" id="class_id" name="class_id">
  22. <option value="">请选择</option>
  23. <?php if(!empty($classInfo)):foreach($classInfo as $loop):?>
  24. <option value="<?php echo $loop->class_id;?>" <?php if(isset($cid) && $cid==$loop->class_id){ echo 'selected';}?>><?php echo $loop->class_name;?></option>
  25. <?php endforeach;endif;?>
  26. </select>
  27. <label id="class-error" class="errorMessage" ></label>
  28. </div>
  29. </div>
  30. </div>
  31. <!--<div class="form-group">
  32. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录账号<span class="errorMessage">*</span>:</label>
  33. <div class="col-sm-9 mtCentent">
  34. <input type="text" id="username" name="username" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" />
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录密码<span class="errorMessage">*</span>:</label>
  39. <div class="col-sm-9 mtCentent">
  40. <input type="password" id="password" name="password" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" />
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <label class="control-label col-xs-12 col-sm-3 no-padding-right">确认密码<span class="errorMessage">*</span>:</label>
  45. <div class="col-sm-9 mtCentent">
  46. <input type="password" id="password2" name="password2" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" />
  47. </div>
  48. </div>-->
  49. <div class="hr hr-16 hr-dotted"></div>
  50. <div class="form-group">
  51. <label class="control-label col-xs-12 col-sm-3 no-padding-right">真实姓名<span class="errorMessage">*</span>:</label>
  52. <div class="col-xs-12 col-sm-9 mtCentent">
  53. <input type="text" name="realname" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" placeholder="姓名唯一" />
  54. <label id="realname-error" class="errorMessage" for="realname"></label>
  55. </div>
  56. </div>
  57. <div class="form-group">
  58. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学号:</label>
  59. <div class="col-xs-12 col-sm-9 mtCentent">
  60. <input type="text" name="userno" id="userno" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" placeholder="学生学号" />
  61. </div>
  62. </div>
  63. <!--<div class="form-group">
  64. <label class="control-label col-xs-12 col-sm-3 no-padding-right">班级序号<span class="errorMessage">*</span>:</label>
  65. <div class="col-xs-12 col-sm-9 mtCentent">
  66. <input type="text" name="serial_number" id="serial_number" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" placeholder="学生所在这个班的序号" />
  67. </div>
  68. </div>-->
  69. <div class="form-group">
  70. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学生手机号:</label>
  71. <div class="col-xs-12 col-sm-9 ">
  72. <input type="text" name="student_phone" class="col-xs-10 col-sm-3 addborder addheight" />
  73. <label id="student_phone-error" class="errorMessage" for="student_phone"></label>
  74. </div>
  75. </div>
  76. <?php if($use_zhixue){
  77. ?>
  78. <div class="form-group">
  79. <label class="control-label col-xs-12 col-sm-3 no-padding-right">绑定智学网准考证号:</label>
  80. <div class="col-xs-12 col-sm-9 ">
  81. <input type="text" name="zhixue_student_card" class="col-xs-10 col-sm-3 addborder addheight" />
  82. </div>
  83. </div>
  84. <?php }?>
  85. <div class="form-group">
  86. <label class="control-label col-xs-12 col-sm-3 no-padding-right">绑定学校准考证号:</label>
  87. <div class="col-xs-12 col-sm-9 ">
  88. <input type="text" name="school_student_card" class="col-xs-10 col-sm-3 addborder addheight" />
  89. </div>
  90. </div>
  91. <div class="form-group">
  92. <label class="control-label col-xs-12 col-sm-3 no-padding-right">性别:</label>
  93. <div class="col-sm-9 mt6">
  94. <span class="inline blue">
  95. <input type="radio" class="ace" name="sex" value="1" checked="checked">
  96. <span class="lbl middle"> 男</span>
  97. </span>
  98. &nbsp; &nbsp; &nbsp;
  99. <span class="inline blue">
  100. <input type="radio" class="ace" name="sex" value="2">
  101. <span class="lbl middle"> 女</span>
  102. </span>
  103. </div>
  104. </div>
  105. <div class="form-group">
  106. <label class="control-label col-xs-12 col-sm-3 no-padding-right">是否为在籍生:</label>
  107. <div class="col-sm-9 mt6">
  108. <span class="inline blue">
  109. <input type="radio" class="ace" name="is_outer" value="0" checked="checked">
  110. <span class="lbl middle"> 是</span>
  111. </span>
  112. &nbsp; &nbsp; &nbsp;
  113. <span class="inline blue">
  114. <input type="radio" class="ace" name="is_outer" value="1">
  115. <span class="lbl middle"> 否</span>
  116. </span>
  117. </div>
  118. </div>
  119. <div class="form-group">
  120. <label class="control-label col-xs-12 col-sm-3 no-padding-right">身份证号:</label>
  121. <div class="col-xs-12 col-sm-9 ">
  122. <input type="text" name="id_number" class="col-xs-10 col-sm-3 addborder addheight" />
  123. <label id="idnumber-error" class="errorMessage" for="idnumber"></label>
  124. </div>
  125. </div>
  126. <div class="form-group">
  127. <label class="control-label col-xs-12 col-sm-3 no-padding-right"><strong>其它第三方考号</strong></label>
  128. <div class="col-xs-12 col-sm-9 ">
  129. <button class="btn btn-success btn-sm" type="button" id="field_setting">
  130. <i class="ace-icon fa fa-check bigger-110"></i>
  131. 设置
  132. </button>
  133. </div>
  134. </div>
  135. <div class="field_area">
  136. <?php
  137. if(isset($studentExtend) && $studentExtend){
  138. foreach ($studentExtend as $key=>$val){
  139. if($val['is_enable']==1) {
  140. ?>
  141. <div class="form-group">
  142. <label class="control-label col-xs-12 col-sm-3 no-padding-right"><?php echo $val['field_mean']?>:</label>
  143. <div class="col-xs-12 col-sm-9 ">
  144. <input type="text" maxlength="20" name="<?php echo $key?>"
  145. class="col-xs-10 col-sm-3 addborder addheight"/>
  146. </div>
  147. </div>
  148. <?php
  149. }
  150. }
  151. }
  152. ?>
  153. </div>
  154. <div class="clearfix form-actions">
  155. <div class="col-md-offset-3 col-md-9">
  156. <button class="btn btn-success btn-sm" type="button" id="schoolSubmit" >
  157. <i class="ace-icon fa fa-check bigger-110"></i>
  158. 提交
  159. </button>
  160. <!--&nbsp; &nbsp; &nbsp;
  161. <button class="btn" type="reset">
  162. <i class="ace-icon fa fa-undo bigger-110"></i>
  163. 重填
  164. </button>-->
  165. </div>
  166. </div>
  167. </form>
  168. <!-- PAGE CONTENT ENDS -->
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <style>
  174. /*弹出层*/
  175. .confirmbox {
  176. background: #fff;
  177. border: 1px solid #cccccc;
  178. border-radius: 3px;
  179. padding: 40px 40px 30px;
  180. text-align: center;
  181. position: fixed;
  182. left: 50%;
  183. top: 50%;
  184. transform: translate(-50%, -50%);
  185. z-index: 99;
  186. }
  187. .confirmbox-mask {
  188. background: rgba(0, 0, 0, .7);
  189. left: 0;
  190. right: 0;
  191. top: 0;
  192. bottom: 0;
  193. z-index: 99;
  194. position: fixed;
  195. }
  196. .confirmbox-mask button {
  197. border: none;
  198. background: #2977ff;
  199. width: 80px;
  200. height: 26px;
  201. border-radius: 3px;
  202. font-size: 14px;
  203. color: #fff;
  204. outline: none;
  205. cursor: pointer;
  206. }
  207. .confirmbox-mask button.save {
  208. display: block;
  209. margin: 40px auto;
  210. }
  211. .confirmbox .confirmbox-btns {
  212. margin-top: 40px;
  213. }
  214. .class-modal {
  215. width: 500px;
  216. background: #fff;
  217. // border-radius: 5px;
  218. position: absolute;
  219. top: 50%;
  220. left: 50%;
  221. transform: translate(-50%, -50%);
  222. height:320px;
  223. }
  224. .class-modal-head {
  225. font-size: 14px;
  226. background:#2977ff;
  227. color:#fff;
  228. height:25px;
  229. line-height: 25px;
  230. padding: 0 0 0 15px;
  231. }
  232. .class-modal-body {
  233. margin-top: 20px;
  234. overflow: auto;
  235. padding:15px;
  236. }
  237. .class-modal-body .classes {
  238. margin-bottom: 20px;
  239. }
  240. .class-modal-body .classes > div {
  241. display: inline-block;
  242. max-width: 640px;
  243. vertical-align: top;
  244. }
  245. .class-modal-body .classes a {
  246. text-decoration: none;
  247. display: inline-block;
  248. margin: 0 5px 5px;
  249. color: #136bfb;
  250. font-size: 14px;
  251. }
  252. .class-modal-body .classes a.active {
  253. color: #fc091b
  254. }
  255. .class-modal .icon-close{
  256. position: absolute;
  257. right: 20px;
  258. top: 2px;
  259. color:#fff;
  260. }
  261. .c-red {
  262. color: #CC3300
  263. }
  264. .avg{
  265. margin:0 10px;
  266. }
  267. .class_btn{
  268. text-align: center;
  269. }
  270. .confirmbox-mask p{
  271. word-wrap : break-word ;
  272. }
  273. .icon-close{
  274. cursor: pointer;
  275. }
  276. .model-input{
  277. border:1px solid #ccc;
  278. padding:5px;
  279. margin-top:10px;
  280. }
  281. .model-input label{
  282. margin:0 15px;
  283. }
  284. .field{
  285. width:90%;
  286. border:1px solid #333;
  287. margin:5px auto;
  288. }
  289. </style>
  290. <!-- 弹窗 -->
  291. <div class="confirmbox-mask" style="display: none" id="fieldModal">
  292. <div class="class-modal">
  293. <i class="icon close_1 icon-close">×</i>
  294. <div class="class-modal-head">设置</div>
  295. <div class="class-modal-body">
  296. 最多可设置5个第三方考号,可自定义重命名,启用后生效
  297. <table class="student-counts addLine table-hide" width="100%">
  298. <tr>
  299. <td><input type="text" maxlength="10" class="field" name="field_1_s" value="<?php if(isset($studentExtend['field_1']) && $studentExtend['field_1']['field_mean']){echo $studentExtend['field_1']['field_mean']; }else{echo '自定义考号1';}?>"></td>
  300. <td><input type="checkbox" <?php if(isset($studentExtend['field_1']) &&$studentExtend['field_1']['is_enable']==1){echo 'checked';}?> name="field_1_status" value="1">启用</td>
  301. </tr>
  302. <tr>
  303. <td><input type="text" maxlength="10" class="field" name="field_2_s" value="<?php if(isset($studentExtend['field_2']) && $studentExtend['field_2']['field_mean']){echo $studentExtend['field_2']['field_mean']; }else{echo '自定义考号2';}?>"></td>
  304. <td><input type="checkbox" <?php if(isset($studentExtend['field_2']) &&$studentExtend['field_2']['is_enable']==1){echo 'checked';}?> name="field_2_status" value="1">启用</td>
  305. </tr>
  306. <tr>
  307. <td><input type="text" maxlength="10" class="field" name="field_3_s" value="<?php if(isset($studentExtend['field_3']) && $studentExtend['field_3']['field_mean']){echo $studentExtend['field_3']['field_mean']; }else{echo '自定义考号3';}?>"></td>
  308. <td><input type="checkbox" <?php if(isset($studentExtend['field_3']) &&$studentExtend['field_3']['is_enable']==1){echo 'checked';}?> name="field_3_status" value="1">启用</td>
  309. </tr>
  310. <tr>
  311. <td><input type="text" maxlength="10" class="field" name="field_4_s" value="<?php if(isset($studentExtend['field_4']) && $studentExtend['field_4']['field_mean']){echo $studentExtend['field_4']['field_mean']; }else{echo '自定义考号4';}?>"></td>
  312. <td><input type="checkbox" <?php if(isset($studentExtend['field_4']) &&$studentExtend['field_4']['is_enable']==1){echo 'checked';}?> name="field_4_status" value="1">启用</td>
  313. </tr>
  314. <tr>
  315. <td><input type="text" maxlength="10" class="field" name="field_5_s" value="<?php if(isset($studentExtend['field_5']) && $studentExtend['field_5']['field_mean']){echo $studentExtend['field_5']['field_mean']; }else{echo '自定义考号5';}?>"></td>
  316. <td><input type="checkbox" <?php if(isset($studentExtend['field_5']) &&$studentExtend['field_5']['is_enable']==1){echo 'checked';}?> name="field_5_status" value="1">启用</td>
  317. </tr>
  318. </table>
  319. </div>
  320. <p class="class_btn">
  321. <button type="button" class="setting_sumbit">确定</button>
  322. <button type="button" class="close_1">取消</button>
  323. </p>
  324. </div>
  325. </div>
  326. <script src="/js/xsgl.js"></script>
  327. <script type="text/javascript">
  328. $(function(){
  329. $('#field_setting').click(function(){
  330. $('#fieldModal').fadeIn();
  331. });
  332. $('.close_1').click(function(){
  333. $('#fieldModal').fadeOut();
  334. });
  335. $('.setting_sumbit').click(function(){
  336. var field_1=$('input[name=field_1_s]').val();
  337. var field_1_status=$('input[name=field_1_status]').is(':checked');
  338. var field_2=$('input[name=field_2_s]').val();
  339. var field_2_status=$('input[name=field_2_status]').is(':checked');
  340. var field_3=$('input[name=field_3_s]').val();
  341. var field_3_status=$('input[name=field_3_status]').is(':checked');
  342. var field_4=$('input[name=field_4_s]').val();
  343. var field_4_status=$('input[name=field_4_status]').is(':checked');
  344. var field_5=$('input[name=field_5_s]').val();
  345. var field_5_status=$('input[name=field_5_status]').is(':checked');
  346. if(field_1_status==true && field_1==''){
  347. layer.msg('请输入自定义考号1名称');
  348. return false;
  349. }
  350. if(field_2_status==true && field_2==''){
  351. layer.msg('请输入自定义考号2名称');
  352. return false;
  353. }
  354. if(field_3_status==true && field_3==''){
  355. layer.msg('请输入自定义考号3名称');
  356. return false;
  357. }
  358. if(field_4_status==true && field_4==''){
  359. layer.msg('请输入自定义考号4名称');
  360. return false;
  361. }
  362. if(field_5_status==true && field_5==''){
  363. layer.msg('请输入自定义考号5名称');
  364. return false;
  365. }
  366. $.ajax({
  367. url:'<?php echo $this->createUrl('studentinfo/ajaxstudentextendsetting')?>',
  368. type:'POST',
  369. dataType:'json',
  370. data:{
  371. 'field_1':field_1,
  372. 'field_1_status':field_1_status,
  373. 'field_2':field_2,
  374. 'field_2_status':field_2_status,
  375. 'field_3':field_3,
  376. 'field_3_status':field_3_status,
  377. 'field_4':field_4,
  378. 'field_4_status':field_4_status,
  379. 'field_5':field_5,
  380. 'field_5_status':field_5_status
  381. },
  382. success:function(res){
  383. if(res.status==1){
  384. html='';
  385. if(field_1_status==true){
  386. html+='<div class="form-group">';
  387. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_1+'</label>';
  388. html+='<div class="col-xs-12 col-sm-9 ">';
  389. html+='<input type="text" name="field_1" class="col-xs-10 col-sm-3 addborder addheight"/>';
  390. html+='</div>';
  391. html+='</div>';
  392. }
  393. if(field_2_status==true){
  394. html+='<div class="form-group">';
  395. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_2+'</label>';
  396. html+='<div class="col-xs-12 col-sm-9 ">';
  397. html+='<input type="text" name="field_2" class="col-xs-10 col-sm-3 addborder addheight"/>';
  398. html+='</div>';
  399. html+='</div>';
  400. }
  401. if(field_3_status==true){
  402. html+='<div class="form-group">';
  403. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_3+'</label>';
  404. html+='<div class="col-xs-12 col-sm-9 ">';
  405. html+='<input type="text" name="field_3" class="col-xs-10 col-sm-3 addborder addheight"/>';
  406. html+='</div>';
  407. html+='</div>';
  408. }
  409. if(field_4_status==true){
  410. html+='<div class="form-group">';
  411. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_4+'</label>';
  412. html+='<div class="col-xs-12 col-sm-9 ">';
  413. html+='<input type="text" name="field_4" class="col-xs-10 col-sm-3 addborder addheight"/>';
  414. html+='</div>';
  415. html+='</div>';
  416. }
  417. if(field_5_status==true){
  418. html+='<div class="form-group">';
  419. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_5+'</label>';
  420. html+='<div class="col-xs-12 col-sm-9 ">';
  421. html+='<input type="text" name="field_5" class="col-xs-10 col-sm-3 addborder addheight"/>';
  422. html+='</div>';
  423. html+='</div>';
  424. }
  425. $('.field_area').html(html);
  426. layer.msg('设置成功');
  427. }else{
  428. layer.msg('设置失败');
  429. }
  430. $('#fieldModal').fadeOut();
  431. }
  432. });
  433. });
  434. $("#schoolSubmit").click(function () {
  435. $error=false;
  436. $("#schoolSubmit")[0].disabled = true;
  437. if($('#class_id').val()==''){
  438. $('#class-error').html('请选择班级');
  439. $error=true;
  440. }
  441. if($('input[name=realname]').val()==''){
  442. $('#realname-error').html('请输入姓名');
  443. $error=true;
  444. }else{
  445. //return checkRealName($(this).val());
  446. value=$('input[name=realname]').val();
  447. $('#realname-error').html('');
  448. //var pattern = /^[\u4E00-\u9FA5^·]{1,20}$/;
  449. var pattern = /^[\u2E80-\uFE4F^0-9·]{1,20}$/;
  450. if(!pattern.test(value)){
  451. $('#realname-error').html('姓名只能为20位汉字');
  452. $error=true;
  453. }
  454. $.post("<?php echo $this->createUrl('studentinfo/verifyrealname');?>",{
  455. realname:value,cid:$('#class_id').val()},function (data){
  456. var m = JSON.parse(data);
  457. if (m.status == 1){
  458. $("input[name=realname]").css("color","#000");
  459. }else
  460. {
  461. var id_number=$('input[name=id_number]').val();
  462. if($('input[name=id_number]').val()=='' || !isCardNo($('input[name=id_number]').val())){
  463. $("#realname-error").html('此学生姓名已存在,请输入身份证号');
  464. $error=true;
  465. }
  466. }
  467. });
  468. }
  469. var mobile=$('input[name=student_phone]').val();
  470. if(mobile!='' && !checkMobile(mobile)){
  471. $('#student_phone-error').html('手机号不正确,请重新输入');
  472. $error=true;
  473. }
  474. var id_number=$('input[name=id_number]').val();
  475. console.log(id_number);
  476. if(id_number!='' && !isCardNo(id_number)){
  477. $('#idnumber-error').html('身份证号不正确,主重新输入');
  478. $error=true;
  479. }
  480. if($error){
  481. $("#schoolSubmit")[0].disabled = false;
  482. return false;
  483. }else{
  484. $("#userInfoSubmit").submit();
  485. }
  486. });
  487. $('#class_id').change(function(){
  488. $('#class-error').html('');
  489. });
  490. $('input[name=realname]').change(function(){
  491. return checkRealName($(this).val());
  492. });
  493. /*
  494. $('input[name=id_number]').change(function () {
  495. $('#idnumber-error').html('');
  496. var id_number=$(this).val();
  497. if(id_number==''){
  498. return false;
  499. }
  500. if(!isCardNo(id_number)){
  501. $("#schoolSubmit")[0].disabled = false;
  502. $('#idnumber-error').html('身份证格式不正确');
  503. }
  504. });
  505. */
  506. //检测手机号
  507. function checkMobile(value){
  508. var regMobile = /^1([356789]\d|4[57])\d{8}$/;
  509. return regMobile.test( value );
  510. }
  511. //检测身份证号
  512. function isCardNo(card) {
  513. var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
  514. return pattern.test(card);
  515. }
  516. //检测用户姓名
  517. function checkRealName(value){
  518. if(value==''){
  519. return false;
  520. }
  521. $('#realname-error').html('');
  522. var pattern = /^[\u2E80-\uFE4F^0-9·]{1,20}$/;
  523. if(!pattern.test(value)){
  524. $('#realname-error').html('姓名只能为20位汉字');
  525. return false;
  526. }else{
  527. if($('#class_id').val()!=''){
  528. $.post("<?php echo $this->createUrl('studentinfo/verifyrealname');?>",{
  529. realname:value,cid:$('#class_id').val()},function (data){
  530. var m = JSON.parse(data);
  531. if (m.status == 1){
  532. $("input[name=realname]").css("color","#000");
  533. return true;
  534. }else
  535. {
  536. var id_number=$('input[name=id_number]').val();
  537. if($('input[name=id_number]').val()=='' || !isCardNo($('input[name=id_number]').val())){
  538. $("#realname-error").html('此学生姓名已存在,请输入身份证号');
  539. return false;
  540. }
  541. }
  542. });
  543. }
  544. return false;
  545. }
  546. }
  547. });
  548. // ajax获取班级
  549. function changeYears(num) {
  550. if (!num) return;
  551. $.post("<?php echo $this->createUrl('classes/ajaxclass');?>",{yid:num},function(data){
  552. var p = eval("("+data+")");
  553. if (p.flag) {
  554. $("#classDiv").show();
  555. var html;
  556. var cityObj = $("#class_id");
  557. cityObj.empty();
  558. if (p.classList.length > 0){
  559. html = "<option value=''>请选择班级</option>";
  560. $.each(p.classList,function(i,n){
  561. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  562. });
  563. } else {
  564. html = "<option value=''>暂无班级</option>";
  565. }
  566. cityObj.append(html);
  567. } else {
  568. alert("获取数据失败!");
  569. }
  570. });
  571. }
  572. </script>