875 lines
43 KiB
HTML
875 lines
43 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" readonly="readonly" type="text" name="activityVenues" id="activityVenues" value="" title="场馆名称" 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="" placeholder="请输入活动地址Y坐标" >
|
||
<input type="hidden" id="activityAddressX" name="activityAddressX" value="" placeholder="请输入活动地址X坐标" >
|
||
<div class="layui-col-md5">
|
||
<input type="text" id="activityAddress" name="activityAddress" class="layui-input" value="" 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" id="cityName" name="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" id="countyName" name="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" id="areaName" name="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-col-lg6" >
|
||
<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="请选择活动报名开始时间" lay-verify="required" readonly style="cursor: pointer;">
|
||
</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="请选择活动报名结束时间" lay-verify="required" readonly style="cursor: pointer;">
|
||
</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="请选择活动开始时间" lay-verify="required" readonly style="cursor: pointer;">
|
||
</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="请选择活动结束时间" lay-verify="required" readonly style="cursor: pointer;">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">志愿类型</label>
|
||
<div class="layui-input-block">
|
||
<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" 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 layui-form">活动详情<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" id="subBtn1" class="layui-btn" lay-submit lay-filter="submitForm1">保存</button>
|
||
<button type="button" id="subBtn2" 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>
|
||
var mapObj = {};
|
||
|
||
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 activityLibraryId = top.restAjax.params(window.location.href).activityLibraryId;
|
||
var his = top.restAjax.params(window.location.href).his;
|
||
|
||
var wangEditor = window.wangEditor;
|
||
var wangEditorObj = {};
|
||
var viewerObj = {};
|
||
|
||
if(his) {
|
||
$('#subBtn1').hide();
|
||
$('#subBtn2').text("保存");
|
||
}
|
||
|
||
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 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(selectValue) {
|
||
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');
|
||
|
||
|
||
var radioObj = {};
|
||
radioObj['activityType'] = selectValue;
|
||
form.val('dataForm', radioObj);
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
|
||
|
||
// 初始化面向对象复选
|
||
function initActivityObjectOrientedCheckbox(selectValues) {
|
||
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');
|
||
|
||
var checkboxValue = selectValues.split(',');
|
||
var checkboxObj = {};
|
||
for(var j = 0, checkbox = checkboxValue[j]; checkbox = checkboxValue[j++];) {
|
||
checkboxObj['activityObjectOriented['+ checkbox +']'] = true;
|
||
}
|
||
form.val('dataForm', checkboxObj);
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 初始化活动详情富文本
|
||
function initActivityDetailsRichText(value) {
|
||
var editor = new wangEditor('#activityDetails');
|
||
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();
|
||
editor.txt.html(value);
|
||
wangEditorObj['activityDetails'] = editor;
|
||
}
|
||
|
||
// 初始化活动开始时间日期
|
||
function initActivityStartTimeDate(data) {
|
||
laydate.render({
|
||
elem: '#activityStartTime',
|
||
type: 'datetime',
|
||
value: data,
|
||
trigger: 'click'
|
||
});
|
||
}
|
||
|
||
// 初始化活动结束时间日期
|
||
function initActivityEndTimeDate(data) {
|
||
laydate.render({
|
||
elem: '#activityEndTime',
|
||
type: 'datetime',
|
||
value: data,
|
||
trigger: 'click'
|
||
});
|
||
}
|
||
|
||
// 初始化活动报名开始时间日期
|
||
function initActivityApplyStartTimeDate(data) {
|
||
laydate.render({
|
||
elem: '#activityApplyStartTime',
|
||
type: 'datetime',
|
||
value: data,
|
||
trigger: 'click'
|
||
});
|
||
}
|
||
|
||
// 初始化活动报名结束时间日期
|
||
function initActivityApplyEndTimeDate(data) {
|
||
laydate.render({
|
||
elem: '#activityApplyEndTime',
|
||
type: 'datetime',
|
||
value: data,
|
||
trigger: 'click'
|
||
});
|
||
}
|
||
|
||
// 初始化所属区域下拉选择
|
||
function initTeamAreaSelect(selectValue, areaValue) {
|
||
top.restAjax.get(top.restAjax.path('api/area/listallbyparentid/' + selectValue, []), {}, null, function(code, data, args) {
|
||
laytpl(document.getElementById('teamAreaSelectTemplate').innerHTML).render(data, function(html) {
|
||
document.getElementById('teamAreaSelectTemplateBox').innerHTML = html;
|
||
});
|
||
form.render('select', 'teamAreaSelectTemplateBox');
|
||
|
||
var selectObj = {};
|
||
selectObj['teamArea'] = areaValue;
|
||
form.val('dataForm', selectObj);
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 初始化服务区域-旗县区下拉选择
|
||
function initTeamCountySelect(selectValue, countyValue, areaValue) {
|
||
top.restAjax.get(top.restAjax.path('api/area/listallbyparentid/' + selectValue, []), {}, null, function(code, data, args) {
|
||
laytpl(document.getElementById('teamCountySelectTemplate').innerHTML).render(data, function(html) {
|
||
document.getElementById('teamCountySelectTemplateBox').innerHTML = html;
|
||
});
|
||
form.render('select', 'teamCountySelectTemplateBox');
|
||
|
||
var selectObj = {};
|
||
selectObj['teamCounty'] = countyValue;
|
||
form.val('dataForm', selectObj);
|
||
if('' != countyValue) {
|
||
initTeamAreaSelect(countyValue, areaValue);
|
||
}
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.msg);
|
||
});
|
||
}
|
||
|
||
// 初始化服务区域-市下拉选择
|
||
function initTeamCitySelect(selectValue, countyValue, areaValue) {
|
||
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');
|
||
|
||
var selectObj = {};
|
||
selectObj['teamCity'] = selectValue;
|
||
form.val('dataForm', selectObj);
|
||
|
||
if('' != selectValue) {
|
||
initTeamCountySelect(selectValue, countyValue, areaValue);
|
||
}
|
||
}, 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()
|
||
$("#teamArea").empty();
|
||
form.render("select");
|
||
}
|
||
});
|
||
|
||
// 服务区域旗县区change事件
|
||
form.on('select(teamCounty)', function(data){
|
||
if(data.value) {
|
||
$('#countyName').val($("#teamCounty").find("option:selected").text())
|
||
initTeamAreaSelect(data.value, '');
|
||
}else {
|
||
$('#countyName').val()
|
||
}
|
||
});
|
||
|
||
form.on('select(teamArea)', function(data){
|
||
if(data.value) {
|
||
$('#areaName').val($("#teamArea").find("option:selected").text())
|
||
}else {
|
||
$('#areaName').val()
|
||
}
|
||
});
|
||
|
||
// 点击志愿者团队选择输入框,弹出层方法
|
||
$(document).on('click', '#teamMemberName', function() {
|
||
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.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 initActivityFormTypeRadio(selectValue) {
|
||
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/', []), {}, null, function(code, data, args) {
|
||
laytpl(document.getElementById('activityFormTypeRadioTemplate').innerHTML).render(data, function(html) {
|
||
document.getElementById('activityFormTypeRadioTemplateBox').innerHTML = html;
|
||
});
|
||
form.render('radio', 'activityFormTypeRadioTemplateBox');
|
||
|
||
var radioObj = {};
|
||
radioObj['activityFormType'] = selectValue;
|
||
form.val('dataForm', radioObj);
|
||
}, function(code, data) {
|
||
top.dialog.msg(data.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: '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, 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 initRadioData(selValue) {
|
||
$("input[name='voluntaryType'][value="+selValue+"]").prop("checked", true);
|
||
if(selValue == 1) {
|
||
$('#volunteerDiv').show();
|
||
$('#teamDiv').hide();
|
||
}else {
|
||
$('#volunteerDiv').hide();
|
||
$('#teamDiv').show();
|
||
}
|
||
form.render();
|
||
}
|
||
|
||
|
||
// 初始化内容
|
||
function initData() {
|
||
var loadLayerIndex;
|
||
top.restAjax.get(top.restAjax.path('api/activitylibrary/getactivitylibrarybyid/{activityLibraryId}', [activityLibraryId]), {}, null, function(code, data) {
|
||
var dataFormData = {};
|
||
for(var i in data) {
|
||
dataFormData[i] = data[i];
|
||
}
|
||
form.val('dataForm', dataFormData);
|
||
form.render(null, 'dataForm');
|
||
initActivityTypeSelect(data['activityType']);
|
||
initActivityObjectOrientedCheckbox(data['activityObjectOriented']);
|
||
initActivityDetailsRichText(data['activityDetails']);
|
||
initActivityStartTimeDate(data['activityStartTime']);
|
||
initActivityEndTimeDate(data['activityEndTime']);
|
||
/*initActivityVenuesSelect(data['activityVenues']);*/
|
||
initActivityApplyStartTimeDate(data['activityApplyStartTime']);
|
||
initActivityApplyEndTimeDate(data['activityApplyEndTime']);
|
||
/*initActivityFormTypeRadio(data['activityFormType']);*/
|
||
initActivityImageUploadFile();
|
||
initActivityVideoUploadFile();
|
||
// 页面初始化时,默认选择显示志愿者选择框(start)
|
||
initRadioData(data['voluntaryType']);
|
||
// 页面初始化时,默认选择显示志愿者选择框(end)
|
||
// 页面初始化时,初始化城市(start)
|
||
initTeamCitySelect(data['city'], data['county'], data['area']);
|
||
// 页面初始化时,初始化城市(end)
|
||
// 将后台返回的志愿者id集合转存到弹出层的对象上
|
||
top.dialog.dialogData.volunteerId = data['volunteerId'];
|
||
top.dialog.dialogData.volunteerName = data['volunteerName'];
|
||
top.dialog.dialogData.teamMemberId = data['teamMemberId'];
|
||
top.dialog.dialogData.teamMemberName = data['teamMemberName'];
|
||
top.dialog.dialogData.activityVenues = data['activityVenues'];
|
||
top.dialog.dialogData.activityVenuesId = data['activityVenuesId'];
|
||
}, 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';/*未发布*/
|
||
top.restAjax.put(top.restAjax.path('api/activitylibrary/updateactivitylibrary/{activityLibraryId}', [activityLibraryId]), 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;
|
||
});
|
||
|
||
// 提交表单
|
||
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.put(top.restAjax.path('api/activitylibrary/updateactivitylibrary/{activityLibraryId}', [activityLibraryId]), 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({
|
||
});
|
||
|
||
// 场馆选择点击事件
|
||
$("#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) {
|
||
console.log(top.dialog.dialogData.activityVenues)
|
||
console.log(top.dialog.dialogData.activityVenuesId)
|
||
$("#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(){
|
||
layer.open({
|
||
type: 2,
|
||
title: '地址选择',
|
||
maxmin: true,
|
||
shadeClose: false,
|
||
area: ['80%','500px'],
|
||
content: 'route/culturalactivity/activityV1/activitylibrary/map.html',
|
||
btn: ['确认', '取消'],
|
||
btn1:function(index){
|
||
$("#activityAddressX").val(mapObj['x']);
|
||
$("#activityAddressY").val(mapObj['y']);
|
||
$("#activityAddress").val(mapObj['name']);
|
||
layer.close(index)
|
||
}
|
||
})
|
||
})
|
||
});
|
||
</script>
|
||
</body>
|
||
</html> |