register.html 15.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>注册</title>
    <script src="__TMPL__/public/assets/js/fontsize.js"></script>
    <link rel="stylesheet" href="__TMPL__/public/assets/css//init.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css//swiper-3.4.2.min.css">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_793738_tlxymah92x.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css//weui.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css//myweui.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css//comment.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css//register.css">
</head>
<body>
<div class="container">
    <div class="banner_box"><img src="__TMPL__/public/assets/images/abg01@2x.png" alt=""></div>
    <div class="content_box">
        <div class="content_item sub_item">
            <div class="item_list">
                <div class="list_title">真实姓名</div>
                <div class="list_input"><input type="text" placeholder="请输入真实姓名" id="user_name"></div>
            </div>
            <div class="item_list">
                <div class="list_title">手机号</div>
                <div class="list_input"><input type="number" placeholder="请输入手机号" id="phone_num"></div>
            </div>
            <div class="item_list">
                <div class="list_title">验证码</div>
                <div class="list_input list_button"><input type="number" placeholder="请输入验证码" id="verify_code">
                    <button class="getCode">获取验证码</button>
                </div>
            </div>
        </div>
        <div class="content_item">
            <div class="item_list platform_item">
                <div class="list_title">平台</div>
                <div class="list_input"><input type="text" placeholder="请选择平台" id="platform" readonly="readonly" onfocus="this.focus()">
                    <text class="iconfont icon-xiala"></text>
                </div>
            </div>
            <div class="item_list hospital_item">
                <div class="list_title">医院</div>
                <div class="list_input"><input type="text" placeholder="请选择医院" id="hospital"  readonly="readonly" onfocus="this.focus()">
                    <text class="iconfont icon-xiala"></text>
                </div>
            </div>
            <div class="item_list department_item">
                <div class="list_title">科室</div>
                <div class="list_input"><input type="text" placeholder="请选择科室" id="department"  readonly="readonly" onfocus="this.focus()">
                    <text class="iconfont icon-xiala"></text>
                </div>
            </div>
            <div class="item_list position_item">
                <div class="list_title">职务</div>
                <div class="list_input"><input type="text" placeholder="请选择职务" id="position"  readonly="readonly" onfocus="this.focus()">
                    <text class="iconfont icon-xiala"></text>
                </div>
            </div>
            <div class="item_list">
                <div class="list_title">所在地区</div>
                <div class="list_select">
                    <div class="select_item">
                        <select name="province" id="province" >
                            <option value="请选择"><text class="area">省份</text></option>
                        </select>
                        <div class="iconfont  icon-daosanjiao"></div>
                    </div>
                    <div  class="select_item">
                        <select name="city" id="city" >
                            <option value="请选择">城市</option>
                        </select>
                        <div class="iconfont  icon-daosanjiao"></div>
                    </div>
                    <div  class="select_item">
                        <select name="town" id="town">
                            <option value="请选择">区县</option>
                        </select>
                        <div class="iconfont  icon-daosanjiao"></div>
                    </div>
                </div>
            </div>
            <div class="item_list">
              <div class="register_btn">完成注册</div>
            </div>
        </div>
    </div>
</div>
<!--表单判断弹窗-->
<div style="z-index: 999" class="form_popup_box">
    <text></text>
</div>
<!--成功第一步-->
<div class="mask_box first">
    <div class="popup_box">
        <div>恭喜您已注册成功!</div>
        <div>您已获得100积分,快去使用吧!</div>
    </div>
</div>
<!--成功第二步-->
<div class="mask_box success">
    <div class="success_box">
        <div>注册成功,请耐心等待</div>
        <div>平台会在两个工作日以内完成审核!!</div>
        <div class="success_info">如有疑问请联系客服:400-56183264</div>
    </div>
</div>
<script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script>
<script src="__TMPL__/public/assets/js/myweui.js"></script>
<script src="__TMPL__/public/assets/js/weui.js"></script>
<script src="__TMPL__/public/assets/js/area.js"></script>
<script src="__TMPL__/public/assets/js/select.js"></script>
<script src="__TMPL__/public/assets/js/register.js"></script>
<style>
.success {
    background:url("__TMPL__/public/assets/images/abg02@2x.png") no-repeat;
    -webkit-background-size: cover;
    background-size: cover;
}
</style>

<script type="application/javascript">


