496 lines
27 KiB
HTML
Executable File
496 lines
27 KiB
HTML
Executable File
<!-- Content Wrapper. Contains page content -->
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
新增新闻
|
|
</h1>
|
|
<ol class="breadcrumb">
|
|
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
|
|
<li><a href="<?php echo url('/admin/article/lists');?>"> 新闻列表</a></li>
|
|
<li class="active"> 新闻</li>
|
|
</ol>
|
|
</section>
|
|
|
|
<!-- Main content -->
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-md-10">
|
|
<form class="form-horizontal" action="<?php echo url('/admin/article/create');?>" method="post">
|
|
<div class="nav-tabs-custom">
|
|
<ul class="nav nav-tabs">
|
|
<li class="active"><a href="#navfirst" data-toggle="tab"><i class="fa fa-edit text-green"></i> 基本信息</a></li>
|
|
<li><a href="#navsecond" data-toggle="tab">详细内容</a></li>
|
|
<li><a href="#navthird" data-toggle="tab">图片信息</a></li>
|
|
<li><a href="#navfourth" data-toggle="tab">SEO设置</a></li>
|
|
</ul>
|
|
<div class="tab-content">
|
|
<div class="active tab-pane" id="navfirst">
|
|
<div class="form-group">
|
|
<label for="name" class="col-sm-2 control-label">新闻名称<em style="color:red;">*</em></label>
|
|
<div class="col-sm-5">
|
|
<input type="text" class="form-control" name="name" id="name" required>
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(新闻名称)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="cid" class="col-sm-2 control-label">所属分类<em style="color:red;">*</em></label>
|
|
<div class="col-sm-5">
|
|
<select class="form-control" name="cid" id="cid" >
|
|
<option value="0" selected="">默认值</option>
|
|
<?php echo $categoryOptions;?>
|
|
</select>
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(所属分类)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label" for="product_series">所属型号</label>
|
|
<div class="col-sm-5">
|
|
<div class="mult-select-imitate">
|
|
<div class="mult-select-view">默认值</div>
|
|
<span class="mult-select-icon-cert">^</span>
|
|
<input type="hidden" name="product_series" id="product_series" />
|
|
<select multiple size="15">
|
|
<?php echo $seriesOptions;?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(按ctrl键多选)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="sort" class="col-sm-2 control-label">新闻排序<em style="color:red;">*</em></label>
|
|
<div class="col-sm-2">
|
|
<input type="text" class="form-control" name="sort" id="sort" value="9999">
|
|
</div>
|
|
<div class="col-sm-5 col-sm-offset-3">
|
|
<span class="help-block">(新闻排序)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="viewcount" class="col-sm-2 control-label">浏览数量<em style="color:red;">*</em></label>
|
|
<div class="col-sm-2">
|
|
<input type="text" class="form-control" name="viewcount" id="viewcount">
|
|
</div>
|
|
<div class="col-sm-5 col-sm-offset-3">
|
|
<span class="help-block">(浏览数量)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="viewcount" class="col-sm-2 control-label">点赞数量</label>
|
|
<div class="col-sm-2">
|
|
<input type="text" class="form-control" name="zancount" value="0">
|
|
</div>
|
|
<div class="col-sm-5 col-sm-offset-3">
|
|
<span class="help-block">(点赞数量)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="headline" class="col-sm-2 control-label">首页推荐</label>
|
|
<div class="col-sm-5">
|
|
<label class="radio-inline">
|
|
<input type="radio" name="headline" value="1"> 是
|
|
</label>
|
|
<label class="radio-inline">
|
|
<input type="radio" name="headline" value="0" checked> 否
|
|
</label>
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(首页推荐)</span>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="form-group">
|
|
<label for="ishot" class="col-sm-2 control-label">热门推荐</label>
|
|
<div class="col-sm-5">
|
|
<label class="radio-inline">
|
|
<input type="radio" name="ishot" value="1"> 是
|
|
</label>
|
|
<label class="radio-inline">
|
|
<input type="radio" name="ishot" value="0" checked> 否
|
|
</label>
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(热门推荐)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="recommend" class="col-sm-2 control-label">是否推荐</label>
|
|
<div class="col-sm-5">
|
|
<label class="radio-inline">
|
|
<input type="radio" name="recommend" value="1"> 是
|
|
</label>
|
|
<label class="radio-inline">
|
|
<input type="radio" name="recommend" value="0" checked> 否
|
|
</label>
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(是否推荐)</span>
|
|
</div>
|
|
</div>-->
|
|
<div class="form-group jump_link" style="display:none;">
|
|
<label for="jump_link" class="col-sm-2 control-label">社区链接</label>
|
|
<div class="col-sm-5">
|
|
<input type="text" class="form-control" id="jump_link" name="jump_link">
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(社区评测)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="writer" class="col-sm-2 control-label">新闻作者</label>
|
|
<div class="col-sm-5">
|
|
<input type="text" class="form-control" name="writer">
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(新闻作者)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="source" class="col-sm-2 control-label">新闻来源</label>
|
|
<div class="col-sm-5">
|
|
<input type="text" class="form-control" name="source">
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(新闻来源)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="tags" class="col-sm-2 control-label">新闻标签</label>
|
|
<div class="col-sm-5">
|
|
<input type="text" class="form-control" name="tags">
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(新闻标签,多个用英文逗号分隔)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="description" class="col-sm-2 control-label">新闻描述</label>
|
|
<div class="col-sm-10">
|
|
<textarea class="form-control" id="description" name="description"></textarea>
|
|
</div>
|
|
<div class="col-sm-10 col-sm-offset-2">
|
|
<span class="help-block">(新闻描述)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="createtime" class="col-sm-2 control-label">发布时间</label>
|
|
<div class="col-sm-5">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" name="createtime" value="<?php //echo date('Y-m-d H:i:s');?>" id="laydate_createtime" onclick="laydate_datetime('#laydate_createtime')" readonly>
|
|
<span class="input-group-btn">
|
|
<button class="btn btn-primary" type="button" onclick="laydate_datetime('#laydate_createtime')">选择时间</button>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(发布时间)</span>
|
|
</div>
|
|
</div>
|
|
<!--
|
|
<div class="form-group">
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
<div class="checkbox">
|
|
<label><input type="checkbox" name="agree"> 确认</label>
|
|
</div>
|
|
</div>
|
|
</div>-->
|
|
</div>
|
|
<!-- /.tab-pane -->
|
|
|
|
<div class="tab-pane" id="navsecond">
|
|
<div class="box box-info">
|
|
<div class="box-header">
|
|
<h3 class="box-title">内容详情
|
|
<small>放置主要内容</small>
|
|
</h3>
|
|
<!-- tools box -->
|
|
<div class="pull-right box-tools">
|
|
<button type="button" class="btn btn-info" data-widget="collapse" data-toggle="tooltip" title="Collapse">
|
|
<i class="fa fa-minus"></i></button>
|
|
<button type="button" class="btn btn-info" data-widget="remove" data-toggle="tooltip" title="Remove">
|
|
<i class="fa fa-times"></i></button>
|
|
</div>
|
|
<!-- /.tools -->
|
|
</div>
|
|
<!-- /.box-header -->
|
|
<div class="box-body">
|
|
<textarea id="content" style="width: 100%;height:500px;" name="content" rows="10" cols="80" placeholder="请输入内容..."></textarea>
|
|
</div>
|
|
</div>
|
|
<!-- /.box -->
|
|
</div>
|
|
|
|
<!-- /.tab-pane -->
|
|
<div class="tab-pane" id="navthird">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">新闻图片</label>
|
|
<div class="col-sm-10">
|
|
<div class="table-responsive">
|
|
<table class="table">
|
|
<tbody>
|
|
<tr>
|
|
<td class="text-left">
|
|
<a href="javascript:void(0);" id="article-image" data-toggle="image" class="img-thumbnail"><img class="img-responsive" src="/uploads/nopic.jpg"/></a>
|
|
<input type="hidden" name="picture" value="/uploads/nopic.jpg" id="input-image" />
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="col-sm-5">
|
|
<span class="help-block">(主要图片)</span>
|
|
</div>-->
|
|
</div>
|
|
</div>
|
|
<!-- /.tab-pane -->
|
|
<div class="tab-pane" id="navfourth">
|
|
<div class="form-group">
|
|
<label for="seo_title" class="col-sm-2 control-label">SEO标题</label>
|
|
<div class="col-sm-5">
|
|
<input type="text" class="form-control" name="seo_title">
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(SEO标题)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="seo_keyword" class="col-sm-2 control-label">SEO关键词</label>
|
|
<div class="col-sm-5">
|
|
<input type="text" class="form-control" name="seo_keyword">
|
|
</div>
|
|
<div class="col-sm-5">
|
|
<span class="help-block">(SEO关键词)</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="seo_description" class="col-sm-2 control-label">SEO描述</label>
|
|
<div class="col-sm-10">
|
|
<textarea class="form-control" id="seo_description" name="seo_description"></textarea>
|
|
</div>
|
|
<div class="col-sm-10 col-sm-offset-2">
|
|
<span class="help-block">(SEO描述)</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /.tab-pane -->
|
|
</div>
|
|
<!-- /.tab-content -->
|
|
<div class="nav-footer row">
|
|
<div class="col-sm-2 col-sm-offset-2">
|
|
<p><button id="reset-btn" type="button" class="btn btn-warning btn-block">重置</button></p>
|
|
</div>
|
|
<div class="col-sm-2">
|
|
<p><button id="submit-btn" type="submit" class="btn btn-danger btn-block">提交</button></p>
|
|
</div>
|
|
<!-- /. row -->
|
|
</div>
|
|
</div>
|
|
<!-- /.nav-tabs-custom -->
|
|
</form>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="box box-primary">
|
|
<div class="box-header">
|
|
<h3 class="box-title">快捷入口</h3>
|
|
</div>
|
|
<div class="box-body">
|
|
<a href="<?php echo url('/admin/article/lists');?>" class="btn btn-block btn-primary">新闻列表</a>
|
|
<a href="<?php echo url('/admin/article_category/lists');?>" class="btn btn-block btn-primary">新闻分类</a>
|
|
<a href="<?php echo url('/admin/article/add');?>" class="btn btn-block btn-primary">添加新闻</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<!-- /.content -->
|
|
</div>
|
|
<style>
|
|
.table thead > tr > td,
|
|
.table tbody > tr > td {
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.mult-select-imitate {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 34px;
|
|
}
|
|
|
|
.mult-select-imitate .mult-select-view {
|
|
width: 100%;
|
|
height: 34px;
|
|
color: #555;
|
|
padding: 6px 12px;
|
|
border: 1px solid #ccc;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.mult-select-imitate .mult-select-view.active {
|
|
border: 1px solid rgb(60, 141, 188);
|
|
}
|
|
|
|
.mult-select-imitate .mult-select-icon-cert {
|
|
position: absolute;
|
|
top: 6px;
|
|
right: 8px;
|
|
font-size: 14px;
|
|
transform: scaleX(160%) rotate(180deg);
|
|
}
|
|
|
|
.mult-select-imitate select {
|
|
position: absolute;
|
|
top: 34px;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
display: none;
|
|
width: calc(100% - 2px);
|
|
box-shadow:
|
|
0px 1px 1px -2px rgb(85, 85, 85, 0.2),
|
|
-1px 0px 1px -2px rgb(85, 85, 85, 0.2),
|
|
1px 0px 1px -2px rgb(85, 85, 85, 0.2),
|
|
0px -1px 0px -2px rgb(255, 255, 255);
|
|
z-index: 2;
|
|
outline: 0;
|
|
}
|
|
</style>
|
|
<!-- /.content-wrapper -->
|
|
<?php echo editor('#content');?>
|
|
<script type="text/javascript">
|
|
function checkUrl(url) {
|
|
var reg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\/])+$/;
|
|
|
|
if(!reg.test(url)) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
$(function () {
|
|
var visit = ['none', 'block']
|
|
$('div.mult-select-imitate div.mult-select-view').click(function () {
|
|
var target = $(this).siblings('select')
|
|
var idx = Number(target.css('display') == 'none')
|
|
$(this).toggleClass('active')
|
|
$(this).siblings('select').css('display', visit[idx])
|
|
$(this).siblings('select').get(0).focus()
|
|
})
|
|
$('div.mult-select-imitate select').change(function () {
|
|
var vals = $(this).val()
|
|
var txts = []
|
|
$(this).children().each(function (i, v) {
|
|
if ($.inArray($(v).attr('value'), vals) >= 0) {
|
|
txts.push($(v).text())
|
|
}
|
|
})
|
|
$('div.mult-select-imitate div.mult-select-view').text(txts)
|
|
$('div.mult-select-imitate input[type="hidden"]').val(vals.join(","))
|
|
})
|
|
$('div.mult-select-imitate select').blur(function () {
|
|
$(this).css('display', 'none')
|
|
$('div.mult-select-imitate div.mult-select-view').toggleClass('active')
|
|
})
|
|
})
|
|
|
|
$(function() {
|
|
$("#cid").on("change",function(){
|
|
console.log(222222);
|
|
var selectedValue = $(this).val();
|
|
$("#jump_link").val('');
|
|
if(selectedValue == 2){
|
|
$(".jump_link").show();
|
|
}
|
|
else{
|
|
$(".jump_link").hide();
|
|
|
|
}
|
|
});
|
|
|
|
|
|
$("#reset-btn").click(function(e) {
|
|
if (confirm('确认重置所有表单项吗?')) {
|
|
this.form.reset();
|
|
}
|
|
});
|
|
$("form.form-horizontal").submit(function(e) {
|
|
var nameObj = document.getElementById('name');
|
|
if (isNull(nameObj.value)) {
|
|
alert('名称必须填写');
|
|
nameObj.focus();
|
|
return false;
|
|
}
|
|
var cidObj = document.getElementById('cid');
|
|
if (isNaN(cidObj.value) || !parseInt(cidObj.value)) {
|
|
alert('所属分类值无效');
|
|
cidObj.focus();
|
|
return false;
|
|
}
|
|
var sortObj = document.getElementById('sort');
|
|
if (isNaN(sortObj.value)) {
|
|
alert('排序值必须是数字');
|
|
sortObj.focus();
|
|
return false;
|
|
}
|
|
var viewcountObj = document.getElementById('viewcount');
|
|
if (isNaN(viewcountObj.value)) {
|
|
alert('浏览数量值必须是数字');
|
|
viewcountObj.focus();
|
|
return false;
|
|
}
|
|
|
|
|
|
var linkObj = document.getElementById('jump_link');
|
|
if (linkObj.value) {
|
|
|
|
if(!checkUrl(linkObj.value)){
|
|
linkObj.focus();
|
|
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
// var agree = $("input[name='agree']", this).prop('checked');
|
|
// if (agree) {
|
|
// alert("Submitted");
|
|
// e.preventDefault();
|
|
// } else {
|
|
// e.preventDefault();
|
|
// alert("请勾选确认");
|
|
// }
|
|
});
|
|
// $("#btn-subcid").click(function(e) {
|
|
// var subcolumn = '';
|
|
// if ($("#subcid").val())
|
|
// subcolumn = encodeURIComponent($("#subcid").val());
|
|
// $('#modal-subcolumn').remove();
|
|
// $.ajax({
|
|
// url: "<?php echo url('/admin/article_category/subcolumn');?>",
|
|
// data: {subcolumn: subcolumn},
|
|
// dataType: 'html',
|
|
// success: function(html) {
|
|
// $('body').append('<div id="modal-subcolumn" class="modal fade">' + html + '</div>');
|
|
// $('#modal-subcolumn').modal({show: true, backdrop: 'static'});
|
|
// }
|
|
// });
|
|
// });
|
|
});
|
|
</script>
|
|
<script type="text/javascript">
|
|
var image_row = "<?php echo '0';?>";
|
|
function addImage() {
|
|
html = '<tr id="image-row' + image_row + '">';
|
|
html += ' <td class="text-left"><a href="" id="thumb-image' + image_row + '"data-toggle="image" class="img-thumbnail"><img class="img-responsive" src="/uploads/nopic.jpg" alt="" title="" data-placeholder="/uploads/nopic.jpg" /></a><input type="hidden" name="product_image[' + image_row + '][image]" value="" id="input-image' + image_row + '" /></td>';
|
|
html += ' <td class="text-right"><input type="text" name="product_image[' + image_row + '][sort_order]" value="" placeholder="排序" class="form-control" size="2"/></td>';
|
|
html += ' <td class="text-left"><button type="button" onclick="$(\'#image-row' + image_row + '\').remove();" data-toggle="tooltip" title="删除" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
|
|
html += '</tr>';
|
|
$('#images tbody').append(html);
|
|
image_row++;
|
|
}
|
|
</script> |