<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String basePath = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../../../common/admin/head.jsp"></jsp:include>
</head>
<body>
<jsp:include page="../../../common/admin/body_pre.jsp"></jsp:include>
<div class="row hidden-print">
    <div class="col-lg-12">
        <div class="ibox">
            <div class="ibox-title">
                <h2>服务商管理</h2>

                </ol>
            </div>
        </div>
    </div>
</div>
<div class="ibox-title">
<input type="hidden" name="formSerialize" />
<input type="hidden" name="pageNo" value="1" />
<form id="formAdd" action="<%=basePath%>/admin/HotWord/add.action" method="post" class="form-inline">
    <div class="form-group">
        <label for="word">热搜词</label>
        <input type="text" id="word" name="word" class="form-control" />
    </div>
    <div class="form-group">
        <label for="sort">排序值</label>
        <input type="text" id="sort" name="sort" class="form-control" />
    </div>

    <div class="form-group">
        <button id="btnAdd" type="button" class="btn btn-sm btn-primary"><i class="fa fa-search"></i>添加</button>
    </div>
</form>
</div>
<jsp:include page="../../../common/admin/grid_pre.jsp"></jsp:include>
<jsp:include page="../../../common/admin/grid_middle.jsp"></jsp:include>
<div id="divGrid">
</div>
<jsp:include page="../../../common/admin/grid_post.jsp"></jsp:include>
<jsp:include page="../../../common/admin/body_post.jsp"></jsp:include>
<script type="text/javascript">
    function search() {
        var formSerialize = $("input[type='hidden'][name='formSerialize']").val();
        var pageNo = $("input[type='hidden'][name='pageNo']").val();
        var formData = formSerialize + "&pageNo=" + pageNo;
        $("#divGrid").renderPartial({ url: "<%=basePath%>/admin/HotWord/list.action", data: formData });
    }

    $("#btnSearch").click(function () {
        $("input[type='hidden'][name='pageNo']").val(1);
        $("input[type='hidden'][name='formSerialize']").val($("#formSearch").serialize());
        search();
    });

    $("#btnAdd").click(function () {
        var reg=/^[0-9]+$/;
        var result= reg.test($("#sort").val());
        if(result) {
            $('#formAdd').ajaxSubmitCloseRefresh();
            window.location.href="<%=basePath%>/admin/HotWord/index.htm";
        }else{
            alert("排序值：请输入数字！");
            reurn;
        }

    });

    search();
</script>
</body>
</html>