<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <title>{{if eq $.Tab "doc"}}[搜文档]{{else}}[搜书籍]{{end}}{{.Wd}} - 搜索结果 - {{.SITE_NAME}}</title>

    <link href="{{$.StaticDomain}}/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="{{$.StaticDomain}}/static/font-awesome/css/font-awesome.min.css" rel="stylesheet">

    <link href="/static/css/main.css?version={{$.Version}}" rel="stylesheet">
    <script src="{{$.StaticDomain}}/static/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="{{$.StaticDomain}}/static/respond.js/1.4.2/respond.min.js"></script>
    <style>
        .search-highlight{font-style: normal;color: red;font-weight: 400;}
    </style>

</head>
<body>
<div class="manual-reader manual-container manual-search-reader search-result">
    {{template "widgets/header.html" .}}
    <div class="container manual-body">
        <div class="row">
            <div class="col-sm-8 col-xs-12">
                <form method="get" action="{{urlfor "SearchController.Result"}}" class="search-form">
                    <div class="input-group input-group-lg">
                        <input type="text" name="wd" value="{{.Wd}}" placeholder="Search..." class="form-control">
                        <input type="hidden" name="tab" value="{{.Tab}}">
                        <span class="input-group-addon"><i class="fa fa-search"></i><span class="hidden-xs"> 搜索</span></span>
                    </div>
                </form>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-8 col-xs-12 result-list">
                <div class="help-block"><a style="color: red;" target="_blank" rel="nofollow noreferrer" href="https://www.baidu.com/s?wd={{.SITE_NAME}}">{{.SITE_NAME}}</a> 本次搜索耗时 <span class="text-danger">{{.SpendTime}}</span> 秒，为您找到  <span class="text-success">{{.TotalRows}}</span> 个相关结果.</div>
                {{if (ads "search-top" $.IsMobile)}}
                    <div class="ap ap-search-top mgb-15px">
                        {{str2html (ads "search-top" $.IsMobile)}}
                    </div>
                {{end}}
                <ul class="nav nav-tabs">
                    <li {{if eq $.Tab "book"}}class="active"{{end}}><a href="{{urlfor "SearchController.Result"}}?wd={{$.Wd}}&tab=book">搜书籍</a></li>
                    <li {{if eq $.Tab "doc"}}class="active"{{end}}><a href="{{urlfor "SearchController.Result"}}?wd={{$.Wd}}&tab=doc">搜文档</a></li>
                </ul>
                {{if eq $.Tab "book"}}
                <ul >
                    {{range .Books}}
                    <li class="clearfix">
                        <div class="col-sm-3 col-md-3 col-lg-2 col-xs-3 " style="padding: 0px;">
                            <a href="{{urlfor "DocumentController.Index" ":key" .Identify}}" target="_blank" title="{{.BookName}}">
                                <img onerror="this.src='/static/images/book.png'" src="{{showImg .Cover "cover"}}" alt="{{.BookName}}" class="img-responsive border-cover-img">
                            </a>
                        </div>
                        <div class="col-sm-9 col-md-9 col-lg-10 col-xs-9">
                            <a href="{{urlfor "DocumentController.Index" ":key" .Identify}}" target="_blank"><h4>{{.BookName}}</h4></a>
                            <div class="text-muted book-info hidden-xs">
                                <span title="" class="tooltips" data-original-title="文档数量"><i class="fa fa-pie-chart"></i> {{.DocCount}}</span>
                                <span title="" class="tooltips" data-original-title="阅读人次"><i class="fa fa-eye"></i> {{.Vcnt}}</span>
                                <span title="" class="tooltips" data-original-title="收藏人次"><i class="fa fa-heart-o"></i> {{.Star}}</span>
                                <span title="" class="tooltips" data-original-title="创建时间"><i class="fa fa-clock-o"></i> {{dateformat .CreateTime "2006-01-02"}}</span>
                            </div>
                            <div class="help-block book-description">{{isubstr .Description 180}}</div>
                        </div>
                    </li>
                    {{else}}
                        <li class="clearfix">
                            <div class="help-block">啊哦，没搜到相关书籍，<a style="font-weight: 600;color: #06f;" href="{{urlfor "SearchController.Result"}}?wd={{$.Wd}}&tab=doc">搜文档</a> 试下？</div>
                        </li>
                    {{end}}
                </ul>
                {{end}}
                {{if eq $.Tab "doc"}}
                    <ul class="doc-result">
                        {{range .Docs}}
                        <li class="clearfix">
                            <div class="col-xs-12">
                                <a href="{{urlfor "DocumentController.Read" ":key" .BookIdentify ":id" .Identify}}?wd={{$.Wd}}" target="_blank"><h4>{{.DocumentName}}</h4></a>
                                <div class="text-muted book-info">
                                    <span class="tooltips" title="阅读人次"><i class="fa fa-eye"></i> {{.Vcnt}}</span>
                                    <span class="tooltips" title="发布时间"><i class="fa fa-clock-o"></i> {{dateformat .CreateTime "2006-01-02"}}</span>
                                    <span><a href="{{urlfor "DocumentController.Index" ":key" .BookIdentify}}" target="_blank" class="tooltips" title="查看书籍"><i class="fa fa-book text-muted"></i>《{{.BookName}}》</a></span>
                                </div>
                                <div class="help-block book-description">{{isubstr .Release 180}}</div>
                            </div>
                        </li>
                        {{else}}
                            <li class="clearfix">
                                <div class="help-block">很遗憾，没搜到相关文档，建议您更换关键字重新搜索</div>
                            </li>
                        {{end}}

                    </ul>
                {{end}}

                {{if (ads "search-bottom" $.IsMobile)}}
                    <div class="ap ap-search-bottom">
                        {{str2html (ads "search-bottom" $.IsMobile)}}
                    </div>
                {{end}}

                {{.PageHtml}}
            </div>
            {{if (ads "search-right" $.IsMobile)}}
                <div class="col-sm-4 hidden-xs result-right ap ap-search-right">
                    {{str2html (ads "search-right" $.IsMobile)}}
                </div>
            {{end}}
        </div>
    </div>
        {{template "widgets/footer.html" .}}
        <script src="{{$.StaticDomain}}/static/js/jquery.highlight.js"></script>
</div>

<script>
    $(function () {
        $(".search-form .input-group-addon").click(function () {
           var form=$(this).parents("form"),wd=form.find("[name=wd]").val();
           if(wd) form.submit();
        });

        var wds={{.Words}}
        if (wds){
            // 关键字高亮
            var arr = wds.split(",");
            for (var i = 0; i < arr.length; i++) {
                $(".result-list h4").highlight(arr[i]);
                $(".result-list .book-description").highlight(arr[i]);
            }
        }
    })
</script>

</body>
</html>