$(document).ready(function () {
    $('.mask_box').hide()
    $('.form_popup_box').hide()

    $(function () {
        //获取短信验证码
        var time = 60;
        var validCode = true;
        $(".getCode").click(function () {
            /*验证信息*/
           var send=$('#verify_code').attr('data-id');
           console.log(send);
           if(send==1){
               $('.form_popup_box').show()
               $('.form_popup_box').text('请稍后再试')
               $('.form_popup_box').delay(1000).hide(0);
               return;
           }
               var phone_num = $('#phone_num').val();
                if (phone_num == '') {
                               $('.form_popup_box').show()
                               $('.form_popup_box').text('手机号不能为空')
                               $('.form_popup_box').delay(1000).hide(0);
                               return;
                }
            $.ajax({
            url:'{:url('sendVerifyCode')}',
            type:'POST',
            data:{
                tel:phone_num
            },
            success:function(res) {
              console.log(res)
              if (res.code==1){
                  $('#verify_code').attr('data-id','1');
                    $('.form_popup_box').show()
                  $('.form_popup_box').text('验证码发送成功')
                      $('.form_popup_box').delay(1000).hide(0);
              } else {
                  $('.form_popup_box').show()
                   $('.form_popup_box').text(res.msg)
                   $('.form_popup_box').delay(1000).hide(0);
                   time=0;
                  return false;
              }
            }
            })


            var $code = $(this);
            if (validCode) {
                validCode = false;
                var t = setInterval(function () {
                    time--;
                    $code.html(time + "秒");
                    if (time == 0) {
                        clearInterval(t);
                        $('#verify_code').attr('data-id','0');
                        $code.html("重新获取");
                        validCode = true;
                    }
                }, 1000)
            }


        })
    })
    var hospital;
    var office=new Array();
    //选择平台
    $('.platform_item').click(function () {
        weui.picker([
                <volist name='platform' id='vo'>
                {label: '{$vo.name}',value:{$vo.id}},
                </volist>
            ], {
                onChange: function (res) {
                     $('#hospital').val('')
                     $('#department').val('')
                     $('#department').val('')

                },
                onConfirm: function (res) {
              var platform=$('#platform').val(res[0].label)
              $('#platform').data('data-id',res[0].value)
                 var  platform=res[0].value;
                $.ajax({
                  url:'{:url('getHospital','','',true)}',
                  type:'POST',
                  data:{
                      'platform':platform,
                  },
                  success:function(res){
                      hospital=new Array();
                      for(var i=0;i<res.data.length;i++){
                          var one=new Object();
                          one.value=res.data[i].hospital_id;
                          one.label=res.data[i].hospital_name;
                          hospital.push(one)
                      }
                  }
                });

                }
            }
        )
    })
    //选择医院
    $('.hospital_item').click(function () {

        console.log(hospital);
        if (hospital.length<1){
            $('.form_popup_box').show()
            $('.form_popup_box').text('当前平台下没有对应医院')
            $('.form_popup_box').delay(1000).hide(0);
            return false;
        }else{
            weui.picker(
                hospital
                , {
                    onChange: function (res) {
                        $('#department').val('')
                    },
                    onConfirm: function (res) {
                        $('#hospital').val(res[0].label)
                        $('#hospital').data('data-id',res[0].value)
                        var platform_id=$('#platform').data('data-id')
                        var hospital_id=res[0].value;
                        console.log(hospital_id)
                        console.log(platform_id);
                        $.ajax({
                            url:'{:url('getOffice','','',true)}',
                            type:'POST',
                            data:{
                                'platform_id':platform_id,
                                'hospital_id':hospital_id,
                            },
                            success:function(res){

                                for(var i=0;i<res.data.length;i++){
                                    var one=new Object();
                                    one.value=res.data[i].office_id;
                                    one.label=res.data[i].office_name;
                                    office.push(one)
                                }

                            }

                        })
                    }
                }
            )
        }
    })


    $('.department_item').click(function () {
        console.log(office);
        weui.picker(office, {
                onChange: function (res) {

                },
                onConfirm: function (res) {
                    $('#department').val(res[0].label)
                    $('#department').data('data-id',res[0].value)
                }
            }
        )
    })

    $('.position_item').click(function () {
        weui.picker([
            <volist name='jobs' id='vo'>
                {label: '{$vo.name}', value: {$vo.id}},
            </volist>
            ], {
                onChange: function (res) {
                    console.log(res)
                },
                onConfirm: function (res) {
                    $('#position').val(res[0].label)
                    $('#position').data('data-id',res[0].value)
                }
            }
        )
    })

    $('.register_btn').click(function () {
      var platform=$('#platform').data('data-id')
      var hospital=$('#hospital').data('data-id')
      var office=$('#department').data('data-id')
      var position=$('#position').data('data-id')


            var user_name = $('#user_name').val()
            var phone_num = $('#phone_num').val()
            var verify_code = $('#verify_code').val()
            // var platform = $('#platform').val()
            // var hospital = $('#hospital').val()
            // var department = $('#department').val()
            // var position = $('#position').val()
            var province = $('#province').val()
            var city = $('#city').val()
            var town = $('#town').val()
            if (user_name == '') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('用户名不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (phone_num == '') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('手机号不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (verify_code == '') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('验证码码不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (platform == '') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('平台不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (hospital == '') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('医院不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (department == '') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('科室不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (position == '') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('职务不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (province == '请选择') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('省份不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (city == '请选择') {

                $('.form_popup_box').text('城市不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else if (town == '请选择') {
                $('.form_popup_box').show()
                $('.form_popup_box').text('区县不能为空')
                $('.form_popup_box').delay(1000).hide(0);
            } else {
                $.ajax({
                url:'{:url('registerPost')}',
                type:'POST',
                data:{
                    platform:platform,
                    hospital:hospital,
                    office:office,
                    user_name:user_name,
                    tel:phone_num,
                    verify_code:verify_code,
                    job:position,
                    province:province,
                    city:city,
                    town:town,
                },
                    success:function(res) {
                    console.log(res)
                      if (res.code==1){
                            $('.success').show().delay(2000).hide(2);
                            window.location.href='{:url('/')}'
                      }else {
                             $('.form_popup_box').show()
                             $('.form_popup_box').text(res.msg)
                             $('.form_popup_box').delay(1000).hide(0);
                      }
                    }
                })



            }
        }
    )
})
</script>

</body>
</html>