<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<div class="layui-fluid oe_fluid">

  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">情感测试</a><span lay-separator="">/</span>
      <a><cite>添加测试</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="addform">
        添加保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <span class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius"><a href="<!--{$oefile}-->&c=<!--{$c}-->">返回列表</a></span>
    </div> 
  </div>
  
  <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
  <input type="hidden" name="a" id="a" value="saveadd" />
  <div class="layui-card">
    <div class="layui-card-header">添加测试</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%"><font color="red">*</font> 测试标题：</th>
          <td width="85%">
            <input type="text" name="title" id="title" class="layui-input input-300" />
          </td>
        </tr>
        <tr>
          <th><font color="red"></font> 副标题：</th>
          <td>
            <input type="text" name="subtitle" id="subtitle" class="layui-input input-300" />
          </td>
        </tr>
        <tr>
          <th><font color="red"></font> 封面图：</th>
          <td colspan="3">
            <div class="layui-btn">
              <i class="layui-icon layui-icon-upload"></i>
              点击上传
              <input type="file" name="img" id="img" f="but_upload_image" data-thumb="1" />
            </div>
            <div class="upload_loading" id="uplogo_loading" style="display:none;"></div>
            <input type="hidden" id="img_thumb" name="thumbimg" value="" />
            <input type="hidden" id="img_url" name="drawimg" value="" />
        
            <div class="tblform_tips normal">&nbsp;&nbsp;&nbsp;预览：</div>
            <div class="upload_pic upload_pic_md" style="width:30px;height:30px;">
              <img src="tpl/static/images/nopic.jpg" id="img_preview" f="viewimg" />
            </div>
            <a href="javascript:;" class="oe_deluploadimg" f="removeimg" data-preview="img" data-input="img">移除</a>
          </td>
        </tr>
        <tr>
          <th>描述/简介：</th>
          <td>
            <textarea name="intro" id="intro" class="layui-textarea" style="width:50%;height:120px;"></textarea>
          </td>
        </tr>
        <tr>
          <th>评分标准：</th>
          <td>
            <textarea name="score_standard" id="score_standard" class="layui-textarea" style="width:50%;height:60px;"></textarea>
          </td>
        </tr>
        <tr>
          <th>评分依据：</th>
          <td>
            <textarea name="score_basis" id="score_basis" class="layui-textarea" style="width:50%;height:60px;"></textarea>
          </td>
        </tr>
        <tr>
          <th>浏览次数：</th>
          <td colspan="3">
            <input type="text" name="hits" id="hits" class="layui-input input-120" />
          </td>
        </tr>
        <tr>
          <th>状态：</th>
          <td>
            <input type="radio" name="flag" title="正常" value="1" checked />
            <input type="radio" name="flag" title="锁定" value="0" />
            &nbsp;&nbsp;&nbsp;
            推荐：
            <input type="radio" name="elite" title="是" value="1" />
            <input type="radio" name="elite" title="否" value="0" checked />
          </td>
        </tr>
      </table>
    </div>
  </div>
  </form>
  
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="addform">
      添加保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
</div>

<script type="text/javascript">
$(function(){

    layui.use('form', function(){
        var form = layui.form;
        //保存...
        form.on('submit(addform)', function(data){
            var obj_id = data.elem.getAttribute("id");
            if (!$("#"+obj_id).hasClass("forbid_submit")) {
            
                if ($("#title").val() == '') {
                    layer.msg("请填写测试标题");
                    return false;
                }
                $("#"+obj_id).addClass("forbid_submit");
                if ($("#"+obj_id).find("span").length > 0) {
                    $("#"+obj_id).find("span").show();
                }
                $("#myform").submit();
            }
        });   
    });
    
});
</script>
</body>
</html>