123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- <style>
- .addborder{border:1px solid #ccc}
- .addheight{height:30px;border-radius:2px;}
- .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;}
- .ace{position:relative;top:0px !important;left:0px !important;}
- label{font-weight:100 !important;}
- </style>
- <div class="main-content-inner">
- <ul class="clearfix main-content-inner-ul">
- <?php if(Yii::app()->session['coachInfo']['leader']==1){?>
- <li class="pull-left">
- <button onclick='location.href="<?php echo $this->createUrl("semester/index");?>"' class="button button_normal button_group button_arrow" data-button="red">学期管理</button>
- <img src="/images/line.jpg" style="height:45px;" />
- </li>
- <?php }?>
- <li class="pull-left">
- <button onclick='location.href="<?php echo $this->createUrl("teacher/index");?>"' class="button button_normal button_group button_arrow" data-button="red">教师管理</button>
- <img src="/images/line.jpg" style="height:45px;" />
- </li>
- <li class="pull-left">
- <button onclick='location.href="<?php echo $this->createUrl("classes/index");?>"' class="button button_normal button_group button_arrow" data-button="red">班级管理</button>
- <img src="/images/line.jpg" style="height:45px;" />
- </li>
- <li class="pull-left">
- <button onclick='location.href="<?php echo $this->createUrl("studentinfo/index");?>"' class="button button_normal button_group button_arrow button_active" data-button="red">学生管理</button>
- <img src="/images/line.jpg" style="height:45px;" />
- </li>
- <li class="pull-left">
- <button onclick='location.href="<?php echo $this->createUrl("classes/export");?>"' class="button button_normal button_group button_arrow " data-button="red">导出学生</button>
- <img src="/images/line.jpg" style="height:45px;" />
- </li>
- </ul>
- <div class="page-content" style="margin-top:15px;">
- <div class="row" style="margin:0px">
- <div class="col-xs-12">
- <!-- PAGE CONTENT BEGINS -->
- <form class="form-horizontal" action="<?php echo $this->createUrl('studentinfo/add');?>" method="post" id="userInfoSubmit">
- <?php if(empty($cid)):?>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">所属班级<span class="errorMessage">*</span>:</label>
- <div class="col-xs-12 col-sm-9">
- <!--<div class="clearfix">
- <select class="input-medium" id="class_id" name="class_id">
- <option value="">请选择</option>
- <?php if(!empty($classInfo)):foreach($classInfo as $loop):?>
- <option value="<?php echo $loop->class_id;?>"><?php echo $loop->class_name;?></option>
- <?php endforeach;endif;?>
- </select>
- </div>-->
- <div class='diy_select ml2' style="width: 131px">
- <input type='hidden' id="class_id" name="class_id" class='diy_select_input' />
- <div class='diy_select_txt'>--请选择--</div>
- <div class='diy_select_btn'></div>
- <ul class='diy_select_list'>
- <?php if(!empty($classInfo)):foreach($classInfo as $loop):?>
- <li val="<?php echo $loop->class_id;?>"><?php echo $loop->class_name;?></li>
- <?php endforeach;endif;?>
- </ul>
- </div>
- </div>
- </div>
- <?php else:?>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">班级名称<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <input type="text" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" disabled="disabled" value="<?php echo $cname;?>" />
- <input type="hidden" name="class_id" id="class_id" value="<?php echo $cid;?>" />
- </div>
- </div>
- <?php endif;?>
-
- <!--<div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录账号<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9 mtCentent">
- <input type="text" id="username" name="username" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" />
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">登录密码<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9 mtCentent">
- <input type="password" id="password" name="password" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" />
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">确认密码<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9 mtCentent">
- <input type="password" id="password2" name="password2" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" />
- </div>
- </div>-->
- <div class="hr hr-16 hr-dotted"></div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">真实姓名<span class="errorMessage">*</span>:</label>
- <div class="col-xs-12 col-sm-9 mtCentent">
- <input type="text" name="realname" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" placeholder="姓名唯一" />
- <label id="realname-error" class="errorMessage" for="realname"></label>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">学号:</label>
- <div class="col-xs-12 col-sm-9 mtCentent">
- <input type="text" name="userno" id="userno" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" placeholder="学生学号" />
- </div>
- </div>
- <!--<div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">班级序号<span class="errorMessage">*</span>:</label>
- <div class="col-xs-12 col-sm-9 mtCentent">
- <input type="text" name="serial_number" id="serial_number" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo" placeholder="学生所在这个班的序号" />
- </div>
- </div>-->
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">学生手机号:</label>
- <div class="col-xs-12 col-sm-9 ">
- <input type="text" name="student_phone" class="col-xs-10 col-sm-3 addborder addheight" />
- </div>
- </div>
- <?php if($use_zhixue){
- ?>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">绑定智学网准考证号:</label>
- <div class="col-xs-12 col-sm-9 ">
- <input type="text" name="zhixue_student_card" class="col-xs-10 col-sm-3 addborder addheight" />
- </div>
- </div>
- <?php }?>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">绑定学校准考证号:</label>
- <div class="col-xs-12 col-sm-9 ">
- <input type="text" name="school_student_card" class="col-xs-10 col-sm-3 addborder addheight" />
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">性别:</label>
- <div class="col-sm-9 mt6">
- <span class="inline blue">
- <input type="radio" class="ace" name="sex" value="1" checked="checked">
- <span class="lbl middle"> 男</span>
- </span>
-
- <span class="inline blue">
- <input type="radio" class="ace" name="sex" value="2">
- <span class="lbl middle"> 女</span>
- </span>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">是否为在籍生:</label>
- <div class="col-sm-9 mt6">
- <span class="inline blue">
- <input type="radio" class="ace" name="is_outer" value="0" checked="checked">
- <span class="lbl middle"> 是</span>
- </span>
-
- <span class="inline blue">
- <input type="radio" class="ace" name="is_outer" value="1">
- <span class="lbl middle"> 否</span>
- </span>
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">身份证号:</label>
- <div class="col-xs-12 col-sm-9 ">
- <input type="text" name="id_number" class="col-xs-10 col-sm-3 addborder addheight" />
- </div>
- </div>
- <div class="clearfix form-actions">
- <div class="col-md-offset-3 col-md-9">
- <button class="btn btn-success btn-sm" type="button" id="schoolSubmit" >
- <i class="ace-icon fa fa-check bigger-110"></i>
- 提交
- </button>
- <!--
- <button class="btn" type="reset">
- <i class="ace-icon fa fa-undo bigger-110"></i>
- 重填
- </button>-->
- </div>
- </div>
- </form>
- <!-- PAGE CONTENT ENDS -->
- </div>
- </div>
- </div>
- </div>
- <script src="/js/xsgl.js"></script>
- <script src="/js/jquery.validate.min.js"></script>
- <script type="text/javascript">
- jQuery(function($) {
- $("#schoolSubmit").click(function () {
- console.log(111)
- if(validator.form()){
- $("#schoolSubmit")[0].disabled = true
- $("#userInfoSubmit").submit();
- }else{
- $("#schoolSubmit")[0].disabled = false
- }
- });
- $("#realname-error").hide();
- //检测手机号
- $.validator.addMethod("isPhone", function(value, element) {
- var regMobile = /^1([356789]\d|4[57])\d{8}$/;
- return this.optional(element) || (regMobile.test( value ));
- }, "请正确填写手机号!");
- $.validator.addMethod("charString", function(value, element) {
- var length = value.length;
- var your_tel =/[^\a-z0-9A-Z\u4E00-\u9FA5\u3400-\u4DBF_-]/g;
- return this.optional(element) || (length<=20&&!your_tel.test(value));
- },"请输入中文,英文名称或者中英文加数字");
- $.validator.addMethod("charclass", function(value, element) {
- var class_id = $("input[name=class_id]").val();
- return this.optional(element) || (class_id);
- },"请选择班级");
- /*$.validator.addMethod("isTerm", function(value, element) {
- var regMobile = /^1([3578]\d|4[57])\d{8}$/;
- return this.optional(element) || (regMobile.test( value ));
- }, "请正确填写手机号!");
- */
- function isCardNo(card) {
- var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
- return pattern.test(card);
- }
- $('input[name=id_number]').change(function(){
- var id_number =$(this).val();
- if(!isCardNo(id_number)){
- layer.msg('身份证号不正确 ')
- }
- });
- $(".diy_select_list").click(function(){
- if($("#class_id-error").length>0){
- $("#class_id-error").css('display','none');
- }
- if($("input[name=realname]").val().length>0 && $("input[name=class_id]").val().length>0){
- $("#realname-error").css('display','none');
- $.post("<?php echo $this->createUrl('studentinfo/verifyrealname');?>",{
- realname:$("input[name=realname]").val(),cid:$("input[name=class_id]").val()},function (data){
- var m = JSON.parse(data);
- if (m.status == 1){
- $("input[name=realname]").css("color","#000");
- return true;
- }else
- {
- var id_number=$('input[name=id_number]').val();
- console.log(id_number);
- console.log(isCardNo(id_number));
- if($('input[name=id_number]').val()=='' || !isCardNo($('input[name=id_number]').val())){
- $("#realname-error").css('display','inline-block');
- $("#realname-error").html('此学生姓名已存在,请输入身份证号');
- }
- }
- });
- }
- });
- var validator= $('#userInfoSubmit').validate({
- //debug:true,// 表单不会提交
- //errorElement: 'font', // 错误信息div
- errorClass: 'errorMessage', //错误样式
- ignore: "", //忽略提交字段
- onfocus: true,
- rules: {
- class_id: {
- required: true
- },
- sex: {
- required: true,
- },
- realname: {
- required: true,
- charString: true,
- charclass:true,
- maxlength: 20,
- remote:{ //自带远程验证存在的方法
- url:"<?php echo $this->createUrl('studentinfo/verifyrealname');?>",
- type:"post",
- dataType:"html",
- data:{
- realname:function(){return $("input[name=realname]").val();},cid:function(){return $("#class_id").val();}
- },
- dataFilter: function(data) {
- var m = JSON.parse(data);
- if (m.status == 1){
- return true;
- }else{
- var id_number=$('input[name=id_number]').val();
- console.log(id_number);
- console.log(isCardNo(id_number));
- if(id_number=='' || !isCardNo(id_number)){
- return false;
- }else{
- return true;
- }
- }
-
- }
- }
- },
- student_phone:{
- isPhone:true
- }
- },
- messages: {
- years_id: {
- required: "请选择年级!",
- },
- class_id: {
- required: "请选择班级!",
- },
- realname: {
- required: "请填写真实姓名!",
- maxlength: "姓名不能大于20个字符!",
- remote:"此学生姓名已存在,请输入身份证号"
- },
- telephone: {
- required: "请填写家长手机号!",
- },
- sex: {
- required: "请选择性别!",
- }
- },
- errorPlacement: function (error, element) {
- // 指定错误信息显示位置
- if(element.is('input[type=radio]')) {
- var controls = element.closest('div[class*="col-"]');
- if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
- else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
- }else{
- error.insertAfter(element.after());
- }
- console.log('sss');
- },
- })
- });
- // ajax获取班级
- function changeYears(num) {
- if (!num) return;
- $.post("<?php echo $this->createUrl('classes/ajaxclass');?>",{yid:num},function(data){
- var p = eval("("+data+")");
- if (p.flag) {
- $("#classDiv").show();
- var html;
- var cityObj = $("#class_id");
- cityObj.empty();
- if (p.classList.length > 0){
- html = "<option value=''>请选择班级</option>";
- $.each(p.classList,function(i,n){
- html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
- });
- } else {
- html = "<option value=''>暂无班级</option>";
- }
- cityObj.append(html);
- } else {
- alert("获取数据失败!");
- }
- });
- }
- </script>
|