提交 a36eaa0a 编写于 作者: 智布道's avatar 智布道 👁

文件资源库管理,可删除、批量删除和上传图片等操作

💄 文章详情页的样式调整
上级 eb12093c
......@@ -2,6 +2,7 @@ package com.zyd.blog.controller;
import com.zyd.blog.business.consts.CommonConst;
import com.zyd.blog.business.enums.ResponseStatus;
import com.zyd.blog.file.exception.OssApiException;
import com.zyd.blog.framework.exception.*;
import com.zyd.blog.framework.object.ResponseVO;
import com.zyd.blog.util.ResultUtil;
......@@ -59,7 +60,7 @@ public class ExceptionHandleController {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public ResponseVO handle(Throwable e) {
if (e instanceof ZhydException) {
if (e instanceof ZhydException || e instanceof OssApiException) {
return ResultUtil.error(e.getMessage());
}
if (e instanceof UndeclaredThrowableException) {
......
......@@ -201,4 +201,11 @@ public class RenderController {
model.addAttribute("spiderConfig", configService.getSpiderConfig());
return ResultUtil.view("laboratory/remover");
}
@RequiresPermissions("files")
@BussinessLog("进入文件管理页面")
@GetMapping("/files")
public ModelAndView files(Model model) {
return ResultUtil.view("file/list");
}
}
package com.zyd.blog.controller;
import com.github.pagehelper.PageInfo;
import com.zyd.blog.business.annotation.BussinessLog;
import com.zyd.blog.business.entity.File;
import com.zyd.blog.business.enums.FileUploadType;
import com.zyd.blog.business.service.BizFileService;
import com.zyd.blog.business.vo.FileConditionVO;
import com.zyd.blog.file.FileUploader;
import com.zyd.blog.framework.object.ResponseVO;
import com.zyd.blog.plugin.file.GlobalFileUploader;
import com.zyd.blog.util.ResultUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
* 文件管理
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @date 2019/2/14 11:37
* @since 1.0
*/
@RestController
@RequestMapping("/file")
public class RestFileController {
@Autowired
private BizFileService fileService;
@RequiresPermissions("files")
@PostMapping("/list")
public PageInfo list(FileConditionVO vo) {
vo.setPageSize(20);
return fileService.findPageBreakByCondition(vo);
}
@RequiresPermissions("files")
@PostMapping(value = "/remove")
@BussinessLog("删除文件,ids:{1}")
public ResponseVO remove(Long[] ids) {
if (null == ids) {
return ResultUtil.error(500, "请至少选择一条记录");
}
fileService.remove(ids);
return ResultUtil.success("成功删除 [" + ids.length + "] 张图片");
}
@RequiresPermissions("files")
@PostMapping(value = "/add")
@BussinessLog("添加文件")
public ResponseVO add(MultipartFile file) {
FileUploader uploader = new GlobalFileUploader();
uploader.upload(file, FileUploadType.COMMON.getPath(), true);
return ResultUtil.success("成功上传一张图片");
}
}
......@@ -3488,12 +3488,12 @@ ul.project_files li a i {
}
.thumbnail .image {
height: 120px;
height: 147px;
overflow: hidden
}
.caption {
padding: 9px 5px;
padding: 5px !important;
background: #F7F7F7
}
......@@ -3501,6 +3501,11 @@ ul.project_files li a i {
margin-bottom: 5px
}
.caption img {
float: right;
width: 20px;
}
.thumbnail {
height: 190px;
overflow: hidden
......@@ -3518,12 +3523,13 @@ ul.project_files li a i {
cursor: pointer
}
.view .content, .view .mask {
.view .content, .view .vmask {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
left: 0
left: 0;
}
.sideways, .view .tools, .view img, .view p {
......@@ -3540,10 +3546,13 @@ ul.project_files li a i {
font-size: 17px;
padding: 3px;
background: rgba(0, 0, 0, .35);
margin: 43px 0 0
/* margin: 69px 0 0; */
bottom: 0;
position: absolute;
width: 100%;
}
.mask.no-caption .tools {
.vmask.no-caption .tools {
margin: 90px 0 0
}
......@@ -3575,9 +3584,9 @@ ul.project_files li a i {
transition: all .2s linear
}
.view-first .mask {
.view-first .vmask {
opacity: 0;
background-color: rgba(0, 0, 0, .5);
background-color: rgba(0, 0, 0, .2);
transition: all .4s ease-in-out
}
......@@ -3597,7 +3606,7 @@ ul.project_files li a i {
transform: scale(1.1)
}
.view-first:hover .mask {
.view-first:hover .vmask {
opacity: 1
}
......@@ -3627,6 +3636,46 @@ ul.project_files li a i {
background-color: #ffff !important
}
.thumbnail.selected, .thumbnail:hover {
-moz-box-shadow:0 0 15px #b5b5b5;
-webkit-box-shadow:0 0 15px #b5b5b5;
box-shadow:0 0 15px #b5b5b5;
}
.thumbnail.selected .selected-mask, .thumbnail:hover .selected-mask {
opacity: 1;
}
.thumbnail .selected-mask {
display: block;
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.thumbnail .selected-mask [class^="icheckbox"] {
float: left!important;
}
.thumbnail .selected-mask .inner {
width: 100%;
height: 100%;
-moz-opacity: .6;
-khtml-opacity: .6;
opacity: .6;
background-color: #000;
filter: alpha(opacity=60);
}
.thumbnail .selected-mask .icon {
position: absolute;
top: 0;
left: 0;
background: transparent url(/assets/images/selected_mask.png) no-repeat 0 0;
width: 100%;
height: 100%;
vertical-align: middle;
display: inline-block;
background-position: 50% 50%;
}
/*!
* bootstrap-vertical-tabs - v1.2.1
* https://dbtek.github.io/bootstrap-vertical-tabs
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1550121992911" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1116" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><defs><style type="text/css"></style></defs><path d="M620.757 170.667c-155.434 0-285.76 107.2-321.194 251.669a182.336 182.336 0 0 0-9.558-0.256c-113.024 0-204.672 91.627-204.672 204.672a203.797 203.797 0 0 0 59.947 144.64 203.733 203.733 0 0 0 144.725 59.861 204.437 204.437 0 0 0 144.79-60.202c32.106-32.107 50.133-75.094 55.317-122.838L416 642.39c-16.79-2.09-22.187-14.805-11.968-28.373L529.6 458.666c10.155-13.546 23.957-11.882 30.613 3.755l71.19 173.974c6.656 15.637-1.75 26.688-18.56 24.618l-55.126-5.077c-6.25 57.643-32.192 108.523-68.458 148.864A329.963 329.963 0 0 0 620.757 832c182.614 0 330.667-148.053 330.667-330.667 0-182.613-148.053-330.666-330.667-330.666z" fill="#1afa29" p-id="1117"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1550123290127" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9629" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><defs><style type="text/css"></style></defs><path d="M512 0L68.48 256v512L512 1024l443.52-256V256L512 0z m256 707.84c0 30.08-27.562667 55.04-65.237333 55.04-26.922667 0-57.642667-10.88-76.842667-34.56l-256-304.682667v284.16c0 30.762667-24.32 55.04-54.357333 55.04H312.32c-30.762667 0-55.04-25.6-55.04-55.04V316.16c0-30.08 26.88-55.04 64-55.04 27.562667 0 58.88 10.88 78.08 34.56l254.72 304.682667V316.16c0-30.762667 25.6-55.04 55.04-55.04h3.2c30.72 0 55.04 25.6 55.04 55.04v391.68H768z" fill="" p-id="9630"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1550122232738" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6335" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><defs><style type="text/css"></style></defs><path d="M893.456828 709.055005" p-id="6336" fill="#1296db"></path><path d="M491.889987 337.939709" p-id="6337" fill="#1296db"></path><path d="M568.154951 338.993714" p-id="6338" fill="#1296db"></path><path d="M957.329555 316.566936c-23.74889-31.844266-72.608691-63.954591-133.394103-71.808466 5.588275-17.800411 9.174963-37.445844 10.657734-58.690704 2.850931-40.815591-2.993171-74.390267-3.242857-75.795267-2.979868-16.790408-16.110933-29.937846-32.893154-32.939203-2.39556-0.429789-4.796236-0.64059-7.172353-0.64059-14.251585 0-27.692712 7.505951-35.07996 20.09978-19.028379 32.253588-51.264571 67.782779-72.496128 75.150584-41.60456-26.2652-93.867878-40.437991-152.375409-41.195238-0.908696-0.062422-1.824555-0.092098-2.749624-0.092098-0.357134 0-0.712221 0.005117-1.065262 0.01228-0.355087-0.007163-0.708128-0.01228-1.065262-0.01228-0.927115 0-1.845021 0.029676-2.755764 0.092098-58.500369 0.760317-110.76164 14.930037-152.367223 41.195238-21.236674-7.369851-53.482075-42.913369-72.505337-75.172073-7.401574-12.55392-20.840654-20.045545-35.065634-20.047592-2.39249 0-4.805446 0.213871-7.218402 0.647753-16.753569 3.02387-29.870308 16.132422-32.846082 32.894178-1.76418 9.92914-11.889795 73.821309 7.175423 134.506437-60.670801 7.902994-109.437481 39.950897-133.155672 71.751161-16.750499 22.458501-22.535249 46.384423-16.291035 67.37141 12.311397 41.376363 61.907978 67.080791 129.432885 67.080791 26.872021 0 53.380768-4.174066 77.605495-11.95017l34.764781 258.95582c-1.578961 4.487198-3.849678 9.904581-6.208399 15.530718-8.450463 20.169365-18.97005 46.167482-18.97005 75.740008 0 72.982198 56.741305 124.853589 137.984654 124.853589l90.420359 0 2.130524 0 90.420359 0c81.243349 0 137.984654-51.871391 137.984654-124.853589 0-29.572526-10.519588-55.120388-18.97005-75.289754-2.358721-5.626137-4.629437-11.269671-6.208399-15.755846l34.764781-259.069407c24.226774 7.777127 50.734498 11.895935 77.607542 11.895935 67.528999 0 117.125581-25.736151 129.432885-67.115584C979.858664 362.936009 974.074937 339.02032 957.329555 316.566936zM934.624437 372.290051c-7.144724 24.01802-45.799092 38.002522-90.440825 38.002522-37.678134 0-79.624479-9.967002-110.462834-32.270984l-43.3626 322.997392c5.27412 23.605627 25.952068 54.469566 25.952068 88.106664 0 53.754275-43.561122 84.047208-97.303116 84.047208l-90.420359 0-2.130524 0-90.420359 0c-53.741995 0-97.303116-30.292933-97.303116-84.047208 0-33.637098 20.677948-64.113203 25.952068-87.718831L321.320193 378.213971c-30.843472 22.307052-72.780607 32.175817-110.461811 32.175817-44.63457 0-83.296101-14.035668-90.441848-38.051641-8.448416-28.390607 53.212946-88.713484 138.91177-88.708368 14.59951 0.002047 29.91124 1.74269 45.678342 5.700839-62.258972-53.657061-41.257659-171.950234-41.257659-171.950234s56.562227 96.627734 114.841561 96.627734c1.130753 0 2.891863-0.039909 4.02364-0.11461 37.637202-27.804253 84.059488-42.132586 145.081283-42.49279 61.021795 0.360204 107.272165 14.685467 144.905274 42.491767 1.13587 0.074701 2.490727 0.11154 3.625574 0.11154 58.277288 0 115.068735-96.630804 115.068735-96.630804s20.996197 118.284987-41.262776 171.942047c15.773242-3.960195 31.071669-5.711072 45.678342-5.711072C881.401258 283.607266 943.070806 343.901491 934.624437 372.290051z" p-id="6339" fill="#1296db"></path><path d="M669.376307 413.20695c0-14.808264-11.988032-26.818809-26.820855-26.818809-14.843056 0-26.825972 12.022825-26.825972 26.818809 0 14.830777 11.982916 26.829042 26.825972 26.829042C657.388275 440.035992 669.376307 428.025447 669.376307 413.20695z" p-id="6340" fill="#1296db"></path><path d="M404.962172 386.388141c-14.843056 0-26.825972 12.022825-26.825972 26.818809 0 14.830777 11.982916 26.829042 26.825972 26.829042 14.833847 0 26.820855-12.010545 26.820855-26.829042C431.78405 398.398686 419.796018 386.388141 404.962172 386.388141z" p-id="6341" fill="#1296db"></path><path d="M400.901693 751.926418c-14.842033 0-26.823925 12.022825-26.823925 26.816762 0 14.833847 11.981892 26.831089 26.823925 26.831089 14.836917 0 26.823925-12.010545 26.823925-26.831089C427.725618 763.936963 415.738609 751.926418 400.901693 751.926418z" p-id="6342" fill="#1296db"></path><path d="M653.713582 751.926418c-14.842033 0-26.823925 12.022825-26.823925 26.816762 0 14.833847 11.981892 26.831089 26.823925 26.831089 14.835893 0 26.823925-12.010545 26.823925-26.831089C680.537508 763.936963 668.549475 751.926418 653.713582 751.926418z" p-id="6343" fill="#1296db"></path></svg>
\ No newline at end of file
......@@ -67,6 +67,13 @@ var gentelella = window.gentelella || {
});
});
}, delay || 0);
},
initiICheck: function () {
$("input[type=checkbox], input[type=radio]").iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
increaseArea: '20%' // optional
});
}
};
......@@ -130,11 +137,7 @@ $(document).ready(function () {
})
}
}), $(document).ready(function () {
$("input[type=checkbox], input[type=radio]").iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
increaseArea: '20%' // optional
});
gentelella.initiICheck();
});
"undefined" != typeof NProgress && ($(document).ready(function () {
NProgress.start()
......
......@@ -85,10 +85,10 @@
}
}
},
ajaxSuccess: function (json) {
ajaxSuccess: function (json, callback) {
if (json.status == 200) {
if (json.message) {
$.alert.info(json.message);
$.alert.info(json.message, callback);
}
} else {
if (json.message) {
......
......@@ -364,8 +364,8 @@
</label>
<div class="col-md-6 col-sm-6 col-xs-12 fixed-radio-checkbox">
<ul class="list-unstyled list-inline">
<li><label for="storageType" class="pointer"> <input type="radio" class="square" checked name="anonymous" value="1"> 开启 </label></li>
<li><label for="storageType" class="pointer"> <input type="radio" class="square" name="anonymous" value="0"> 关闭 </label></li>
<li><label for="anonymous" class="pointer"> <input type="radio" class="square" checked name="anonymous" value="1"> 开启 </label></li>
<li><label for="anonymous" class="pointer"> <input type="radio" class="square" name="anonymous" value="0"> 关闭 </label></li>
</ul>
</div>
</div>
......@@ -373,8 +373,8 @@
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="comment">开启留言板评论 <i class="fa fa-question-circle" title="控制留言板页面的评论框显示情况"></i></label>
<div class="col-md-6 col-sm-6 col-xs-12 fixed-radio-checkbox">
<ul class="list-unstyled list-inline">
<li><label for="storageType" class="pointer"> <input type="radio" class="square" checked name="comment" value="1"> 开启 </label></li>
<li><label for="storageType" class="pointer"> <input type="radio" class="square" name="comment" value="0"> 关闭 </label></li>
<li><label for="comment" class="pointer"> <input type="radio" class="square" checked name="comment" value="1"> 开启 </label></li>
<li><label for="comment" class="pointer"> <input type="radio" class="square" name="comment" value="0"> 关闭 </label></li>
</ul>
</div>
</div>
......@@ -493,8 +493,8 @@
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="maintenance">维护通知</label>
<div class="col-md-6 col-sm-6 col-xs-12 fixed-radio-checkbox">
<ul class="list-unstyled list-inline">
<li><label for="storageType" class="pointer"> <input type="radio" class="square" checked name="maintenance" value="1"> 显示 </label> </li>
<li><label for="storageType" class="pointer"> <input type="radio" class="square" name="maintenance" value="0"> 关闭 </label></li>
<li><label for="maintenance" class="pointer"> <input type="radio" class="square" checked name="maintenance" value="1"> 显示 </label> </li>
<li><label for="maintenance" class="pointer"> <input type="radio" class="square" name="maintenance" value="0"> 关闭 </label></li>
</ul>
</div>
</div>
......
<#include "/include/macros.ftl">
<@header></@header>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<@breadcrumb>
<ol class="breadcrumb">
<li><a href="/">首页</a></li>
<li class="active">图片库管理</li>
</ol>
</@breadcrumb>
<div class="x_panel">
<div class="x_content">
<div class="btn-group hidden-xs" id="toolbar" style="padding: 10px 0;">
<@shiro.hasPermission name="files">
<button id="btn_add" type="button" class="btn btn-default" title="新增图片">
<i class="fa fa-plus"></i> 新增图片
</button>
</@shiro.hasPermission>
<@shiro.hasPermission name="files">
<button id="btn_delete_ids" type="button" class="btn btn-default" title="删除选中">
<i class="fa fa-trash-o"></i> 批量删除
</button>
</@shiro.hasPermission>
</div>
<div class="x_panel">
<form id="file-form">
<div class="x_content" id="file-container">
<#--<div class="col-md-55">
<div class="thumbnail selected">
<div class="image view view-first">
<img style="display: block;margin: 0 auto;margin-top: 10px;" src="/assets/images/loading.gif" alt="image" />
<div class="selected-mask">
<div class="inner"></div>
<div class="icon"></div>
</div>
</div>
<div class="caption">
<p>正在加载...</p>
</div>
</div>
</div>-->
<div class="col-md-55">
<div class="thumbnail">
<div class="image view view-first">
<img style="display: block;margin: 0 auto;margin-top: 10px;" src="/assets/images/loading.gif" alt="image" />
</div>
<div class="caption">
<p>暂无可用的图片... </p>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<@addOrUpdateMOdal defaultTitle="添加图片">
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="url">选择图片 <span class="required">*</span></label>
<div class="col-md-7 col-sm-7 col-xs-7">
<input type="file" class="form-control" name="file" id="file" required="required"/>
</div>
</div>
</@addOrUpdateMOdal>
<@footer>
<script>
var curSstorageType = '${config.storageType}';
$(function () {
$.ajax({
url: "/file/list",
type: "POST",
success: function (json) {
var tpl = '{{#list}}<div class="col-md-55">\n' +
' <div class="thumbnail">\n' +
' <div class="image view view-first pointer file-item">\n' +
' <img style="width: 100%; display: block;" src="{{fullFilePath}}" onerror="this.alt=\'图片加载失败\'" alt="{{originalFileName}}" title="{{originalFileName}}" />\n' +
' <div class="vmask">\n' +
' <p>File Path: {{filePath}}<br>File Hash: {{fileHash}}</p>\n' +
' <div class="tools tools-bottom">\n' +
' <a href="{{fullFilePath}}" class="file-icon showImage" title="大图查看"><i class="fa fa-eye"></i></a>\n' +
' <a href="{{fullFilePath}}" target="_blank" class="file-icon" title="复制地址(打开标签后复制)"><i class="fa fa-link"></i></a>\n' +
' <a class="pointer file-icon" data-event="del" data-value="{{id}}" data-storage-type="{{storageType}}" title="删除文件"><i class="fa fa-times"></i></a>\n' +
' </div>\n' +
' </div>\n' +
' <div class="selected-mask">\n' +
' <input type="checkbox" class="square mask-checkbox" name="ids" value="{{id}}" data-storage-type="{{storageType}}" />' +
' </div>\n' +
' </div>\n' +
' <div class="caption">\n' +
' <p>{{originalFileName}}<img src="/assets/images/icons/{{storageType}}.svg" alt="{{storageType}}" title="{{storageType}}"></p>\n' +
' </div>\n' +
' </div>\n' +
' </div>{{/list}}';
var html = Mustache.render(tpl, json);
$("#file-container").html(html);
gentelella.initiICheck();
$('.mask-checkbox').on('ifChanged', function (event) {
var $this = $(this),
$thumbnail = $this.parents("div.thumbnail");
if ($this.is(':checked')) {
$thumbnail.addClass("selected");
} else {
$thumbnail.removeClass("selected");
}
});
bindFileItemEvent();
function bindFileItemEvent() {
$(".file-item").click(function () {
var $checkbox = $(this).find('.mask-checkbox');
$checkbox.iCheck($checkbox.is(':checked') ? "uncheck" : "check");
});
}
$("#btn_delete_ids").click(function () {
var canBeDeleted = true;
$('.mask-checkbox').each(function () {
var $this = $(this);
var storageType = $this.data("storage-type");
if($this.is(':checked') && storageType != curSstorageType) {
canBeDeleted = false;
return false;
}
});
if(!canBeDeleted) {
$.alert.error("【不可删除】当前选择的文件存储于不同的云存储平台!");
return false;
}
del($("#file-form").serialize());
});
$(".file-icon").click(function () {
$(".file-item").unbind("click");
var event = $(this).data("event");
var id = $(this).data("value");
var storageType = $(this).data("storage-type");
if(event) {
del({'ids': id}, storageType);
} else {
setTimeout(function () {
bindFileItemEvent();
})
}
});
function del(data, storageType){
if(storageType && storageType != curSstorageType) {
$.alert.error("【不可删除】该文件存储于[" + storageType + "],当前系统的云存储类型为[" + curSstorageType + "]");
return false;
}
$.alert.confirm("确定删除该选中的文件?不可恢复,请确认!", function () {
$.ajax({
type: "POST",
url: "/file/remove",
traditional: true,
data: data,
success: function (json) {
$.alert.ajaxSuccess(json, function () {
window.location.reload();
});
}
})
})
}
},
error: $.alert.ajaxError
});
$("#btn_add").click(function () {
$("#addOrUpdateModal").modal('show');
$(".addOrUpdateBtn").unbind('click').click(function () {
var $form = $("#addOrUpdateForm");
if (validator.checkAll($form)) {
$form.ajaxSubmit({
type: "post",
url: "/file/add",
success: function (json) {
$.alert.ajaxSuccess(json, function () {
window.location.reload();
});
},
error: $.alert.ajaxError
});
}
})
});
});
</script>
</@footer>
\ No newline at end of file
......@@ -8,6 +8,7 @@ package com.zyd.blog.business.enums;
* @since 1.0
*/
public enum FileUploadType {
COMMON("oneblog/"),
QRCODE("oneblog/qrcode/"),
SIMPLE("oneblog/article/"),
COVER_IMAGE("oneblog/cover/");
......
......@@ -17,4 +17,6 @@ public interface BizFileService extends AbstractService<File, Long> {
PageInfo<File> findPageBreakByCondition(FileConditionVO vo);
File selectFileByPathAndUploadType(String filePath, String uploadType);
void remove(Long[] ids);
}
......@@ -5,8 +5,10 @@ import com.github.pagehelper.PageInfo;
import com.zyd.blog.business.entity.File;
import com.zyd.blog.business.service.BizFileService;
import com.zyd.blog.business.vo.FileConditionVO;
import com.zyd.blog.file.FileUploader;
import com.zyd.blog.persistence.beans.BizFile;
import com.zyd.blog.persistence.mapper.BizFileMapper;
import com.zyd.blog.plugin.file.GlobalFileUploader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -66,6 +68,18 @@ public class BizFileServiceImpl implements BizFileService {
return CollectionUtils.isEmpty(fileList) ? null : new File(fileList.get(0));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void remove(Long[] ids) {
for (Long id : ids) {
File oldFile = this.getByPrimaryKey(id);
this.removeByPrimaryKey(id);
FileUploader uploader = new GlobalFileUploader();
uploader.delete(oldFile.getFilePath(), oldFile.getUploadType());
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public File insert(File entity) {
......
......@@ -217,13 +217,42 @@ h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
.blog-info-body, .disclaimer-body, .archives-body {
font-size: 14px;
color: #666;
color: #1c1f21;
line-height: 24px;
padding: 10px 0;
overflow: hidden;
word-wrap: break-word;
}
.blog-info-body h1, .blog-info-body h2, .blog-info-body h3, .blog-info-body h4, .blog-info-body h5, .blog-info-body h6 {
font-family: inherit;
font-weight: 700;
}
.blog-info-body h1 {
font-size: 1.89111em;
}
.blog-info-body h2 {
font-size: 1.49111em;
}
.blog-info-body h3 {
font-size: 1.19111em;
}
.blog-info-body h4 {
font-size: 1.1em;
}
.blog-info-body h5 {
font-size: 1em;
}
.blog-info-body h6 {
font-size: .857em;
}
.blog-info-body ol {
display: block;
list-style-type: decimal;
......@@ -274,11 +303,38 @@ fieldset legend {
}
blockquote {
text-indent: 0;
padding: 10px 20px;
margin: 0;
font-size: 14px;
border-left: 5px solid #eee;
background-color: #fefefe;
margin: 0 0 15px;
color: #555;
font-size: 1em;
background-color: #f5f5f5;
border-left: 4px solid #ccc;
}
.blog-info-body p {
text-indent: 0;
line-height: 1.5;
margin: .8em 0!important;
color: #1c1f21;
overflow-x: auto;
}
.blog-info-body table {
display: table!important;
margin-bottom: 10px;
border-collapse: collapse;
width: 100%;
}
.blog-info-body table th, .blog-info-body table td {
border: 1px solid #e6e6e6!important;
padding: 5px 8px!important;
word-break: normal;
}
.blog-info-body table th {
background: #eee;
}
.div-quote {
......@@ -290,16 +346,16 @@ blockquote {
pre {
display: block;
padding: 8px;
margin: 10px 0 10px;
font-size: 14px;
padding: 10px!important;
overflow-x: auto;
font-size: 1em;
line-height: 1.42857143;
color: #333;
white-space: pre;
word-break: break-all;
word-wrap: break-word;
background-color: #f8f8f8;
border: 0 solid #ccc;
border-radius: 0;
background-color: #fbfdff!important;
border: 1px solid #f1f3f5;
}
.bottom-line {
......
......@@ -177,6 +177,8 @@ INSERT INTO `dblog`.`sys_resources` VALUES (72, '实验室', 'menu', '', '', 0,
INSERT INTO `dblog`.`sys_resources` VALUES (73, '文章搬运工', 'menu', '/remover', 'remover', 72, NULL, 0, 1, '', now(), now());
INSERT INTO `dblog`.`sys_resources` VALUES (74, '编辑器', 'menu', '/editor', 'editor', 68, NULL, 0, 1, '', now(), now());
INSERT INTO `dblog`.`sys_resources` VALUES (75, '文件管理', 'menu', '/files', 'files', 40, 6, 0, 1, NULL, now(), now());
# 清空系统角色
TRUNCATE TABLE `dblog`.`sys_role`;
# 初始化系统角色
......
# 更新日志
----
### 2019-02-14
- 新增
- 文件资源库管理,可删除、批量删除和上传图片等操作
- 修改
- 文章详情页的样式调整
----
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册