文章包含pdf
This commit is contained in:
parent
3cd9cb27a9
commit
56d9fa35f7
|
|
@ -52,7 +52,13 @@ public class PlayletPublicDetailController extends BaseController
|
|||
public AjaxResult checkExist(@RequestBody Long id) {
|
||||
PlayletPublicDetail detail = playletPublicDetailService.getById(id);
|
||||
if(detail!=null){
|
||||
return AjaxResult.success();
|
||||
String url;
|
||||
if("01".equals(detail.getType())){
|
||||
url = "https://www.mungerfans.com/article/info/" + id;
|
||||
}else {
|
||||
url = "https://www.mungerfans.com/article/file/" + id;
|
||||
}
|
||||
return AjaxResult.success("操作成功", url);
|
||||
}else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
|
@ -112,6 +118,9 @@ public class PlayletPublicDetailController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(PlayletPublicDetail playletPublicDetail)
|
||||
{
|
||||
if("02".equals(playletPublicDetail.getType())){
|
||||
playletPublicDetail.setContent(playletPublicDetail.getPdfUrl());
|
||||
}
|
||||
return toAjax(playletPublicDetailService.insertPlayletPublicDetail(playletPublicDetail));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ spring:
|
|||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
max-file-size: 50MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
max-request-size: 100MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
|
|
|
|||
|
|
@ -51,6 +51,24 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文章类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="radio-box">
|
||||
<input type="radio" checked="" value="01" name="type">富文本</label>
|
||||
<label class="radio-box">
|
||||
<input type="radio" value="02" name="type">PDF</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">PDF附件:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="pdfUrl" type="text" hidden>
|
||||
<div class="file-loading">
|
||||
<input id="pdfUrlFile" name="file" type="file">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">详情(富文本):</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
@ -154,6 +172,26 @@
|
|||
$("input[name='imgUrl']").val('')
|
||||
})
|
||||
|
||||
|
||||
// 详情页
|
||||
$("#pdfUrlFile").fileinput({
|
||||
uploadUrl: ctx + 'tool/oss/uploadFromPlaylet',
|
||||
maxFileCount: 1,
|
||||
dropZoneEnabled: false, //是否显示拖拽区域
|
||||
showPreview: false,
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
console.log(data);
|
||||
if(data.response.success){
|
||||
$("input[name='pdfUrl']").val(data.response.msg)
|
||||
}else {
|
||||
alert("上传失败!");
|
||||
}
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
$("input[name='pdfUrl']").val('')
|
||||
})
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-detail-add').serialize());
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<th:block th:include="include :: header('修改公众号文章详情')" />
|
||||
<th:block th:include="include :: summernote-css" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
|
|
@ -28,6 +29,33 @@
|
|||
<input name="authorAlias" th:field="*{authorAlias}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="imgUrl" th:field="*{imgUrl}" type="text" hidden="hidden">
|
||||
<div class="file-loading">
|
||||
<input id="imgUrlFile" name="file" type="file">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文章类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="radio-box">
|
||||
<input type="radio" th:checked="${playletPublicDetail.type == '01' ? true : false}" value="01" name="type">富文本</label>
|
||||
<label class="radio-box">
|
||||
<input type="radio" th:checked="${playletPublicDetail.type == '02' ? true : false}" value="02" name="type">PDF</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">PDF附件:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="pdfUrl" type="text" hidden="hidden">
|
||||
<div class="file-loading">
|
||||
<input id="pdfUrlFile" name="file" type="file">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">详情(富文本):</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
@ -35,12 +63,6 @@
|
|||
<div class="summernote" id="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="imgUrl" th:field="*{imgUrl}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
@ -51,6 +73,7 @@
|
|||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: summernote-js" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "system/playlet/detail";
|
||||
$("#form-detail-edit").validate({
|
||||
|
|
@ -63,6 +86,44 @@
|
|||
}
|
||||
}
|
||||
|
||||
// 详情页
|
||||
$("#imgUrlFile").fileinput({
|
||||
uploadUrl: ctx + 'tool/oss/uploadFromPlaylet',
|
||||
maxFileCount: 1,
|
||||
dropZoneEnabled: false, //是否显示拖拽区域
|
||||
showPreview: false,
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
console.log(data);
|
||||
if(data.response.success){
|
||||
$("input[name='imgUrl']").val(data.response.msg)
|
||||
}else {
|
||||
alert("上传失败!");
|
||||
}
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
$("input[name='imgUrl']").val('')
|
||||
})
|
||||
|
||||
// 详情页
|
||||
$("#pdfUrlFile").fileinput({
|
||||
uploadUrl: ctx + 'tool/oss/uploadFromPlaylet',
|
||||
maxFileCount: 1,
|
||||
dropZoneEnabled: false, //是否显示拖拽区域
|
||||
showPreview: false,
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
console.log(data);
|
||||
if(data.response.success){
|
||||
$("input[name='pdfUrl']").val(data.response.msg)
|
||||
}else {
|
||||
alert("上传失败!");
|
||||
}
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
$("input[name='pdfUrl']").val('')
|
||||
})
|
||||
|
||||
$(function() {
|
||||
$('.summernote').each(function(i) {
|
||||
$('#' + this.id).summernote({
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
contentType: "application/json",
|
||||
success: function (result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$('#wxQrcode').qrcode("https://www.mungerfans.com/article/info/"+id);
|
||||
$('#wxQrcode').qrcode(result.data);
|
||||
} else {
|
||||
$.modal.msgError("文章不存在!")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ public class PlayletPublicDetail extends BaseEntity
|
|||
@ApiModelProperty(value = "图片")
|
||||
private String imgUrl;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String pdfUrl;
|
||||
|
||||
@ApiModelProperty(value = "点赞数")
|
||||
private String starCount;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
<result property="readCount" column="read_count" />
|
||||
<result property="content" column="content" />
|
||||
<result property="starCount" column="star_count" />
|
||||
<result property="type" column="type" />
|
||||
<result property="itemOne" column="item_one" />
|
||||
<result property="itemTwo" column="item_two" />
|
||||
<result property="itemThree" column="item_three" />
|
||||
|
|
@ -35,7 +36,7 @@
|
|||
select id, public_id, item_id, read_count,star_count,
|
||||
item_one,item_two,item_three,item_four,item_five,
|
||||
item_six,item_seven,item_eight,item_nine,item_ten,
|
||||
title,author_alias,img_url, content, create_by, create_time,
|
||||
title,type,author_alias,img_url, content, create_by, create_time,
|
||||
update_by, update_time, remark from playlet_public_detail
|
||||
</sql>
|
||||
|
||||
|
|
@ -61,6 +62,7 @@
|
|||
<if test="readCount != null">read_count,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="title != null">title,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="authorAlias != null">author_alias,</if>
|
||||
<if test="starCount != null">star_count,</if>
|
||||
<if test="itemOne != null">item_one,</if>
|
||||
|
|
@ -86,6 +88,7 @@
|
|||
<if test="readCount != null">#{readCount},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="title != null">#{title},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="authorAlias != null">#{authorAlias},</if>
|
||||
<if test="starCount != null">#{starCount},</if>
|
||||
<if test="itemOne != null">#{itemOne},</if>
|
||||
|
|
@ -115,6 +118,7 @@
|
|||
<if test="readCount != null">read_count = #{readCount},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="authorAlias != null">author_alias = #{authorAlias},</if>
|
||||
<if test="starCount != null">star_count = #{starCount},</if>
|
||||
<if test="itemOne != null">item_one = #{itemOne},</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue