258 lines
10 KiB
HTML
Executable File
258 lines
10 KiB
HTML
Executable File
{extend name='public/base' /}
|
|
{block name='content'}
|
|
{include file='public/content_header' /}
|
|
<style type="text/css">
|
|
/* 图片展示
|
|
----------------------------------------------- */
|
|
ul.albums {
|
|
display: block;
|
|
min-height: 1px;
|
|
height: auto;
|
|
overflow: hidden;
|
|
padding: 5px 0;
|
|
margin: 0 15px;
|
|
}
|
|
ul.albums li {
|
|
position: relative;
|
|
display: inline-block;
|
|
padding: 5px;
|
|
border: 1px solid #e5e5e5;
|
|
margin: 5px 0 0 20px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
ul.albums li a.btn-close {
|
|
display: block;
|
|
position: absolute;
|
|
z-index: 2;
|
|
top: -8px;
|
|
right: -10px;
|
|
width: 20px;
|
|
height: 20px;
|
|
}
|
|
ul.albums li a.btn-fm{width: 100px;
|
|
display:none;
|
|
height: 100px;
|
|
border: 0px;
|
|
opacity: 0.5;
|
|
background-color: #000;
|
|
line-height: 100px;
|
|
text-align: center;
|
|
color: #fff;
|
|
position: absolute;}
|
|
ul.albums li:hover a.btn-fm{ display: block; }
|
|
ul.albums li a.btn-fm_z{
|
|
display:none;
|
|
color: #ccc;
|
|
border: 0px;
|
|
background-color: #000;
|
|
position: absolute;
|
|
bottom: 5px;
|
|
left: 5px;
|
|
opacity: 0.6;
|
|
width: 40px;
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="box box-primary">
|
|
<!-- 表单头部 -->
|
|
<div class="box-header with-border">
|
|
<div class="btn-group">
|
|
<a class="btn flat btn-sm btn-default BackButton">
|
|
<i class="fa fa-arrow-left"></i>
|
|
返回
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<!-- 表单 -->
|
|
<form id="dataForm" class="form-horizontal dataForm" action="" method="post"
|
|
enctype="multipart/form-data">
|
|
<!-- 表单字段区域 -->
|
|
<div class="box-body">
|
|
<div class="form-group">
|
|
<label for="name" class="col-sm-2 control-label">名称</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<input id="name" name="name" value="{$data.name|default=''}" placeholder="请输入名称"
|
|
type="text" class="form-control field-text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="alias" class="col-sm-2 control-label">广告位置</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<select name="alias" id="alias" class="form-control field-select"
|
|
data-placeholder="请选择广告位置">
|
|
<option value=""></option>
|
|
{foreach name='banner_list' id='item'}
|
|
<option value="{$item.bm}" {if isset($data) &&
|
|
$data.alias==$item.bm}selected{/if}>{$item.name}
|
|
</option>
|
|
{/foreach}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$('#alias').select2();
|
|
</script>
|
|
<div class="form-group">
|
|
<label for="img" class="col-sm-2 control-label">图片</label>
|
|
<ul class="albums" id="albums">
|
|
<li id="nophoto" ><img src="{if isset($data.img)}{$data.img}{else}/static/admin/images/nophoto_100x100.png{/if}" style="width: 100px;height: 100px;"></li>
|
|
<input type="hidden" name="img" id="img" value="{$data.img|default=''}">
|
|
</ul>
|
|
</div>
|
|
<script type="text/javascript">
|
|
layui.use(['upload','laydate','form'], function(){
|
|
var form = layui.form;
|
|
var upload = layui.upload;
|
|
//执行实例
|
|
upload.render({
|
|
elem: '#nophoto' //绑定元素
|
|
,url: "{:url('file/icon')}" //接口url
|
|
,data:{type:0,width:200,heigh:200}
|
|
,field:'image'
|
|
,multiple: true
|
|
,done: function(res){
|
|
$(".albums img").attr('src',res.data.avatar_logo);
|
|
$("#img").val(res.data.avatar_logo);
|
|
}
|
|
,error: function(){
|
|
layer.tips('图片错误', '#btn');
|
|
return false;
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<div class="form-group">
|
|
<label for="jump_type" class="col-sm-2 control-label">跳转类型</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<select name="jump_type" id="jump_type" class="form-control field-select"
|
|
data-placeholder="请选择跳转类型" onchange="getTargetList(this.value)">
|
|
<option value=""></option>
|
|
{foreach name='jump_type' id='item'}
|
|
<option value="{$item.id}" {if isset($data) &&
|
|
$data.jump_type==$item.id}selected{/if}>{$item.name}
|
|
</option>
|
|
{/foreach}
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$('#jump_type').select2();
|
|
</script>
|
|
<div class="form-group">
|
|
<label for="jump_target" class="col-sm-2 control-label">跳转目标</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<select name="jump_target" id="jump_target" class="form-control field-select">
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$('#jump_target').select2({
|
|
placeholder: '请选择跳转目标'
|
|
});
|
|
</script>
|
|
<div class="form-group">
|
|
<label for="sort_number" class="col-sm-2 control-label">排序</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<input id="sort_number" name="sort_number" value="{$data.sort_number|default='1000'}"
|
|
placeholder="请输入排序" type="text" class="form-control field-text">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- 表单底部 -->
|
|
<div class="box-footer">
|
|
{:token()}
|
|
<div class="col-sm-2">
|
|
</div>
|
|
<div class="col-sm-10 col-md-4">
|
|
{if !isset($data)}
|
|
<div class="btn-group pull-right">
|
|
<label class="createContinue">
|
|
<input type="checkbox" value="1" id="_create" name="_create"
|
|
title="继续添加数据">继续添加</label>
|
|
</div>
|
|
{/if}
|
|
<div class="btn-group">
|
|
<button type="submit" class="btn flat btn-info dataFormSubmit">
|
|
保存
|
|
</button>
|
|
</div>
|
|
<div class="btn-group">
|
|
<button type="reset" class="btn flat btn-default dataFormReset">
|
|
重置
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<script>
|
|
/** 表单验证 **/
|
|
$('#dataForm').validate({
|
|
rules: {
|
|
'name': {
|
|
required: true,
|
|
},
|
|
'jump_type': {
|
|
required: true,
|
|
},
|
|
'jump_target': {
|
|
required: true,
|
|
},
|
|
'sort_number': {
|
|
required: true,
|
|
},
|
|
|
|
},
|
|
messages: {
|
|
'name': {
|
|
required: "名称不能为空",
|
|
},
|
|
'jump_type': {
|
|
required: "跳转类型不能为空",
|
|
},
|
|
'jump_target': {
|
|
required: "跳转目标不能为空",
|
|
},
|
|
'sort_number': {
|
|
required: "排序不能为空",
|
|
},
|
|
|
|
}
|
|
});
|
|
|
|
function getTargetList(id) {
|
|
var html ='';
|
|
var $jump_target = $('#jump_target');
|
|
id = parseInt(id);
|
|
if (id !== 3) {
|
|
$.post('{:url("pub/getSlideTargetData")}', {type_id: id}, function (result) {
|
|
|
|
$.each(result.data,function (index, item) {
|
|
html+='<option value="'+item.id+'">'+item.name+'</option>';
|
|
});
|
|
|
|
$jump_target.html(html);
|
|
$jump_target.select2();
|
|
});
|
|
}else{
|
|
$jump_target.html(html);
|
|
$jump_target.select2({
|
|
tags:true,
|
|
placeholder:'请输入需要跳转的网址',
|
|
});
|
|
}
|
|
|
|
|
|
|
|
}
|
|
</script>
|
|
{/block} |