Commit 69699848 by 李洋

update code

parent 51d18a21
//选择定时推送时间
layui.use('laydate', function(){ layui.use('laydate', function(){
var laydate = layui.laydate; var laydate = layui.laydate;
...@@ -8,4 +9,165 @@ layui.use('laydate', function(){ ...@@ -8,4 +9,165 @@ layui.use('laydate', function(){
,type:'datetime' ,type:'datetime'
,format:'yyyy-MM-dd HH:mm' ,format:'yyyy-MM-dd HH:mm'
}); });
}); });
\ No newline at end of file
$('#msg_tpl_submit').click(function()
{
//前端校验
//1.消息渠道 、 模板描述 和 消息模板
if(!$("input[id='chk-channels-inner']").is(':checked') && !$("input[id='chk-channels-sms']").is(':checked') &&
!$("input[id='chk-channels-email']").is(':checked') && !$("input[id='chk-channels-wechat-notify']").is(':checked'))
{
Prompt('请勾选至少一个消息渠道', 5);
return false;
}
if(!$('#msg-tpl-desc').val())
{
Prompt('请输入模板描述', 5);
return false;
}
//2.渠道模板
//站内信
if($("input[id='chk-channels-inner']").is(':checked'))
{
if($("#inner-tpl-type option:selected").val()==0)
{
Prompt('请选择消息类型', 5);
return false;
}
if(!$('#inner-tpl-title').val())
{
Prompt('请填写消息标题', 5);
return false;
}
var ue = UE.getEditor('inner-tpl-content');
if(!ue.getContent())
{
Prompt('请填写消息内容', 5);
return false;
}
if(!$("input[id='inner-tpl-op-url']").is(':checked') && !$("input[id='inner-tpl-op-open']").is(':checked'))
{
Prompt('请选择点击消息操作', 5);
return false;
}
if($("input[id='inner-tpl-op-url']").is(':checked') && !$("#inner-tpl-op-url-text").val())
{
Prompt('请填写要打开的url', 5);
return false;
}
}
//短信
if($("input[id='chk-channels-sms']").is(':checked'))
{
if(!$("#sms-tpl-content").val())
{
Prompt('请填写短信内容', 5);
return false;
}
}
//邮件
if($("input[id='chk-channels-email']").is(':checked'))
{
if(!$("#email-tpl-title").val())
{
Prompt('请填写邮件标题', 5);
return false;
}
var ue = UE.getEditor('email-tpl-content');
if(!ue.getContent())
{
Prompt('请填写邮件内容', 5);
return false;
}
}
//微信通知
if($("input[id='chk-channels-wechat-notify']").is(':checked'))
{
if(!$("#wechat-notify_tpl_title").val())
{
Prompt('请填写微信模板编号', 5);
return false;
}
}
//3.用户范围 发送时间
if($("input[id='user-range-specified']").is(':checked') && !$('#msg-specified-users-text').val())
{
Prompt('请填写指定用户', 5);
return false;
}
if($("input[id='send-time-specified']").is(':checked') && !$('#Choice_start').val())
{
Prompt('请填写定时推送时间', 5);
return false;
}
// addTemplate();
})
function addTemplate()
{
$.ajax({
type: 'post',
url: '/msgapi/addTemplate',
timeout : 10000, //超时时间设置,单位毫秒
data: {
spu_id:$('#spu_id').val(),
class_id1:$('#class_id1').val(),
class_id2:$('#class_id2').val(),
class_id3:$('#class_id3').val(),
brand_id:$('#brand_id').val(),
spu_name:$('#spu_name').val(),
status:$("input[name='status']:checked").val(),
images_l:$('#images_l').val(),
images_s:$('#images_s').val(),
encap:$('#encap').val(),
pdf:$('#pdf').val(),
spu_brief:$('#spu_brief').val(),
has_rohs:$("input[name='has_rohs']:checked").val(),
attrs:$('#spu_attrs').val(),
spu_detail:ue.getContent(),
bussiness_area:checkBoxes,
},
dataType: 'json',
success: function(resp){
if(!resp){
Prompt('网络异常,请重试', 5);
return false;
}
if(resp.errcode==0){
Prompt(resp.errmsg, 1);
location.reload();
}else{
Prompt(resp.errmsg, 5);
return false;
}
},
error:function(jqXHR, textStatus, errorThrown){
Prompt("网络异常,请重试",5);
},
});
}
//监听短信内容,计算短信条数
$('#sms-tpl-content').bind('input propertychange', function() {
$('#sms-content-length').html('预计' + Math.ceil($(this).val().length/70) + '条短信');
});
//获取点选了的消息渠道复选框
function getChosenMsgChannels()
{
var chk_values = [];
$('input[name="chk-channels"]:checked').each(function(){
chk_values.push($(this).val());
});
var chk_str = chk_values.join(",");
return chk_str;
}
\ No newline at end of file
...@@ -107,7 +107,6 @@ ...@@ -107,7 +107,6 @@
<div class="col-sm-10 form-inline" style="margin-top: 20px"> <div class="col-sm-10 form-inline" style="margin-top: 20px">
<label class="col-sm-2 control-label" id="msg-tpl-channels"><span style="color: red">*</span> 消息渠道:</label> <label class="col-sm-2 control-label" id="msg-tpl-channels"><span style="color: red">*</span> 消息渠道:</label>
<div class="col-sm-4"> <div class="col-sm-4">
{{--<label>@if(empty($info->channels_str)) 未填写任何渠道 @else {{ $info->channels_str }} @endif</label>--}}
<input type="checkbox" name="chk-channels" id="chk-channels-inner" value="1" @if(!empty($isContainInner)) checked @endif/><label>站内信</label> <input type="checkbox" name="chk-channels" id="chk-channels-inner" value="1" @if(!empty($isContainInner)) checked @endif/><label>站内信</label>
<input type="checkbox" name="chk-channels" id="chk-channels-sms" value="2" @if(!empty($isContainSMS)) checked @endif/><label>短息</label> <input type="checkbox" name="chk-channels" id="chk-channels-sms" value="2" @if(!empty($isContainSMS)) checked @endif/><label>短息</label>
<input type="checkbox" name="chk-channels" id="chk-channels-email" value="3" @if(!empty($isContainEmail)) checked @endif/><label>邮箱</label> <input type="checkbox" name="chk-channels" id="chk-channels-email" value="3" @if(!empty($isContainEmail)) checked @endif/><label>邮箱</label>
...@@ -123,7 +122,7 @@ ...@@ -123,7 +122,7 @@
</div> </div>
<div class="col-sm-10 form-inline" style="margin-top: 20px"> <div class="col-sm-10 form-inline" style="margin-top: 20px">
<label class="col-sm-2 control-label"><span style="color: red">*</span> 选择模板:</label> <label class="col-sm-2 control-label"> 选择模板:</label>
<div class="col-sm-3"> <div class="col-sm-3">
<select class="form-control" name="inner-choose-type" id="choose-tpl"> <select class="form-control" name="inner-choose-type" id="choose-tpl">
@if(empty($info->tpl_id)) @if(empty($info->tpl_id))
...@@ -132,11 +131,6 @@ ...@@ -132,11 +131,6 @@
@for($i=0;$i<count($all_msg_tpl);$i++) @for($i=0;$i<count($all_msg_tpl);$i++)
<option value="{{ $all_msg_tpl[$i]->tpl_id }}" @if($info->tpl_id==$all_msg_tpl[$i]->tpl_id) selected @endif>{{ $all_msg_tpl[$i]->description }}</option> <option value="{{ $all_msg_tpl[$i]->tpl_id }}" @if($info->tpl_id==$all_msg_tpl[$i]->tpl_id) selected @endif>{{ $all_msg_tpl[$i]->description }}</option>
@endfor @endfor
{{--<option value="0">请选择</option>--}}
{{--<option value="1">模板1</option>--}}
{{--<option value="2">模板2</option>--}}
{{--<option value="3">模板3</option>--}}
{{--<option value="4">模板4</option>--}}
</select> </select>
</div> </div>
</div> </div>
...@@ -238,7 +232,7 @@ ...@@ -238,7 +232,7 @@
</div> </div>
<div class="col-sm-10" style="margin-top: 20px"> <div class="col-sm-10" style="margin-top: 20px">
<label>邮件内容:</label> <label><span style="color: red">*</span>邮件内容:</label>
<script type="text/plain" id="email-tpl-content" name="email-tpl-content">@if(!empty($info->channel_tpls['3']->content)) {{ $info->channel_tpls['3']->content }} @endif</script> <script type="text/plain" id="email-tpl-content" name="email-tpl-content">@if(!empty($info->channel_tpls['3']->content)) {{ $info->channel_tpls['3']->content }} @endif</script>
<script type="text/javascript">UE.getEditor('email-tpl-content');</script> <script type="text/javascript">UE.getEditor('email-tpl-content');</script>
</div> </div>
...@@ -263,9 +257,9 @@ ...@@ -263,9 +257,9 @@
<div class="col-sm-10 form-inline" style="margin-top: 20px;margin-left: 40px"> <div class="col-sm-10 form-inline" style="margin-top: 20px;margin-left: 40px">
<label class="col-sm-2 control-label"><span style="color: red">*</span> 用户范围:</label> <label class="col-sm-2 control-label"><span style="color: red">*</span> 用户范围:</label>
<div class="col-sm-5"> <div class="col-sm-5">
<input type="radio" name="user-range" id="user-range-all" class="form-control" value="1" @if(!empty($info->obj_user) && ($info->obj_user == 'all')) checked @endif/><label for="user-range-all">所有用户</label> <input type="radio" name="user-range" id="user-range-all" class="form-control" value="1" @if(empty($info->obj_user)) checked @endif/><label for="user-range-all">所有用户</label>
<input type="radio" name="user-range" id="user-range-specified" class="form-control" value="3" @if(!empty($info->obj_user) && ($info->obj_user != 'all')) checked @endif/><label for="user-range-specified">指定用户</label> <input type="radio" name="user-range" id="user-range-specified" class="form-control" value="3" @if(!empty($info->obj_user)) checked @endif/><label for="user-range-specified">指定用户</label>
<input type="text" id="msg-specified-users-text" name="msg-specified-users-text" placeholder="请输入指定用户手机号" style="width: 200px" value="{{ $info->obj_user }}"/> <input type="text" id="msg-specified-users-text" name="msg-specified-users-text" placeholder="请输入指定用户" style="width: 200px" value="{{ $info->obj_user }}"/>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment