🎨 新增自动添加缩略图的特性
|
@ -133,7 +133,12 @@ public enum BlogPropertiesEnum {
|
||||||
/**
|
/**
|
||||||
* 仪表盘部件 成立天数
|
* 仪表盘部件 成立天数
|
||||||
*/
|
*/
|
||||||
WIDGET_DAYCOUNT("widget_daycount");
|
WIDGET_DAYCOUNT("widget_daycount"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认缩略图地址
|
||||||
|
*/
|
||||||
|
DEFAULT_THUMBNAIL("/static/images/thumbnail/thumbnail.png");
|
||||||
|
|
||||||
private String prop;
|
private String prop;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import cc.ryanc.halo.model.domain.*;
|
||||||
import cc.ryanc.halo.model.dto.HaloConst;
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
import cc.ryanc.halo.model.dto.JsonResult;
|
import cc.ryanc.halo.model.dto.JsonResult;
|
||||||
import cc.ryanc.halo.model.dto.LogsRecord;
|
import cc.ryanc.halo.model.dto.LogsRecord;
|
||||||
|
import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
|
||||||
import cc.ryanc.halo.model.enums.PostTypeEnum;
|
import cc.ryanc.halo.model.enums.PostTypeEnum;
|
||||||
import cc.ryanc.halo.model.enums.ResultCodeEnum;
|
import cc.ryanc.halo.model.enums.ResultCodeEnum;
|
||||||
import cc.ryanc.halo.service.GalleryService;
|
import cc.ryanc.halo.service.GalleryService;
|
||||||
|
@ -11,6 +12,7 @@ import cc.ryanc.halo.service.LinkService;
|
||||||
import cc.ryanc.halo.service.LogsService;
|
import cc.ryanc.halo.service.LogsService;
|
||||||
import cc.ryanc.halo.service.PostService;
|
import cc.ryanc.halo.service.PostService;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -232,6 +234,10 @@ public class PageController {
|
||||||
post.setPostDate(DateUtil.date());
|
post.setPostDate(DateUtil.date());
|
||||||
post.setPostUpdate(DateUtil.date());
|
post.setPostUpdate(DateUtil.date());
|
||||||
}
|
}
|
||||||
|
//当没有选择文章缩略图的时候,自动分配一张内置的缩略图
|
||||||
|
if (StringUtils.equals(post.getPostThumbnail(), BlogPropertiesEnum.DEFAULT_THUMBNAIL.getProp())) {
|
||||||
|
post.setPostThumbnail("/static/images/thumbnail/thumbnail-" + RandomUtil.randomInt(1, 10) + ".jpg");
|
||||||
|
}
|
||||||
postService.saveByPost(post);
|
postService.saveByPost(post);
|
||||||
logsService.saveByLogs(new Logs(LogsRecord.PUSH_PAGE, post.getPostTitle(), ServletUtil.getClientIP(request), DateUtil.date()));
|
logsService.saveByLogs(new Logs(LogsRecord.PUSH_PAGE, post.getPostTitle(), ServletUtil.getClientIP(request), DateUtil.date()));
|
||||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), msg);
|
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), msg);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import cc.ryanc.halo.service.TagService;
|
||||||
import cc.ryanc.halo.utils.HaloUtils;
|
import cc.ryanc.halo.utils.HaloUtils;
|
||||||
import cc.ryanc.halo.web.controller.core.BaseController;
|
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import cn.hutool.http.HtmlUtil;
|
import cn.hutool.http.HtmlUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -198,6 +199,10 @@ public class PostController extends BaseController {
|
||||||
post.setTags(tags);
|
post.setTags(tags);
|
||||||
}
|
}
|
||||||
post.setPostUrl(urlFilter(post.getPostUrl()));
|
post.setPostUrl(urlFilter(post.getPostUrl()));
|
||||||
|
//当没有选择文章缩略图的时候,自动分配一张内置的缩略图
|
||||||
|
if (StringUtils.equals(post.getPostThumbnail(), BlogPropertiesEnum.DEFAULT_THUMBNAIL.getProp())) {
|
||||||
|
post.setPostThumbnail("/static/images/thumbnail/thumbnail-" + RandomUtil.randomInt(1, 10) + ".jpg");
|
||||||
|
}
|
||||||
postService.saveByPost(post);
|
postService.saveByPost(post);
|
||||||
logsService.saveByLogs(new Logs(LogsRecord.PUSH_POST, post.getPostTitle(), ServletUtil.getClientIP(request), DateUtil.date()));
|
logsService.saveByLogs(new Logs(LogsRecord.PUSH_POST, post.getPostTitle(), ServletUtil.getClientIP(request), DateUtil.date()));
|
||||||
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), msg);
|
return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), msg);
|
||||||
|
|
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
@ -104,9 +104,9 @@
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div>
|
<div>
|
||||||
<#if post??>
|
<#if post??>
|
||||||
<img src="${post.postThumbnail?default("/static/images/thumbnail.png")}" class="img-responsive img-thumbnail" id="selectImg" onclick="openAttach('selectImg')" style="cursor: pointer;">
|
<img src="${post.postThumbnail?default("/static/images/thumbnail/thumbnail.png")}" class="img-responsive img-thumbnail" id="selectImg" onclick="openAttach('selectImg')" style="cursor: pointer;">
|
||||||
<#else >
|
<#else >
|
||||||
<img src="/static/images/thumbnail.png" class="img-responsive img-thumbnail" id="selectImg" onclick="openAttach('selectImg')" style="cursor: pointer;">
|
<img src="/static/images/thumbnail/thumbnail.png" class="img-responsive img-thumbnail" id="selectImg" onclick="openAttach('selectImg')" style="cursor: pointer;">
|
||||||
</#if>
|
</#if>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -237,7 +237,7 @@
|
||||||
'postUrl' : $('#postUrl').html().toString(),
|
'postUrl' : $('#postUrl').html().toString(),
|
||||||
'postContentMd': editor.getMarkdown(),
|
'postContentMd': editor.getMarkdown(),
|
||||||
'postContent': editor.getTextareaSavedHTML(),
|
'postContent': editor.getTextareaSavedHTML(),
|
||||||
'postThumbnail': $('#selectImg')[0].src,
|
'postThumbnail': $('#selectImg').attr('src'),
|
||||||
'allowComment' : $('#allowComment').val()
|
'allowComment' : $('#allowComment').val()
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
|
@ -155,9 +155,9 @@
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div>
|
<div>
|
||||||
<#if post??>
|
<#if post??>
|
||||||
<img src="${post.postThumbnail?default("/static/images/thumbnail.png")}" class="img-responsive img-thumbnail" id="selectImg" onclick="openAttach('selectImg')" style="cursor: pointer;">
|
<img src="${post.postThumbnail?default("/static/images/thumbnail/thumbnail.png")}" class="img-responsive img-thumbnail" id="selectImg" onclick="openAttach('selectImg')" style="cursor: pointer;">
|
||||||
<#else >
|
<#else >
|
||||||
<img src="/static/images/thumbnail.png" class="img-responsive img-thumbnail" id="selectImg" onclick="openAttach('selectImg')" style="cursor: pointer;">
|
<img src="/static/images/thumbnail/thumbnail.png" class="img-responsive img-thumbnail" id="selectImg" onclick="openAttach('selectImg')" style="cursor: pointer;">
|
||||||
</#if>
|
</#if>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -330,7 +330,7 @@
|
||||||
'postUrl' : $('#postUrl').html().toString(),
|
'postUrl' : $('#postUrl').html().toString(),
|
||||||
'postContentMd': editor.getMarkdown(),
|
'postContentMd': editor.getMarkdown(),
|
||||||
'postContent': editor.getHTML(),
|
'postContent': editor.getHTML(),
|
||||||
'postThumbnail': $('#selectImg')[0].src,
|
'postThumbnail': $('#selectImg').attr('src'),
|
||||||
'cateList' : cateList.toString(),
|
'cateList' : cateList.toString(),
|
||||||
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString(),
|
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString(),
|
||||||
'allowComment' : $('#allowComment').val()
|
'allowComment' : $('#allowComment').val()
|
||||||
|
|
|
@ -24,26 +24,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-wrap {
|
.native-wrap {
|
||||||
border: 1px solid #f0f0f0;
|
border: 1px solid #f0f0f0!important;
|
||||||
padding: 10px;
|
padding: 10px!important;
|
||||||
position: relative;
|
position: relative!important;
|
||||||
margin-left: 58px;
|
margin-left: 58px!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea, button {
|
input, textarea, button {
|
||||||
outline: none;
|
outline: none!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-submit,.native-list-one-img,.native-list-one-footer-time,.native-list-one-footer-reback,.native-info,.native-nav,.ua,.native-message{
|
.comment-submit,.native-list-one-img,.native-list-one-footer-time,.native-list-one-footer-reback,.native-info,.native-nav,.ua,.native-message{
|
||||||
-webkit-user-select:none;
|
-webkit-user-select:none!important;
|
||||||
-moz-user-select:none;
|
-moz-user-select:none!important;
|
||||||
-ms-user-select:none;
|
-ms-user-select:none!important;
|
||||||
user-select:none;
|
user-select:none!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-header {
|
.comment-header {
|
||||||
width: 100%;
|
width: 100%!important;
|
||||||
line-height: 1.8;
|
line-height: 1.8!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-input-who, .comment-input-email, .comment-input-website {
|
.comment-input-who, .comment-input-email, .comment-input-website {
|
||||||
|
@ -69,15 +69,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-OwO{
|
.comment-OwO{
|
||||||
text-align: left;
|
text-align: left!important;
|
||||||
vertical-align: middle;
|
vertical-align: middle!important;
|
||||||
padding-top: 10px;
|
padding-top: 10px!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-footer {
|
.comment-footer {
|
||||||
text-align: right;
|
text-align: right!important;
|
||||||
vertical-align: middle;
|
vertical-align: middle!important;
|
||||||
padding-top: 10px;
|
padding-top: 10px!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-submit {
|
.comment-submit {
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
color: #313131!important;
|
color: #313131!important;
|
||||||
outline: none!important;
|
outline: none!important;
|
||||||
line-height: normal!important;
|
line-height: normal!important;
|
||||||
transition: all .3s ease-in-out;
|
transition: all .3s ease-in-out!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-submit:hover{
|
.comment-submit:hover{
|
||||||
|
@ -129,79 +129,79 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-list-one-img:hover{
|
.native-list-one-img:hover{
|
||||||
transform: rotate(360deg);
|
transform: rotate(360deg)!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-list .native-list-one section {
|
.native-list .native-list-one section {
|
||||||
overflow: hidden;
|
overflow: hidden!important;
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem!important;
|
||||||
border-bottom: 1px dashed #f5f5f5;
|
border-bottom: 1px dashed #f5f5f5!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-list .native-list-one section .native-list-one-head {
|
.native-list .native-list-one section .native-list-one-head {
|
||||||
line-height: 1.5;
|
line-height: 1.5!important;
|
||||||
margin-bottom: .5rem;
|
margin-bottom: .5rem!important;
|
||||||
margin-top: 0;
|
margin-top: 0!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-list-one-head-name {
|
.native-list-one-head-name {
|
||||||
font-size: .875rem;
|
font-size: .875rem!important;
|
||||||
font-weight: 700;
|
font-weight: 700!important;
|
||||||
cursor: pointer;
|
cursor: pointer!important;
|
||||||
text-decoration: none;
|
text-decoration: none!important;
|
||||||
color: #555;
|
color: #555!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-list-one-head-admin{
|
.native-list-one-head-admin{
|
||||||
padding: .1em 0.2em;
|
padding: .1em 0.2em!important;
|
||||||
border-radius: 2px;
|
border-radius: 2px!important;
|
||||||
font-size: 70%;
|
font-size: 70%!important;
|
||||||
font-weight: 700;
|
font-weight: 700!important;
|
||||||
background-color: #87ceeb;
|
background-color: #87ceeb!important;
|
||||||
color: #fff;
|
color: #fff!important;
|
||||||
display: inline;
|
display: inline!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ua {
|
.ua {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: .2rem .5rem;
|
padding: .2rem .5rem!important;
|
||||||
background: #ededed;
|
background: #ededed!important;
|
||||||
color: #b3b1b1;
|
color: #b3b1b1!important;
|
||||||
font-size: .75rem;
|
font-size: .75rem!important;
|
||||||
border-radius: .2rem;
|
border-radius: .2rem!important;
|
||||||
margin-right: .3rem;
|
margin-right: .3rem!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-list-one-content p {
|
.native-list-one-content p {
|
||||||
font-size: 14px;
|
font-size: 14px!important;
|
||||||
letter-spacing: 0;
|
letter-spacing: 0!important;
|
||||||
margin: 0 0 1pc;
|
margin: 0!important;
|
||||||
font-weight: 400;
|
font-weight: 400!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-list-one-footer-time {
|
.native-list-one-footer-time {
|
||||||
color: #b3b3b3;
|
color: #b3b3b3!important;
|
||||||
font-size: .75rem;
|
font-size: .75rem!important;
|
||||||
margin-right: .875rem;
|
margin-right: .875rem!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-list-one-footer-reback {
|
.native-list-one-footer-reback {
|
||||||
font-size: .8125rem;
|
font-size: .8125rem!important;
|
||||||
color: #ef2f11;
|
color: #ef2f11!important;
|
||||||
cursor: pointer;
|
cursor: pointer!important;
|
||||||
}
|
}
|
||||||
.native-info{
|
.native-info{
|
||||||
padding-top: 10px;
|
padding-top: 10px!important;
|
||||||
font-size: 12px;
|
font-size: 12px!important;
|
||||||
color: #555;
|
color: #555!important;
|
||||||
}
|
}
|
||||||
.comment-avatar{
|
.comment-avatar{
|
||||||
position: relative;
|
position: relative!important;
|
||||||
float: left;
|
float: left!important;
|
||||||
}
|
}
|
||||||
.comment-avatar img{
|
.comment-avatar img{
|
||||||
border-radius: 100%;
|
border-radius: 100%!important;
|
||||||
-webkit-transition: 0.4s;
|
-webkit-transition: 0.4s!important;
|
||||||
-webkit-transition: -webkit-transform 0.4s ease-out;
|
-webkit-transition: -webkit-transform 0.4s ease-out;
|
||||||
transition: transform 0.4s ease-out;
|
transition: transform 0.4s ease-out;
|
||||||
-moz-transition: -moz-transform 0.4s ease-out;
|
-moz-transition: -moz-transform 0.4s ease-out;
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-avatar img:hover{
|
.comment-avatar img:hover{
|
||||||
transform: rotate(360deg);
|
transform: rotate(360deg)!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.native-nav{
|
.native-nav{
|
||||||
|
|