admin/app/shop/view/notice/edit_notice.html

117 lines
3.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{extend name="base"/}
{block name="resources"}
<style>
.form-wrap {margin-top: 0;}
</style>
{/block}
{block name="main"}
<div class="layui-form form-wrap">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required">*</span>公告标题:</label>
<div class="layui-input-block">
<input type="text" name="title" value="{$info.title}" lay-verify="require|title" class="layui-input len-long" placeholder="请输入公告标题" maxlength="30">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">是否置顶:</label>
<div class="layui-input-block">
<input type="checkbox" name="is_top" lay-skin="switch" value="1" {if $info.is_top} checked {/if}>
</div>
</div>
<!--<div class="layui-form-item">-->
<!--<label class="layui-form-label">接收范围:</label>-->
<!--<div class="layui-input-block">-->
<!--<input type="checkbox" name="receiving_type[]" value="mobile" {if strpos($info.receiving_type,'mobile') !== false } checked {/if} lay-skin="primary" title="手机端" >-->
<!--</div>-->
<!--</div>-->
<div class="layui-form-item">
<label class="layui-form-label"><span class="required">*</span>公告内容:</label>
<div class="layui-input-block special-length">
<script id="container" name="content" type="text/plain" style="width: 800px; height: 300px;"></script>
</div>
</div>
<input type="hidden" name="id" value="{$info.id}">
<input type="hidden" value="{$info.content}" id="content" />
<div class="form-row">
<button class="layui-btn" lay-submit lay-filter="formSave">保存</button>
<button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" charset="utf-8" src="STATIC_EXT/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="STATIC_EXT/ueditor/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="STATIC_EXT/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
var ue = UE.getEditor('container');
ue.ready(function() { //对编辑器的操作最好在编辑器ready之后再做
var con = $("#content").val();
ue.setContent(con); //获取html内容返回: <p>hello</p>
});
layui.use('form', function() {
var form = layui.form,
repeat_flag = false; //防重复标识
form.render();
form.verify({
title: function(value) {
if (value.length < 1) {
return '请输入公告标题';
}
}
});
form.on('submit(formSave)', function(data) {
var html;
ue.ready(function() { //对编辑器的操作最好在编辑器ready之后再做
html = ue.getContent(); //获取html内容返回: <p>hello</p>
});
data.field.content = html;
if (data.field.content == "") {
layer.msg('请输入公告内容', {
icon: 5
});
return;
}
if (repeat_flag) return;
repeat_flag = true;
$.ajax({
url: ns.url("shop/notice/editNotice"),
data: data.field,
type: "POST",
dataType: "JSON",
success: function(res) {
repeat_flag = false;
if (res.code == 0) {
layer.confirm('编辑成功', {
title:'操作提示',
btn: ['返回列表', '继续操作'],
yes: function(){
location.href = ns.url("shop/notice/index")
},
btn2: function() {
location.reload();
}
});
}else{
layer.msg(res.message);
}
}
});
});
});
function back() {
location.href = ns.url("shop/notice/index");
}
</script>
{/block}