增加了操作手册

This commit is contained in:
wanggeng 2022-07-22 17:34:06 +08:00
parent 81ae64a415
commit abfd82a2d7
5 changed files with 897 additions and 14 deletions

View File

@ -1,7 +1,7 @@
server: server:
port: 7012 port: 7012
ip: 127.0.0.1 ip: 39.99.41.54
url: http://${server.ip}:7011/usercenter url: http://${server.ip}:9199/usercenter
system-title: 青海省数字经济发展 system-title: 青海省数字经济发展
system-sub-title: 统一用户管理系统 system-sub-title: 统一用户管理系统
default-index-page: route/custom/index default-index-page: route/custom/index
@ -21,23 +21,20 @@ spring:
cache: false cache: false
main: main:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
mvc:
pathmatch:
matching-strategy: ant_path_matcher
servlet: servlet:
multipart: multipart:
max-file-size: 1GB max-file-size: 1GB
max-request-size: 1GB max-request-size: 1GB
datasource: datasource:
druid: druid:
url: jdbc:mysql://192.168.0.103:3306/db_qhsz_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true url: jdbc:mysql://152.136.196.165:3306/qh_jcfw?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
db-type: mysql db-type: mysql
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
username: root username: qh_jcfw
password: root password: FX1$wf$4
initial-size: 2 initial-size: 2
min-idle: 2 min-idle: 2
max-active: 5 max-active: 1000
max-wait: 60000 max-wait: 60000
time-between-eviction-runs-millis: 60000 time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000 min-evictable-idle-time-millis: 300000
@ -67,7 +64,7 @@ swagger:
base-package-list: ink.wgink,cn.com.tenlion base-package-list: ink.wgink,cn.com.tenlion
file: file:
upload-path: C:\Users\wenc0\Desktop\UploadFiles\ upload-path: /root/projects/usercenter/uploadFiles/
image-types: png,jpg,jpeg,gif,blob image-types: png,jpg,jpeg,gif,blob
video-types: mp4,rmvb video-types: mp4,rmvb
audio-types: mp3,wmv,amr audio-types: mp3,wmv,amr
@ -87,10 +84,11 @@ app-token:
logging: logging:
# enable-api-log: true # enable-api-log: true
file: file:
name: C:\Users\wenc0\Desktop\UploadFiles\logs\usercenter-logs.log name: /root/projects/usercenter/logs/log.log
level: level:
root: error root: error
org.apache.kafka: error
org.springframework.data.mongodb: info
org.springframework.boot.autoconfigure.security.servlet: debug
ink.wgink: debug ink.wgink: debug
sms:
active: true
type: custom

View File

