476 lines
22 KiB
HTML
476 lines
22 KiB
HTML
|
|
<!DOCTYPE html>
|
|||
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|||
|
|
<head>
|
|||
|
|
<th:block th:include="include :: header('修改活动信息')" />
|
|||
|
|
<th:block th:include="include :: ztree-css" />
|
|||
|
|
<th:block th:include="include :: datetimepicker-css" />
|
|||
|
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
|||
|
|
</head>
|
|||
|
|
<body class="white-bg">
|
|||
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|||
|
|
<form class="form-horizontal m" id="form-role-edit" th:object="${active}">
|
|||
|
|
<input id="roleId" name="id" type="hidden" th:field="*{id}" />
|
|||
|
|
<input id="lpFilesName" name="lpFilesName" type="hidden" th:field="*{lpFilesName}"/>
|
|||
|
|
<input id="listLpNames" name="listLpNames" type="hidden" th:field="*{listLpNames}"/>
|
|||
|
|
|
|||
|
|
<input id="lsFilesName" name="lsFilesName" type="hidden" th:field="*{lsFilesName}"/>
|
|||
|
|
<input id="listLsNames" name="listLsNames" type="hidden" th:field="*{listLsNames}"/>
|
|||
|
|
|
|||
|
|
<input id="fpFilesName" name="fpFilesName" type="hidden" th:field="*{fpFilesName}"/>
|
|||
|
|
<input id="listFpNames" name="listFpNames" type="hidden" th:field="*{listFpNames}"/>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label is-required">活动标题:</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<input class="form-control" type="text" name="activeTitle" id="activeTitle" th:field="*{activeTitle}" required>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label is-required">活动内容描述:</label>
|
|||
|
|
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<textarea name="activeDesc" maxlength="500" class="form-control" rows="3">[[*{activeDesc}]]</textarea>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group draggable">
|
|||
|
|
<label class="col-sm-3 control-label">报名开始日期:</label>
|
|||
|
|
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<div class="input-group date">
|
|||
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|||
|
|
<input class="form-control" type="text" name="enrollStartDate" id="enrollStartDate" th:field="*{enrollStartDate}" required>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group draggable">
|
|||
|
|
<label class="col-sm-3 control-label">报名结束日期:</label>
|
|||
|
|
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<div class="input-group date">
|
|||
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|||
|
|
<input class="form-control" type="text" name="enrollEndDate" id="enrollEndDate" th:field="*{enrollEndDate}" required>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group draggable">
|
|||
|
|
<label class="col-sm-3 control-label">活动开始日期:</label>
|
|||
|
|
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<div class="input-group date">
|
|||
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|||
|
|
<input class="form-control" type="text" name="activeStartDate" id="activeStartDate" th:field="*{activeStartDate}" required>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group draggable">
|
|||
|
|
<label class="col-sm-3 control-label">活动结束日期:</label>
|
|||
|
|
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<div class="input-group date">
|
|||
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|||
|
|
<input class="form-control" type="text" name="activeEndDate" id="activeEndDate" th:field="*{activeEndDate}" required>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label is-required">活动类型:</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<select name="activeType" class="form-control m-b" th:with="type=${@dict.getType('sys_active_type')}">
|
|||
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{activeType}"></option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label is-required">海报图片上传:</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<div class="file-loading">
|
|||
|
|
<input id="firstSingleFile" name="file" type="file">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label is-required">活动列表图片上传:</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<div class="file-loading">
|
|||
|
|
<input id="singleFile" name="file" type="file">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label is-required">报名要求:</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<select name="isEnroll" class="form-control m-b" th:with="type=${@dict.getType('sya_active_enroll')}">
|
|||
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isEnroll}"></option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label is-required">活动明细图片:</label>
|
|||
|
|
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<div class="file-loading">
|
|||
|
|
<input id="multipleFile" name="files" type="file" multiple>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<!-- <div class="form-group">-->
|
|||
|
|
<!-- <label class="col-sm-3 control-label is-required">活动状态:</label>-->
|
|||
|
|
<!-- <div class="col-sm-8">-->
|
|||
|
|
<!-- <select name="status" class="form-control m-b" th:with="type=${@dict.getType('sys_active_status')}">-->
|
|||
|
|
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{status}"></option>-->
|
|||
|
|
<!-- </select>-->
|
|||
|
|
<!-- </div>-->
|
|||
|
|
<!-- </div>-->
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label is-required">活动地址:</label>
|
|||
|
|
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<textarea name="address" maxlength="500" class="form-control" rows="3">[[*{address}]]</textarea>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">备注:</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<input id="remark" name="remark" class="form-control" type="text" th:field="*{remark}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<th:block th:include="include :: footer" />
|
|||
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|||
|
|
<script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
|
|||
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|||
|
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
|||
|
|
<script th:src="@{/ajax/libs/beautifyhtml/beautifyhtml.js}"></script>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
$(document).ready(function(){setup_draggable();$("#n-columns").on("change",function(){var v=$(this).val();if(v==="1"){var $col=$(".form-body .col-md-12").toggle(true);$(".form-body .col-md-6 .draggable").each(function(i,el){$(this).remove().appendTo($col)});$(".form-body .col-md-6").toggle(false)}else{var $col=$(".form-body .col-md-6").toggle(true);$(".form-body .col-md-12 .draggable").each(function(i,el){$(this).remove().appendTo(i%2?$col[1]:$col[0])});$(".form-body .col-md-12").toggle(false)}});$("#copy-to-clipboard").on("click",function(){var $copy=$(".form-body").clone().appendTo(document.body);$copy.find(".tools, :hidden").remove();$.each(["draggable","droppable","sortable","dropped","ui-sortable","ui-draggable","ui-droppable","form-body"],function(i,c){$copy.find("."+c).removeClass(c).removeAttr("style")});var html=html_beautify($copy.html());$copy.remove();$modal=get_modal(html).modal("show");$modal.find(".btn").remove();$modal.find(".modal-title").html("复制HTML代码");$modal.find(":input:first").select().focus();return false})});var setup_draggable=function(){$(".draggable").draggable({appendTo:"body",helper:"clone"});$(".droppable").droppable({accept:".draggable",helper:"clone",hoverClass:"droppable-active",drop:function(event,ui){$(".empty-form").remove();var $orig=$(ui.draggable);if(!$(ui.draggable).hasClass("dropped")){var $el=$orig.clone().addClass("dropped").css({"position":"static","left":null,"right":null}).appendTo(this);if($el.find("label").hasClass("radio-box")){$el=$el.html('<label class="col-sm-3 control-label">单选框:</label>'+'<div class="col-sm-9">'+'<label class="radio-box"><input type="radio" checked="" value="option1" id="optionsRadios1" name="optionsRadios">选项1</label>'+'<label class="radio-box"><input type="radio" value="option2" id="optionsRadios2" name="optionsRadios">选项2</label>'+"</div>")}else{if($el.find("label").hasClass("check-box")){$el=$el.html('<label class="col-sm-3 control-label">复选框:</label>'+'<div class="col-sm-9">'+'<label class="check-box">'+'<input type="checkbox" value="option1" id="inlineCheckbox1">选项1</label>'+'<label class="check-box">'+'<input type="checkbox" value="option2" id="inlineCheckbox2">选项2</label>'+'<label class="check-box">'+'<input type="checkbox" value="option3" id="inlineCheckbox3">选项3</label>'+"</div>")}}var id=$orig.find(":input").attr("id");if(id){id=id.split("-").slice(0,-1).join("-")+"-"+(parseInt(id.split("-").slice(-1)[0])+1);$orig.find(":input").attr("id",id);$orig.find("label").attr("for",id)}$('<p class="tools col-sm-12 col-sm-offset-3"> <a class="edit-link">编辑HTML<a> | <a class="remove-link">移除</a></p>').appendTo($el)}else{if($(this)[0]!=$orig.parent()[0]){var $el=$orig.clone().css({"position":"static","left":null,"right":null}).appendTo(this);$orig.remove()}}}}).sortable()};var get_modal=function(content){var modal=$('<div class="modal" style="overflow: auto;" tabindex="-1"> <div class="modal-dialog"><div class="modal-content"><div class="modal-header"><a type="button" class="close" data-dismiss="modal" aria-hidden="true">×</a><h4 class="modal-title">编辑HTML</h4></div><div class="modal-body ui-front"> <textarea class="form-control textarea-show-src" style="min-height: 200px; margin-bottom: 10px;font-family: Monaco, Fixed"></textarea><button class="btn btn-success">更新HTML</button></div></div></div></div>').appendTo(document.body);var doms=document.getElementsByClassName("textarea-show-src");for(var i=0;i<doms.length;i++){doms.item(i).innerHTML=content}return modal};$(document).on("click",".edit-link",function(ev){var $el=$(this).parent().parent();var $el_copy=$el.clone();var $edit_btn=$el_copy.find(".edit-link").parent().remove();var $modal=get_modal(html_beautify($el_copy.html())).modal("show");$modal.find(":input:first").focus();$modal.find(".btn-success").click(function(ev2){var html=$modal.find("textarea").val();if(!html){$el.remove()}else{$el.html(html);$edit_btn.appendTo($el)}$modal.modal("hide");return false})});$(document).on("click",".remove-link",function(ev){
|
|||
|
|
</script>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
function edit() {
|
|||
|
|
var id = $("input[name='id']").val();
|
|||
|
|
var activeTitle = $("input[name='activeTitle']").val();
|
|||
|
|
var activeDesc =$("textarea[name='activeDesc']").val();
|
|||
|
|
var enrollStartDate = $("input[name='enrollStartDate']").val();
|
|||
|
|
var enrollEndDate = $("input[name='enrollEndDate']").val();
|
|||
|
|
var activeStartDate = $("input[name='activeStartDate']").val();
|
|||
|
|
var activeEndDate = $("input[name='activeEndDate']").val();
|
|||
|
|
var activeType = $("select[name='activeType']").val();
|
|||
|
|
var isEnroll = $("select[name='isEnroll']").val();
|
|||
|
|
var lpFilesName = $("input[name='lpFilesName']").val();
|
|||
|
|
var lsFilesName = $("input[name='lsFilesName']").val();
|
|||
|
|
var fpFilesName = $("input[name='fpFilesName']").val();
|
|||
|
|
var remark = $("input[name='remark']").val();
|
|||
|
|
var address =$("textarea[name='address']").val();
|
|||
|
|
$.ajax({
|
|||
|
|
cache : true,
|
|||
|
|
type : "POST",
|
|||
|
|
url : ctx + "active/info/edit",
|
|||
|
|
data : {
|
|||
|
|
"id": id,
|
|||
|
|
"activeTitle": activeTitle,
|
|||
|
|
"activeDesc": activeDesc,
|
|||
|
|
"address": address,
|
|||
|
|
"enrollStartDate": enrollStartDate,
|
|||
|
|
"enrollEndDate": enrollEndDate,
|
|||
|
|
"activeStartDate": activeStartDate,
|
|||
|
|
"activeEndDate": activeEndDate,
|
|||
|
|
"activeType": activeType,
|
|||
|
|
"isEnroll": isEnroll,
|
|||
|
|
"lpFilesName": lpFilesName,
|
|||
|
|
"lsFilesName": lsFilesName,
|
|||
|
|
"fpFilesName": fpFilesName,
|
|||
|
|
"remark": remark
|
|||
|
|
},
|
|||
|
|
async : false,
|
|||
|
|
error : function(request) {
|
|||
|
|
$.modal.alertError("系统错误");
|
|||
|
|
},
|
|||
|
|
success : function(data) {
|
|||
|
|
$.operate.successCallback(data);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function submitHandler() {
|
|||
|
|
var c = check_c();
|
|||
|
|
if(c){
|
|||
|
|
edit();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function initIdCardFile() {
|
|||
|
|
//测试图片回显
|
|||
|
|
var a = $("input[name='listLpNames']").val();
|
|||
|
|
var initialList = eval("("+a+")");
|
|||
|
|
var previewJson = new Array();//回显文件数组
|
|||
|
|
var initPreviewConfig = new Array();
|
|||
|
|
if (initialList != null && initialList.length) {
|
|||
|
|
for (var i = 0; i < initialList.length; i++) {
|
|||
|
|
previewJson[i] = initialList[i].filepath;
|
|||
|
|
//alert(initialList[i].filepath);
|
|||
|
|
//组装图片配置
|
|||
|
|
var tjson = {
|
|||
|
|
type: getFileTypeFromUrl(initialList[i].filepath),
|
|||
|
|
caption: initialList[i].filename, // 展示的文件名
|
|||
|
|
url: 'idcardremove', // 删除url 必填,可以写一个空方法,不然无法删除初始化图片
|
|||
|
|
key: initialList[i].id, // 删除时Ajax向后台传递的参数
|
|||
|
|
/* extra: function() {
|
|||
|
|
return {"id":id};
|
|||
|
|
} */ //这里也可以携带格外的参数
|
|||
|
|
};
|
|||
|
|
initPreviewConfig[i] = tjson;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// 多图上传
|
|||
|
|
var cacheImgs = {};
|
|||
|
|
var g_value = $("#lpFilesName").val() || '';
|
|||
|
|
var g_list = g_value.split(',');
|
|||
|
|
$("#multipleFile").fileinput({
|
|||
|
|
uploadUrl: ctx + 'common/uploadsLp',//上传路径
|
|||
|
|
fileActionSettings: {
|
|||
|
|
uploadClass: 'hideBtn'
|
|||
|
|
},
|
|||
|
|
overwriteInitial: false,
|
|||
|
|
initialPreviewAsData: true,
|
|||
|
|
initialPreview: previewJson,
|
|||
|
|
initialPreviewConfig: initPreviewConfig,
|
|||
|
|
// uploadAsync:false, 需要使用异步
|
|||
|
|
layoutTemplates: {
|
|||
|
|
actionUpload: '',//去除上传预览缩略图中的上传图片
|
|||
|
|
},
|
|||
|
|
showPreview: true,//是否显示预览
|
|||
|
|
showUpload: false,//不显示底部上传按钮
|
|||
|
|
showRemove: false,//不显示底部清空按钮
|
|||
|
|
showCaption: true,//显示底部上传按钮左侧文本(完全是为了美观)
|
|||
|
|
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
|
|||
|
|
var rsp = data.response;
|
|||
|
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
|||
|
|
|
|||
|
|
cacheImgs[previewId] = data.response.newFileNames;
|
|||
|
|
var rsp = data.response;
|
|||
|
|
var value = $("#lpFilesName").val() || '';
|
|||
|
|
var list = [];
|
|||
|
|
var res = [];
|
|||
|
|
var r_val = rsp.newFileNames;
|
|||
|
|
var list = value.split(',');
|
|||
|
|
list.forEach(function (item) {
|
|||
|
|
if ((item !== r_val) && (item !=='') ) {
|
|||
|
|
res.push(item);
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
res.push(r_val);
|
|||
|
|
console.log('end:', res);
|
|||
|
|
$("#lpFilesName").val(res);
|
|||
|
|
var c = $("#lpFilesName").val();
|
|||
|
|
console.log('fileuploaded: c:', c);
|
|||
|
|
|
|||
|
|
}).on('filebatchselected', function (event, files) {
|
|||
|
|
$(this).fileinput("upload");//这里会根据uploadAsync值自动去执行对应的回调函
|
|||
|
|
}).on('filebatchuploaderror', function (event, data, msg) {
|
|||
|
|
//批量上传失败提示
|
|||
|
|
var _maxRequestSize = 10240;
|
|||
|
|
_allFileSize = 0;
|
|||
|
|
if (_allFileSize > _maxRequestSize) {
|
|||
|
|
msg = "上传文件总大小(" + (_allFileSize / 1024).toFixed(2) + "MB)超出限制(" + (_maxRequestSize / 1024).toFixed(2) + "MB)";
|
|||
|
|
$('#input-id').fileinput('clear');
|
|||
|
|
$.modal.msgWarning(msg);
|
|||
|
|
}
|
|||
|
|
}).on('fileclear', function (event, previewId, extra) {
|
|||
|
|
//拒绝移除 如果给移除上传控件所有内容的功能,则系统会重新初始化回显的文件,那么我的 initInputFileImg()函数完全不起作用了,所以,禁用它
|
|||
|
|
return false;
|
|||
|
|
}).on('fileerror', function (event, data, msg) {
|
|||
|
|
console.log("--------------------fileerror--------------------");
|
|||
|
|
console.log(data);
|
|||
|
|
console.log(msg);
|
|||
|
|
$.modal.msgError("上传失败");
|
|||
|
|
}).on('filepreremove', function (event, key) {
|
|||
|
|
$.modal.msgSuccess("移除成功-1");
|
|||
|
|
}).on('filebeforedelete', function (event, key) {
|
|||
|
|
$.modal.msgSuccess("移除成功-2");
|
|||
|
|
console.log('filebeforedelete',event,key);
|
|||
|
|
var value = $("#lpFilesName").val() || '';
|
|||
|
|
var list = value.split(',');
|
|||
|
|
var res = [];
|
|||
|
|
for (var i = 0; i < list.length; i++) {
|
|||
|
|
if(list[i]!==g_list[key]){
|
|||
|
|
res.push(list[i]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$("#lpFilesName").val(res);
|
|||
|
|
var f = $("#lpFilesName").val();
|
|||
|
|
console.log('filesuccessremove: f:', f);
|
|||
|
|
}).on('filesuccessremove', function (event, data, previewId, index) {
|
|||
|
|
$.modal.msgSuccess("移除成功-3");
|
|||
|
|
var urls = cacheImgs[data];
|
|||
|
|
delete cacheImgs[data];
|
|||
|
|
var value = $("#lpFilesName").val() || '';
|
|||
|
|
var list = value.split(',');
|
|||
|
|
var res = [];
|
|||
|
|
list.forEach(function (item) {
|
|||
|
|
if ((item !== urls) && (item !=='')) {
|
|||
|
|
res.push(item);
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
$("#lpFilesName").val(res);
|
|||
|
|
var d = $("#lpFilesName").val();
|
|||
|
|
console.log('filesuccessremove: d:', d);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
$(document).ready(function () {
|
|||
|
|
|
|||
|
|
var a = $("input[name='listLsNames']").val();
|
|||
|
|
var b= [];
|
|||
|
|
if (a.endsWith('null')){
|
|||
|
|
b= []
|
|||
|
|
}else{
|
|||
|
|
b= [a]
|
|||
|
|
}
|
|||
|
|
console.log('a:', a);
|
|||
|
|
// 单图上传
|
|||
|
|
$("#singleFile").fileinput({
|
|||
|
|
uploadUrl: ctx + 'common/uploadsLs',
|
|||
|
|
maxFileCount: 1,
|
|||
|
|
initialPreviewAsData: true,
|
|||
|
|
initialPreview: b,
|
|||
|
|
layoutTemplates: {
|
|||
|
|
footer: '',//隐藏全部小图标
|
|||
|
|
},
|
|||
|
|
showRemove: true, //不显示底部清空按钮
|
|||
|
|
autoReplace: true
|
|||
|
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
|||
|
|
var rsp = data.response;
|
|||
|
|
$("#lsFilesName").val(rsp.newFileName);
|
|||
|
|
log.info("return lsFilesName url:" + rsp.url)
|
|||
|
|
log.info("reutrn lsFilesName fileName:" + rsp.fileName)
|
|||
|
|
log.info("reutrn lsFilesName newFileName:" + rsp.newFileName)
|
|||
|
|
log.info("return lsFilesName originalFilename:" + rsp.originalFilename)
|
|||
|
|
}).on('fileremoved', function (event, id, index) {
|
|||
|
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
|||
|
|
}).on('filebeforedelete', function (event, key) {
|
|||
|
|
$.modal.msgSuccess("移除成功-2");
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
initIdCardFile(); //调用上面的初始化方法
|
|||
|
|
initInputFileImg();
|
|||
|
|
fpFilesName();
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
function getFileTypeFromUrl(url) {
|
|||
|
|
if (url.endsWith('gif') || url.endsWith('jpg') || url.endsWith('jpeg') || url.endsWith('png')) {
|
|||
|
|
return 'image';
|
|||
|
|
}
|
|||
|
|
if (url.endsWith('mp4')) {
|
|||
|
|
return 'video';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//回显文件 对应的div里追加 hidden_img
|
|||
|
|
function initInputFileImg(){
|
|||
|
|
$(".file-sortable").each(function(){
|
|||
|
|
var tempFileName = $(this).find('.kv-file-content').find('.file-preview-image').attr("src");
|
|||
|
|
$(this).find('.kv-file-content').eq(0).parent().append("<span class='hidden_img hidden_img_init' hidden >"+tempFileName+"</span>");
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function fpFilesName(){
|
|||
|
|
var c = $("input[name='listFpNames']").val();
|
|||
|
|
var d= [];
|
|||
|
|
if (c.endsWith('null')){
|
|||
|
|
d= []
|
|||
|
|
}else{
|
|||
|
|
d= [c]
|
|||
|
|
}
|
|||
|
|
console.log('c:', d);
|
|||
|
|
// 单图上传
|
|||
|
|
$("#firstSingleFile").fileinput({
|
|||
|
|
uploadUrl: ctx + 'common/uploadsFp',
|
|||
|
|
maxFileCount: 1,
|
|||
|
|
initialPreviewAsData: true,
|
|||
|
|
initialPreview: d,
|
|||
|
|
layoutTemplates: {
|
|||
|
|
footer: '',//隐藏全部小图标
|
|||
|
|
},
|
|||
|
|
showRemove: true, //不显示底部清空按钮
|
|||
|
|
autoReplace: true
|
|||
|
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
|||
|
|
var rsp = data.response;
|
|||
|
|
$("#fpFilesName").val(rsp.newFileName);
|
|||
|
|
log.info("return url:" + rsp.url)
|
|||
|
|
log.info("reutrn fileName:" + rsp.fileName)
|
|||
|
|
log.info("reutrn newFileName:" + rsp.newFileName)
|
|||
|
|
log.info("return originalFilename:" + rsp.originalFilename)
|
|||
|
|
}).on('fileremoved', function (event, id, index) {
|
|||
|
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
|||
|
|
}).on('filebeforedelete', function (event, key) {
|
|||
|
|
$.modal.msgSuccess("移除成功-2");
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function check_c() {
|
|||
|
|
var enrollStartDate = $("input[name='enrollStartDate']").val();
|
|||
|
|
var enrollEndDate = $("input[name='enrollEndDate']").val();
|
|||
|
|
var activeStartDate = $("input[name='activeStartDate']").val();
|
|||
|
|
var activeEndDate = $("input[name='activeEndDate']").val();
|
|||
|
|
if (enrollStartDate == null || enrollStartDate == "") {
|
|||
|
|
//为空
|
|||
|
|
$.modal.alertWarning("报名开始日期不能为空");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if (enrollEndDate == null || enrollEndDate == "") {
|
|||
|
|
//为空
|
|||
|
|
$.modal.alertWarning("报名结束日期不能为空");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(enrollEndDate<enrollStartDate){
|
|||
|
|
$.modal.alertWarning("报名结束日期不能早于报名开始日期");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (activeStartDate == null || activeStartDate == "") {
|
|||
|
|
//为空
|
|||
|
|
$.modal.alertWarning("活动开始日期不能为空");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if (activeEndDate == null || activeEndDate == "") {
|
|||
|
|
//为空
|
|||
|
|
$.modal.alertWarning("活动结束日期不能为空");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if(activeEndDate<activeStartDate){
|
|||
|
|
$.modal.alertWarning("活动结束日期不能早于活动开始日期");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
if(enrollEndDate>activeEndDate){
|
|||
|
|
$.modal.alertWarning("报名结束日期不能晚于活动结束日期");
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</body>
|
|||
|
|
</html>
|