Browse Source

文本配置管理

master
yanyan 3 years ago
parent
commit
9c4ed6a186
  1. 15
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/add.html
  2. 16
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/edit.html
  3. 60
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/text/add.html
  4. 65
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/text/edit.html
  5. 9
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/text/view.html
  6. 13
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneHome.java
  7. 9
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/WechatServiceImpl.java
  8. 8
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneHomeMapper.xml
  9. 6
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneTextMapper.xml

15
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/add.html

@ -22,6 +22,21 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">跳转地址:</label>
<div class="col-sm-8">
<select name="pagePath" class="form-control">
<option value="">消息</option>
<option value="/subpkg/address/address">地址管理</option>
<option value="/subpkg/feedback/feedback">意见反馈</option>
<option value="/subpkg/privacy/privacy">隐私政策</option>
<option value="/subpkg/agreement/agreement">用户协议</option>
<option value="">帮助</option>
<option value="">设置</option>
<option value="/subpkg/about/about">关于</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">隐藏:</label>
<div class="col-sm-8">

16
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/home/edit.html

@ -14,6 +14,22 @@
<input name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">跳转地址:</label>
<div class="col-sm-8">
<select name="pagePath" class="form-control" th:field="*{pagePath}">
<option value="">请选择</option>
<option value="">消息</option>
<option value="/subpkg/address/address">地址管理</option>
<option value="/subpkg/feedback/feedback">意见反馈</option>
<option value="/subpkg/secret/secret">隐私政策</option>
<option value="/subpkg/userPlan/userPlan">用户协议</option>
<option value="">帮助</option>
<option value="">设置</option>
<option value="/subpkg/about/about">关于</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否隐藏:</label>
<div class="col-sm-8">

60
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/text/add.html

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="zdxtInclude :: header('编辑')" />
<th:block th:include="zdxtInclude :: summernote-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -17,14 +18,16 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">配置内容:</label>
<label class="col-sm-3 control-label">配置内容:</label>
<div class="col-sm-8">
<textarea name="content" class="form-control" style="height: 300px" required></textarea>
<input type="hidden" name="content" id="content" />
<div id="itemContentSummernote" class="summernote"></div>
</div>
</div>
</form>
</div>
<th:block th:include="zdxtInclude :: footer" />
<th:block th:include="zdxtInclude :: summernote-js"/>
<script type="text/javascript" th:inline="javascript">
var prefix = ctx + "small/project/text";
$("#form-text-add").validate({
@ -33,9 +36,60 @@
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-text-add').serialize());
var formData = $("#form-text-add").serialize();
formData = decodeURIComponent(formData, true);
var arr = formData.split("&");
var data = {};
for (var i=0; i<arr.length; i++) {
var item = arr[i].split('=');
var value = item[1].replace("+", " ");
data[item[0]] = value;
}
data.content = $('#itemContentSummernote').summernote('code');
$.operate.save(prefix + "/add", data);
}
}
/** 富文本 */
$('.summernote').summernote({
// placeholder: '请输入公告内容',
height: 330,
lang: 'zh-CN',
followingToolbar: false,
callbacks: {
onImageUpload: function (files) {
PlanVersion.summernoteImgUpload(files[0], this);
}
},
toolbar: [
['operate', ['undo','redo']],
['magic',['style']],
['style', ['bold', 'italic', 'underline', 'clear']],
['para', ['height','fontsize','ul', 'ol', 'paragraph']],
['font', ['strikethrough', 'superscript', 'subscript']],
['color', ['color']],
['insert',['video','link','table','hr','attachment']],//自定义按钮展示
['layout',['codeview']],
],
buttons: {
attachment:AttachmentButton
},
});
var AttachmentButton = function (context) {
var ui = $.summernote.ui;
// create button
var button = ui.button({
contents: '<i class="fa fa-folder-open"/>', //按钮样式
tooltip: '上传文件',
click: function () {
$("#fileWord").click();
}
});
return button.render(); //按钮渲染
}
</script>
</body>
</html>

