优化文集内搜索样式

This commit is contained in:
yangjian 2021-03-22 22:54:20 +08:00
parent 22ee910cb5
commit 0f0e0c6482
3 changed files with 10 additions and 2 deletions

View File

@ -381,6 +381,7 @@ def project_index(request,pro_id):
# ).values('id','name','top_doc').order_by('sort')
if kw != '':
search_result = Doc.objects.filter(top_doc=int(pro_id),pre_content__icontains=kw)
remove_markdown_tag(search_result)
return render(request,'app_doc/project_doc_search.html',locals())
return render(request, 'app_doc/project.html', locals())
except Exception as e:

View File

@ -46,7 +46,7 @@
<!-- 文档搜索 -->
<form action="{% url 'pro_index' pro_id=project.id %}" method="get">
<div id="doc-search-input">
<input type="text" name="kw" placeholder="{% trans '输入并回车搜索' %}" value="" class="layui-input doc-search-input">
<input type="text" name="kw" placeholder="{% trans '在文集内搜索文档' %}" value="" class="layui-input doc-search-input">
</div>
</form>
<!-- 文集名称 -->

View File

@ -15,7 +15,7 @@
{% endblock %}
{% block content_head %}
<h1>{% trans "搜索" %} {{kw}} {% trans "共有" %}{{ search_result.count }}{% trans "个结果" %} - {{project.name}}</h1><hr>
<h1>{% trans "搜索" %} {{kw}} {% trans "共有" %}{{ search_result.count }}{% trans "个结果" %}</h1><hr>
{% endblock %}
{% block page_content %}
@ -24,5 +24,12 @@
<p><a href="{% url 'doc' pro_id=project.id doc_id=result.id %}" target="_blank">{{ result.name }}</a> - <span style="font-size: 14px;color: #999;">{{result.modify_time}}</span></p>
<p>{{ result.pre_content|truncatechars:300 }}</p>
</div>
<hr>
{% endfor %}
{% endblock %}
{% block custom_script %}
<script>
keyLight('doc-content','{{kw}}')
</script>
{% endblock %}