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.
130 lines
4.8 KiB
130 lines
4.8 KiB
{layout name="public/layout" /}
|
|
<script src="__PUBLIC__/kindeditor/kindeditor-all-min.js" type="text/javascript"></script>
|
|
<script src="__PUBLIC__/layer/layer_home.js" type="text/javascript"></script>
|
|
<style>
|
|
.edui-default .edui-toolbar{padding:4px 1px;}
|
|
.edui-default .edui-editor-toolbarboxouter{background-color:#fff;border:1px solid #c2cfcc;background-image:none;box-shadow:none;border-radius:0px;}
|
|
.edui-default .edui-editor-toolbarbox{box-shadow:none !important;}
|
|
</style>
|
|
<div class="bbs">
|
|
<a href="javascript:void(0);" class="sendbtn">发表</a>
|
|
<div class="particle">
|
|
<form id="poForm" method="post" >
|
|
<input type="hidden" name="child_id" value="{$detail.child_id|default=0}">
|
|
<input type="hidden" name="id" value="{$id}">
|
|
<div class="category">
|
|
<div class="icon"><i class="fa fa-th-large"></i></div>
|
|
<div class="select">
|
|
<select name="parent_id">
|
|
<option value="">选择版区</option>
|
|
{volist name="cates" id="vo" key="key"}
|
|
<option value="{$vo.id}">{$vo.name}</option>
|
|
{/volist}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="childswraper">
|
|
{volist name="cates" id="vo"}
|
|
{if condition="count($vo['childs'])"}
|
|
<div class="childsrow">
|
|
<a href="javascript:void(0);" class="active" data-id="0">全部</a>
|
|
{volist name="vo.childs" id="jo"}
|
|
<a href="javascript:void(0);" data-id="{$jo.id}">{$jo.name}</a>
|
|
{/volist}
|
|
</div>
|
|
{/if}
|
|
{/volist}
|
|
</div>
|
|
<div class="topic"><input name="title" placeholder="加个标题先~(5—40个字)~" value="{$detail.name}"></div>
|
|
<div class="infor">
|
|
<textarea name="content" id="content" style="min-height:300px;width:100%;" placeholder="请输入您的文章内容">{$detail.content}</textarea>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<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(){
|
|
var parentid="{$detail.parent_id}";
|
|
var childid="{$detail.child_id|default=0}";
|
|
$("[name='parent_id']").change(function(){
|
|
var val=$('[name="parent_id"]').find("option:selected").val();
|
|
var cur=$('[name="parent_id"]').find("option:selected").index();
|
|
$("[name='child_id']").val(0);
|
|
$(".childsrow").hide();
|
|
if(val){
|
|
$(this).addClass('open');
|
|
if(cur)$(".childsrow").eq(cur-1).slideDown();
|
|
}else{
|
|
$(this).removeClass('open');
|
|
if(cur)$(".childsrow").eq(cur-1).slideUp();
|
|
}
|
|
});
|
|
if(parentid!=""){
|
|
$("[name='parent_id'] option").each(function(){
|
|
var val=$(this).val();
|
|
if(val==parentid){
|
|
$(this).prop("selected",true);
|
|
$("[name='parent_id']").trigger("change");
|
|
$("[name='child_id']").val(childid);
|
|
|
|
var cur=$('[name="parent_id"]').find("option:selected").index();
|
|
cur=cur-1;
|
|
$(".childsrow:eq("+cur+") a").each(function(){
|
|
var self=this;
|
|
var cval=$(self).data('id');
|
|
if(cval==childid){
|
|
$(".childsrow a").removeClass('active');
|
|
$(self).addClass('active');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
$(".childsrow a").click(function(){
|
|
$(".childsrow a").removeClass('active');
|
|
$(this).addClass('active');
|
|
var id=$(this).data("id");
|
|
$("[name='child_id']").val(id);
|
|
});
|
|
$(".sendbtn").click(function(){
|
|
editor.sync();
|
|
var form=$("#poForm").serialize();
|
|
var url="{:url('article')}";
|
|
var pid=$("[name='parent_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>
|