65
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/text/edit.html

@ -2,10 +2,11 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="zdxtInclude :: header('编辑')" />
<th:block th:include="zdxtInclude :: summernote-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-text-edit" th:object="${text}">
<form class="form-horizontal m" id="form-text-edit" th:object="${sceneText}">
<input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">配置类型:</label>
@ -18,25 +19,81 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">配置内容:</label>
<label class="col-sm-3 control-label">配置内容:</label>
<div class="col-sm-8">
<input name="content" class="form-control" type="textarea" required th:field="*{content}">
<input type="hidden" name="content" id="content" th:field="*{content}"/>
<div id="itemContentSummernote" class="summernote"></div>
</div>
</div>
</form>
</div>
<th:block th:include="zdxtInclude :: footer" />
<th:block th:include="zdxtInclude :: summernote-js"/>
<script type="text/javascript" th:inline="javascript">
var prefix = ctx + "small/project/text";
$("#form-text-edit").validate({
focusCleanup: true
});
$(function() {
$('#itemContentSummernote').summernote('code', $('#content').val());
})
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-text-edit').serialize());
var formData = $("#form-text-edit").serialize();
formData = decodeURIComponent(formData, true);
var arr = formData.split("&");
var data = {};
for (var i=0; i<arr.length; i++) {
var item = arr[i].split('=');
var value = item[1].replace("+", " ");
data[item[0]] = value;
}
data.content = $('#itemContentSummernote').summernote('code');
$.operate.save(prefix + "/edit", data);
}
}
/** 富文本 */
$('.summernote').summernote({
// placeholder: '请输入公告内容',
height: 330,
lang: 'zh-CN',
followingToolbar: false,
callbacks: {
onImageUpload: function (files) {
PlanVersion.summernoteImgUpload(files[0], this);
}
},
toolbar: [
['operate', ['undo','redo']],
['magic',['style']],
['style', ['bold', 'italic', 'underline', 'clear']],
['para', ['height','fontsize','ul', 'ol', 'paragraph']],
['font', ['strikethrough', 'superscript', 'subscript']],
['color', ['color']],
['insert',['video','link','table','hr','attachment']],//自定义按钮展示
['layout',['codeview']],
],
buttons: {
attachment:AttachmentButton
},
});
var AttachmentButton = function (context) {
var ui = $.summernote.ui;
// create button
var button = ui.button({
contents: '<i class="fa fa-folder-open"/>', //按钮样式
tooltip: '上传文件',
click: function () {
$("#fileWord").click();
}
});
return button.render(); //按钮渲染
}
</script>
</body>
</html>

9
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/text/view.html

@ -54,10 +54,6 @@
columns: [{
checkbox: true
},
{
field: 'content',
title: '配置内容'
},
{
field: 'type',
title: '配置类型',
@ -73,6 +69,10 @@
}
}
},
{
field: 'content',
title: '配置内容'
},
{
field: 'creator',
title: '创建人'
@ -87,6 +87,7 @@
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.guid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.guid + '\')"><i class="fa fa-remove"></i> 删除</a>');
return actions.join('');
}
}

13
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneHome.java

