增加上传apk

master
wanghao 2 weeks ago
parent fcfa9fbfca
commit 33c2abb4de

@ -6,7 +6,7 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://175.27.215.92:3306/bg_wheel_chocks?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://119.45.202.115:3306/bg_wheel_chocks?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: haiwei@123 password: haiwei@123
# 从库数据源 # 从库数据源

@ -64,9 +64,9 @@ spring:
servlet: servlet:
multipart: multipart:
# 单个文件大小 # 单个文件大小
max-file-size: 10MB max-file-size: 20MB
# 设置总上传的文件大小 # 设置总上传的文件大小
max-request-size: 20MB max-request-size: 30MB
# 服务模块 # 服务模块
devtools: devtools:
restart: restart:

@ -0,0 +1,125 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增手持版本升级')" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
<th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-pda_version-add">
<div class="form-group">
<label class="col-sm-3 control-label">版本号:</label>
<div class="col-sm-8">
<input name="versionCode" 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="versionName" 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 type="hidden" class="form-control" name="modifyContent">
<div class="summernote" id="modifyContent"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">位置:</label>
<div class="col-sm-8">
<!-- <input type="hidden" name="downloadUrl">-->
<!-- <div class="file-loading">-->
<!-- <input class="form-control file-upload" id="downloadUrl" name="file" type="file">-->
<input id="filePath" name="filePath" class="form-control" type="file">
<!-- </div>-->
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript">
var prefix = ctx + "pda/pda_version"
$("#form-pda_version-add").validate({
focusCleanup: true
});
function submitHandler() {
// if ($.validate.form()) {
// $.operate.save(prefix + "/add", $('#form-pda_version-add').serialize());
// }
var formData = new FormData();
if ($('#filePath')[0].files[0] == null) {
$.modal.alertWarning("请先选择文件路径");
return false;
}
formData.append('versionCode', $("input[name='versionCode']").val());
formData.append('versionName', $("input[name='versionName']").val());
formData.append('modifyContent', $("input[name='modifyContent']").val());
formData.append('file', $('#filePath')[0].files[0]);
$.ajax({
url: prefix + "/add",
type: 'post',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function(result) {
$.operate.successCallback(result);
}
});
}
// $(".file-upload").fileinput({
// uploadUrl: ctx + 'common/upload',
// maxFileCount: 1,
// autoReplace: true
// }).on('fileuploaded', function (event, data, previewId, index) {
// $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
// }).on('fileremoved', function (event, id, index) {
// $("input[name='" + event.currentTarget.id + "']").val('')
// })
$(function() {
$('.summernote').summernote({
lang: 'zh-CN',
dialogsInBody: true,
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
});
</script>
</body>
</html>

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改手持版本升级')" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
<th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-pda_version-edit" th:object="${pdaApkVersion}">
<input name="objid" th:field="*{objid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">版本号:</label>
<div class="col-sm-8">
<input name="versionCode" th:field="*{versionCode}" 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="versionName" th:field="*{versionName}" 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 type="hidden" class="form-control" th:field="*{modifyContent}">
<div class="summernote" id="modifyContent"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">位置:</label>
<div class="col-sm-8">
<input type="hidden" name="downloadUrl" th:field="*{downloadUrl}">
<div class="file-loading">
<input class="form-control file-upload" id="downloadUrl" name="file" type="file">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript">
var prefix = ctx + "pda/pda_version";
$("#form-pda_version-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-pda_version-edit').serialize());
}
}
$(".file-upload").each(function (i) {
var val = $("input[name='" + this.id + "']").val()
$(this).fileinput({
'uploadUrl': ctx + 'common/upload',
initialPreviewAsData: true,
initialPreview: [val],
maxFileCount: 1,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
$(this).fileinput('_initFileActions');
});
$(function() {
$('.summernote').each(function(i) {
$('#' + this.id).summernote({
lang: 'zh-CN',
dialogsInBody: true,
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
var content = $("input[name='" + this.id + "']").val();
$('#' + this.id).summernote('code', content);
})
});
</script>
</body>
</html>

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('手持版本升级列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>版本号:</label>
<input type="text" name="versionCode"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="pda:pda_version:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="pda:pda_version:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="pda:pda_version:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="pda:pda_version:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('pda:pda_version:edit')}]];
var removeFlag = [[${@permission.hasPermi('pda:pda_version:remove')}]];
var prefix = ctx + "pda/pda_version";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "手持版本升级",
sortName: "versionCode",
sortOrder: "desc",
columns: [{
checkbox: true
},
{
field: 'objid',
title: '主键标识',
visible: false
},
{
field: 'versionCode',
title: '版本号'
},
{
field: 'versionName',
title: '版本名'
},
{
field: 'modifyContent',
title: '信息'
},
{
field: 'downloadUrl',
title: '位置'
},
{
field: 'apkSize',
title: '文件大小'
},
{
field: 'apkMd5',
title: '文件标识'
},
{
field: 'createTime',
title: '创建时间'
},
{
title: '操作',
align: 'center',
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.objid + '\')"><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.objid + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
Loading…
Cancel
Save