You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
3.7 KiB
89 lines
3.7 KiB
{layout name="layout" /}
|
|
<div class="particle">
|
|
<div class="navs">
|
|
<a href="/bbs/index/index.html" class="active"><i class="fa fa-angle-left"></i> 返回上一页</a>
|
|
</div>
|
|
<div class="top"><span class="ic"><i class="fa fa-edit"></i></span><span class="txt">发表帖子</span></div>
|
|
<form id="poForm" method="post" >
|
|
<input type="hidden" name="parent_id" value="{$detail.parent_id|default=0}">
|
|
<input type="hidden" name="id" value="{$id}">
|
|
<div class="inputs">
|
|
<div class="topic"><input name="title" placeholder="加个标题先~(5—40个字)~" value="{$detail.name}"></div>
|
|
<div class="category">
|
|
<div class="icon"><i class="fa fa-th-large"></i></div>
|
|
<div class="select">
|
|
<select name="child_id">
|
|
<option value="">选择版区</option>
|
|
{volist name="cates" id="vo" key="key"}
|
|
<option value="{$vo.id}" data-pid="{$vo.id}" {if condition="$vo['id'] eq $detail['child_id']"}selected{/if} {if condition="count($vo['childs'])"}disabled{/if}> {$vo.name}</option>
|
|
{if condition="count($vo['childs'])"}
|
|
{volist name="vo.childs" id="jo"}
|
|
<option value="{$jo.id}" data-pid="{$vo.id}" {if condition="$jo['id'] eq $detail['child_id']"}selected{/if}> └ {$jo.name}</option>
|
|
{/volist}
|
|
{/if}
|
|
{/volist}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="infor">
|
|
<textarea name="content" id="content" style="min-height:300px;width:100%;" placeholder="请输入您的文章内容">{$detail.content}</textarea>
|
|
</div>
|
|
<div class="btns">
|
|
<a href="javascript:void(0);" class="sendbtn">发表</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<script src="{:SITE_PATH}__PUBLIC__/kindeditor/kindeditor-all-min.js" type="text/javascript"></script>
|
|
<script type="text/javascript">
|
|
var wid=$(window).width();
|
|
wid=wid-20;
|
|
console.log(wid);
|
|
var editor;
|
|
KindEditor.ready(function(K) {
|
|
editor=K.create('#content', {
|
|
items:['bold','italic','image','emoticons'],
|
|
noDisableItems : ['bold','italic','image','emoticons'],
|
|
allowFileManager : true
|
|
});
|
|
|
|
});
|
|
$(function(){
|
|
$("[name='child_id']").change(function(){
|
|
var val=$('[name="child_id"]').find("option:selected").val();
|
|
var cur=$('[name="child_id"]').find("option:selected").index();
|
|
var pid=$('[name="child_id"]').find("option:selected").data('pid');
|
|
$("[name='parent_id']").val(pid);
|
|
});
|
|
$(".sendbtn").click(function(){
|
|
editor.sync();
|
|
var form=$("#poForm").serialize();
|
|
var url="{:url('article')}";
|
|
var pid=$("[name='child_id']").find("option:selected").val();
|
|
if(typeof pid=='undefined'||pid==''){
|
|
layer.msg("请选择版块");
|
|
return false;
|
|
}
|
|
var title=$("[name='title']").val();
|
|
if(typeof title=='undefined'||title==''){
|
|
layer.msg("请输入标题");
|
|
return false;
|
|
}
|
|
var content=editor.html();
|
|
if(typeof content=='undefined'||content==''||content=='请输入您的文章内容'){
|
|
layer.msg("请输入文章内容");
|
|
return false;
|
|
}
|
|
$.post(url,form,function(res){
|
|
var jump=res.url;
|
|
layer.msg(res.msg);
|
|
if(jump!=''){
|
|
setTimeout(function(){
|
|
window.location.href=jump;
|
|
},3000);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|