forked from mirror/MrDoc
v0.5.6,详见更新记录
This commit is contained in:
parent
4d043409d6
commit
d1b8c87948
11
CHANGES.md
11
CHANGES.md
@ -1,5 +1,16 @@
|
||||
## 版本更新记录
|
||||
|
||||
### v0.5.6 2020-07-31
|
||||
|
||||
- 修复Markdown编辑器插入图片、表格、音视频等内容时光标丢失的问题;
|
||||
- 优化重构搜索功能,支持在搜索界面进行文集和文档搜索;
|
||||
- 优化文档页面排版显示;
|
||||
- 优化文档页面代码块超长超宽代码样式;
|
||||
- 优化移动复制文档弹出框大纲超长的样式;
|
||||
- 优化epub和PDF格式文件导出;
|
||||
- 优化编辑器界面排版布局;
|
||||
- 优化文档三级目录渲染错误的问题;
|
||||
|
||||
### v0.5.5 2020-07-20
|
||||
|
||||
- 禁用编辑器页面的列表目录和下拉目录语法解析
|
||||
|
@ -40,7 +40,7 @@ SECRET_KEY = '5&71mt9@^58zdg*_!t(x6g14q*@84d%ptr%%s6e0l50zs0we3d'
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = CONFIG.getboolean('site','debug')
|
||||
|
||||
VERSIONS = '0.5.5'
|
||||
VERSIONS = '0.5.6'
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
|
@ -1,9 +1,16 @@
|
||||
## MrDoc觅道文档 - 记录文档,汇聚思想 - [English](./README_ENG.md)
|
||||
|
||||
![mrdoc](https://img.shields.io/badge/MrDoc-v0.5.5-brightgreen.svg) ![python](https://img.shields.io/badge/Python-3.5+-blue.svg) ![mrdoc](https://img.shields.io/badge/Django-v2.2-important.svg)
|
||||
![mrdoc](https://img.shields.io/badge/MrDoc-v0.5.6-brightgreen.svg) ![python](https://img.shields.io/badge/Python-3.5+-blue.svg) ![mrdoc](https://img.shields.io/badge/Django-v2.2-important.svg)
|
||||
|
||||
![Mrdoc首页](./captrue/mrdoc-index.png)
|
||||
|
||||
<p>打赏项目:
|
||||
<a href="http://mrdoc.zmister.com/project-7/doc-434/">微信</a>|
|
||||
<a href="http://mrdoc.zmister.com/project-7/doc-434/">支付宝</a>|
|
||||
<a href="http://mrdoc.zmister.com/project-7/doc-434/">QQ</a>|
|
||||
<a href="http://mrdoc.zmister.com/project-7/doc-434/">PayPal</a>|
|
||||
</p>
|
||||
|
||||
### 介绍
|
||||
|
||||
`MrDoc` 是基于`Python`开发的在线文档系统,适合作为个人和小型团队的文档、知识和笔记管理工具。致力于成为全平台(Web端、桌面端、移动端)的私有化在线文档部署方案。
|
||||
|
@ -1,10 +1,17 @@
|
||||
## MrDoc - Writing documents, gathering ideas
|
||||
|
||||
![mrdoc](https://img.shields.io/badge/MrDoc-v0.5.5-brightgreen.svg) ![python](https://img.shields.io/badge/Python-3.5+-blue.svg) ![mrdoc](https://img.shields.io/badge/Django-v2.2-important.svg)
|
||||
![mrdoc](https://img.shields.io/badge/MrDoc-v0.5.6-brightgreen.svg) ![python](https://img.shields.io/badge/Python-3.5+-blue.svg) ![mrdoc](https://img.shields.io/badge/Django-v2.2-important.svg)
|
||||
|
||||
|
||||
![Mrdoc首页](./captrue/mrdoc-index.png)
|
||||
|
||||
<p>Sponsor:
|
||||
<a href="http://mrdoc.zmister.com/project-7/doc-434/">WeChat</a>|
|
||||
<a href="http://mrdoc.zmister.com/project-7/doc-434/">AliPay</a>|
|
||||
<a href="http://mrdoc.zmister.com/project-7/doc-434/">QQ</a>|
|
||||
<a href="http://mrdoc.zmister.com/project-7/doc-434/">PayPal</a>|
|
||||
</p>
|
||||
|
||||
### Introduce
|
||||
|
||||
`Mrdoc` is an online document system developed based on python. It is suitable for individuals and small teams to manage documents, knowledge and notes. It is committed to become a private online document deployment solution for the whole platform (web, desktop, mobile).
|
||||
|
@ -317,7 +317,7 @@ def admin_project(request):
|
||||
if request.method == 'GET':
|
||||
search_kw = request.GET.get('kw','')
|
||||
if search_kw == '':
|
||||
project_list = Project.objects.all()
|
||||
project_list = Project.objects.all().order_by('-create_time')
|
||||
paginator = Paginator(project_list,20)
|
||||
page = request.GET.get('page',1)
|
||||
try:
|
||||
|
@ -275,6 +275,7 @@ class ReportEPUB():
|
||||
seque_tag = html_soup.select('.sequence-diagram') # 查找所有时序图标签
|
||||
echart_tag = html_soup.select('.echart') # 查找所有echart图表标签
|
||||
code_tag = html_soup.find_all(name="code") # 查找code代码标签
|
||||
iframe_tag = html_soup.find_all(name='iframe') # 查找iframe
|
||||
|
||||
# 添加css样式标签
|
||||
style_link = html_soup.new_tag(name='link',href="../Styles/style.css",rel="stylesheet",type="text/css")
|
||||
@ -290,6 +291,12 @@ class ReportEPUB():
|
||||
# 添加html标签的xmlns属性
|
||||
html_soup.html['xmlns'] = "http://www.w3.org/1999/xhtml"
|
||||
|
||||
# 替换iframe视频为视频URL链接文本
|
||||
for iframe in iframe_tag:
|
||||
iframe_src = iframe.get('src')
|
||||
iframe.name = 'p'
|
||||
iframe.string = "本格式不支持iframe视频显示,视频地址为:{}".format(iframe_src)
|
||||
|
||||
# 替换HTML文本中静态文件的相对链接为绝对链接
|
||||
for src in src_tag:
|
||||
if src['src'].startswith("/"):
|
||||
@ -908,7 +915,7 @@ class ReportPDF():
|
||||
</head>
|
||||
<body>
|
||||
<div style="position: fixed;font-size:8px; bottom: 5px; right: 10px; background: red; z-index: 10000">
|
||||
本文档由觅道文档(MrDoc)生成
|
||||
本文档由MrDoc觅道文档生成
|
||||
</div>
|
||||
<div style="text-align:center;margin-top:400px;">
|
||||
<h1>{project_name}</h1>
|
||||
|
@ -2,6 +2,7 @@
|
||||
# 文档自定义模板过滤器
|
||||
from app_doc.models import *
|
||||
from django import template
|
||||
import re
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@ -129,4 +130,32 @@ def get_doc_previous(value):
|
||||
return previous.id
|
||||
except Exception as e:
|
||||
import traceback
|
||||
print(traceback.print_exc())
|
||||
print(traceback.print_exc())
|
||||
|
||||
|
||||
# 获取内容的关键词上下文
|
||||
@register.filter(name='get_key_context')
|
||||
def get_key_context(value,args):
|
||||
# print(value,args)
|
||||
# re_result = re.findall(args, value, flags=re.IGNORECASE)
|
||||
value = value.replace('\n','')
|
||||
p = re.compile(args,flags=re.IGNORECASE)
|
||||
value_list = []
|
||||
for m in p.finditer(value):
|
||||
# print(value,m,m.start(),m.group(),)
|
||||
# print( m.start(), m.group())
|
||||
start_point = m.start() - 20
|
||||
if start_point < 0:
|
||||
start_point = 0
|
||||
end_point = m.end()+20
|
||||
# print(start_point,end_point)
|
||||
# print(value[start_point:end_point])
|
||||
value_list.append(value[start_point:end_point])
|
||||
# print(value_list)
|
||||
if len(value_list) > 0:
|
||||
r = "…".join(value_list)
|
||||
if len(r) > 200:
|
||||
r = r[0:200]
|
||||
else:
|
||||
r = value[0:200]
|
||||
return r
|
@ -32,6 +32,7 @@ urlpatterns = [
|
||||
path('move_doc/', views.move_doc, name='move_doc'), # 移动文档
|
||||
path('doc_recycle/', views.doc_recycle,name='doc_recycle'), # 文档回收站
|
||||
path('fast_pub_doc/',views.fast_publish_doc,name='fast_pub_doc'), # 一键发布文档
|
||||
path('download_doc_md/<int:doc_id>/',views.download_doc_md,name='download_doc_md'), # 下载文档Markdown文件
|
||||
#################文档模板相关
|
||||
path('manage_doctemp/',views.manage_doctemp,name='manage_doctemp'), # 文档模板列表
|
||||
path('create_doctemp/',views.create_doctemp,name="create_doctemp"), # 创建文档模板
|
||||
@ -44,4 +45,5 @@ urlpatterns = [
|
||||
path('manage_attachment/',views.manage_attachment,name='manage_attachment'), # 附件管理
|
||||
################其他功能相关
|
||||
path('upload_doc_img/',util_upload_img.upload_img,name="upload_doc_img"), # 上传图片
|
||||
path('search/',views.search,name="search"), # 搜索功能
|
||||
]
|
136
app_doc/views.py
136
app_doc/views.py
@ -1339,7 +1339,7 @@ def get_pro_doc_tree(request):
|
||||
'level': 3
|
||||
}
|
||||
sec_item['children'].append(item)
|
||||
top_item['children'].append(sec_item)
|
||||
top_item['children'].append(sec_item)
|
||||
else:
|
||||
top_item['children'].append(sec_item)
|
||||
doc_list.append(top_item)
|
||||
@ -1471,6 +1471,7 @@ def genera_project_file(request):
|
||||
|
||||
return JsonResponse({'status': True, 'data': epub_file})
|
||||
except Exception as e:
|
||||
logger.exception("生成EPUB出错")
|
||||
return JsonResponse({'status': False, 'data': '生成出错'})
|
||||
# 导出PDF
|
||||
elif report_type in ['pdf']:
|
||||
@ -1865,4 +1866,135 @@ def manage_attachment(request):
|
||||
attachment_list.append(item)
|
||||
return JsonResponse({'status':True,'data':attachment_list})
|
||||
else:
|
||||
return JsonResponse({'status':False,'data':'无效参数'})
|
||||
return JsonResponse({'status':False,'data':'无效参数'})
|
||||
|
||||
|
||||
# 搜索
|
||||
def search(request):
|
||||
kw = request.GET.get('kw', None)
|
||||
search_type = request.GET.get('type', 'doc') # 搜索类型,默认文档doc
|
||||
date_type = request.GET.get('d_type', 'recent')
|
||||
date_range = request.GET.get('d_range', 'all') # 时间范围,默认不限,all
|
||||
project_range = request.GET.get('p_range', 0) # 文集范围,默认不限,all
|
||||
|
||||
# 处理时间范围
|
||||
if date_type == 'recent':
|
||||
if date_range == 'recent1': # 最近1天
|
||||
start_date = datetime.datetime.now() - datetime.timedelta(days=1)
|
||||
elif date_range == 'recent7': # 最近7天
|
||||
start_date = datetime.datetime.now() - datetime.timedelta(days=7)
|
||||
elif date_range == 'recent30': # 最近30天
|
||||
start_date = datetime.datetime.now() - datetime.timedelta(days=30)
|
||||
elif date_range == 'recent365': # 最近一年
|
||||
start_date = datetime.datetime.now() - datetime.timedelta(days=365)
|
||||
else:
|
||||
start_date = datetime.datetime.strptime('1900-01-01', '%Y-%m-%d')
|
||||
end_date = datetime.datetime.now()
|
||||
elif date_type == 'day':
|
||||
try:
|
||||
date_list = date_range.split('|')
|
||||
start_date = datetime.datetime.strptime(date_list[0], '%Y-%m-%d')
|
||||
end_date = datetime.datetime.strptime(date_list[1], '%Y-%m-%d')
|
||||
except:
|
||||
start_date = datetime.datetime.now() - datetime.timedelta(days=1)
|
||||
end_date = datetime.datetime.now()
|
||||
|
||||
# 是否时间筛选
|
||||
if date_range == 'all':
|
||||
is_date_range = False
|
||||
else:
|
||||
is_date_range = True
|
||||
|
||||
# 是否认证
|
||||
if request.user.is_authenticated:
|
||||
is_auth = True
|
||||
else:
|
||||
is_auth = False
|
||||
|
||||
# 存在搜索关键词
|
||||
if kw:
|
||||
# 搜索文档
|
||||
if search_type == 'doc':
|
||||
if is_auth:
|
||||
colla_list = [i.project.id for i in ProjectCollaborator.objects.filter(user=request.user)] # 用户的协作文集
|
||||
open_list = [i.id for i in Project.objects.filter(role=0)] # 公开文集
|
||||
view_list = list(set(open_list).union(set(colla_list))) # 合并上述两个文集ID列表
|
||||
|
||||
data_list = Doc.objects.filter(
|
||||
Q(top_doc__in=view_list), # 包含用户可浏览到的文集
|
||||
Q(create_time__gte=start_date, create_time__lte=end_date), # 筛选创建时间
|
||||
Q(name__icontains=kw) | Q(content__icontains=kw) # 筛选文档标题和内容中包含搜索词
|
||||
).order_by('-create_time')
|
||||
else:
|
||||
view_list = [i.id for i in Project.objects.filter(role=0)]
|
||||
data_list = Doc.objects.filter(
|
||||
Q(top_doc__in=view_list),
|
||||
Q(create_time__gte=start_date, create_time__lte=end_date), # 筛选创建时间
|
||||
Q(name__icontains=kw) | Q(content__icontains=kw) # 筛选文档标题和内容中包含搜索词
|
||||
).order_by('-create_time')
|
||||
|
||||
# 搜索文集
|
||||
elif search_type == 'pro':
|
||||
# 认证用户
|
||||
if is_auth:
|
||||
colla_list = [i.project.id for i in ProjectCollaborator.objects.filter(user=request.user)] # 用户的协作文集
|
||||
# 查询所有可显示的文集
|
||||
data_list = Project.objects.filter(
|
||||
Q(role=0) | \
|
||||
Q(role=2, role_value__contains=str(request.user.username)) | \
|
||||
Q(create_user=request.user) | \
|
||||
Q(id__in=colla_list),
|
||||
Q(create_time__gte=start_date, create_time__lte=end_date), # 筛选创建时间
|
||||
Q(name__icontains=kw) | Q(intro__icontains=kw) # 筛选文集名称和简介包含搜索词
|
||||
).order_by('-create_time')
|
||||
# 游客
|
||||
else:
|
||||
data_list = Project.objects.filter(
|
||||
Q(role=0),
|
||||
Q(name__icontains=kw) | Q(intro__icontains=kw),
|
||||
Q(create_time__gte=start_date, create_time__lte=end_date), # 筛选创建时间
|
||||
).order_by("-create_time")
|
||||
|
||||
# 搜索标签
|
||||
# elif search_type == 'tag':
|
||||
# pass
|
||||
else:
|
||||
return render(request, 'app_doc/search.html')
|
||||
|
||||
# 分页处理
|
||||
paginator = Paginator(data_list, 12)
|
||||
page = request.GET.get('page', 1)
|
||||
try:
|
||||
datas = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
datas = paginator.page(1)
|
||||
except EmptyPage:
|
||||
datas = paginator.page(paginator.num_pages)
|
||||
return render(request, 'app_doc/search_result.html', locals())
|
||||
|
||||
# 否则跳转到搜索首页
|
||||
else:
|
||||
return render(request,'app_doc/search.html')
|
||||
|
||||
# 文档Markdown文件下载
|
||||
@require_http_methods(['GET',"POST"])
|
||||
def download_doc_md(request,doc_id):
|
||||
if request.user.is_authenticated:
|
||||
if request.user.is_superuser:
|
||||
try:
|
||||
doc = Doc.objects.get(id=doc_id)
|
||||
except ObjectDoesNotExist:
|
||||
return JsonResponse({'status':False,'data':'文档不存在'})
|
||||
else:
|
||||
try:
|
||||
doc = Doc.objects.get(id=doc_id,create_user = request.user)
|
||||
except ObjectDoesNotExist:
|
||||
return JsonResponse({'status':False,'data':'文档不存在'})
|
||||
else:
|
||||
return render(request,'404.html')
|
||||
|
||||
response = HttpResponse(content_type='text/plain')
|
||||
response['Content-Disposition'] = 'attachment; filename={}.md'.format(doc.name)
|
||||
response.write(doc.pre_content)
|
||||
|
||||
return response
|
||||
|
@ -188,7 +188,7 @@ body, html {
|
||||
.project-title{
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
margin:20px;
|
||||
margin:0 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.doc-summary {
|
||||
@ -356,12 +356,12 @@ li.active > a,li.active > div > a{
|
||||
}
|
||||
/* 返回顶部 */
|
||||
.toTop {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
background: #f6f6f6;
|
||||
text-align: center;
|
||||
line-height: 70px;
|
||||
line-height: 50px;
|
||||
/*返回顶部标签固定定位*/
|
||||
position: fixed;
|
||||
right: 35px;
|
||||
|
1
static/search/home_btn.svg
Normal file
1
static/search/home_btn.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg id="Capa_1" enable-background="new 0 0 512.145 512.145" height="512" viewBox="0 0 512.145 512.145" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m406.073 30.073h-60c-8.291 0-15 6.709-15 15v49.75l90 52.5v-102.25c0-8.291-6.709-15-15-15z" fill="#dce1eb"/><g><path d="m452.073 191.572v305.501h-392v-305.501l196-171.7z" fill="#f2f6fc"/></g><path d="m452.073 191.572v305.501h-196v-477.201z" fill="#dce1eb"/><path d="m508.473 235.971c-5.7 6.301-15 6.901-21.301 1.501l-231.099-202.6-231.1 202.601c-6.301 5.4-15.601 4.799-21.301-1.501-5.4-6.299-4.799-15.599 1.5-21.299l241-211c2.701-2.401 6.301-3.6 9.901-3.6s7.2 1.199 9.901 3.6l241 211c6.298 5.7 6.899 14.999 1.499 21.298z" fill="#4793ff"/><path d="m512.073 497.073c0 8.399-6.599 15-15 15h-482c-8.401 0-15-6.601-15-15 0-8.401 6.599-15 15-15h482c8.401 0 15 6.599 15 15z" fill="#77de5b"/><path d="m512.073 497.073c0 8.399-6.599 15-15 15h-241v-30h241c8.401 0 15 6.599 15 15z" fill="#3acf60"/><path d="m487.172 237.473-231.099-202.601v-34.799c3.6 0 7.2 1.199 9.901 3.6l241 211c6.299 5.7 6.899 15 1.5 21.299-5.701 6.3-15.001 6.901-21.302 1.501z" fill="#525cdd"/><g><path d="m196.073 361.073h-60c-8.291 0-15-6.709-15-15s6.709-15 15-15h60c8.291 0 15 6.709 15 15s-6.709 15-15 15z" fill="#dce1eb"/><path d="m286.073 271.073c-8.291 0-15-6.709-15-15v-60c0-8.291 6.709-15 15-15s15 6.709 15 15v60c0 8.291-6.709 15-15 15z" fill="#cdd2e1"/><path d="m376.073 301.073h-60c-8.291 0-15-6.709-15-15s6.709-15 15-15h60c8.291 0 15 6.709 15 15s-6.709 15-15 15z" fill="#cdd2e1"/><path d="m226.073 452.073c-8.291 0-15-6.709-15-15v-61c0-8.291 6.709-15 15-15s15 6.709 15 15v61c0 8.291-6.709 15-15 15z" fill="#dce1eb"/><path d="m286.073 452.073c-8.291 0-15-6.709-15-15v-61c0-8.291 6.709-15 15-15s15 6.709 15 15v61c0 8.291-6.709 15-15 15z" fill="#cdd2e1"/><path d="m376.073 361.073h-60c-8.291 0-15-6.709-15-15s6.709-15 15-15h60c8.291 0 15 6.709 15 15s-6.709 15-15 15z" fill="#cdd2e1"/><path d="m196.073 301.073h-60c-8.291 0-15-6.709-15-15s6.709-15 15-15h60c8.291 0 15 6.709 15 15s-6.709 15-15 15z" fill="#dce1eb"/><path d="m226.073 271.073c-8.291 0-15-6.709-15-15v-60c0-8.291 6.709-15 15-15s15 6.709 15 15v60c0 8.291-6.709 15-15 15z" fill="#dce1eb"/><path d="m316.073 241.073h-120c-8.401 0-15 6.599-15 15v120c0 8.401 6.599 15 15 15h120c8.401 0 15-6.599 15-15v-120c0-8.401-6.599-15-15-15z" fill="#2d4051"/><path d="m331.073 256.073v120c0 8.401-6.599 15-15 15h-60v-150h60c8.401 0 15 6.599 15 15z" fill="#1a252f"/><circle cx="256.073" cy="316.073" fill="#4793ff" r="15"/><path d="m271.073 316.073c0 8.401-6.599 15-15 15v-30c8.401 0 15 6.599 15 15z" fill="#525cdd"/></g></g></svg>
|
After Width: | Height: | Size: 2.5 KiB |
BIN
static/search/mrdoc_logo_300.png
Normal file
BIN
static/search/mrdoc_logo_300.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
39
static/search/mrdoc_search_logo.svg
Normal file
39
static/search/mrdoc_search_logo.svg
Normal file
@ -0,0 +1,39 @@
|
||||
<svg width="200" height="50" xmlns="http://www.w3.org/2000/svg">
|
||||
<style type="text/css">.st0{fill:#5179BC;}
|
||||
.st1{fill:#D5402F;}
|
||||
.st2{fill:#EBB621;}
|
||||
.st3{fill:#45A256;}
|
||||
.st4{fill:url(#SVGID_1_);}
|
||||
.st5{fill:url(#SVGID_2_);}</style>
|
||||
|
||||
<g>
|
||||
<title>background</title>
|
||||
<rect fill="none" id="canvas_background" height="402" width="582" y="-1" x="-1"/>
|
||||
</g>
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<g id="svg_1">
|
||||
<text xml:space="preserve" text-anchor="start" font-family="Arvo, sans-serif" font-size="18" id="svg_12" y="31.805504" x="60" stroke-opacity="null" stroke-width="0" stroke="null" fill="#ff5656">道</text>
|
||||
<text xml:space="preserve" text-anchor="start" font-family="Arvo, sans-serif" font-size="18" id="svg_13" y="32" x="30" stroke-opacity="null" stroke-width="0" stroke="null" fill="#007fff">觅</text>
|
||||
<text xml:space="preserve" text-anchor="start" font-family="Arvo, sans-serif" font-size="18" id="svg_14" y="31.638826" x="128" stroke-width="0" fill="#ff7f00">搜</text>
|
||||
<text xml:space="preserve" text-anchor="start" font-family="Arvo, sans-serif" font-size="18" id="svg_16" y="31.639457" x="158" stroke-opacity="null" stroke-width="0" stroke="null" fill="#559E84">索</text>
|
||||
<g stroke="null" id="svg_37">
|
||||
<path stroke="null" id="svg_22" fill="#7ae57d" d="m91.522974,17.955419l-1.031728,0c-0.271255,0 -0.491246,0.209859 -0.491246,0.468622l0,14.714986c0,0.258938 0.219991,0.468798 0.491246,0.468798l11.593708,0l0,-14.855714l-2.161557,0l-0.78592,-0.796693l-7.614502,0zm0,0"/>
|
||||
<path stroke="null" id="svg_23" fill="#66d166" d="m101.249798,18.752111l0,13.590399c0,0.258762 -0.219991,0.468622 -0.491246,0.468622l-10.758552,0l0,0.328071c0,0.258763 0.219991,0.468622 0.491246,0.468622l11.593708,0l0,-14.855714l-0.835156,0zm0,0"/>
|
||||
<path stroke="null" id="svg_24" fill="#ddf5ff" d="m102.084954,32.15499l-0.797906,-0.806016c-0.556709,-0.562382 -1.331934,-0.88113 -2.142933,-0.88113l-7.621141,0l0,-12.934257c0,-0.258762 0.219807,-0.468622 0.491246,-0.468622l7.129894,0c0.810999,0 1.586224,0.318748 2.142933,0.88113l0.797906,0.806016l0,13.402879zm0,0"/>
|
||||
<path stroke="null" id="svg_25" fill="#c1e9f4" d="m101.299034,31.361112l0.78592,0.793878l0,-13.402879l-0.78592,-0.793878l0,13.402879zm0,0"/>
|
||||
<path stroke="null" id="svg_26" fill="#c1e9f4" d="m91.522974,30.467845l0,1.218523c0,0.258763 0.219807,0.468622 0.491246,0.468622l10.070733,0l-0.797906,-0.806016c-0.556709,-0.562382 -1.331934,-0.88113 -2.142933,-0.88113l-7.621141,0zm0,0"/>
|
||||
<path stroke="null" id="svg_27" fill="#7ae57d" d="m112.646934,17.955419l1.031728,0c0.271255,0 0.491246,0.209684 0.491246,0.468622l0,14.714986c0,0.258938 -0.219991,0.468798 -0.491246,0.468798l-11.593708,0l0,-14.855714l2.161557,0l0.78592,-0.796693l7.614502,0zm0,0"/>
|
||||
<path stroke="null" id="svg_28" fill="#66d166" d="m113.383988,17.955419l0,14.387092c0,0.258762 -0.219991,0.468446 -0.491246,0.468446l-10.807787,0l0,0.796693l11.593708,0c0.271255,0 0.491246,-0.209684 0.491246,-0.468622l0,-14.714986c0,-0.258763 -0.219991,-0.468622 -0.491246,-0.468622l-0.294674,0zm0,0"/>
|
||||
<path stroke="null" id="svg_29" fill="#ddf5ff" d="m102.084954,32.15499l0.797906,-0.806016c0.556709,-0.562382 1.331934,-0.88113 2.142933,-0.88113l7.62114,0l0,-12.934257c0,-0.258762 -0.219807,-0.468622 -0.491062,-0.468622l-7.130078,0c-0.810999,0 -1.586224,0.318748 -2.142933,0.88113l-0.797906,0.806016l0,13.402879zm0,0"/>
|
||||
<path stroke="null" id="svg_30" fill="#c1e9f4" d="m111.910065,17.064966l0,13.402879l0.736869,0l0,-12.934257c0,-0.258762 -0.219807,-0.468622 -0.491062,-0.468622l-0.245807,0zm0,0"/>
|
||||
<path stroke="null" id="svg_31" fill="#c1e9f4" d="m112.646934,30.467845l0,1.218523c0,0.258763 -0.219807,0.468622 -0.491062,0.468622l-10.070918,0l0.797906,-0.806016c0.556709,-0.562382 1.331934,-0.88113 2.142933,-0.88113l7.62114,0zm0,0"/>
|
||||
<path stroke="null" id="svg_32" fill="#636363" d="m102.5762,36.934973l-0.982493,0c-0.271255,0 -0.491246,-0.209684 -0.491246,-0.468622l0,-7.826204l1.964985,0l0,7.826204c0,0.258938 -0.219991,0.468622 -0.491246,0.468622zm0,0"/>
|
||||
<path stroke="null" id="svg_33" fill="#494949" d="m102.281526,28.640147l-1.179065,0l0,1.514931c0.319568,0.051365 0.647804,0.078456 0.982493,0.078456c0.065831,0 0.131109,-0.001759 0.196572,-0.00387l0,6.70531l0.294674,0c0.271255,0 0.491246,-0.209684 0.491246,-0.468622l0,-7.826204l-0.78592,0zm0,0"/>
|
||||
<path stroke="null" id="svg_34" fill="#636363" d="m106.997602,24.610066c0,2.588153 -2.199544,4.686223 -4.912648,4.686223s-4.912648,-2.09807 -4.912648,-4.686223c0,-2.588329 2.199544,-4.686399 4.912648,-4.686399s4.912648,2.09807 4.912648,4.686399zm0,0"/>
|
||||
<path stroke="null" id="svg_35" fill="#494949" d="m105.251132,21.027146c0.721749,0.815691 1.156937,1.869564 1.156937,3.020538c0,2.588153 -2.199544,4.686223 -4.912648,4.686223c-1.206541,0 -2.311107,-0.415146 -3.166178,-1.103479c0.900987,1.01869 2.249148,1.665861 3.755711,1.665861c2.713103,0 4.912648,-2.09807 4.912648,-4.686223c0,-1.437355 -0.678598,-2.723252 -1.746469,-3.58292zm0,0"/>
|
||||
<path stroke="null" id="svg_36" fill="#8db0ff" d="m105.523863,24.610066c0,1.811689 -1.539755,3.280356 -3.438909,3.280356s-3.438909,-1.468667 -3.438909,-3.280356c0,-1.811866 1.539755,-3.280532 3.438909,-3.280532s3.438909,1.468666 3.438909,3.280532zm0,0"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.1 KiB |
17
static/search/mrdoc_search_logo_2.svg
Normal file
17
static/search/mrdoc_search_logo_2.svg
Normal file
@ -0,0 +1,17 @@
|
||||
<svg width="140" height="32" xmlns="http://www.w3.org/2000/svg">
|
||||
<!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/ -->
|
||||
<g>
|
||||
<title>background</title>
|
||||
<rect fill="#ffffff" id="canvas_background" height="34" width="142" y="-1" x="-1"/>
|
||||
<g display="none" overflow="visible" y="0" x="0" height="100%" width="100%" id="canvasGrid">
|
||||
<rect fill="url(#gridpattern)" stroke-width="0" y="0" x="0" height="100%" width="100%"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="24" id="svg_1" y="24.166642" x="9.16682" stroke-width="0" stroke="#000" fill="#007fff">觅</text>
|
||||
<text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="24" id="svg_2" y="24.499975" x="43.166729" stroke-width="0" stroke="#000" fill="#ff5656">道</text>
|
||||
<text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="24" id="svg_3" y="24.166642" x="76.833305" stroke-width="0" stroke="#000" fill="#ff7f00">搜</text>
|
||||
<text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="24" id="svg_4" y="24.499974" x="110.166548" stroke-width="0" stroke="#000" fill="#559e84">索</text>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
1
static/search/search.svg
Normal file
1
static/search/search.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="512pt" viewBox="0 -35 512 512" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m32.261719 19.773438h-21.855469c-5.746094 0-10.40625 4.660156-10.40625 10.40625v326.761718c0 5.75 4.660156 10.410156 10.40625 10.410156h245.59375v-329.886718h-45.789062l-16.648438-17.691406zm0 0" fill="#7ae57d"/><path d="m238.308594 37.464844v301.789062c0 5.746094-4.660156 10.40625-10.40625 10.40625h-227.902344v7.285156c0 5.746094 4.660156 10.40625 10.40625 10.40625h245.59375v-329.886718zm0 0" fill="#66d166"/><path d="m256 335.089844-16.902344-17.898438c-11.792968-12.488281-28.214844-19.566406-45.394531-19.566406h-161.441406v-287.21875c0-5.746094 4.65625-10.40625 10.40625-10.40625h151.035156c17.179687 0 33.601563 7.078125 45.394531 19.566406l16.902344 17.898438zm0 0" fill="#ddf5ff"/><path d="m239.351562 317.460938 16.648438 17.628906v-297.625l-16.648438-17.628906zm0 0" fill="#c1e9f4"/><path d="m32.261719 297.625v27.058594c0 5.746094 4.65625 10.40625 10.40625 10.40625h213.332031l-16.902344-17.898438c-11.792968-12.488281-28.214844-19.566406-45.394531-19.566406zm0 0" fill="#c1e9f4"/><path d="m479.738281 19.773438h21.855469c5.746094 0 10.40625 4.65625 10.40625 10.40625v326.761718c0 5.75-4.660156 10.410156-10.40625 10.410156h-245.59375v-329.886718h45.789062l16.648438-17.691406zm0 0" fill="#7ae57d"/><path d="m495.351562 19.773438v319.480468c0 5.746094-4.660156 10.402344-10.40625 10.402344h-228.945312v17.691406h245.59375c5.746094 0 10.40625-4.65625 10.40625-10.40625v-326.761718c0-5.746094-4.660156-10.40625-10.40625-10.40625zm0 0" fill="#66d166"/><path d="m256 335.089844 16.902344-17.898438c11.792968-12.488281 28.214844-19.566406 45.394531-19.566406h161.441406v-287.21875c0-5.746094-4.65625-10.40625-10.402343-10.40625h-151.039063c-17.179687 0-33.601563 7.078125-45.394531 19.566406l-16.902344 17.898438zm0 0" fill="#ddf5ff"/><path d="m464.128906 0v297.625h15.609375v-287.21875c0-5.746094-4.65625-10.40625-10.402343-10.40625zm0 0" fill="#c1e9f4"/><path d="m479.738281 297.625v27.058594c0 5.746094-4.65625 10.40625-10.402343 10.40625h-213.335938l16.902344-17.898438c11.792968-12.488281 28.214844-19.566406 45.394531-19.566406zm0 0" fill="#c1e9f4"/><path d="m266.40625 441.234375h-20.8125c-5.746094 0-10.40625-4.65625-10.40625-10.40625v-173.789063h41.625v173.789063c0 5.75-4.660156 10.40625-10.40625 10.40625zm0 0" fill="#636363"/><path d="m260.164062 257.039062h-24.976562v33.640626c6.769531 1.140624 13.722656 1.742187 20.8125 1.742187 1.394531 0 2.777344-.039063 4.164062-.085937v148.898437h6.242188c5.746094 0 10.40625-4.65625 10.40625-10.40625v-173.789063zm0 0" fill="#494949"/><path d="m360.066406 167.546875c0 57.472656-46.59375 104.0625-104.066406 104.0625s-104.066406-46.589844-104.066406-104.0625c0-57.476563 46.59375-104.066406 104.066406-104.066406s104.066406 46.589843 104.066406 104.066406zm0 0" fill="#636363"/><path d="m323.070312 87.984375c15.289063 18.113281 24.507813 41.515625 24.507813 67.074219 0 57.472656-46.59375 104.0625-104.066406 104.0625-25.558594 0-48.957031-9.21875-67.070313-24.503906 19.085938 22.621093 47.644532 36.992187 79.558594 36.992187 57.472656 0 104.066406-46.589844 104.066406-104.0625 0-31.917969-14.375-60.472656-36.996094-79.5625zm0 0" fill="#494949"/><path d="m328.847656 167.546875c0 40.230469-32.617187 72.84375-72.847656 72.84375s-72.847656-32.613281-72.847656-72.84375c0-40.234375 32.617187-72.847656 72.847656-72.847656s72.847656 32.613281 72.847656 72.847656zm0 0" fill="#8db0ff"/></svg>
|
After Width: | Height: | Size: 3.4 KiB |
1
static/search/search_btn.svg
Normal file
1
static/search/search_btn.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg role="img" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" viewBox="0 0 24 24" aria-labelledby="searchIconTitle searchIconDesc" stroke="#2329D6" stroke-width="1" stroke-linecap="square" stroke-linejoin="miter" fill="none" color="#2329D6"> <title id="searchIconTitle">Search</title> <desc id="searchIconDesc">Icon of a magnifying glass</desc> <path d="M14.4121122,14.4121122 L20,20"/> <circle cx="10" cy="10" r="6"/> </svg>
|
After Width: | Height: | Size: 441 B |
@ -44,7 +44,7 @@
|
||||
<tbody>
|
||||
{% for pro in projects %}
|
||||
<tr>
|
||||
<td>{{ pro.name }}</td>
|
||||
<td><a href="{% url 'pro_index' pro_id=pro.id %}" target="_blank">{{ pro.name }}</a></td>
|
||||
<td>{{ pro.intro }}</td>
|
||||
{% load project_filter %}
|
||||
<td>{{ pro.id | get_doc_count }}</td>
|
||||
@ -64,9 +64,9 @@
|
||||
<td>{{ pro.create_time }}</td>
|
||||
<td>{{ pro.create_user }}</td>
|
||||
<td>
|
||||
<a href="{% url 'pro_index' pro_id=pro.id %}" target="_blank" class="layui-btn layui-btn-normal layui-btn-xs">
|
||||
<!-- <a href="{% url 'pro_index' pro_id=pro.id %}" target="_blank" class="layui-btn layui-btn-normal layui-btn-xs">
|
||||
<i class="layui-icon layui-icon-read"></i>查看
|
||||
</a>
|
||||
</a> -->
|
||||
<a href="javascript:void(0);" onclick="modifyProject('{{pro.id}}','{{pro.name}}','{{pro.intro}}')" class="layui-btn layui-btn-normal layui-btn-xs">
|
||||
<i class="layui-icon layui-icon-edit"></i>修改
|
||||
</a>
|
||||
|
@ -112,6 +112,13 @@
|
||||
.layui-colla-content{
|
||||
padding: 0px;
|
||||
}
|
||||
/* 预览代码宽度 */
|
||||
ol.linenums li{
|
||||
width: max-content;
|
||||
}
|
||||
#doc-tree{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
@ -382,6 +389,7 @@
|
||||
|
||||
$("#TableGroup").empty();//清空表格
|
||||
$("#pasteExcel").val('');
|
||||
editor.focus();
|
||||
|
||||
},
|
||||
btn2:function(index,layero){
|
||||
@ -406,7 +414,7 @@
|
||||
}
|
||||
},
|
||||
// 添加音视频
|
||||
multimedia:function(){
|
||||
multimedia:function(cm,icon,cursor,selection){
|
||||
layer.open({
|
||||
type:'1',
|
||||
title:'添加音视频外链',
|
||||
@ -478,6 +486,7 @@
|
||||
//新一行的图片显示
|
||||
layer.closeAll("loading");
|
||||
editor.insertValue("\n![](" + ret.url + ")");
|
||||
editor.focus()
|
||||
}else{
|
||||
layer.closeAll("loading");
|
||||
layer.msg("粘贴图片失败!")
|
||||
@ -549,12 +558,14 @@
|
||||
insertImg = function(e){
|
||||
console.log(e.src);
|
||||
editor.insertValue("\n![](" + e.src + ")");
|
||||
editor.focus()
|
||||
};
|
||||
// 按钮点击插入输入框图片链接
|
||||
insertImgUrl = function(){
|
||||
editor.insertValue("\n![](" + $("#img_url_input").val() + ")");
|
||||
$("#img_url_input").val("")
|
||||
layer.closeAll();
|
||||
editor.focus()
|
||||
};
|
||||
// 切换图片分组
|
||||
switchImgGroup = function(e){
|
||||
@ -608,6 +619,7 @@
|
||||
$("#video_input").val('')
|
||||
$("#video_iframe_input").val('')
|
||||
layer.closeAll();
|
||||
editor.focus()
|
||||
}
|
||||
</script>
|
||||
{% block custom_script %}
|
||||
|
@ -50,6 +50,14 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block doc_bottom_block %}
|
||||
{% if request.user == doc.create_user or request.user.is_superuser %}
|
||||
<button class="layui-btn layui-btn-radius layui-btn-xs" id="download_doc" style="background-color: #333;">
|
||||
<i class="fa fa-download"></i> 下载
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block doc_previous_next %}
|
||||
{% load doc_filter %}
|
||||
<div class="layui-row" style="margin-top: 10px;padding:10px;display:flex;justify-content:space-around;">
|
||||
@ -72,6 +80,15 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block custom_script %}
|
||||
<!-- 下载选项卡模板 -->
|
||||
<div id="download_div" style="display: none;">
|
||||
<div class="layui-row" style="margin: 10px;">
|
||||
<a class="" download='{{doc.name}}.md' href="{% url 'download_doc_md' doc.id %}" target="_blank">
|
||||
<i class="fa fa-download"></i> 下载Markdown文件
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="{% static 'viewerjs/viewer.js' %}"></script>
|
||||
<script>
|
||||
var layer = layui.layer;
|
||||
@ -110,6 +127,19 @@
|
||||
title:false,
|
||||
};
|
||||
var viewer = new Viewer(document.getElementById('content'), img_options);
|
||||
|
||||
// 显示文档下载弹出框
|
||||
$("#download_doc").click(function(r){
|
||||
var layer = layui.layer;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['350px','150px'],
|
||||
shadeClose: true,
|
||||
content: $('#download_div')
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -79,12 +79,26 @@
|
||||
.markdown-body h6{
|
||||
font-size: .85em;
|
||||
}
|
||||
.markdown-body p img{
|
||||
max-width: 350px;
|
||||
}
|
||||
#url_qrcode img{
|
||||
margin: auto;
|
||||
}
|
||||
#share{
|
||||
background-color: #333;
|
||||
}
|
||||
/* 文档代码块样式 */
|
||||
ol.linenums li{
|
||||
width: max-content;
|
||||
}
|
||||
pre.linenums{
|
||||
max-height: 400px;
|
||||
}
|
||||
li.L1, li.L3, li.L5, li.L7, li.L9 {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
/* layui弹出框颜色 */
|
||||
.layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after{
|
||||
border-bottom: 2px solid #333;
|
||||
@ -136,7 +150,7 @@
|
||||
<ul class="summary" id="project-toc"></ul>
|
||||
</nav>
|
||||
<div class="bq">
|
||||
<a href="https://gitee.com/zmister/MrDoc" target="_blank" class="mrdoc-link">本文档使用MrDoc发布</a>
|
||||
<a href="javascript:void(0);" class="mrdoc-link" id="dashang">本文档使用MrDoc发布</a>
|
||||
</div>
|
||||
<!-- 右下角广告块 -->
|
||||
<!-- 广告代码开始 -->
|
||||
@ -156,11 +170,9 @@
|
||||
<div class="doc-body">
|
||||
<!-- 文档导航 -->
|
||||
<div class="doc-header" role="navigation">
|
||||
|
||||
<a class="btn pull-left js-toolbar-action" aria-label="" href="javascript:void(0);" title="切换侧边栏">
|
||||
<i class="fa fa-align-justify"></i>
|
||||
</a>
|
||||
|
||||
<a class="btn pull-left font-small" href="javascript:void(0);" title="缩小字体">
|
||||
<i class="fa fa-font">-</i>
|
||||
</a>
|
||||
@ -213,6 +225,8 @@
|
||||
<button id="share" class="layui-btn layui-btn-radius layui-btn-xs">
|
||||
<i class="fa fa-share-alt"></i> 分享
|
||||
</button>
|
||||
{% block doc_bottom_block %}
|
||||
{% endblock %}
|
||||
|
||||
<!-- 广告代码开始 -->
|
||||
{% if debug %}
|
||||
@ -235,7 +249,12 @@
|
||||
</div>
|
||||
|
||||
<script src="{% static 'jquery/3.1.1/jquery.min.js' %}"></script>
|
||||
|
||||
<!-- 小屏自动收起左侧文集大纲 -->
|
||||
<script>
|
||||
$.ajaxSetup({
|
||||
data: {csrfmiddlewaretoken: '{{ csrf_token }}' },
|
||||
});
|
||||
//加载页面时执行一次
|
||||
changeSidebar();
|
||||
//监听浏览器宽度的改变
|
||||
@ -256,57 +275,6 @@
|
||||
}
|
||||
</script>
|
||||
<script src="{% static 'layui/layui.all.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/marked.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/prettify.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/raphael.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/underscore.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/sequence-diagram.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/flowchart.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/jquery.flowchart.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/echarts.min.js' %}"></script>
|
||||
<!-- 脑图开始 -->
|
||||
<script src="{% static 'mindmap/d3@5.js' %}"></script>
|
||||
<script src="{% static 'mindmap/transform.min.js' %}"></script>
|
||||
<script src="{% static 'mindmap/view.min.js' %}"></script>
|
||||
<!-- 脑图结束 -->
|
||||
|
||||
<!-- <script src="{% static 'editor.md/editormd.min.js' %}"></script> -->
|
||||
<script src="{% static 'editor.md/editormd.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'qrcodejs/qrcode.min.js' %}"></script>
|
||||
|
||||
<!-- 解析Markdown -->
|
||||
<script>
|
||||
$.ajaxSetup({
|
||||
data: {csrfmiddlewaretoken: '{{ csrf_token }}' },
|
||||
});
|
||||
//解析Markdown为HTML
|
||||
editormd.markdownToHTML("content", {
|
||||
htmlDecode : "style,script,iframe",
|
||||
emoji : true, //emoji表情
|
||||
taskList : true, // 任务列表
|
||||
tex : true, // 科学公式
|
||||
flowChart : true, // 流程图
|
||||
sequenceDiagram : true, // 时序图
|
||||
tocm : true, //目录
|
||||
toc :true,
|
||||
tocContainer : "#toc-container",
|
||||
tocDropdown : false,
|
||||
atLink : false,//禁用@链接
|
||||
|
||||
});
|
||||
// 显示分享弹出框
|
||||
$("#share").click(function(r){
|
||||
var layer = layui.layer;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['350px','350px'],
|
||||
shadeClose: true,
|
||||
content: $('#share_div')
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- 生成文集目录大纲 -->
|
||||
<script>
|
||||
@ -381,6 +349,55 @@
|
||||
getProjectToc();
|
||||
</script>
|
||||
|
||||
<script src="{% static 'editor.md/lib/marked.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/prettify.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/raphael.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/underscore.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/sequence-diagram.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/flowchart.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/jquery.flowchart.min.js' %}"></script>
|
||||
<script src="{% static 'editor.md/lib/echarts.min.js' %}"></script>
|
||||
<!-- 脑图开始 -->
|
||||
<script src="{% static 'mindmap/d3@5.js' %}"></script>
|
||||
<script src="{% static 'mindmap/transform.min.js' %}"></script>
|
||||
<script src="{% static 'mindmap/view.min.js' %}"></script>
|
||||
<!-- 脑图结束 -->
|
||||
|
||||
<!-- <script src="{% static 'editor.md/editormd.min.js' %}"></script> -->
|
||||
<script src="{% static 'editor.md/editormd.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'qrcodejs/qrcode.min.js' %}"></script>
|
||||
|
||||
<!-- 解析Markdown -->
|
||||
<script>
|
||||
//解析Markdown为HTML
|
||||
editormd.markdownToHTML("content", {
|
||||
htmlDecode : "style,script,iframe",
|
||||
emoji : true, //emoji表情
|
||||
taskList : true, // 任务列表
|
||||
tex : true, // 科学公式
|
||||
flowChart : true, // 流程图
|
||||
sequenceDiagram : true, // 时序图
|
||||
tocm : true, //目录
|
||||
toc :true,
|
||||
tocContainer : "#toc-container",
|
||||
tocDropdown : false,
|
||||
atLink : false,//禁用@链接
|
||||
|
||||
});
|
||||
// 显示分享弹出框
|
||||
$("#share").click(function(r){
|
||||
var layer = layui.layer;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['350px','350px'],
|
||||
shadeClose: true,
|
||||
content: $('#share_div')
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- 页面初始化字体设置 -->
|
||||
<script>
|
||||
font_stauts = window.localStorage.getItem('font-sans')
|
||||
@ -479,6 +496,19 @@
|
||||
console.log("xxx")
|
||||
}
|
||||
};
|
||||
|
||||
// 显示打赏图片
|
||||
$("#dashang").click(function(r){
|
||||
var layer = layui.layer;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['480px','400px'],
|
||||
shadeClose: true,
|
||||
content: $('#dashang_img')
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!-- 分享选项卡模板 -->
|
||||
<div id="share_div" style="display: none;">
|
||||
@ -499,6 +529,43 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 打赏选项卡模板 -->
|
||||
<div id="dashang_img" style="display: none;">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">微信</li>
|
||||
<li>支付宝</li>
|
||||
<li>QQ支付</li>
|
||||
<li>PayPal</li>
|
||||
<li>项目源码</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="height: 100px;">
|
||||
<div class="layui-tab-item layui-show" align='center'>
|
||||
<img src="{% static 'dashang/dashang_wx.jpg' %}" style="width: 300px;height: auto;" />
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<img src="{% static 'dashang/dashang_alipay.jpg' %}" style="width: 300px;height: auto;" />
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<img src="{% static 'dashang/dashang_qq.png' %}" style="width: 300px;height: auto;" />
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<a href="https://paypal.me/zmister" target="_blank">
|
||||
<img src="{% static 'dashang/dashang_paypal.png' %}" style="width: 280px;height: auto;" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<p><a href="" target="_blank">GitHub:https://github.com/zmister2016/MrDoc</a></p>
|
||||
<br>
|
||||
<p><a href="https://gitee.com/zmister/MrDoc" target="_blank">码云:https://gitee.com/zmister/MrDoc</a> </p>
|
||||
<br>
|
||||
<p><a href="https://zmister.com" target="_blank">作者博客:https://zmister.com</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 展开收起左边目录
|
||||
$(function(){
|
||||
|
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<!-- 搜索框 -->
|
||||
<div style="margin:12px;" class="layui-hide-xs">
|
||||
<form method="get" action="">
|
||||
<form method="get" action="{% url 'search' %}" target="_blank">
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input mrdoc-search-input" placeholder="搜索文集或文档" name="kw"/>
|
||||
<button type="submit" style="position: absolute;top:12px;right: 8px;border: none;background-color: white;">
|
||||
@ -19,6 +19,12 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="layui-hide-lg layui-hide-md layui-hide-sm" style="margin:20px;">
|
||||
<a href="{% url 'search' %}">
|
||||
<i class="layui-icon layui-icon-search" style="font-size: 24px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- 新建文档按钮 -->
|
||||
<div class="layui-hide-xs" style="">
|
||||
<ul class="layui-nav" style="">
|
||||
@ -31,64 +37,64 @@
|
||||
</div>
|
||||
<!-- 用户菜单 -->
|
||||
<div class="">
|
||||
<ul class="layui-nav layui-layout-right">
|
||||
{% if request.user.is_authenticated %}
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0);">
|
||||
<i class="layui-icon layui-icon-friends"></i> <span class="layui-hide-xs">{{request.user.username}}</span>
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<!-- <dd><a href="">基本资料</a></dd> -->
|
||||
{% if request.user.is_superuser %}
|
||||
<dd>
|
||||
<a href="{% url 'user_manage' %}">
|
||||
<i class="layui-icon layui-icon-console layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">进入后台</span>
|
||||
</a>
|
||||
</dd>
|
||||
{% endif %}
|
||||
<dd class="layui-hide-md">
|
||||
<a href="{% url 'create_doc' %}">
|
||||
<i class="layui-icon layui-icon-add-1 layui-hide-md"></i>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="{% url 'manage_doc' %}">
|
||||
<i class="layui-icon layui-icon-app layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">个人中心</span>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="javascript:void(0);" onclick="changePwd('{{ request.user.id }}','{{ request.user.username }}' )">
|
||||
<i class="layui-icon layui-icon-password layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">修改密码</span>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="{% url 'logout' %}">
|
||||
<i class="layui-icon layui-icon-release layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">退出登录</span>
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
{% else %}
|
||||
<ul class="layui-nav layui-layout-right">
|
||||
{% if request.user.is_authenticated %}
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0);">
|
||||
<i class="layui-icon layui-icon-username"></i> 游客
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<!-- <dd><a href="">基本资料</a></dd> -->
|
||||
{% if close_register == 'on' %}
|
||||
<dd><a href="{% url 'login' %}">登录</a></dd>
|
||||
<a href="javascript:void(0);">
|
||||
<i class="layui-icon layui-icon-friends"></i> <span class="layui-hide-xs">{{request.user.username}}</span>
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<!-- <dd><a href="">基本资料</a></dd> -->
|
||||
{% if request.user.is_superuser %}
|
||||
<dd>
|
||||
<a href="{% url 'user_manage' %}">
|
||||
<i class="layui-icon layui-icon-console layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">进入后台</span>
|
||||
</a>
|
||||
</dd>
|
||||
{% endif %}
|
||||
<dd class="layui-hide-md">
|
||||
<a href="{% url 'create_doc' %}">
|
||||
<i class="layui-icon layui-icon-add-1 layui-hide-md"></i>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="{% url 'manage_doc' %}">
|
||||
<i class="layui-icon layui-icon-app layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">个人中心</span>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="javascript:void(0);" onclick="changePwd('{{ request.user.id }}','{{ request.user.username }}' )">
|
||||
<i class="layui-icon layui-icon-password layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">修改密码</span>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="{% url 'logout' %}">
|
||||
<i class="layui-icon layui-icon-release layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">退出登录</span>
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
{% else %}
|
||||
<dd><a href="{% url 'register' %}">注册</a></dd>
|
||||
<dd><a href="{% url 'login' %}">登录</a></dd>
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0);">
|
||||
<i class="layui-icon layui-icon-username"></i> 游客
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<!-- <dd><a href="">基本资料</a></dd> -->
|
||||
{% if close_register == 'on' %}
|
||||
<dd><a href="{% url 'login' %}">登录</a></dd>
|
||||
{% else %}
|
||||
<dd><a href="{% url 'register' %}">注册</a></dd>
|
||||
<dd><a href="{% url 'login' %}">登录</a></dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</li>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -555,7 +555,9 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md12" id="move-doc-tree"></div>
|
||||
<div class="layui-col-md12" style="max-height: 380px;overflow: hidden;overflow-y: scroll;overflow-x: scroll;">
|
||||
<div id="move-doc-tree"></div>
|
||||
</div>
|
||||
<div class="layui-col-md12" style="margin: 10px;">
|
||||
<button class="layui-btn layui-btn-normal layui-btn-fluid" onclick="submitMoveDoc()">确认操作</button>
|
||||
</div>
|
||||
|
370
template/app_doc/search.html
Normal file
370
template/app_doc/search.html
Normal file
@ -0,0 +1,370 @@
|
||||
{% load staticfiles %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp">
|
||||
<link rel="icon" href="{% static 'search/mrdoc_logo_300.png' %}" sizes="192x192" />
|
||||
<link rel="apple-touch-icon-precomposed" href="{% static 'search/mrdoc_logo_300.png' %}" />
|
||||
<meta name="msapplication-TileImage" content="{% static 'search/mrdoc_logo_300.png' %}" />
|
||||
<link rel="shortcut icon" href="{% static 'search/mrdoc_logo_300.png' %}" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-touch-fullscreen" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="full-screen" content="yes">
|
||||
<!--UC强制全屏-->
|
||||
<meta name="browsermode" content="application">
|
||||
<!--UC应用模式-->
|
||||
<meta name="x5-fullscreen" content="true">
|
||||
<!--QQ强制全屏-->
|
||||
<meta name="x5-page-mode" content="app">
|
||||
<!--QQ应用模式-->
|
||||
<title>觅道搜索</title>
|
||||
<style>
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
outline: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: 'Noto Sans SC Sliced', PingFangSC-Light, Microsoft YaHei UI, Microsoft YaHei, helvetica, sans-serif;
|
||||
font-weight: 300;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
form,
|
||||
input,
|
||||
button {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
outline: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
input::-webkit-input-placeholder {
|
||||
color: #ccc;
|
||||
letter-spacing: 2px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
ul,
|
||||
li {
|
||||
display: block;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.con {
|
||||
width: 100%;
|
||||
transition: 1s all;
|
||||
margin: auto;
|
||||
min-width: 320px;
|
||||
height: 380px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -100px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.con .shlogo {
|
||||
position: relative;
|
||||
width: 480px;
|
||||
height: 120px;
|
||||
margin: 20px auto;
|
||||
background: url(/static/search/mrdoc_search_logo.svg) no-repeat center/cover;
|
||||
}
|
||||
|
||||
.con .shlogo a {
|
||||
width: 100%;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.con .sou {
|
||||
max-width: 680px;
|
||||
position: relative;
|
||||
width: calc(100% - 60px);
|
||||
min-width: 320px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.con .sou form {
|
||||
width: 100%;
|
||||
/*border: 1px solid #ddd;*/
|
||||
height: 50px;
|
||||
display: block;
|
||||
margin: 10px auto 30px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.con .sou form .wd {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 25px;
|
||||
line-height: 100%;
|
||||
text-indent: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.con .sou form .wd:focus {
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 6px 0 rgba(32, 33, 36, 0.28);
|
||||
border-color: #fff
|
||||
}
|
||||
|
||||
.con .sou form button {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
right: 6px;
|
||||
top: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 22px;
|
||||
line-height: 40px;
|
||||
border-radius: 50%;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.con .sou ul {
|
||||
height: 40px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.con .sou ul li {
|
||||
width: 120px;
|
||||
margin: 0 10px;
|
||||
float: left;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
background: #eee;
|
||||
font-size: 16px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
text-indent: 30px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.con .sou ul li:active {
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 20px 0 rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
.con .sou ul li i {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
left: 0;
|
||||
/* border-radius: 50%; */
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
/* background-color: #fff; */
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
.foot {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
z-index: 1000;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
color: #999;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.home {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
position: absolute;
|
||||
right: 70px;
|
||||
top: 10px;
|
||||
z-index: 200;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.home a {
|
||||
font-size: 20px;
|
||||
color: #999;
|
||||
line-height: 50px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
svg.icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin: 0 5px 0 8px;
|
||||
vertical-align: -0.15em;
|
||||
fill: currentColor;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.con {
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
.con .shlogo {
|
||||
width: 320px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.con .sou form .wd:focus {
|
||||
background: #f1f1f1;
|
||||
box-shadow: none;
|
||||
border-color: #ccc
|
||||
}
|
||||
|
||||
.con .sou form button {
|
||||
border-radius: 25px;
|
||||
}
|
||||
|
||||
.con .sou ul li {
|
||||
width: 100px;
|
||||
font-size: 12px;
|
||||
text-indent: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-height: 420px) {
|
||||
.con {
|
||||
margin: 0;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
.con .sou form .wd {
|
||||
text-indent: 50px;
|
||||
}
|
||||
|
||||
.con .sou form:after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 10px;
|
||||
background: url(/static/search/search.svg) no-repeat center/cover;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.con .shlogo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.foot {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
background-color: #162035;
|
||||
}
|
||||
|
||||
.con .sou ul li {
|
||||
background: #293550;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.con .sou form .wd:focus {
|
||||
background: #293550;
|
||||
border: 1px solid #162035;
|
||||
}
|
||||
|
||||
.con .sou form .wd {
|
||||
border: 1px solid #293550;
|
||||
color: #bbb;
|
||||
}
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #222d46;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #293550;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #293550;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background: #222d46;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="content">
|
||||
<div class="con">
|
||||
<div class="shlogo"></div>
|
||||
<div class="sou">
|
||||
<form action="{% url 'search' %}" method="get" target="_self">
|
||||
<input class="wd" type="text" placeholder="请输入搜索内容" name="kw" x-webkit-speech lang="zh-CN">
|
||||
<input name="type" value="doc" hidden>
|
||||
<input name="d_range" value="all" hidden>
|
||||
<button type="submit" style="background-image: url(/static/search/search_btn.svg);"></button>
|
||||
</form>
|
||||
<ul>
|
||||
<li><a href="/"><i style="background-image: url(/static/search/home_btn.svg);"></i>返回首页</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="foot">© 2019-2010 by <a href="https://zmister.com/">州的先生</a> . All rights reserved.</div>
|
||||
</div>
|
||||
<!--
|
||||
作者:D.Young
|
||||
主页:https://yyv.me/
|
||||
github:https://github.com/5iux/sou
|
||||
日期:20200324
|
||||
版权所有,请勿删除
|
||||
-->
|
||||
</body>
|
||||
|
||||
</html>
|
468
template/app_doc/search_result.html
Normal file
468
template/app_doc/search_result.html
Normal file
@ -0,0 +1,468 @@
|
||||
{% load staticfiles %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
||||
<meta http-equiv="Cache-Control" content="no-transform" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<meta http-equiv="Cache-Control" content="max-age=7200" />
|
||||
<meta name="keywords" content="觅道文档,mrdoc,markdown,文档写作,在线教程,Python文档系统,django应用"/>
|
||||
<meta name="description" content="MrDoc觅道文档是一个开源的在线文档系统,由州的先生(zmister.com)基于 Python 的 Django 进行开发框架,适合作为个人和小型团队的文档、笔记和知识管理工具。" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>{{ kw }} - 觅道搜索 - MrDoc觅道文档</title>
|
||||
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'favicon_16.png' %}"/>
|
||||
<style>
|
||||
.layui-nav .layui-this:after, .layui-nav-bar, .layui-nav-tree .layui-nav-itemed:after{
|
||||
background-color: #0885ff !important;
|
||||
}
|
||||
.layui-nav .layui-nav-child dd.layui-this a, .layui-nav-child dd.layui-this{
|
||||
background-color: #0885ff !important;
|
||||
}
|
||||
/* layui分页组件样式 */
|
||||
.layui-laypage .layui-laypage-curr .layui-laypage-em{
|
||||
background-color: #0885ff !important;
|
||||
}
|
||||
/* 控制栏表单下拉框样式 */
|
||||
.index-control .layui-input-inline{
|
||||
/* width: 100px; */
|
||||
}
|
||||
.index-control .layui-input{
|
||||
height: 25px;
|
||||
border: none;
|
||||
}
|
||||
.index-control .layui-form-select dl {
|
||||
top: 30px;
|
||||
}
|
||||
.index-control .layui-form-item{
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
/* 文集列表样式 */
|
||||
.project-item-list{
|
||||
/* float: left; */
|
||||
min-width: 0;
|
||||
width: 100vw;
|
||||
height: 120px;
|
||||
/* margin-top: 20px; */
|
||||
/* margin-left: 20px; */
|
||||
margin: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,.055);
|
||||
}
|
||||
/* 搜索类型 */
|
||||
a.search_type{
|
||||
color: #999;
|
||||
margin-left: 15px;
|
||||
font-size: 16px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
a.search_type:hover{
|
||||
color: #333;
|
||||
}
|
||||
/* 当前搜索类型链接样式 */
|
||||
.current_search_type{
|
||||
color: #333 !important;
|
||||
border-bottom: 2px solid#007fff !important;
|
||||
}
|
||||
/* 搜索结果标题 */
|
||||
.search_result_title{
|
||||
color: #00c;
|
||||
font-weight: 400;
|
||||
font-size: medium;
|
||||
line-height:26px;
|
||||
}
|
||||
.search_result_title:hover{
|
||||
color: #00c;
|
||||
}
|
||||
/* 搜索结果简介 */
|
||||
.search_result_pre{
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
line-height: 20px;
|
||||
word-break: break-word;
|
||||
}
|
||||
/* 搜索结果归属 */
|
||||
.search_result_info a{
|
||||
color: green;
|
||||
}
|
||||
/* 时间筛选下拉框 */
|
||||
.layui-form-select dl dd.layui-this{
|
||||
background-color:#0885ff;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1200px){
|
||||
.layui-container {
|
||||
width: 970px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 移动端筛选控制栏样式 */
|
||||
@media screen and (max-width: 768px){
|
||||
/* 控制栏样式 */
|
||||
.index-control .layui-form-item .layui-inline{
|
||||
display: -webkit-inline-box;
|
||||
}
|
||||
.index-control .layui-form-item .layui-input-inline{
|
||||
display: -webkit-inline-box;
|
||||
float: none;
|
||||
left: -3px;
|
||||
/* width: auto; */
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body class="layui-container">
|
||||
<!-- 页头 -->
|
||||
<div class="layui-header layui-fluid">
|
||||
<div class="" style="display:flex;flex-direction:row;justify-content:space-between;">
|
||||
<!-- LOGO -->
|
||||
<div class="">
|
||||
<a class="logo" href="{% url 'search' %}">
|
||||
<img src="{% static 'search/mrdoc_search_logo_2.svg' %}" style="height: 32px;width: auto;">
|
||||
</a>
|
||||
</div>
|
||||
<!-- 搜索框 -->
|
||||
<div style="margin:12px;" class="layui-hide-xs">
|
||||
<form method="get" action="">
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input mrdoc-search-input"
|
||||
placeholder="搜索文集或文档" name="kw" style="width: 500px;border-radius:5px" value="{{kw}}"/>
|
||||
<input name="type" value="{{search_type}}" hidden>
|
||||
<button type="submit"
|
||||
style="position: absolute;top:12px;right: 8px;border: none;background-color: white;">
|
||||
<i class="layui-icon layui-icon-search" ></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- 用户菜单 -->
|
||||
<div class="">
|
||||
<ul class="layui-nav layui-layout-right">
|
||||
{% if request.user.is_authenticated %}
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0);">
|
||||
<i class="layui-icon layui-icon-friends"></i> <span class="layui-hide-xs">{{request.user.username}}</span>
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<!-- <dd><a href="">基本资料</a></dd> -->
|
||||
{% if request.user.is_superuser %}
|
||||
<dd>
|
||||
<a href="{% url 'pro_list' %}">
|
||||
<i class="layui-icon layui-icon-console layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">返回首页</span>
|
||||
</a>
|
||||
</dd>
|
||||
{% endif %}
|
||||
<dd class="layui-hide-md">
|
||||
<a href="{% url 'create_doc' %}">
|
||||
<i class="layui-icon layui-icon-add-1 layui-hide-md"></i>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="{% url 'manage_doc' %}">
|
||||
<i class="layui-icon layui-icon-app layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">个人中心</span>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="javascript:void(0);" onclick="changePwd('{{ request.user.id }}','{{ request.user.username }}' )">
|
||||
<i class="layui-icon layui-icon-password layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">修改密码</span>
|
||||
</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="{% url 'logout' %}">
|
||||
<i class="layui-icon layui-icon-release layui-hide-md"></i>
|
||||
<span class="layui-hide-xs">退出登录</span>
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0);">
|
||||
<i class="layui-icon layui-icon-username"></i> 游客
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<!-- <dd><a href="">基本资料</a></dd> -->
|
||||
{% if close_register == 'on' %}
|
||||
<dd><a href="{% url 'login' %}">登录</a></dd>
|
||||
{% else %}
|
||||
<dd><a href="{% url 'register' %}">注册</a></dd>
|
||||
<dd><a href="{% url 'login' %}">登录</a></dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 页头结束 -->
|
||||
|
||||
<!-- 小屏下的搜索框 -->
|
||||
<div class="" style="margin-top:10px;padding-left:15px;">
|
||||
<!-- 搜索框 -->
|
||||
<div style="margin:12px 0 12px 0;" class="layui-hide-md layui-hide-lg layui-hide-sm">
|
||||
<form method="get" action="">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input mrdoc-search-input"
|
||||
placeholder="搜索文集或文档" name="kw" style="border-radius:5px" value="{{kw}}"/>
|
||||
<input name="type" value="{{search_type}}" hidden>
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-sm layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-search" ></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 筛选栏 -->
|
||||
<div class="layui-container" style="margin-top: 10px;">
|
||||
<!-- 表单风格开始 -->
|
||||
<div class="layui-row">
|
||||
<form class="index-control layui-form" lay-filter="filter-time-form">
|
||||
<div class="layui-form-item">
|
||||
<!-- 筛选开始 -->
|
||||
<div class="layui-inline">
|
||||
<!-- 文档搜索 -->
|
||||
<div class="layui-input-inline">
|
||||
<a href="{% url 'search' %}?kw={{kw}}&type=doc&d_range={{d_range}}" class="search_type" id="search_doc"><i class="layui-icon layui-icon-search"></i>文档</a>
|
||||
<a href="{% url 'search' %}?kw={{kw}}&type=pro&d_range={{d_range}}" class="search_type" id="search_project"><i class="layui-icon layui-icon-list"></i>文集</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 筛选结束 -->
|
||||
<div class="layui-input-inline" style="float: right;">
|
||||
<select name="d_range" lay-verify="sel_recent" id="sel_recent">
|
||||
<option value="">时间筛选</option>
|
||||
<option value="all">全部时间</option>
|
||||
<option value="recent1">近1天</option>
|
||||
<option value="recent7">近7天</option>
|
||||
<option value="recent30">近30天</option>
|
||||
<option value="recent365">近1年</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- 表单风格结束 -->
|
||||
</div>
|
||||
|
||||
<!-- 搜索结果提示 -->
|
||||
{% if kw != '' %}
|
||||
<div style="padding: 0 15px;margin-top: 10px;margin-bottom: 10px;color: #999;">
|
||||
觅道文档在
|
||||
{% if date_range == 'recent1' %}
|
||||
近1天内
|
||||
{% elif date_range == 'recent7' %}
|
||||
近7天内
|
||||
{% elif date_range == 'recent30' %}
|
||||
近30天内
|
||||
{% elif date_range == 'recent365' %}
|
||||
近一年内
|
||||
{% else %}
|
||||
全部时间内
|
||||
{% endif %}
|
||||
搜索到 {{ data_list.count }} 条结果
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- 主体 -->
|
||||
<div class="layui-container search_result" id="search_result" style="padding: 0 20px;">
|
||||
<!-- 遍历搜索结果列表 -->
|
||||
<!-- 文档搜索结果 -->
|
||||
{% if search_type == 'doc' %}
|
||||
{% load doc_filter %}
|
||||
{% for result in datas %}
|
||||
<div style="margin-bottom: 18px;">
|
||||
<!-- 标题 -->
|
||||
<h3>
|
||||
<a href="{% url 'doc' pro_id=result.top_doc doc_id=result.id %}" target="_blank" class="search_result_title">{{ result.name }}</a>
|
||||
</h3>
|
||||
<!-- 简介 -->
|
||||
<div class="search_result_pre">{{ result.pre_content|get_key_context:kw }}</div>
|
||||
<!-- 所属文集 -->
|
||||
<p class="search_result_info">
|
||||
<a href="{% url 'pro_index' pro_id=result.top_doc %}" target="_blank">{{ result.top_doc | get_doc_top }}</a> - <span style="font-size: 14px;color: #999;">{{result.modify_time}}</span></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<!-- 文集搜索结果 -->
|
||||
{% elif search_type == 'pro' %}
|
||||
{% load project_filter %}
|
||||
{% for result in datas %}
|
||||
<div style="margin-bottom: 18px;">
|
||||
<!-- 标题 -->
|
||||
<h3>
|
||||
<a href="{% url 'pro_index' pro_id=result.id %}" target="_blank" class="search_result_title">{{ result.name }}</a>
|
||||
</h3>
|
||||
<!-- 简介 -->
|
||||
<div class="search_result_pre">{{ result.intro|get_key_context:kw }}</div>
|
||||
<!-- 所属文集 -->
|
||||
<p class="search_result_info">
|
||||
<a>{{ result.create_user }}</a> - <span style="font-size: 14px;color: #999;">{{result.modify_time}}</span></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
<!-- 主体结束 -->
|
||||
<!-- 分页 -->
|
||||
<div class="layui-row project-list-page" style="text-align: center;">
|
||||
<div class="layui-box layui-laypage layui-laypage-default">
|
||||
<!-- 上一页 -->
|
||||
{% if datas.has_previous %}
|
||||
<a href="?page={{ datas.previous_page_number }}&kw={{kw}}&type={{search_type}}&d_range={{date_range}}" class="layui-btn layui-btn-xs layui-btn-normal">上一页</a>
|
||||
{% else %}
|
||||
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-disabled">上一页</a>
|
||||
{% endif %}
|
||||
<!-- 当前页 -->
|
||||
<span class="layui-laypage-curr">
|
||||
<em class="layui-laypage-em"></em>
|
||||
<em>{{ datas.number }}/{{ datas.paginator.num_pages }}</em>
|
||||
</span>
|
||||
<!-- 下一页 -->
|
||||
{% if datas.has_next %}
|
||||
<a href="?page={{ datas.next_page_number }}&kw={{kw}}&type={{search_type}}&d_range={{date_range}}" class="layui-btn layui-btn-xs layui-btn-normal">下一页</a>
|
||||
{% else %}
|
||||
<a class="layui-btn layui-btn-xs layui-btn-disabled">下一页</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 分页结束 -->
|
||||
|
||||
<!-- 页脚 -->
|
||||
{% include 'app_doc/foot_base.html' %}
|
||||
<!-- 页脚结束 -->
|
||||
|
||||
<script src="{% static 'jquery/3.1.1/jquery.min.js' %}"></script>
|
||||
<script src="{% static 'layui/layui.all.js' %}"></script>
|
||||
{% block custom_script %}
|
||||
<script>
|
||||
$.ajaxSetup({
|
||||
data: {csrfmiddlewaretoken: '{{ csrf_token }}' },
|
||||
});
|
||||
var layer = layui.layer;
|
||||
var form = layui.form;
|
||||
function positionFooter() {
|
||||
// 获取页脚的高度
|
||||
footerHeight = $(".layui-footer").height();
|
||||
// 获取页脚的高度
|
||||
// scrollTop() 设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
|
||||
footerTop = ($(window).scrollTop() + $(window).height() - footerHeight - 35)+"px";
|
||||
//如果页面内容高度小于屏幕高度,div#footer将绝对定位到屏幕底部,否则div#footer保留它的正常静态定位
|
||||
if(($(".layui-header").height() + $(".index-control").height() + $(".project-list-content").height() + $(".project-list-page").height() + 16) < $(window).height()) {
|
||||
console.log("页脚置底")
|
||||
$(".layui-footer").css({ position: "absolute",left:"0" }).stop().css({top:footerTop});
|
||||
}else{
|
||||
$(".layui-footer").css({ position: ""})
|
||||
}
|
||||
};
|
||||
$(window).bind("load", function() {
|
||||
// 设置页脚位置
|
||||
var footerHeight = 0;
|
||||
var footerTop = 0;
|
||||
positionFooter();
|
||||
//$(window).scroll(positionFooter).resize(positionFooter);
|
||||
//设置条件栏选中值
|
||||
var url = layui.url();
|
||||
console.log(url)
|
||||
$("#sel-role").val(url.search.role);
|
||||
$("#sel-sort").val(url.search.sort);
|
||||
layui.form.render('select');
|
||||
});
|
||||
|
||||
// 搜索词高亮
|
||||
function keyLight(id, key, bgColor){
|
||||
var oDiv = document.getElementById(id),
|
||||
sText = oDiv.innerHTML,
|
||||
bgColor = bgColor || "#c00",
|
||||
sKey = "<span name='addSpan' style='color: "+bgColor+";'>"+key+"</span>",
|
||||
num = -1,
|
||||
rStr = new RegExp(key, "ig"),
|
||||
rHtml = new RegExp("\<.*?\>","ig"), //匹配html元素
|
||||
aHtml = sText.match(rHtml); //存放html元素的数组
|
||||
sText = sText.replace(rHtml, '{~}'); //替换html标签
|
||||
// sText = sText.replace(rStr,sKey); //替换key
|
||||
sText = sText.replace(rStr,function(text){
|
||||
return "<span name='addSpan' style='color: "+bgColor+";'>"+text+"</span>"
|
||||
}); //替换key
|
||||
sText = sText.replace(/{~}/g,function(){ //恢复html标签
|
||||
num++;
|
||||
return aHtml[num];
|
||||
});
|
||||
oDiv.innerHTML = sText;
|
||||
};
|
||||
keyLight('search_result',"{{kw}}")
|
||||
|
||||
// 侦听Select下拉框的选择事件
|
||||
form.on('select()', function(data){
|
||||
var filter_data = form.val("filter-time-form");
|
||||
console.log(filter_data)
|
||||
window.location.href = '{% url "search" %}?kw={{kw}}&type={{search_type}}' + '&d_range=' + filter_data['d_range']
|
||||
});
|
||||
|
||||
// 当前搜索类型动态设置
|
||||
tagCurrentSearchType = function(){
|
||||
if('{{ search_type }}' == 'doc'){
|
||||
$('#search_doc').addClass('current_search_type')
|
||||
$('#search_project').removeClass('current_search_type')
|
||||
}else if('{{ search_type }}' == 'pro'){
|
||||
$('#search_project').addClass('current_search_type')
|
||||
$('#search_doc').removeClass('current_search_type')
|
||||
}
|
||||
}
|
||||
tagCurrentSearchType();
|
||||
|
||||
</script>
|
||||
<script>
|
||||
//修改用户密码
|
||||
changePwd = function(uid,username){
|
||||
layer.open({
|
||||
type:1,
|
||||
title:'修改密码',
|
||||
area:'300px;',
|
||||
id:'changePwd',
|
||||
content:'<div style="padding:10px 0 0 20px;">修改用户[' + username + ']的密码:</div><div style="padding: 20px;"><input class="layui-input" type="password" id="newPwd1" style="margin-bottom:10px;" placeholder="输入新密码" required lay-verify="required"><input class="layui-input" type="password" id="newPwd2" placeholder="再次确认新密码" required lay-verify="required"></div>',
|
||||
btn:['确认修改','取消'],
|
||||
yes:function (index,layero) {
|
||||
layer.load(1);
|
||||
data = {
|
||||
'password':$("#newPwd1").val(),
|
||||
'password2':$("#newPwd2").val(),
|
||||
}
|
||||
$.post("{% url 'modify_pwd' %}",data,function(r){
|
||||
layer.closeAll("loading");
|
||||
if(r.status){
|
||||
//修改成功
|
||||
window.location.reload();
|
||||
//layer.close(index)
|
||||
}else{
|
||||
//修改失败,提示
|
||||
//console.log(r)
|
||||
layer.msg(r.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
};
|
||||
</script>
|
||||
<!-- 统计代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
{{ static_code | safe }}
|
||||
{% endif %}
|
||||
<!-- 统计代码结束 -->
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user