ping_stu.html 3.2 KB
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta name="viewport"
          content="width=device-width, initial-scale=1,maximum-scale=1,maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>点评学员</title>
    <link rel="stylesheet" href="/static/css/common.css">
    <link rel="stylesheet" href="/static/css/style.css">
    <style>
        .box {
            overflow: hidden;
        }

        .ping_area {
            width: 9.4133333333rem;
            margin: 0 auto;
            background-color: #fff;
            margin-top: .267rem;
            height: auto;
        }

        .ping_area #wordtext {
            height: 3.46rem;
            resize: none;
            font-size: .4rem;
        }
    </style>
</head>
<body style="background-color: #f6f6f6">
<div class="box">
    <div class="ping_area">
        <textarea id="wordtext" placeholder="请输入该学员的学车情况"></textarea>
        <em id="wordage">0/500字</em>
    </div>
    <div class="btn_ping">
        <img src="/static/image/btn_ping.png"/>
    </div>
</div>
<script type="text/javascript" src="/static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript" src="/static/js/layer/layer.js"></script>
<script>
    (function (win, $) {
        var limitNum = 0;
        var pattern =  limitNum + '/500字';
        $('#wordage').html(pattern);
        $('#wordtext').keyup(
            function(){
                var remain = $(this).val().length;
                if(remain > 500){
                    pattern = "字数超过500个限制!";
                }else{
                    pattern =  remain + '/500字';

                }
                $('#wordage').html(pattern);
            }
        );
        var click_num = 0;
        $('.btn_ping').click(function () {
            if(click_num ==  0){
                click_num++;
                var str_len = $('#wordtext').val().length;
                if (str_len ==0) {
                    layer.msg('评价不能为空!')
                } else {
                    $.ajax({
                        url: "{:url('pingjia_by_coach_do')}",
                        data: {
                            uid: {$uid},
                            yuyue_id: {$yuyue_id},
                            comment: $('#wordtext').val()
                        },
                        success: function (res) {
                            console.log(res);
                            if (res.code == '1') {
                                layer.msg(res.msg);
                                window.location.href="/user/profile/percenter";
                            }
                        },
                        error:function(err){
                            click_num=0;
                        }
                    });
                }
            }else{
                layer.msg("请勿重复评价");
            }
        });
    })(window, jQuery)
</script>
</body>
</html>