122 lines
4.1 KiB
HTML

{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">添加</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">轮播位置<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="slide_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='slide' id='vo'}
<option value="{$vo.id}" >{$vo.title}</option>
{/volist}
</select>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">标题<font>*</font></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
autocomplete="off" placeholder="请输入标题" class="layui-input"></td>
</tr>
<tr>
<td class="layui-td-gray">描述</td>
<td colspan="7"><input type="text" name="desc" autocomplete="off" class="layui-input"></td>
</tr>
<tr>
<td class="layui-td-gray">图片</td>
<td colspan="7">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传图片</button>
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="150" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="img" value="">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">跳转路径<font>*</font></td>
<td colspan="7"><input type="text" name="src" lay-verify="required" lay-reqText="请输入跳转路径"
autocomplete="off" placeholder="请输入跳转路径" class="layui-input"></td>
</tr>
</table>
<div class="pt-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
//上传缩略图
var upload_thumb = layui.upload.render({
elem: '#upload_btn_thumb',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#upload_box_thumb input').attr('value', res.data.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.slideinfo/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->