@ -35,6 +35,11 @@ public class SceneHome implements Serializable {
*/
private String picIcon;
/**
* 图标
*/
private String pagePath;
/**
* 名称
*/
@ -128,4 +133,12 @@ public class SceneHome implements Serializable {
public void setUploadPath(String uploadPath) {
this.uploadPath = uploadPath;
}
public String getPagePath() {
return pagePath;
}
public void setPagePath(String pagePath) {
this.pagePath = pagePath;
}
}

9
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/WechatServiceImpl.java

@ -100,9 +100,9 @@ public class WechatServiceImpl implements WechatService {
insertOrUpdateDO.setCreator("SYSTEM");
insertOrUpdateDO.setToken(getToken(insertOrUpdateDO.getGuid(), insertOrUpdateDO.getNickname()));
wechatLoginMapper.insertUser(insertOrUpdateDO);
userInfoMap.put("token", insertOrUpdateDO.getToken());
userInfoMap.put("token", openId);
} else {
userInfoMap.put("token", user.getToken());
userInfoMap.put("token", openId);
// 已存在,做已存在的处理,如更新用户的头像,昵称等,根据openID更新
//wechatLoginMapper.updateByOpenId(insertOrUpdateDO);
}
@ -122,9 +122,6 @@ public class WechatServiceImpl implements WechatService {
private JSONObject getSessionKeyOrOpenId(String code) throws Exception {
// String apiUrl = StrUtil.format("https://api.weixin.qq.com/sns/jscode2session?appid={}&secret={}&js_code={}&grant_type=authorization_code", APPID, SECRET, code);
// String body = HttpRequest.get(apiUrl).execute().body();
Map<String, String> requestUrlParam = new HashMap<>();
// 小程序appId
requestUrlParam.put("appid", APPID);
@ -215,6 +212,6 @@ public class WechatServiceImpl implements WechatService {
// 生成token
//String token = JWTUtil.createToken(tokenMap,tokenKey.getBytes());
return StringUtils.getUUID();
return "";
}
}

8
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneHomeMapper.xml

@ -9,13 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="name" column="name" />
<result property="sort" column="sort" />
<result property="hide" column="hide" />
<result property="pagePath" column="page_path" />
<result property="picIcon" column="pic_icon" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectSceneHomeVo">
select guid, name, sort, hide, pic_icon, creator, create_time from scene_home
select guid, name, sort, hide, pic_icon, page_path, creator, create_time from scene_home
</sql>
<select id="selectSceneHomeList" parameterType="SceneHome" resultMap="SceneHomeResult">
@ -38,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="guid != null ">guid,</if>
<if test="name != null and name != ''">`name`,</if>
<if test="picIcon != null and picIcon != ''">pic_icon,</if>
<if test="pagePath != null and pagePath != ''">page_path,</if>
<if test="sort != null ">sort,</if>
<if test="hide != null and hide != ''">`hide`,</if>
<if test="creator != null and creator != ''">creator,</if>
@ -47,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="guid != null ">#{guid},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="picIcon != null and picIcon != ''">#{picIcon},</if>
<if test="pagePath != null and pagePath != ''">#{pagePath},</if>
<if test="sort != null ">#{sort},</if>
<if test="hide != null and hide != ''">#{hide},</if>
<if test="creator != null and creator != ''">#{creator},</if>
@ -59,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="picIcon != null and picIcon != ''">pic_icon = #{picIcon},</if>
<if test="pagePath != null and pagePath != ''">page_path = #{pagePath},</if>
<if test="sort != null ">sort = #{sort},</if>
<if test="hide != null ">hide = #{hide},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
@ -86,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectSceneHomeListAll" parameterType="SceneHome" resultMap="SceneHomeResult">
select cu.guid, cu.name, zd.upload_path from scene_home as cu
select cu.guid, cu.name, cu.page_path, zd.upload_path from scene_home as cu
inner join zdxt_file as zd
on cu.guid = zd.business_id
where cu.hide = 1

6
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneTextMapper.xml

@ -27,7 +27,7 @@
<select id="selectSceneTextList" parameterType="SceneText" resultMap="SceneTextResult">
<include refid="selectSceneTextVo"/>
<where>
<if test="type != null and type != ''">and `type` like concat('%', #{type}, '%')</if>
<if test="type != null">and `type` = #{type}</if>
<if test="creator != null and creator != ''">and creator = #{creator}</if>
</where>
order by create_time desc
@ -43,7 +43,7 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null ">guid,</if>
<if test="content != null and content != ''">`content`,</if>
<if test="type != null and type != ''">`type`,</if>
<if test="type != null ">`type`,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
@ -52,7 +52,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null ">#{guid},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="type != null ">#{type},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>

Loading…
Cancel
Save