838 lines
41 KiB
HTML
838 lines
41 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<base href="/xzszwhy/">
|
||
<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" type="text/css" href="assets/js/vendor/viewer/viewer.min.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-form-item">
|
||
<label class="layui-form-label">活动标题<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="activityTitle" name="activityTitle" class="layui-input" value="" placeholder="请输入活动名称" lay-verify="required">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" pane>
|
||
<label class="layui-form-label">活动类型</label>
|
||
<div class="layui-input-block layui-form" id="activityTypeRadioTemplateBox" lay-filter="activityTypeRadioTemplateBox"></div>
|
||
<script id="activityTypeRadioTemplate" type="text/html">
|
||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||
<input type="radio" name="activityType" value="{{item.dataId}}" title="{{item.dataName}}">
|
||
{{# } }}
|
||
</script>
|
||
</div>
|
||
<div class="layui-form-item" pane>
|
||
<label class="layui-form-label">面向人群</label>
|
||
<div class="layui-input-block layui-form" id="activityObjectOrientedCheckboxTemplateBox" lay-filter="activityObjectOrientedCheckboxTemplateBox"></div>
|
||
<script id="activityObjectOrientedCheckboxTemplate" type="text/html">
|
||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||
<input type="checkbox" name="activityObjectOriented[{{item.dataId}}]" value="{{item.dataId}}" title="{{item.dataName}}">
|
||
{{# } }}
|
||
</script>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">活动人数<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<input type="number" id="activityUserNum" name="activityUserNum" class="layui-input" value="" placeholder="请输入活动人数" lay-verify="required">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">主办单位<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="activitySponsor" name="activitySponsor" class="layui-input" value="" placeholder="请输入活动主办单位" 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="activityOrganizer" name="activityOrganizer" class="layui-input" value="" placeholder="请输入活动承办单位" >
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">协办单位</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="activityCoOrganizer" name="activityCoOrganizer" class="layui-input" value="" placeholder="请输入活动协办单位" >
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" >
|
||
<label class="layui-form-label">活动场馆</label>
|
||
<div class="layui-input-block" >
|
||
<div class="layui-col-md5">
|
||
<input type="hidden" id="activityVenuesId" name="activityVenuesId" value="">
|
||
<input class="layui-input" type="text" name="activityVenues" id="activityVenues" value="" title="场馆名称" readonly placeholder="场馆名称">
|
||
</div>
|
||
<div class="layui-col-md5">
|
||
<button type="button" class="layui-btn layui-btn-warm" id="findByActivityYenuse">选择活动场馆</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">活动地址<span style="color: red;">*</span></label>
|
||
|
||
<div class="layui-input-block">
|
||
<input type="hidden" id="activityAddressY" name="activityAddressY" value="">
|
||
<input type="hidden" id="activityAddressX" name="activityAddressX" value="">
|
||
<div class="layui-col-md5">
|
||
<input type="text" id="activityAddress" name="activityAddress" class="layui-input" value="" readonly placeholder="请输入活动地址" lay-verify="required">
|
||
</div>
|
||
<div class="layui-col-md5">
|
||
<button type="button" class="layui-btn layui-btn-normal" id="findMapButton">选择活动地址</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item layui-row" pane>
|
||
<div class="layui-col-lg6">
|
||
<label class="layui-form-label">市</label>
|
||
<input type="hidden" name="cityName" id="cityName"/>
|
||
<div class="layui-input-block layui-form" id="teamCitySelectTemplateBox" lay-filter="teamCitySelectTemplateBox"></div>
|
||
<script id="teamCitySelectTemplate" type="text/html">
|
||
<select id="teamCity" name="teamCity" lay-filter="teamCity">
|
||
<option value="">请选择市</option>
|
||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||
<option value="{{item.areaId}}">{{item.areaName}}</option>
|
||
{{# } }}
|
||
</select>
|
||
</script>
|
||
</div>
|
||
<div class="layui-col-lg6">
|
||
<label class="layui-form-label">旗县区</label>
|
||
<input type="hidden" name="countyName" id="countyName"/>
|
||
<div class="layui-input-block layui-form" id="teamCountySelectTemplateBox" lay-filter="teamCountySelectTemplateBox"></div>
|
||
<script id="teamCountySelectTemplate" type="text/html">
|
||
<select id="teamCounty" name="teamCounty" lay-filter="teamCounty">
|
||
<option value="">请选择旗县区</option>
|
||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||
<option value="{{item.areaId}}">{{item.areaName}}</option>
|
||
{{# } }}
|
||
</select>
|
||
</script>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">所属区域</label>
|
||
<input type="hidden" name="areaName" id="areaName"/>
|
||
<div class="layui-input-block layui-form" id="teamAreaSelectTemplateBox" lay-filter="teamAreaSelectTemplateBox"></div>
|
||
<script id="teamAreaSelectTemplate" type="text/html">
|
||
<select id="teamArea" name="teamArea" lay-filter="teamArea">
|
||
<option value="">请选择所属区域</option>
|
||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||
<option value="{{item.areaId}}">{{item.areaName}}</option>
|
||
{{# } }}
|
||
</select>
|
||
</script>
|
||
</div>
|
||
<div class="layui-form-item" >
|
||
<label class="layui-form-label">参与形式</label>
|
||
<div class="layui-input-block" >
|
||
<input type="radio" name="activityFormType" value="1" title="需报名">
|
||
<input type="radio" name="activityFormType" value="2" title="直接进入">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">报名时间始<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="activityApplyStartTime" name="activityApplyStartTime" class="layui-input" value="" placeholder="请选择活动报名开始时间" readonly style="cursor: pointer;" lay-verify="required">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">报名时间终<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="activityApplyEndTime" name="activityApplyEndTime" class="layui-input" value="" placeholder="请选择活动报名结束时间" readonly style="cursor: pointer;" lay-verify="required">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">活动时间始<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="activityStartTime" name="activityStartTime" class="layui-input" value="" placeholder="请选择活动开始时间" readonly style="cursor: pointer;" lay-verify="required">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">活动时间终<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<input type="text" id="activityEndTime" name="activityEndTime" class="layui-input" value="" placeholder="请选择活动结束时间" readonly style="cursor: pointer;" lay-verify="required">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item" pane>
|
||
<label class="layui-form-label">志愿类型</label>
|
||
<div class="layui-input-block layui-form" id="voluntaryRadioTemplateBox" lay-filter="voluntaryRadioTemplateBox">
|
||
<input type="radio" name="voluntaryType" value="1" title="志愿者" lay-filter="voluntaryType" checked>
|
||
<input type="radio" name="voluntaryType" value="2" title="团队" lay-filter="voluntaryType">
|
||
</div>
|
||
</div>
|
||
<!-- 团队选择 -->
|
||
<div id="teamDiv" style="display: none;" class="layui-form-item" pane>
|
||
<label class="layui-form-label">选择团队</label>
|
||
<div class="layui-input-block">
|
||
<input type="hidden" id="teamMemberId" name="teamMemberId">
|
||
<input type="text" readonly id="teamMemberName" name="teamMemberName" class="layui-input" style="cursor:pointer;" placeholder="请选择团队成员" >
|
||
</div>
|
||
</div>
|
||
<!-- 志愿者选择 -->
|
||
<div id="volunteerDiv" class="layui-form-item" pane>
|
||
<label class="layui-form-label">选择志愿者</label>
|
||
<div class="layui-input-block">
|
||
<input type="hidden" id="volunteerId" name="volunteerId">
|
||
<input type="text" readonly id="volunteerName" name="volunteerName" class="layui-input" style="cursor:pointer;" placeholder="请选择志愿者" >
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="layui-form-item layui-form-text">
|
||
<label class="layui-form-label">活动详情<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<div id="activityDetails"></div>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item layui-form-text">
|
||
<label class="layui-form-label">报名须知<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<textarea id="activityApplyDetails" name="activityApplyDetails" class="layui-textarea" placeholder="请输入报名须知"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item layui-form-text">
|
||
<label class="layui-form-label">宣传图片<span style="color: red;">*</span></label>
|
||
<div class="layui-input-block">
|
||
<input type="hidden" id="activityImage" name="activityImage">
|
||
<div class="layui-btn-container" id="activityImageFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||
<script id="activityImageFileDownload" type="text/html">
|
||
{{# var fileName = 'activityImage'; }}
|
||
{{# if(d[fileName].length > 0) { }}
|
||
{{# var files = d[fileName];}}
|
||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||
<div class="upload-image-box">
|
||
<span class="upload-image-span">
|
||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||
</span>
|
||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="activityImageRemoveFile">
|
||
<i class="fa fa-trash-o"></i>
|
||
</a>
|
||
</div>
|
||
{{# } }}
|
||
{{# } }}
|
||
{{# if(d[fileName].length < 9) { }}
|
||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||
<a href="javascript:void(0);" lay-form-button data-explain="宣传图片" data-name="activityImage" lay-filter="activityImageUploadFile">
|
||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||
</a>
|
||
</div>
|
||
{{# } }}
|
||
</script>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item layui-form-text">
|
||
<label class="layui-form-label">宣传视频</label>
|
||
<div class="layui-input-block">
|
||
<input type="hidden" id="activityVideo" name="activityVideo">
|
||
<div class="layui-btn-container" id="activityVideoFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||
<script id="activityVideoFileDownload" type="text/html">
|
||
{{# var fileName = 'activityVideo' }}
|
||
{{# if(d[fileName] != '') { }}
|
||
{{# var files = d[fileName];}}
|
||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||
<div class="upload-video-box">
|
||
<div id="video{{i}}" style="width:300px; height:200px;"></div>
|
||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-video" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="activityVideoRemoveFile">
|
||
<i class="fa fa-trash-o"></i>
|
||
</a>
|
||
</div>
|
||
{{# } }}
|
||
{{# } }}
|
||
{{# if(d[fileName].length < 1) { }}
|
||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||
<a href="javascript:void(0);" lay-form-button data-explain="宣传视频" data-name="activityVideo" lay-filter="activityVideoUploadFile">
|
||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||
</a>
|
||
</div>
|
||
{{# } }}
|
||
</script>
|
||
</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="submitForm1">保存</button>
|
||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm2">保存并发布</button>
|
||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||
|
||
<script>
|
||
layui.config({
|
||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||
}).extend({
|
||
index: 'lib/index' //主入口模块
|
||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||
var $ = layui.$;
|
||
var form = layui.form;
|
||
var laytpl = layui.laytpl;
|
||
var laydate = layui.laydate;
|
||
var wangEditor = window.wangEditor;
|
||
var wangEditorObj = {};
|
||
var viewerObj = {};
|
||
|
||
function closeBox() {
|
||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||
}
|
||
|
||
function refreshDownloadTemplet(fileName, file) {
|
||
var dataRander = {};
|
||
dataRander[fileName] = file;
|
||
|
||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||
});
|
||
}
|
||
|
||
// 初始化服务区域-市下拉选择
|
||
function initTeamCitySelect() {
|
||
top.restAjax.get(top.restAjax.path('api/area/listallbyparentid/110889', []), {}, null, function(code, data, args) {
|
||
laytpl(document.getElementById('teamCitySelectTemplate').innerHTML).render(data, function(html) {
|
||
document.getElementById('teamCitySelectTemplateBox').innerHTML = html;
|
||
});
|
||
form.render('select', 'teamCitySelectTemplateBox');
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 初始化所属区域下拉选择
|
||
function initTeamAreaSelect(value) {
|
||
top.restAjax.get(top.restAjax.path('api/area/listallbyparentid/' + value, []), {}, null, function(code, data, args) {
|
||
laytpl(document.getElementById('teamAreaSelectTemplate').innerHTML).render(data, function(html) {
|
||
document.getElementById('teamAreaSelectTemplateBox').innerHTML = html;
|
||
});
|
||
form.render('select', 'teamAreaSelectTemplateBox');
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 初始化服务区域-旗县区下拉选择
|
||
function initTeamCountySelect(value) {
|
||
top.restAjax.get(top.restAjax.path('api/area/listallbyparentid/' + value, []), {}, null, function(code, data, args) {
|
||
laytpl(document.getElementById('teamCountySelectTemplate').innerHTML).render(data, function(html) {
|
||
document.getElementById('teamCountySelectTemplateBox').innerHTML = html;
|
||
});
|
||
form.render('select', 'teamCountySelectTemplateBox');
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 服务区域市change事件
|
||
form.on('select(teamCity)', function(data){
|
||
if(data.value) {
|
||
$('#cityName').val($("#teamCity").find("option:selected").text())
|
||
initTeamCountySelect(data.value);
|
||
}else {
|
||
$('#cityName').val('')
|
||
$("#teamCity").empty();
|
||
}
|
||
console.log($('#cityName').val())
|
||
$("#teamArea").empty();
|
||
form.render("select");
|
||
});
|
||
|
||
// 服务区域旗县区change事件
|
||
form.on('select(teamCounty)', function(data){
|
||
if(data.value) {
|
||
initTeamAreaSelect(data.value);
|
||
$('#countyName').val($("#teamCounty").find("option:selected").text())
|
||
}else {
|
||
$('#countyName').val('')
|
||
}
|
||
});
|
||
|
||
form.on('select(teamArea)', function(data){
|
||
if(data.value) {
|
||
$('#areaName').val($("#teamArea").find("option:selected").text())
|
||
}else {
|
||
$('#areaName').val('')
|
||
}
|
||
});
|
||
|
||
// 初始化文件列表
|
||
function initFileList(fileName, ids, callback) {
|
||
var dataForm = {};
|
||
dataForm[fileName] = ids;
|
||
form.val('dataForm', dataForm);
|
||
|
||
if(!ids) {
|
||
refreshDownloadTemplet(fileName, []);
|
||
if(callback) {
|
||
callback(fileName, []);
|
||
}
|
||
return;
|
||
}
|
||
|
||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||
ids: ids
|
||
}, null, function(code, data) {
|
||
refreshDownloadTemplet(fileName, data);
|
||
if(callback) {
|
||
callback(fileName, data);
|
||
}
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 初始化视频
|
||
function initVideo(fileName, data) {
|
||
for(var i = 0, item; item = data[i++];) {
|
||
var player = new ckplayer({
|
||
container: '#'+ fileName + i,
|
||
variable: 'player',
|
||
flashplayer: false,
|
||
video: {
|
||
file: 'route/file/downloadfile/true/'+ item.fileId,
|
||
type: 'video/mp4'
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
// 初始化活动类型单选
|
||
function initActivityTypeSelect() {
|
||
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/e36ad682-c6b4-44fe-a05c-889a5ff7c284', []), {}, null, function(code, data, args) {
|
||
laytpl(document.getElementById('activityTypeRadioTemplate').innerHTML).render(data, function(html) {
|
||
document.getElementById('activityTypeRadioTemplateBox').innerHTML = html;
|
||
});
|
||
form.render('radio', 'activityTypeRadioTemplateBox');
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 初始化面向对象复选
|
||
function initActivityObjectOrientedCheckbox() {
|
||
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/9e6d4c5d-3377-4445-aa05-3d29673924b1', []), {}, null, function(code, data, args) {
|
||
laytpl(document.getElementById('activityObjectOrientedCheckboxTemplate').innerHTML).render(data, function(html) {
|
||
document.getElementById('activityObjectOrientedCheckboxTemplateBox').innerHTML = html;
|
||
});
|
||
form.render('checkbox', 'activityObjectOrientedCheckboxTemplateBox');
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 初始化活动详情富文本
|
||
function initActivityDetailsRichText() {
|
||
var editor = new wangEditor('#activityDetails');
|
||
editor.customConfig.menus = [
|
||
'head', // 标题
|
||
'bold', // 粗体
|
||
'fontSize', // 字号
|
||
'fontName', // 字体
|
||
'italic', // 斜体
|
||
'underline', // 下划线
|
||
'strikeThrough', // 删除线
|
||
'foreColor', // 文字颜色
|
||
'backColor', // 背景颜色
|
||
'list', // 列表
|
||
'justify', // 对齐方式
|
||
'quote', // 引用
|
||
'emoticon', // 表情
|
||
'image', // 插入图片
|
||
'undo', // 撤销
|
||
'redo' // 重复
|
||
]
|
||
editor.customConfig.zIndex = 1000;
|
||
editor.customConfig.uploadImgMaxSize = 5 * 1024 * 1024;
|
||
editor.customConfig.uploadImgMaxLength = 1;
|
||
editor.customConfig.uploadFileName = 'image';
|
||
editor.customConfig.uploadImgServer = 'api/file/wangeditorimage';
|
||
editor.customConfig.uploadImgHooks = {
|
||
fail: function (xhr, editor, result) {
|
||
top.dialog.msg('系统错误,图片上传失败');
|
||
},
|
||
error: function (xhr, editor) {
|
||
top.dialog.msg('网络异常');
|
||
},
|
||
timeout: function (xhr, editor) {
|
||
top.dialog.msg('网络请求超时');
|
||
}
|
||
};
|
||
editor.create();
|
||
wangEditorObj['activityDetails'] = editor;
|
||
}
|
||
|
||
// 初始化活动开始时间日期
|
||
function initActivityStartTimeDate() {
|
||
laydate.render({
|
||
elem: '#activityStartTime',
|
||
type: 'datetime',
|
||
value: '',
|
||
istime: true,
|
||
calendar: true,
|
||
trigger: 'click'
|
||
});
|
||
}
|
||
|
||
// 初始化活动结束时间日期
|
||
function initActivityEndTimeDate() {
|
||
laydate.render({
|
||
elem: '#activityEndTime',
|
||
type: 'datetime',
|
||
value: '',
|
||
istime: true,
|
||
calendar: true,
|
||
trigger: 'click',
|
||
done: function(value, date, endDate){
|
||
if(compareDate($("#activityStartTime").val(),value)){
|
||
$("#activityStartTime").val("");
|
||
$("#activityEndTime").val("");
|
||
layer.msg("请输入正确的活动时间")
|
||
}
|
||
//console.log(value); //得到日期生成的值,如:2017-08-18
|
||
// console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
|
||
// console.log(endDate); //得结束的日期时间对象,开启范围选择(range: true)才会返回。对象成员同上。
|
||
}
|
||
});
|
||
}
|
||
|
||
// 点击志愿者团队选择输入框,弹出层方法
|
||
$(document).on('click', '#teamMemberName', function() {
|
||
top.dialog.dialogData.teamMemberId = '';
|
||
top.dialog.dialogData.teamMemberName = '';
|
||
top.dialog.open({
|
||
url: top.restAjax.path('route/culturalactivity/activityV1/activitylibrary/list-team-check.html', []),
|
||
title: '请选择团队',
|
||
width: '1040px',
|
||
height: '100%',
|
||
onClose: function(data) {
|
||
$("#teamMemberId").val(top.dialog.dialogData.teamMemberId);
|
||
$("#teamMemberName").val(top.dialog.dialogData.teamMemberName);
|
||
}
|
||
});
|
||
});
|
||
|
||
// 点击志愿者选择输入框,弹出层方法
|
||
$(document).on('click', '#volunteerName', function() {
|
||
top.dialog.dialogData.volunteerId = '';
|
||
top.dialog.dialogData.volunteerName = '';
|
||
top.dialog.open({
|
||
url: top.restAjax.path('route/culturalactivity/activityV1/activitylibrary/list-volunteer-check.html', []),
|
||
title: '亲选择志愿者',
|
||
width: '1040px',
|
||
height: '100%',
|
||
onClose: function(data) {
|
||
$("#volunteerId").val(top.dialog.dialogData.volunteerId);
|
||
$("#volunteerName").val(top.dialog.dialogData.volunteerName);
|
||
}
|
||
});
|
||
});
|
||
|
||
// 当单选按钮改变时,判断显示志愿者或者团队
|
||
form.on('radio(voluntaryType)', function (data) {
|
||
var value = data.value;
|
||
// value==1:志愿者
|
||
// value==2:团队
|
||
if(value == 1) {
|
||
$('#volunteerDiv').show();
|
||
$('#teamDiv').hide();
|
||
}else {
|
||
$('#volunteerDiv').hide();
|
||
$('#teamDiv').show();
|
||
}
|
||
});
|
||
|
||
// 初始化活动报名开始时间日期
|
||
function initActivityApplyStartTimeDate() {
|
||
laydate.render({
|
||
elem: '#activityApplyStartTime',
|
||
type: 'datetime',
|
||
value: '',
|
||
istime: true,
|
||
calendar: true,
|
||
trigger: 'click'
|
||
});
|
||
}
|
||
|
||
// 初始化活动报名结束时间日期
|
||
function initActivityApplyEndTimeDate() {
|
||
laydate.render({
|
||
elem: '#activityApplyEndTime',
|
||
type: 'datetime',
|
||
value: '',
|
||
trigger: 'click',
|
||
istime: true,
|
||
calendar: true,
|
||
done: function(value, date, endDate){
|
||
if(compareDate($("#activityApplyStartTime").val(),value)){
|
||
$("#activityApplyEndTime").val("");
|
||
$("#activityApplyStartTime").val("");
|
||
layer.msg("请输入正确的报名时间")
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
// 初始化活动图片图片上传
|
||
function initActivityImageUploadFile() {
|
||
var files = $('#activityImage').val();
|
||
initFileList('activityImage', files, function(fileName) {
|
||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||
viewerObj[fileName] = viewer;
|
||
});
|
||
|
||
form.on('button(activityImageUploadFile)', function(obj) {
|
||
var name = this.dataset.name;
|
||
var explain = this.dataset.explain;
|
||
top.dialog.file({
|
||
type: 'image',
|
||
title: '上传'+ explain,
|
||
width: '400px',
|
||
height: '420px',
|
||
maxFileCount: '4',
|
||
onClose: function() {
|
||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||
var files = $('#'+ name).val();
|
||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||
if(files.length > 0) {
|
||
files += ',';
|
||
}
|
||
files += file.data;
|
||
}
|
||
initFileList(name, files, function(fileName) {
|
||
viewerObj[fileName].update();
|
||
});
|
||
}
|
||
}
|
||
});
|
||
});
|
||
|
||
form.on('button(activityImageRemoveFile)', function(obj) {
|
||
var name = this.dataset.name;
|
||
var id = this.dataset.id;
|
||
var files = $('#'+ name).val().replace(id, '');
|
||
files = files.replace(/\,+/g, ',');
|
||
if(files.charAt(0) == ',') {
|
||
files = files.substring(1);
|
||
}
|
||
if(files.charAt(files.length - 1) == ',') {
|
||
files = files.substring(0, files.length - 1);
|
||
}
|
||
initFileList(name, files, function(fileName) {
|
||
viewerObj[fileName].update();
|
||
});
|
||
});
|
||
}
|
||
|
||
// 初始化活动视频视频上传
|
||
function initActivityVideoUploadFile() {
|
||
var files = $('#activityVideo').val();
|
||
initFileList('activityVideo', files, initVideo);
|
||
|
||
form.on('button(activityVideoUploadFile)', function(obj) {
|
||
var name = this.dataset.name;
|
||
var explain = this.dataset.explain;
|
||
top.dialog.file({
|
||
type: 'video',
|
||
title: '上传'+ explain,
|
||
width: '400px',
|
||
height: '420px',
|
||
maxFileCount: '1',
|
||
onClose: function() {
|
||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||
var files = $('#'+ name).val();
|
||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||
if(files.length > 0) {
|
||
files += ',';
|
||
}
|
||
files += file.data;
|
||
}
|
||
initFileList(name, files, initVideo);
|
||
}
|
||
}
|
||
});
|
||
});
|
||
|
||
form.on('button(activityVideoRemoveFile)', function(obj) {
|
||
var name = this.dataset.name;
|
||
var id = this.dataset.id;
|
||
var files = $('#'+ name).val().replace(id, '');
|
||
files = files.replace(/\,+/g, ',');
|
||
if(files.charAt(0) == ',') {
|
||
files = files.substring(1);
|
||
}
|
||
if(files.charAt(files.length - 1) == ',') {
|
||
files = files.substring(0, files.length - 1);
|
||
}
|
||
initFileList(name, files, initVideo);
|
||
});
|
||
}
|
||
|
||
|
||
// 初始化内容
|
||
function initData() {
|
||
top.restAjax.get(top.restAjax.path('api/activitylibrary/getcurrentuseridinfo', []), {}, null, function(code, data) {
|
||
initActivityTypeSelect();
|
||
initActivityObjectOrientedCheckbox();
|
||
initActivityDetailsRichText();
|
||
initActivityStartTimeDate();
|
||
initActivityEndTimeDate();
|
||
initActivityApplyStartTimeDate();
|
||
initActivityApplyEndTimeDate();
|
||
initActivityImageUploadFile();
|
||
initActivityVideoUploadFile();
|
||
initTeamCitySelect();
|
||
// 页面初始化时,默认选择显示志愿者选择框(start)
|
||
$('#volunteerDiv').show();
|
||
$('#teamDiv').hide();
|
||
// 页面初始化时,默认选择显示志愿者选择框(end)
|
||
}, 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(submitForm1)', function(formData) {
|
||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||
top.dialog.close(index);
|
||
var loadLayerIndex;
|
||
formData.field['activityObjectOriented'] = top.restAjax.checkBoxToString(formData.field, 'activityObjectOriented');
|
||
formData.field['activityDetails'] = wangEditorObj['activityDetails'].txt.html();
|
||
formData.field['activityState'] = '1';/*未发布*/
|
||
debugger
|
||
top.restAjax.post(top.restAjax.path('api/activitylibrary/saveactivitylibrary', []), 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;
|
||
});
|
||
|
||
|
||
|
||
form.on('submit(submitForm2)', function(formData) {
|
||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||
top.dialog.close(index);
|
||
var loadLayerIndex;
|
||
formData.field['activityObjectOriented'] = top.restAjax.checkBoxToString(formData.field, 'activityObjectOriented');
|
||
formData.field['activityDetails'] = wangEditorObj['activityDetails'].txt.html();
|
||
formData.field['activityState'] = '2';/*发布*/
|
||
top.restAjax.post(top.restAjax.path('api/activitylibrary/saveactivitylibrary', []), 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({
|
||
});
|
||
|
||
|
||
// 场馆选择点击事件
|
||
$("#findByActivityYenuse").on('click',function(){
|
||
top.dialog.open({
|
||
url: top.restAjax.path('route/culturalactivity/activityV1/activitylibrary/list-venuesinfo.html', []),
|
||
title: '场馆选择',
|
||
width: '1040px',
|
||
height: '97%',
|
||
onClose: function(data) {
|
||
$("#activityVenues").val(top.dialog.dialogData.activityVenues);
|
||
$("#activityVenuesId").val(top.dialog.dialogData.activityVenuesId);
|
||
$("#activityAddress").val(top.dialog.dialogData.address);
|
||
$("#activityAddressY").val(top.dialog.dialogData.latitude);
|
||
$("#activityAddressX").val(top.dialog.dialogData.longitude);
|
||
}
|
||
});
|
||
})
|
||
|
||
//地图点击件事
|
||
$("#findMapButton").on('click',function(){
|
||
top.dialog.open({
|
||
url: top.restAjax.path('route/culturalactivity/activityV1/activitylibrary/map.html', []),
|
||
title: '地址选择',
|
||
width: '1040px',
|
||
height: '100%',
|
||
onClose: function(data) {
|
||
$("#activityAddressX").val(top.dialog.dialogData.activityAddressX);
|
||
$("#activityAddressY").val(top.dialog.dialogData.activityAddressY);
|
||
$("#activityAddress").val(top.dialog.dialogData.activityAddress);
|
||
}
|
||
});
|
||
})
|
||
|
||
|
||
/*判断s1大于或等于s2*/
|
||
function compareDate(s1,s2){
|
||
/* console.log(s1,s2)*/
|
||
return ((new Date(s1.replace(/-/g,"\/")))>=(new Date(s2.replace(/-/g,"\/"))));
|
||
}
|
||
});
|
||
</script>
|
||
</body>
|
||
</html> |