edit2.php 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  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/edit',array('stid'=>$userInfo->student_id));?>" 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" disabled id="class_id" name="">
  22. <option value="">请选择</option>
  23. <?php
  24. if(isset($studentClass)){
  25. $userClassId=(string)$studentClass;
  26. }
  27. if(!empty($classInfo)):foreach($classInfo as $loop):
  28. $loopClassId=(string)$loop->class_id;
  29. ?>
  30. <option value="<?php echo $loop->class_id;?>" <?php if($userClassId && strcmp($userClassId,$loopClassId)==0){ echo 'selected';}?>><?php echo $loop->class_name;?></option>
  31. <?php endforeach;endif;?>
  32. </select>
  33. <label id="class-error" class="errorMessage" ></label>
  34. <input type="hidden" name="class_id" value="<?php echo $userClassId?>">
  35. </div>
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. <label class="control-label col-xs-12 col-sm-3 no-padding-right">准考证:</label>
  40. <div class="col-sm-9" style="line-height:32px">
  41. <?php echo $studentInfo->student_card;?>
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录账号<span class="errorMessage">*</span>:</label>
  46. <div class="col-sm-9" style="line-height:32px">
  47. <input type="text" id="username" name="username" readonly class="col-xs-10 col-sm-3" value="<?php echo $studentInfo->username;?>" />
  48. <?php /*echo $studentInfo->username;*/?>
  49. </div>
  50. </div>
  51. <div class="form-group">
  52. <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录密码:</label>
  53. <div class="col-sm-9">
  54. <input type="password" id="password" name="password" class="col-xs-10 col-sm-3 addborder addheight" placeholder="无需修改密码请留空!" />
  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-sm-9">
  60. <input type="password" id="password2" name="password2" class="col-xs-10 col-sm-3 addborder addheight" placeholder="无需修改密码请留空!" />
  61. </div>
  62. </div>
  63. <div class="hr hr-16 hr-dotted"></div>
  64. <div class="form-group">
  65. <label class="control-label col-xs-12 col-sm-3 no-padding-right">真实姓名<span class="errorMessage">*</span>:</label>
  66. <div class="col-xs-12 col-sm-9 mtCentent">
  67. <input value="<?php echo $userInfo->realname;?>" type="text" name="realname" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" placeholder="姓名唯一" />
  68. <label id="realname-error" class="errorMessage" for="realname"></label>
  69. </div>
  70. </div>
  71. <div class="form-group">
  72. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学号:</label>
  73. <div class="col-xs-12 col-sm-9 mtCentent">
  74. <input type="text" value="<?php echo $userInfo->userno;?>" name="userno" id="userno" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" placeholder="学生学号" />
  75. </div>
  76. </div>
  77. <div class="form-group">
  78. <label class="control-label col-xs-12 col-sm-3 no-padding-right">班级序号<span class="errorMessage">*</span>:</label>
  79. <div class="col-xs-12 col-sm-9">
  80. <input type="text" name="serial_number" id="serial_number" class="col-xs-10 col-sm-3 addborder addheight" value="<?php echo $userInfo->serial_number;?>" />
  81. </div>
  82. </div>
  83. <div class="form-group">
  84. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学生手机号:</label>
  85. <div class="col-xs-12 col-sm-9 ">
  86. <input type="text" value="<?php if($userInfo->student_phone){echo $userInfo->student_phone;}?>" name="student_phone" class="col-xs-10 col-sm-3 addborder addheight" />
  87. <label id="student_phone-error" class="errorMessage" for="student_phone"></label>
  88. </div>
  89. </div>
  90. <?php if($use_zhixue){
  91. ?>
  92. <div class="form-group">
  93. <label class="control-label col-xs-12 col-sm-3 no-padding-right">绑定智学网准考证号:</label>
  94. <div class="col-xs-12 col-sm-9">
  95. <input type="text" name="zhixue_student_card" class="col-xs-10 col-sm-3 addborder addheight" value="<?php if($studentInfo->zhixue_student_card){echo $studentInfo->zhixue_student_card;}?>" />
  96. </div>
  97. </div>
  98. <?php }?>
  99. <div class="form-group">
  100. <label class="control-label col-xs-12 col-sm-3 no-padding-right">绑定学校准考证号:</label>
  101. <div class="col-xs-12 col-sm-9 ">
  102. <input type="text" name="school_student_card" class="col-xs-10 col-sm-3 addborder addheight" value="<?php if($studentInfo->school_student_card){echo $studentInfo->school_student_card;}?>" />
  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="sex" value="1" <?php if($userInfo->sex == 1){echo '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="sex" value="2" <?php if($userInfo->sex == 2){echo 'checked="checked"';}?>>
  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-sm-9 mt6">
  122. <span class="inline blue">
  123. <input type="radio" class="ace" name="is_outer" value="0" <?php if($userInfo->is_outer == 0){echo 'checked="checked"';}?>>
  124. <span class="lbl middle"> 是</span>
  125. </span>
  126. &nbsp; &nbsp; &nbsp;
  127. <span class="inline blue">
  128. <input type="radio" class="ace" name="is_outer" value="1" <?php if($userInfo->is_outer == 1){echo 'checked="checked"';}?>>
  129. <span class="lbl middle"> 否</span>
  130. </span>
  131. </div>
  132. </div>
  133. <div class="form-group">
  134. <label class="control-label col-xs-12 col-sm-3 no-padding-right">身份证号:</label>
  135. <div class="col-xs-12 col-sm-9 ">
  136. <input type="text" name="id_number" value="<?php if($userInfo->id_number){echo $userInfo->id_number;}?>" class="col-xs-10 col-sm-3 addborder addheight" />
  137. <label id="idnumber-error" class="errorMessage" for="idnumber"></label>
  138. </div>
  139. </div>
  140. <div class="form-group">
  141. <label class="control-label col-xs-12 col-sm-3 no-padding-right">是否有效:</label>
  142. <div class="col-sm-9 mt6">
  143. <span class="inline blue">
  144. <input type="radio" class="ace" name="status" value="0" <?php if(!$studentInfo->status){echo 'checked="checked"';}?>>
  145. <span class="lbl middle"> 是</span>
  146. </span>
  147. &nbsp; &nbsp; &nbsp;
  148. <span class="inline blue">
  149. <input type="radio" class="ace" name="status" value="1" <?php if($studentInfo->status == 1){echo 'checked="checked"';}?>>
  150. <span class="lbl middle"> 否</span>
  151. </span>
  152. </div>
  153. </div>
  154. <div class="form-group">
  155. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学生账号注销:</label>
  156. <div class="col-sm-9 mt6">
  157. <span class="inline blue">
  158. <input type="radio" class="ace" name="logout_status" value="0" <?php if(!$studentInfo->logout_status){echo 'checked="checked"';}?>>
  159. <span class="lbl middle"> 是</span>
  160. </span>
  161. &nbsp; &nbsp; &nbsp;
  162. <span class="inline blue">
  163. <input type="radio" class="ace" name="logout_status" value="1" <?php if($studentInfo->logout_status == 1){echo 'checked="checked"';}?>>
  164. <span class="lbl middle"> 否</span>
  165. </span>
  166. </div>
  167. </div>
  168. <?php if(isset($is_login_permission) && $is_login_permission):?>
  169. <div class="form-group">
  170. <label class="control-label col-xs-12 col-sm-3 no-padding-right">学生端登录ID重置:</label>
  171. <?php if(isset($stu_login_id) && $stu_login_id):?>
  172. <div class="col-sm-9 mt6">
  173. <span class="inline red">已有设备</span>
  174. <span style="background-color: #15ae68;padding: 6px 12px;font-size: 12px;color: #fff;cursor: pointer;" id="reset-login" studentId="<?php echo $userInfo->student_id;?>">重制</span>
  175. </div>
  176. <?php else:?>
  177. <div class="col-sm-9 mt6">
  178. <span class="inline red">未绑定设备</span>
  179. <span style="background-color: #adadad;padding: 6px 12px;font-size: 12px;color: #fff;">重制</span>
  180. </div>
  181. <?php endif;?>
  182. </div>
  183. <?php endif;?>
  184. <div class="form-group">
  185. <label class="control-label col-xs-12 col-sm-3 no-padding-right"><strong>其它第三方考号</strong></label>
  186. <div class="col-xs-12 col-sm-9 ">
  187. <button class="btn btn-success btn-sm" type="button" id="field_setting">
  188. <i class="ace-icon fa fa-check bigger-110"></i>
  189. 设置
  190. </button>
  191. </div>
  192. </div>
  193. <div class="field_area">
  194. <?php
  195. if(isset($studentExtend) && $studentExtend){
  196. foreach ($studentExtend as $key=>$val){
  197. if($val['is_enable']==1) {
  198. ?>
  199. <div class="form-group">
  200. <label class="control-label col-xs-12 col-sm-3 no-padding-right"><?php echo $val['field_mean']?>:</label>
  201. <div class="col-xs-12 col-sm-9 ">
  202. <input type="text" maxlength="20" name="<?php echo $key?>" value="<?php if(isset($userInfo->$key)){echo $userInfo->$key;}?>" class="col-xs-10 col-sm-3 addborder addheight"/>
  203. </div>
  204. </div>
  205. <?php
  206. }
  207. }
  208. }
  209. ?>
  210. </div>
  211. <div class="clearfix form-actions">
  212. <div class="col-md-offset-3 col-md-9">
  213. <button class="btn btn-success btn-sm" type="button" id="schoolSubmit" >
  214. <i class="ace-icon fa fa-check bigger-110"></i>
  215. 提交
  216. </button>
  217. <input type="hidden" name="student_id" value="<?php echo $studentId;?>" />
  218. <!--&nbsp; &nbsp; &nbsp;
  219. <button class="btn" type="reset">
  220. <i class="ace-icon fa fa-undo bigger-110"></i>
  221. 重填
  222. </button>-->
  223. </div>
  224. </div>
  225. </form>
  226. <!-- PAGE CONTENT ENDS -->
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. <style>
  232. /*弹出层*/
  233. .confirmbox {
  234. background: #fff;
  235. border: 1px solid #cccccc;
  236. border-radius: 3px;
  237. padding: 40px 40px 30px;
  238. text-align: center;
  239. position: fixed;
  240. left: 50%;
  241. top: 50%;
  242. transform: translate(-50%, -50%);
  243. z-index: 99;
  244. }
  245. .confirmbox-mask {
  246. background: rgba(0, 0, 0, .7);
  247. left: 0;
  248. right: 0;
  249. top: 0;
  250. bottom: 0;
  251. z-index: 99;
  252. position: fixed;
  253. }
  254. .confirmbox-mask button {
  255. border: none;
  256. background: #2977ff;
  257. width: 80px;
  258. height: 26px;
  259. border-radius: 3px;
  260. font-size: 14px;
  261. color: #fff;
  262. outline: none;
  263. cursor: pointer;
  264. }
  265. .confirmbox-mask button.save {
  266. display: block;
  267. margin: 40px auto;
  268. }
  269. .confirmbox .confirmbox-btns {
  270. margin-top: 40px;
  271. }
  272. .class-modal {
  273. width: 500px;
  274. background: #fff;
  275. // border-radius: 5px;
  276. position: absolute;
  277. top: 50%;
  278. left: 50%;
  279. transform: translate(-50%, -50%);
  280. height:320px;
  281. }
  282. .class-modal-head {
  283. font-size: 14px;
  284. background:#2977ff;
  285. color:#fff;
  286. height:25px;
  287. line-height: 25px;
  288. padding: 0 0 0 15px;
  289. }
  290. .class-modal-body {
  291. margin-top: 20px;
  292. overflow: auto;
  293. padding:15px;
  294. }
  295. .class-modal-body .classes {
  296. margin-bottom: 20px;
  297. }
  298. .class-modal-body .classes > div {
  299. display: inline-block;
  300. max-width: 640px;
  301. vertical-align: top;
  302. }
  303. .class-modal-body .classes a {
  304. text-decoration: none;
  305. display: inline-block;
  306. margin: 0 5px 5px;
  307. color: #136bfb;
  308. font-size: 14px;
  309. }
  310. .class-modal-body .classes a.active {
  311. color: #fc091b
  312. }
  313. .class-modal .icon-close{
  314. position: absolute;
  315. right: 20px;
  316. top: 2px;
  317. color:#fff;
  318. }
  319. .c-red {
  320. color: #CC3300
  321. }
  322. .avg{
  323. margin:0 10px;
  324. }
  325. .class_btn{
  326. text-align: center;
  327. }
  328. .confirmbox-mask p{
  329. word-wrap : break-word ;
  330. }
  331. .icon-close{
  332. cursor: pointer;
  333. }
  334. .model-input{
  335. border:1px solid #ccc;
  336. padding:5px;
  337. margin-top:10px;
  338. }
  339. .model-input label{
  340. margin:0 15px;
  341. }
  342. .field{
  343. width:90%;
  344. border:1px solid #333;
  345. margin:5px auto;
  346. }
  347. </style>
  348. <!-- 弹窗 -->
  349. <div class="confirmbox-mask" style="display: none" id="fieldModal">
  350. <div class="class-modal">
  351. <i class="icon close_1 icon-close">×</i>
  352. <div class="class-modal-head">设置</div>
  353. <div class="class-modal-body">
  354. 最多可设置5个第三方考号,可自定义重命名,启用后生效
  355. <table class="student-counts addLine table-hide" width="100%">
  356. <tr>
  357. <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>
  358. <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>
  359. </tr>
  360. <tr>
  361. <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>
  362. <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>
  363. </tr>
  364. <tr>
  365. <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>
  366. <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>
  367. </tr>
  368. <tr>
  369. <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>
  370. <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>
  371. </tr>
  372. <tr>
  373. <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>
  374. <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>
  375. </tr>
  376. </table>
  377. </div>
  378. <p class="class_btn">
  379. <button type="button" class="setting_sumbit">确定</button>
  380. <button type="button" class="close_1">取消</button>
  381. </p>
  382. </div>
  383. </div>
  384. <script src="/js/xsgl.js"></script>
  385. <script type="text/javascript">
  386. $(function(){
  387. $('#field_setting').click(function(){
  388. $('#fieldModal').fadeIn();
  389. });
  390. $('.close_1').click(function(){
  391. $('#fieldModal').fadeOut();
  392. });
  393. $('.setting_sumbit').click(function(){
  394. var field_1_old=$('input[name=field_1]').val();
  395. var field_2_old=$('input[name=field_2]').val();
  396. var field_3_old=$('input[name=field_3]').val();
  397. var field_4_old=$('input[name=field_4]').val();
  398. var field_5_old=$('input[name=field_5]').val();
  399. var field_1=$('input[name=field_1_s]').val();
  400. var field_1_status=$('input[name=field_1_status]').is(':checked');
  401. var field_2=$('input[name=field_2_s]').val();
  402. var field_2_status=$('input[name=field_2_status]').is(':checked');
  403. var field_3=$('input[name=field_3_s]').val();
  404. var field_3_status=$('input[name=field_3_status]').is(':checked');
  405. var field_4=$('input[name=field_4_s]').val();
  406. var field_4_status=$('input[name=field_4_status]').is(':checked');
  407. var field_5=$('input[name=field_5_s]').val();
  408. var field_5_status=$('input[name=field_5_status]').is(':checked');
  409. if(field_1_status==true && field_1==''){
  410. layer.msg('请输入自定义考号1名称');
  411. return false;
  412. }
  413. if(field_2_status==true && field_2==''){
  414. layer.msg('请输入自定义考号2名称');
  415. return false;
  416. }
  417. if(field_3_status==true && field_3==''){
  418. layer.msg('请输入自定义考号3名称');
  419. return false;
  420. }
  421. if(field_4_status==true && field_4==''){
  422. layer.msg('请输入自定义考号4名称');
  423. return false;
  424. }
  425. if(field_5_status==true && field_5==''){
  426. layer.msg('请输入自定义考号5名称');
  427. return false;
  428. }
  429. $.ajax({
  430. url:'<?php echo $this->createUrl('studentinfo/ajaxstudentextendsetting')?>',
  431. type:'POST',
  432. dataType:'json',
  433. data:{
  434. 'field_1':field_1,
  435. 'field_1_status':field_1_status,
  436. 'field_2':field_2,
  437. 'field_2_status':field_2_status,
  438. 'field_3':field_3,
  439. 'field_3_status':field_3_status,
  440. 'field_4':field_4,
  441. 'field_4_status':field_4_status,
  442. 'field_5':field_5,
  443. 'field_5_status':field_5_status
  444. },
  445. success:function(res){
  446. if(res.status==1){
  447. html='';
  448. if(field_1_status==true){
  449. html+='<div class="form-group">';
  450. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_1+'</label>';
  451. html+='<div class="col-xs-12 col-sm-9 ">';
  452. if(field_1_old!=undefined){
  453. html+='<input type="text" name="field_1" maxlength="20" value="'+field_1_old+'" class="col-xs-10 col-sm-3 addborder addheight"/>';
  454. }else{
  455. html+='<input type="text" name="field_1" maxlength="20" value class="col-xs-10 col-sm-3 addborder addheight"/>';
  456. }
  457. html+='</div>';
  458. html+='</div>';
  459. }
  460. if(field_2_status==true){
  461. html+='<div class="form-group">';
  462. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_2+'</label>';
  463. html+='<div class="col-xs-12 col-sm-9 ">';
  464. if(field_2_old!=undefined){
  465. html+='<input type="text" name="field_2" maxlength="20" value="'+field_2_old+'" class="col-xs-10 col-sm-3 addborder addheight"/>';
  466. }else{
  467. html+='<input type="text" name="field_2" maxlength="20" class="col-xs-10 col-sm-3 addborder addheight"/>';
  468. }
  469. html+='</div>';
  470. html+='</div>';
  471. }
  472. if(field_3_status==true){
  473. html+='<div class="form-group">';
  474. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_3+'</label>';
  475. html+='<div class="col-xs-12 col-sm-9 ">';
  476. if(field_3_old!=undefined){
  477. html+='<input type="text" name="field_3" maxlength="20" value="'+field_3_old+'" class="col-xs-10 col-sm-3 addborder addheight"/>';
  478. }else{
  479. html+='<input type="text" name="field_3" maxlength="20" class="col-xs-10 col-sm-3 addborder addheight"/>';
  480. }
  481. html+='</div>';
  482. html+='</div>';
  483. }
  484. if(field_4_status==true){
  485. html+='<div class="form-group">';
  486. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_4+'</label>';
  487. html+='<div class="col-xs-12 col-sm-9 ">';
  488. if(field_4_old!=undefined){
  489. html+='<input type="text" name="field_4" maxlength="20" value="'+field_4_old+'" class="col-xs-10 col-sm-3 addborder addheight"/>';
  490. }else{
  491. html+='<input type="text" name="field_4" maxlength="20" class="col-xs-10 col-sm-3 addborder addheight"/>';
  492. }
  493. html+='</div>';
  494. html+='</div>';
  495. }
  496. if(field_5_status==true){
  497. html+='<div class="form-group">';
  498. html+='<label class="control-label col-xs-12 col-sm-3 no-padding-right">'+field_5+'</label>';
  499. html+='<div class="col-xs-12 col-sm-9 ">';
  500. if(field_5_old!=undefined){
  501. html+='<input type="text" name="field_5" maxlength="20" value="'+field_5_old+'" class="col-xs-10 col-sm-3 addborder addheight"/>';
  502. }else{
  503. html+='<input type="text" name="field_5" maxlength="20" class="col-xs-10 col-sm-3 addborder addheight"/>';
  504. }
  505. html+='</div>';
  506. html+='</div>';
  507. }
  508. $('.field_area').html(html);
  509. layer.msg('设置成功');
  510. }else{
  511. layer.msg('设置失败');
  512. }
  513. $('#fieldModal').fadeOut();
  514. }
  515. });
  516. });
  517. $("#schoolSubmit").click(function () {
  518. $error=false;
  519. $("#schoolSubmit")[0].disabled = true;
  520. if($('#class_id').val()==''){
  521. $('#class-error').html('请选择班级');
  522. $error=true;
  523. }
  524. if($('input[name=realname]').val()==''){
  525. $('#realname-error').html('请输入姓名');
  526. $error=true;
  527. var mobile=$('input[name=student_phone]').val();
  528. if(mobile!='' && !checkMobile(mobile)){
  529. $('#student_phone-error').html('手机号不正确,请重新输入');
  530. $error=true;
  531. }
  532. var id_number=$('input[name=id_number]').val();
  533. console.log(id_number);
  534. if(id_number!='' && !isCardNo(id_number)){
  535. $('#idnumber-error').html('身份证号不正确,请重新输入');
  536. $error=true;
  537. }
  538. console.log($error);
  539. if($error){
  540. $("#schoolSubmit")[0].disabled = false;
  541. return false;
  542. }else{
  543. $("#userInfoSubmit").submit();
  544. }
  545. }else{
  546. //return checkRealName($(this).val());
  547. value=$('input[name=realname]').val();
  548. $('#realname-error').html('');
  549. var pattern = /^[\u2E80-\uFE4F^0-9·]{1,20}$/;
  550. if(!pattern.test(value)){
  551. $('#realname-error').html('姓名只能为20位汉字');
  552. return false;
  553. }
  554. $.ajax({
  555. url:"<?php echo $this->createUrl('studentinfo/verifyrealname');?>",
  556. type:"post",
  557. dataType:"json",
  558. data:{
  559. realname:value,
  560. student_id: $("input[name=student_id]").val(),
  561. cid:$('#class_id').val(),
  562. p_type:2
  563. },
  564. success: function(m) {
  565. if (m.status == 1){
  566. $("input[name=realname]").css("color","#000");
  567. }else{
  568. var id_number=$('input[name=id_number]').val();
  569. if($('input[name=id_number]').val()=='' || !isCardNo($('input[name=id_number]').val())){
  570. $("#realname-error").html('此学生姓名已存在,请输入身份证号');
  571. $error=true;
  572. }
  573. }
  574. var mobile=$('input[name=student_phone]').val();
  575. if(mobile!='' && !checkMobile(mobile)){
  576. $('#student_phone-error').html('手机号不正确,请重新输入');
  577. $error=true;
  578. }
  579. var id_number=$('input[name=id_number]').val();
  580. console.log(id_number);
  581. if(id_number!='' && !isCardNo(id_number)){
  582. $('#idnumber-error').html('身份证号不正确,请重新输入');
  583. $error=true;
  584. }
  585. console.log($error);
  586. if($error){
  587. $("#schoolSubmit")[0].disabled = false;
  588. return false;
  589. }else{
  590. $("#userInfoSubmit").submit();
  591. }
  592. }
  593. });
  594. }
  595. });
  596. $('#class_id').change(function(){
  597. $('#class-error').html('');
  598. });
  599. $('input[name=realname]').change(function(){
  600. return checkRealName($(this).val());
  601. });
  602. //重置学生登陆信息
  603. $('#reset-login').click(function(){
  604. var studentId = $(this).attr("studentId");
  605. if(studentId){
  606. $.ajax({
  607. url:"<?php echo $this->createUrl('studentinfo/ajaxResetLoginId');?>",
  608. type:"post",
  609. dataType:"json",
  610. data:{
  611. studentId:studentId
  612. },
  613. success:function(res){
  614. if(res.status==1){
  615. layer.msg("重制成功");
  616. window.location.reload();
  617. }else{
  618. layer.msg(res.msg);
  619. }
  620. },
  621. error:function(){
  622. layer.msg('系统错误');
  623. }
  624. });
  625. }
  626. });
  627. /*
  628. $('input[name=id_number]').change(function () {
  629. $('#idnumber-error').html('');
  630. var id_number=$(this).val();
  631. if(id_number==''){
  632. return false;
  633. }
  634. if(!isCardNo(id_number)){
  635. $("#schoolSubmit")[0].disabled = false;
  636. $('#idnumber-error').html('身份证格式不正确');
  637. }
  638. });
  639. */
  640. //检测手机号
  641. function checkMobile(value){
  642. var regMobile = /^1([356789]\d|4[57])\d{8}$/;
  643. return regMobile.test( value );
  644. }
  645. //检测身份证号
  646. function isCardNo(card) {
  647. var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
  648. return pattern.test(card);
  649. }
  650. //检测用户姓名
  651. function checkRealName(value){
  652. if(value==''){
  653. return false;
  654. }
  655. $('#realname-error').html('');
  656. var pattern = /^[\u2E80-\uFE4F^0-9·]{1,20}$/;
  657. if(!pattern.test(value)){
  658. $('#realname-error').html('姓名只能为20位汉字');
  659. return false;
  660. }else{
  661. if($('#class_id').val()!=''){
  662. $.post("<?php echo $this->createUrl('studentinfo/verifyrealname');?>",{
  663. realname:value,cid:$('#class_id').val()},function (data){
  664. var m = JSON.parse(data);
  665. if (m.status == 1){
  666. $("input[name=realname]").css("color","#000");
  667. return true;
  668. }else
  669. {
  670. var id_number=$('input[name=id_number]').val();
  671. if($('input[name=id_number]').val()=='' || !isCardNo($('input[name=id_number]').val())){
  672. $("#realname-error").html('此学生姓名已存在,请输入身份证号');
  673. return false;
  674. }
  675. }
  676. });
  677. }
  678. return false;
  679. }
  680. }
  681. });
  682. // ajax获取班级
  683. function changeYears(num) {
  684. if (!num) return;
  685. $.post("<?php echo $this->createUrl('classes/ajaxclass');?>",{yid:num},function(data){
  686. var p = eval("("+data+")");
  687. if (p.flag) {
  688. $("#classDiv").show();
  689. var html;
  690. var cityObj = $("#class_id");
  691. cityObj.empty();
  692. if (p.classList.length > 0){
  693. html = "<option value=''>请选择班级</option>";
  694. $.each(p.classList,function(i,n){
  695. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  696. });
  697. } else {
  698. html = "<option value=''>暂无班级</option>";
  699. }
  700. cityObj.append(html);
  701. } else {
  702. alert("获取数据失败!");
  703. }
  704. });
  705. }
  706. </script>