init
This commit is contained in:
321
app/admin/view/navigation/add.html
Executable file
321
app/admin/view/navigation/add.html
Executable file
@@ -0,0 +1,321 @@
|
||||
<!-- 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/navigation/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/navigation/create');?>" method="post">
|
||||
<div class="nav-tabs-custom">
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="active tab-pane" id="navfirst">
|
||||
<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 c-p chosen-select" id="change_data" name="nav_type" data-placeholder="导航类型..." data-validation-message="导航类型选择错误">
|
||||
<option value="0">导航类型...</option>
|
||||
|
||||
<?php foreach($dataType as $ks=>$value):?>
|
||||
<option value="<?php echo $ks;?>" ><?php echo $value;?></option>
|
||||
<?php endforeach;?>
|
||||
|
||||
</select>
|
||||
</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">导航级别</label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control c-p chosen-select" name="pid" data-placeholder="一级栏目..." data-validation-message="导航级别选择错误" id="category_level" >
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="data_type" class="col-sm-2 control-label">数据类型<em style="color:red;">*</em></label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control c-p chosen-select" id="change_type" name="data_type" data-placeholder="数据类型..." data-validation-message="数据类型选择错误">
|
||||
<option value="">数据类型...</option>
|
||||
<?php foreach($typeOption as $kt=> $type):?>
|
||||
<option value="<?php echo $kt;?>" ><?php echo $type;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group chosed-select" id="nav-data">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<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 value="">
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-group chosed-select" id="nav-custom" style="display:none;">
|
||||
<label for="cid" class="col-sm-2 control-label">Url地址</label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="url" id="url" placeholder="url地址" value="" required >
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<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="stat" class="col-sm-2 control-label">是否显示</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input name="stat" type="radio" value="0" /> 是
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input name="stat" type="radio" value="1" /> 否
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="is_new_window_open" class="col-sm-2 control-label">是否新窗口打开</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input name="is_new_window_open" type="radio" value="1" /> 是
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input name="is_new_window_open" type="radio" value="0" /> 否
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /.tab-pane -->
|
||||
|
||||
</div>
|
||||
<!-- /.tab-content -->
|
||||
<div class="nav-footer row">
|
||||
<input name="id" value="" type="hidden">
|
||||
<div class="col-sm-2 col-sm-offset-2">
|
||||
<p><button id="reset-btn" type="reset" class="btn btn-warning">重置</button></p>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<p><button id="submit-btn" type="submit" class="btn btn-danger">提交</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/navigation/lists');?>" class="btn btn-block btn-primary">导航列表</a>
|
||||
<a href="<?php echo url('/admin/navigation/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;
|
||||
}
|
||||
</style>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
|
||||
$("#reset-btn").click(function(e) {
|
||||
if (confirm('确认重置所有表单项吗?')) {
|
||||
this.form.reset();
|
||||
}
|
||||
});
|
||||
$("form.form-horizontal").submit(function(e) {
|
||||
var navData = document.getElementById('change_data');
|
||||
if (isNull(navData.value)) {
|
||||
alert('导航类型必须勾选' + navData.value);
|
||||
navData.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var nameObj = document.getElementById('name');
|
||||
if (isNull(nameObj.value)) {
|
||||
alert('导航名称必须填写' + nameObj.value);
|
||||
nameObj.focus();
|
||||
return false;
|
||||
}
|
||||
var cType = document.getElementById('change_type');
|
||||
if (isNull(cType.value) ) {
|
||||
alert('数据类型必须勾选' + cType.value);
|
||||
cType.focus();
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
|
||||
if(cType.value!= 'custom') {
|
||||
|
||||
var typeValue = $('#nav-data option:selected').val();
|
||||
if (isNaN(typeValue)|| !parseInt(typeValue)) {
|
||||
alert('文章、博客、分类必须选择具体内容');
|
||||
$('#nav-data option').focus();
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sortObj = document.getElementById('sort');
|
||||
if (isNaN(sortObj.value)|| !parseInt(sortObj.value)) {
|
||||
alert('排序值必须是数字' + sortObj.value);
|
||||
sortObj.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
$("#submit-btn").click(function(event) {
|
||||
event.preventDefault();
|
||||
$('.form-horizontal').submit();
|
||||
});
|
||||
|
||||
//导航数据分类
|
||||
$("#change_type").change(function () {
|
||||
var navType = $(this).val();
|
||||
//$(".chosed-select").hide();
|
||||
//$("#nav-" + v).show();
|
||||
checkData(navType);
|
||||
|
||||
});
|
||||
|
||||
//导航级别
|
||||
$("#change_data").change(function () {
|
||||
var navType = $(this).val();
|
||||
|
||||
if(navType){
|
||||
$.ajax({
|
||||
url: '/admin/navigation/fetchLevelOneNav',
|
||||
type: "post",
|
||||
data: {nav_type: navType},
|
||||
dataType: "json",
|
||||
success: function(res) {
|
||||
|
||||
var levelFeed = '', list = res.data.data,len=list.length;
|
||||
if(res.code==200){
|
||||
|
||||
levelFeed += '<option value="">一级栏目...</option>';
|
||||
for (i = 0; i < len; i++) {
|
||||
levelFeed += '<option value="'+list[i].id+'">'+ list[i].name+'</option>';
|
||||
}
|
||||
$("#category_level").html(levelFeed);
|
||||
}
|
||||
|
||||
//$('body').append('<div id="modal-adjs" class="modal fade">' + html + '</div>');
|
||||
//$('#modal-adjs').modal({show: true, backdrop: false, keyboard: false});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function checkData(navType){
|
||||
if(navType){
|
||||
if(navType == 'custom'){
|
||||
$("#nav-custom").show();
|
||||
$('#nav-data').hide();
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
url: '/admin/navigation/checkType',
|
||||
type: "post",
|
||||
data: {nav_type: navType},
|
||||
dataType: "html",
|
||||
success: function(html) {
|
||||
$("#nav-custom").hide();
|
||||
$("#nav-data").show();
|
||||
|
||||
$('#nav-data').html(html);
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
62
app/admin/view/navigation/check_type.html
Executable file
62
app/admin/view/navigation/check_type.html
Executable file
@@ -0,0 +1,62 @@
|
||||
<?php if($nav_type== 'goods_category'):?>
|
||||
<label for="cid" class="col-sm-2 control-label">商品分类</label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control c-p chosen-select" id="valueSelect" name="value" data-placeholder="请选择..." data-validation-message="商品分类选择有误" required>
|
||||
<option value="">请选择...</option>
|
||||
<?php foreach($list as $v):?>
|
||||
<option value="<?php echo $v['id'];?>" <?php if($v['id']==$value):?>selected<?php endif;?>><?php echo $v['name'];?></option>
|
||||
<?php if(!empty($v['child'])):?>
|
||||
<?php foreach($v['child'] as $vs):?>
|
||||
<option style="padding-left: 30px;margin-left:15px;" value="<?php echo $vs['id'];?>" <?php if($vs['id']==$value):?>selected<?php endif;?>> └² <?php echo $vs['name'];?></option>
|
||||
<?php if(!empty($vs['child'])):?>
|
||||
<?php foreach($vs['child'] as $key => $vss):?>
|
||||
<?php if ($key == count($vs['child']) - 1):?>
|
||||
|
||||
<option style="padding-left: 60px;margin-left:30px;" value="<?php echo $vss['id'];?>" <?php if($vss['id']==$value):?>selected<?php endif;?>> └³ <?php echo $vss['name'];?></option>
|
||||
<?php else:?>
|
||||
|
||||
<option style="padding-left: 60px;margin-left:30px;" value="<?php echo $vss['id'];?>" <?php if($vss['id']==$value):?>selected<?php endif;?>> ├³ <?php echo $vss['name'];?></option>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
<?php if($nav_type== 'article'):?>
|
||||
<label for="cid" class="col-sm-2 control-label">文章</label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control c-p chosen-select" id="valueSelect" name="value" data-placeholder="请选择..." data-validation-message="文章选择有误" required>
|
||||
<option value="">请选择...</option>
|
||||
<?php foreach ($list as $article):?>
|
||||
<optgroup label="<?php echo $article['name'];?>">
|
||||
<?php if(!empty($article['items'])):?>
|
||||
<?php foreach($article['items'] as $vs):?>
|
||||
<option value="<?php echo $vs['id'];?>" <?php if($vs['id']==$value):?>selected<?php endif;?>><?php echo $vs['name'];?></option>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
</optgroup>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
<?php if($nav_type== 'blog'):?>
|
||||
<label for="value" class="col-sm-2 control-label">博客</label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control c-p chosen-select" id="valueSelect" name="value" data-placeholder="请选择..." data-validation-message="博客选择有误" required>
|
||||
<option value="">请选择...</option>
|
||||
<?php foreach ($list as $blog):?>
|
||||
|
||||
<option value="<?php echo $blog['id'];?>" <?php if($blog['id']==$value):?>selected<?php endif;?>><?php echo $blog['title'];?></option>
|
||||
|
||||
</optgroup>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
330
app/admin/view/navigation/edit.html
Executable file
330
app/admin/view/navigation/edit.html
Executable file
@@ -0,0 +1,330 @@
|
||||
<!-- 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/navigation/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/navigation/update');?>" method="post">
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="active tab-pane" id="navfirst">
|
||||
<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 c-p chosen-select" id="change_data" name="nav_type" data-placeholder="导航类型..." data-validation-message="导航类型选择错误">
|
||||
<option value="">导航类型...</option>
|
||||
|
||||
<?php foreach($dataType as $ks=>$value):?>
|
||||
<option value="<?php echo $ks;?>" <?php if($ks==$navigation['nav_type']):?>Selected<?php endif;?>><?php echo $value;?></option>
|
||||
<?php endforeach;?>
|
||||
|
||||
</select>
|
||||
</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 c-p chosen-select" name="pid" data-placeholder="一级栏目..." data-validation-message="导航级别选择错误" id="category_level" >
|
||||
<option value="">一级栏目...</option>
|
||||
<?php foreach($nav_header_pid_list as $v):?>
|
||||
<?php if($v['id']!=$navigation['id']):?>
|
||||
<option value="<?php echo $v['id'];?>" <?php if($v['id']==$navigation['pid']):?>Selected<?php endif;?>><?php echo $v['name'];?></option>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="data_type" class="col-sm-2 control-label">数据类型<em style="color:red;">*</em></label>
|
||||
<div class="col-sm-5">
|
||||
<select class="form-control c-p chosen-select" id="change_type" name="data_type" data-placeholder="数据类型..." data-validation-message="数据类型选择错误">
|
||||
<option value="">数据类型...</option>
|
||||
<?php foreach($typeOption as $kt=> $type):?>
|
||||
<option value="<?php echo $kt;?>" <?php if($kt==$navigation['data_type']):?>Selected<?php endif;?>><?php echo $type;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group chosed-select" id="nav-data">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<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 value="<?php echo $navigation['name'];?>">
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group chosed-select" id="nav-custom" style="display:none;">
|
||||
<label for="cid" class="col-sm-2 control-label">Url地址</label>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" class="form-control" name="url" id="url" placeholder="url地址" value="<?php echo $navigation['url'];?>" required >
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
<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="<?php echo empty($navigation['picture'])?'/uploads/nopic.jpg':$navigation['picture'];?>" /></a>
|
||||
<input type="hidden" name="picture" value="<?php echo $navigation['picture'];?>" id="input-image" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</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="<?php echo $navigation['sort'];?>">
|
||||
</div>
|
||||
<div class="col-sm-5 col-sm-offset-3">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="stat" class="col-sm-2 control-label">是否显示</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input name="stat" type="radio" value="0" <?php if($navigation['stat']=='0'):?>checked=""<?php endif;?>/> 是
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input name="stat" type="radio" value="1" <?php if($navigation['stat']=='1'):?>checked=""<?php endif;?>/> 否
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="is_new_window_open" class="col-sm-2 control-label">是否新窗口打开</label>
|
||||
<div class="col-sm-5">
|
||||
<label class="radio-inline">
|
||||
<input name="is_new_window_open" type="radio" value="1" <?php if($navigation['is_new_window_open']=='1'):?>checked=""<?php endif;?>/> 是
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input name="is_new_window_open" type="radio" value="0" <?php if($navigation['is_new_window_open']=='0'):?>checked=""<?php endif;?>/> 否
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /.tab-pane -->
|
||||
|
||||
</div>
|
||||
<!-- /.tab-content -->
|
||||
<div class="nav-footer row">
|
||||
<input name="id" value="<?php echo $navigation['id'];?>" type="hidden">
|
||||
<div class="col-sm-2 col-sm-offset-2">
|
||||
<button id="reset-btn" type="button" class="btn btn-warning btn-block">重置</button>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button id="submit-btn" type="submit" class="btn btn-danger btn-block">提交</button>
|
||||
</div>
|
||||
<!-- /. row -->
|
||||
</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/navigation/lists');?>" class="btn btn-block btn-primary">导航列表</a>
|
||||
<a href="<?php echo url('/admin/navigation/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;
|
||||
}
|
||||
</style>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var navType = $('#change_type').val();
|
||||
var value = "<?php echo $navigation['value'];?>";
|
||||
if(navType){
|
||||
checkData(navType,value);
|
||||
|
||||
}
|
||||
|
||||
$("#reset-btn").click(function(e) {
|
||||
if (confirm('确认重置所有表单项吗?')) {
|
||||
this.form.reset();
|
||||
}
|
||||
});
|
||||
$("form.form-horizontal").submit(function(e) {
|
||||
var navData = document.getElementById('change_data');
|
||||
if (isNull(navData.value)) {
|
||||
alert('导航类型必须勾选' + navData.value);
|
||||
navData.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var nameObj = document.getElementById('name');
|
||||
if (isNull(nameObj.value)) {
|
||||
alert('导航名称必须填写' + nameObj.value);
|
||||
nameObj.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var cType = document.getElementById('change_type');
|
||||
if (isNull(cType.value) ) {
|
||||
alert('数据类型必须勾选' + cType.value);
|
||||
cType.focus();
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
|
||||
|
||||
if(cType.value!= 'custom') {
|
||||
|
||||
var typeValue = $('#nav-data option:selected').val();
|
||||
if (isNaN(typeValue)|| !parseInt(typeValue)) {
|
||||
alert('文章、博客、分类必须选择具体内容');
|
||||
$('#nav-data option').focus();
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sortObj = document.getElementById('sort');
|
||||
if (isNaN(sortObj.value)|| !parseInt(sortObj.value)) {
|
||||
alert('排序值必须是数字' + sortObj.value);
|
||||
sortObj.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
$("#submit-btn").click(function(event) {
|
||||
event.preventDefault();
|
||||
$('.form-horizontal').submit();
|
||||
});
|
||||
|
||||
//导航数据分类
|
||||
$("#change_type").change(function () {
|
||||
var navType = $(this).val();
|
||||
var navValue = $("#valueSelect").val();
|
||||
//$(".chosed-select").hide();
|
||||
//$("#nav-" + v).show();
|
||||
checkData(navType, navValue);
|
||||
|
||||
});
|
||||
|
||||
//导航级别
|
||||
$("#change_data").change(function () {
|
||||
var navType = $(this).val();
|
||||
|
||||
if(navType){
|
||||
$.ajax({
|
||||
url: '/admin/navigation/fetchLevelOneNav',
|
||||
type: "post",
|
||||
data: {nav_type: navType},
|
||||
dataType: "json",
|
||||
success: function(res) {
|
||||
|
||||
var levelFeed = '', list = res.data.data,len=list.length;
|
||||
if(res.code==200){
|
||||
|
||||
levelFeed += '<option value="">一级栏目...</option>';
|
||||
for (i = 0; i < len; i++) {
|
||||
levelFeed += '<option value="'+list[i].id+'">'+ list[i].name+'</option>';
|
||||
}
|
||||
$("#category_level").html(levelFeed);
|
||||
}
|
||||
|
||||
//$('body').append('<div id="modal-adjs" class="modal fade">' + html + '</div>');
|
||||
//$('#modal-adjs').modal({show: true, backdrop: false, keyboard: false});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function checkData(navType, value){
|
||||
if(navType){
|
||||
if(navType == 'custom'){
|
||||
$("#nav-custom").show();
|
||||
$('#nav-data').hide();
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
url: '/admin/navigation/checkType',
|
||||
type: "post",
|
||||
data: {nav_type: navType, value:value},
|
||||
dataType: "html",
|
||||
success: function(html) {
|
||||
$("#nav-custom").hide();
|
||||
$("#nav-data").show();
|
||||
|
||||
$('#nav-data').html(html);
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
185
app/admin/view/navigation/lists.html
Executable file
185
app/admin/view/navigation/lists.html
Executable file
@@ -0,0 +1,185 @@
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
导航管理
|
||||
<small>导航列表</small>
|
||||
</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/navigation/lists');?>"> 导航</a></li>
|
||||
<li class="active"> 导航列表</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="box box-solid collapsed-box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><i class="fa fa-fw fa-search"></i>...</h3>
|
||||
<div class="box-tools">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||
<i class="fa fa-fw fa-search-plus"></i> 展开/关闭
|
||||
</button>
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||
<i class="fa fa-fw fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<form class="form-horizontal" action="<?php echo url('/admin/navigation/lists');?>" method="get">
|
||||
<div class="col-sm-5">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="name" class="form-control" value="<?php echo $search['name']; ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">导航类型</label>
|
||||
<div class="col-sm-4">
|
||||
<select name="nav_type" class="form-control">
|
||||
<option value="">导航类型...</option>
|
||||
|
||||
<?php foreach($dataType as $ks=>$value):?>
|
||||
<option value="<?php echo $ks;?>"><?php echo $value;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">发布时间</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="col-xs-12 col-sm-6 no-padding">
|
||||
<div class="input-group">
|
||||
<input type="text" name="timebegin" id="timebegin" class="form-control" value="<?php echo $search['timebegin']; ?>">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="button" onclick="laydate_datetime('#timebegin');"><i class="fa fa-fw fa-calendar"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 no-padding">
|
||||
<div class="input-group">
|
||||
<input type="text" name="timeend" id="timeend" class="form-control" value="<?php echo $search['timeend']; ?>">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="button" onclick="laydate_datetime('#timeend');"><i class="fa fa-fw fa-calendar"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-primary btn-sm" ><i class="fa fa-fw fa-check"></i>搜索</button>
|
||||
<button type="reset" class="btn btn-info btn-sm" ><i class="fa fa-fw fa-undo"></i>重置</button>
|
||||
<button type="button" class="btn btn-info btn-sm" id="doclear"><i class="fa fa-fw fa-remove"></i>清空</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">导航列表</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||
<i class="fa fa-fw fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- /.box-tools -->
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body no-padding">
|
||||
<?php if(!empty($list)):?>
|
||||
<div class="table-responsive lists-table">
|
||||
<table class="table table-hover table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="35rem"> </th>
|
||||
<th>导航名称</th>
|
||||
<th class="text-center">导航类型</th>
|
||||
<th class="text-center">数据类型</th>
|
||||
|
||||
<th width="75rem" class="text-center">排序</th>
|
||||
<th width="160rem" class="text-center">发布时间</th>
|
||||
<th width="60rem" class="text-center">状态</th>
|
||||
<th width="135rem" class="text-center">操作</th>
|
||||
</tr>
|
||||
<?php foreach($list as $k=>$nav):?>
|
||||
<tr>
|
||||
<td class="text-center"><input type="checkbox" name="ids[]" value="<?php echo $nav['id'];?>"></td>
|
||||
<td class="text-left" <?php if(!isset($nav['is_sub_data'])){echo "style='padding-left: 2.4rem;margin-left: 2.4rem;'";}?>>
|
||||
<a href="<?php echo url('/admin/navigation/edit',['id'=>$nav['id']]);?>"><?php echo $nav['name'];?></a>
|
||||
</td>
|
||||
<td class="text-center"> <?php echo $dataType[$nav['nav_type']];?></td>
|
||||
|
||||
<td class="text-center"><?php echo $nav['data_type_text'];?></td>
|
||||
|
||||
<td class="text-center"><input size="3" maxlength="7" value="<?php echo $nav['sort'];?>" type="text" data-id="<?php echo $nav['id'];?>" data-url="<?php echo url('/admin/navigation/updatesort');?>" data-cod="sort"></td>
|
||||
|
||||
|
||||
<td class="text-center"><?php echo date('Y-m-d H:i:s',$nav['createtime']);?></td>
|
||||
<td class="text-center"><span class="fa <?php if(!$nav['stat']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $nav['id'];?>" data-url="<?php echo url('/admin/navigation/toggleisshow');?>" data-cod="state"></span></td>
|
||||
<td>
|
||||
<a class="btn btn-xs btn-info" href="<?php echo url('/admin/navigation/edit',['id'=>$nav['id']]);?>">编辑</a>
|
||||
<a class="btn btn-xs btn-info" data-id="<?php echo $nav['id'];?>" data-url="<?php echo url('/admin/navigation/delete');?>" data-cod="dowarn">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- /.table -->
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<!-- /.lists-table -->
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
<div class="box-footer no-padding">
|
||||
<div class="mailbox-controls row">
|
||||
<div class="col-sm-6">
|
||||
<button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-sm" data-url="<?php echo url('/admin/navigation/deletes');?>" data-cod="batch">删除</button>
|
||||
|
||||
<button type="button" class="btn btn-default btn-sm" data-cod="refresh">刷新</button>
|
||||
</div>
|
||||
<!-- /.btn-group -->
|
||||
<a href="<?php echo url('/admin/navigation/add');?>" class="btn btn-default btn-sm">添加</a>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="pull-right">
|
||||
<?php if($page):?>
|
||||
<?php echo $page;?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<!-- /.pull-right -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
<style>
|
||||
.table-responsive .table tbody > tr > th,.table-responsive .table thead > tr > td, .table-responsive .table tbody > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<!-- Page Script -->
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user