mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
优化文章seo声明;导出面板新增版权声明功能;
This commit is contained in:
16
app/common/tools/PostBlock.php
Normal file
16
app/common/tools/PostBlock.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\tools;
|
||||
|
||||
use think\facade\View;
|
||||
|
||||
class PostBlock
|
||||
{
|
||||
public static function copyright($model_post)
|
||||
{
|
||||
|
||||
return View::fetch(__DIR__ . '/post_block/copyright.html', [
|
||||
'post' => $model_post
|
||||
]);
|
||||
}
|
||||
}
|
||||
14
app/common/tools/post_block/copyright.html
Normal file
14
app/common/tools/post_block/copyright.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<blockquote class="copyright">
|
||||
<p>
|
||||
<span>原文标题:</span>{$post->title}
|
||||
</p>
|
||||
<p>
|
||||
<span>原文地址:</span><a href="{$post->read_url}">{$post->read_url}</a>
|
||||
</p>
|
||||
<p>
|
||||
<span>原文平台:</span><a href="http://{:get_system_config('main_domain')}">{:get_system_config('site_name')}</a>
|
||||
</p>
|
||||
<p>
|
||||
<span>版权声明:</span>{:get_system_config('post_copyright')}
|
||||
</p>
|
||||
</blockquote>
|
||||
@@ -122,11 +122,10 @@
|
||||
}
|
||||
|
||||
.post-item .info .title {
|
||||
font-size : 20px;
|
||||
font-size : 24px;
|
||||
line-height : 1.3;
|
||||
margin-bottom : 4px;
|
||||
font-weight : 700;
|
||||
max-height : 52px;
|
||||
/* max-height : 52px; */
|
||||
display : -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow : hidden;
|
||||
@@ -220,7 +219,7 @@
|
||||
}
|
||||
|
||||
a.post-item:visited {
|
||||
color: #bbb;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -297,6 +296,7 @@ a.post-item:visited {
|
||||
|
||||
.copyright {
|
||||
margin-top : 15px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.index-poster {
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
|
||||
}
|
||||
|
||||
#editor-container li {
|
||||
list-style: inherit;
|
||||
}
|
||||
|
||||
#title-container {
|
||||
padding: 20px 0;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
|
||||
@@ -37,6 +37,12 @@
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.article-body.show-copyright-inner .copyright-inner {
|
||||
background-color: #e8e8e8;
|
||||
color: #333;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -46,7 +52,11 @@
|
||||
<div id="post-desc">
|
||||
{$post.desc}
|
||||
</div>
|
||||
<article id="post-content" class="ul-content">{$post->content_html|raw}</article>
|
||||
<article id="post-content" class="ul-content">
|
||||
{$post->content_html|raw}
|
||||
|
||||
{:\\app\\common\\tools\\PostBlock::copyright($post)}
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<div class="options-box layui-btn-container">
|
||||
@@ -55,6 +65,8 @@
|
||||
<a class="copy-option layui-btn layui-btn-sm" href="#post-title">选中标题</a>
|
||||
<a class="copy-option layui-btn layui-btn-sm" href="#post-desc">选中描述</a>
|
||||
<a class="copy-option layui-btn layui-btn-sm select-content" href="#post-content">选中内容</a>
|
||||
<a class=" layui-btn layui-btn-sm build-copyright" href="#post-content">插入声明</a>
|
||||
<a class=" layui-btn layui-btn-sm show-copyright" href="#post-content">显示声明</a>
|
||||
<div class="layui-btn layui-btn-sm code2base64">
|
||||
代码转临时图片
|
||||
</div>
|
||||
@@ -104,6 +116,30 @@
|
||||
copyContent($(this).attr('href'))
|
||||
})
|
||||
|
||||
$('.build-copyright').click(function () {
|
||||
var copyElem = $('.copyright').find('p').last();
|
||||
|
||||
var html = copyElem.html();
|
||||
$('#post-content > p').not('.copyright-inner').each(function (index, elem) {
|
||||
|
||||
if (index > 0 && index % 8 == 0) {
|
||||
|
||||
if (!$(elem).next().hasClass('copyright-inner')) {
|
||||
$('<blockquote>' + html + '</blockquote>').insertAfter(elem).addClass('copyright-inner')
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('.show-copyright').click(function () {
|
||||
if ($('.article-body').hasClass('show-copyright-inner')) {
|
||||
$('.article-body').removeClass('show-copyright-inner')
|
||||
} else {
|
||||
|
||||
$('.article-body').addClass('show-copyright-inner')
|
||||
}
|
||||
})
|
||||
|
||||
function copyContent(id) {
|
||||
var content = $(id)[0];
|
||||
|
||||
@@ -113,7 +149,7 @@
|
||||
|
||||
// Range 起始位置在段落2
|
||||
range.selectNode(content);
|
||||
console.log(range);
|
||||
|
||||
// 获取 selection 对象
|
||||
const selection = window.getSelection();
|
||||
selection.removeAllRanges()
|
||||
|
||||
@@ -126,11 +126,14 @@
|
||||
<div class="">
|
||||
<article class="ul-content entry heti heti--classic">
|
||||
{$post->content_html|raw}
|
||||
|
||||
{:\\app\\common\\tools\\PostBlock::copyright($post)}
|
||||
</article>
|
||||
</div>
|
||||
<div class="copyright">
|
||||
{:get_system_config('post_copyright')}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="post-container">
|
||||
@@ -151,7 +154,6 @@
|
||||
<div>
|
||||
<div class="layui-btn layui-btn-xs delete" style="cursor: pointer;">删除</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -161,10 +163,7 @@
|
||||
<form action="" class="layui-form">
|
||||
<input type="hidden" name="post_id" value="{$post.id}">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
|
||||
|
||||
<textarea name="content" placeholder="请输入内容" class="layui-textarea" autocomplete="off"></textarea>
|
||||
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn" type="submit" lay-filter="postComment" lay-submit>发表评论</button>
|
||||
@@ -183,10 +182,9 @@
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{include file='common/_right'/}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="share-tips-options" style="display: none;">
|
||||
|
||||
Reference in New Issue
Block a user