TaoLer/view/admin/slider/add.html
2020-01-02 16:23:03 +08:00

120 lines
3.8 KiB
HTML

{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">位置</label>
<div class="layui-input-inline">
<select name="slid_type" lay-verify="required">
<option value="">请选择广告位置</option>
<option value="1">首页幻灯 - 1126x410</option>
<option value="2">通用右底</option>
<option value="3">首页赞助</option>
<option value="4">文章赞助</option>
<option value="5">分类赞助</option>
<option value="6">友情链接</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="slid_name" lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">广告块底色</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="请输入名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开始</label>
<div class="layui-input-inline">
<input type="text" name="slid_start" id="start-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">结束</label>
<div class="layui-input-inline">
<input type="text" name="slid_over" id="over-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接</label>
<div class="layui-input-inline">
<input type="text" name="slid_href" lay-verify="required" placeholder="输入完整连接" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图片</label>
<div class="layui-input-inline">
<input type="text" name="slid_img" lay-verify="" placeholder="请上传图片" autocomplete="off" class="layui-input" >
</div>
<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-slid-img">上传图片</button>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-slider-submit" id="LAY-slider-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload','laydate','table'], function(){
var $ = layui.$
,table = layui.table
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload ;
//开始时间
laydate.render({
elem: '#start-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
//结束时间
laydate.render({
elem: '#over-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
upload.render({
elem: '#layuiadmin-upload-slid-img'
,url: 'uploadImg'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
//console.log(res)
$(this.item).prev("div").children("input").val(res.src)
if(res.code == 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
})
</script>
{/block}