@ -0,0 +1,313 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.tenlion.qhszusercenter.dao.manual.IManualDao">
<resultMap id="manualDTO" type="cn.com.tenlion.qhszusercenter.pojo.dtos.manual.ManualDTO">
<result column="manual_id" property="manualId"/>
<result column="manual_title" property="manualTitle"/>
<result column="manual_summary" property="manualSummary"/>
<result column="manual_file_id" property="manualFileId"/>
<result column="manual_type" property="manualType"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="manualBO" type="cn.com.tenlion.qhszusercenter.pojo.bos.manual.ManualBO">
<result column="manual_id" property="manualId"/>
<result column="manual_title" property="manualTitle"/>
<result column="manual_summary" property="manualSummary"/>
<result column="manual_file_id" property="manualFileId"/>
<result column="manual_type" property="manualType"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="manualPO" type="cn.com.tenlion.qhszusercenter.pojo.pos.manual.ManualPO">
<result column="manual_id" property="manualId"/>
<result column="manual_title" property="manualTitle"/>
<result column="manual_summary" property="manualSummary"/>
<result column="manual_file_id" property="manualFileId"/>
<result column="manual_type" property="manualType"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增 -->
<insert id="save" parameterType="map">
INSERT INTO manual_manual(
manual_id,
manual_title,
manual_summary,
manual_file_id,
manual_type,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
) VALUES(
#{manualId},
#{manualTitle},
#{manualSummary},
#{manualFileId},
#{manualType},
#{gmtCreate},
#{creator},
#{gmtModified},
#{modifier},
#{isDelete}
)
</insert>
<!-- 删除 -->
<update id="remove" parameterType="map">
UPDATE
manual_manual
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
manual_id IN
<foreach collection="manualIds" index="index" open="(" separator="," close=")">
#{manualIds[${index}]}
</foreach>
</update>
<!-- 删除(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
manual_manual
WHERE
manual_id IN
<foreach collection="manualIds" index="index" open="(" separator="," close=")">
#{manualIds[${index}]}
</foreach>
</update>
<!-- 修改 -->
<update id="update" parameterType="map">
UPDATE
manual_manual
SET
<if test="manualTitle != null and manualTitle != ''">
manual_title = #{manualTitle},
</if>
<if test="manualSummary != null and manualSummary != ''">
manual_summary = #{manualSummary},
</if>
<if test="manualFileId != null and manualFileId != ''">
manual_file_id = #{manualFileId},
</if>
<if test="manualType != null and manualType != ''">
manual_type = #{manualType},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
manual_id = manual_id
WHERE
manual_id = #{manualId}
</update>
<!-- 详情 -->
<select id="get" parameterType="map" resultMap="manualDTO">
SELECT
t1.manual_title,
t1.manual_summary,
t1.manual_file_id,
t1.manual_type,
t1.manual_id
FROM
manual_manual t1
WHERE
t1.is_delete = 0
<if test="manualId != null and manualId != ''">
AND
t1.manual_id = #{manualId}
</if>
</select>
<!-- 详情 -->
<select id="getBO" parameterType="map" resultMap="manualBO">
SELECT
t1.manual_id,
t1.manual_title,
t1.manual_summary,
t1.manual_file_id,
t1.manual_type,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
manual_manual t1
WHERE
t1.is_delete = 0
<if test="manualId != null and manualId != ''">
AND
t1.manual_id = #{manualId}
</if>
</select>
<!-- 详情 -->
<select id="getPO" parameterType="map" resultMap="manualPO">
SELECT
t1.manual_id,
t1.manual_title,
t1.manual_summary,
t1.manual_file_id,
t1.manual_type,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
manual_manual t1
WHERE
t1.is_delete = 0
<if test="manualId != null and manualId != ''">
AND
t1.manual_id = #{manualId}
</if>
</select>
<!-- 列表 -->
<select id="list" parameterType="map" resultMap="manualDTO">
SELECT
t1.manual_id,
t1.manual_title,
t1.manual_summary,
t1.manual_file_id,
t1.manual_type,
t1.gmt_create
FROM
manual_manual t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.manual_title LIKE CONCAT('%', #{keywords}, '%')
OR
t1.manual_summary LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="manualIds != null and manualIds.size > 0">
AND
t1.manual_id IN
<foreach collection="manualIds" index="index" open="(" separator="," close=")">
#{manualIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listBO" parameterType="map" resultMap="manualBO">
SELECT
t1.manual_id,
t1.manual_title,
t1.manual_summary,
t1.manual_file_id,
t1.manual_type,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
manual_manual t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="manualIds != null and manualIds.size > 0">
AND
t1.manual_id IN
<foreach collection="manualIds" index="index" open="(" separator="," close=")">
#{manualIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listPO" parameterType="map" resultMap="manualPO">
SELECT
t1.manual_id,
t1.manual_title,
t1.manual_summary,
t1.manual_file_id,
t1.manual_type,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
manual_manual t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="manualIds != null and manualIds.size > 0">
AND
t1.manual_id IN
<foreach collection="manualIds" index="index" open="(" separator="," close=")">
#{manualIds[${index}]}
</foreach>
</if>
</select>
<!-- 统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
manual_manual t1
WHERE
t1.is_delete = 0
</select>
</mapper>

View File

@ -0,0 +1,258 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
<i class="fa fa-lg fa-edit"></i> 编辑
</button>
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
</div>
</script>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/manual/listpage';
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [
[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'manualTitle', width: 180, title: '手册标题', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'manualSummary', width: 180, title: '手册描述', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'manualType', width: 100, title: '手册类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'manualFileId', width: 100, title: '查看手册', align:'center',
templet: function(row) {
var rowData = row[this.field];
var fileIdArray = rowData.split(':');
var fileId = fileIdArray[0];
if (row.manualType == 'pdf') {
return '<a class="layui-btn layui-btn-xs" href="route/file/download/true/'+ fileId +'" target="_blank">查看</a>'
}
return '<a class="layui-btn layui-btn-xs layui-btn-normal" href="route/file/download/false/'+ fileId +'" target="_blank">下载</a>'
}
},
{field: 'gmtCreate', width: 180, title: '创建时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
]
],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
},
page: {
curr: currentPage
},
});
}
// 初始化日期
function initDate() {
// 日期选择
laydate.render({
elem: '#startTime',
format: 'yyyy-MM-dd'
});
laydate.render({
elem: '#endTime',
format: 'yyyy-MM-dd'
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/manual/remove/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
initTable();
initDate();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/manual/save', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/manual/update?manualId={manualId}', [checkDatas[0].manualId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['manualId'];
}
removeData(ids);
}
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,148 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="assets/js/vendor/viewer/viewer.min.css">
<link rel="stylesheet" href="assets/css/layui-util.css">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>新增内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-row">
<div class="layui-col-xs8">
<div class="layui-form-item">
<label class="layui-form-label">手册标题 *</label>
<div class="layui-input-block">
<input type="text" id="manualTitle" name="manualTitle" class="layui-input" value="" placeholder="请输入手册标题" maxlength="255" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手册描述 *</label>
<div class="layui-input-block">
<input type="text" id="manualSummary" name="manualSummary" class="layui-input" value="" placeholder="请输入手册描述" maxlength="500" lay-verify="required">
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">手册类型 *</label>
<div class="layui-input-block">
<input type="radio" name="manualType" value="pdf" title="PDF" checked>
<input type="radio" name="manualType" value="other" title="其他">
</div>
</div>
<div id="manualFileIdBox" class="layui-form-item">
<label class="layui-form-label">操作手册 *</label>
<button type="button" class="layui-btn layui-upload-file-btn" id="manualFileIdUploadBtn">上传操作手册</button>
<div class="upload-image-box">
<input type="hidden" id="manualFileId" name="manualFileId">
<div class="layui-btn-container" id="manualFileIdFileBox"></div>
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/js/layui-util.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl', 'upload'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var layuiUtil = new LayuiUtil(layui, Viewer ? Viewer : null);
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function initManualFileId() {
layuiUtil.initUploadFile({
fieldName: 'manualFileId',
maxCount: 1,
isShow: false,
allowExts: [],
acceptMime: [],
onFileClick: function(fileId) {
console.log(fileId)
}
})
}
// 初始化内容
function initData() {
initManualFileId();
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/manual/save', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,166 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="assets/js/vendor/viewer/viewer.min.css">
<link rel="stylesheet" href="assets/css/layui-util.css">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-row">
<div class="layui-col-xs8">
<div class="layui-form-item">
<label class="layui-form-label">手册标题 *</label>
<div class="layui-input-block">
<input type="text" id="manualTitle" name="manualTitle" class="layui-input" value="" placeholder="请输入手册标题" maxlength="255" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手册描述 *</label>
<div class="layui-input-block">
<input type="text" id="manualSummary" name="manualSummary" class="layui-input" value="" placeholder="请输入手册描述" maxlength="500" lay-verify="required">
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">手册类型 *</label>
<div class="layui-input-block">
<input type="radio" name="manualType" value="pdf" title="PDF" checked>
<input type="radio" name="manualType" value="other" title="其他">
</div>
</div>
<div id="manualFileIdBox" class="layui-form-item">
<label class="layui-form-label">操作手册 *</label>
<button type="button" class="layui-btn layui-upload-file-btn" id="manualFileIdUploadBtn">上传操作手册</button>
<div class="upload-image-box">
<input type="hidden" id="manualFileId" name="manualFileId">
<div class="layui-btn-container" id="manualFileIdFileBox"></div>
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/js/layui-util.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl', 'upload'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var manualId = top.restAjax.params(window.location.href).manualId;
var layuiUtil = new LayuiUtil(layui, Viewer ? Viewer : null);
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function initManualFileId() {
layuiUtil.initUploadFile({
fieldName: 'manualFileId',
maxCount: 1,
isShow: false,
allowExts: [],
acceptMime: [],
onFileClick: function(fileId) {
console.log(fileId);
}
})
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/manual/get/{manualId}', [manualId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initManualFileId();
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/manual/update/{manualId}', [manualId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>