2023-07-03 12:49:15 +08:00
|
|
|
{extend name="public:admin_form" /}
|
|
|
|
|
|
|
|
{block name="body"}
|
2023-03-16 22:40:15 +08:00
|
|
|
<form class="layui-form" action="">
|
|
|
|
<div class="mainBox">
|
|
|
|
<div class="main-container">
|
|
|
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
<label class="layui-form-label">上级分类</label>
|
|
|
|
<div class="layui-input-block">
|
|
|
|
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
|
|
|
<label class="layui-form-label">分类名</label>
|
|
|
|
<div class="layui-input-block">
|
|
|
|
<input type="text" name="catename" lay-verify="required" value="{$cate.catename}" placeholder="分类名*" autocomplete="off" class="layui-input">
|
|
|
|
</div>
|
2023-05-05 11:58:42 +08:00
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
2023-03-16 22:40:15 +08:00
|
|
|
<label class="layui-form-label">EN别名</label>
|
|
|
|
<div class="layui-input-block">
|
|
|
|
<input type="text" name="ename" lay-verify="required" value="{$cate.ename}" placeholder="英文名*" autocomplete="off" class="layui-input">
|
|
|
|
</div>
|
2023-05-05 11:58:42 +08:00
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
2023-03-16 22:40:15 +08:00
|
|
|
<label class="layui-form-label">图标</label>
|
|
|
|
<div class="layui-input-block">
|
|
|
|
<input type="text" name="icon" placeholder="图标*" value="{$cate.icon}" id="iconPicker" lay-filter="iconPicker" style="display:none;" class="layui-input">
|
|
|
|
</div>
|
2023-05-05 11:58:42 +08:00
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
2023-03-16 22:40:15 +08:00
|
|
|
<label class="layui-form-label">详情页模板</label>
|
|
|
|
<div class="layui-input-block">
|
|
|
|
<select name="detpl" id="tpl" lay-verify="required">
|
|
|
|
{volist name="template" id="vo"}
|
|
|
|
<option value="{$vo}" {if($vo == $cate.detpl)} selected {/if} >{$vo}</option>
|
|
|
|
{/volist}
|
|
|
|
</select>
|
|
|
|
</div>
|
2023-05-05 11:58:42 +08:00
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
2023-03-16 22:40:15 +08:00
|
|
|
<label class="layui-form-label">描述</label>
|
|
|
|
<div class="layui-input-block">
|
2023-07-03 12:50:57 +08:00
|
|
|
<textarea type="text" name="desc" lay-verify="required" value="{$cate.desc}" placeholder="描述*" autocomplete="off" class="layui-textarea">{$cate.desc}</textarea>
|
2023-03-16 22:40:15 +08:00
|
|
|
</div>
|
2023-05-05 11:58:42 +08:00
|
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
2023-03-16 22:40:15 +08:00
|
|
|
<label class="layui-form-label">排序</label>
|
|
|
|
<div class="layui-input-block">
|
|
|
|
<input type="text" name="sort" lay-verify="number|required" value="{$cate.sort}" placeholder="请填数字" autocomplete="off" class="layui-input">
|
|
|
|
</div>
|
|
|
|
<div class="layui-input-block layui-hide">
|
|
|
|
<input type="text" name="id" lay-verify="number|required" value="{$cate.id}" placeholder="请填数字" autocomplete="off" class="layui-input">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="bottom">
|
|
|
|
<div class="button-container">
|
|
|
|
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="cate-save">
|
|
|
|
<i class="layui-icon layui-icon-ok"></i>
|
|
|
|
提交
|
|
|
|
</button>
|
|
|
|
<button type="reset" class="pear-btn pear-btn-sm">
|
|
|
|
<i class="layui-icon layui-icon-refresh"></i>
|
|
|
|
重置
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2023-07-03 12:49:15 +08:00
|
|
|
{/block}
|
|
|
|
|
|
|
|
{block name="js"}
|
2023-03-16 22:40:15 +08:00
|
|
|
<script>
|
|
|
|
layui.use(['form', 'iconPicker', 'xmSelect',], function(){
|
|
|
|
var $ = layui.jquery
|
|
|
|
,form = layui.form ;
|
|
|
|
var iconPicker = layui.iconPicker;
|
|
|
|
var xmSelect = layui.xmSelect;
|
|
|
|
var initPid = "{$cate.pid}";
|
2023-07-03 12:49:15 +08:00
|
|
|
let ADD_EDIT = "{:url('content.cate/addEdit')}";
|
2023-03-16 22:40:15 +08:00
|
|
|
|
|
|
|
//初始化图标选择
|
|
|
|
iconPicker.render({
|
|
|
|
elem: '#iconPicker',
|
|
|
|
type: 'fontClass',
|
|
|
|
search: false,
|
|
|
|
page: true,
|
|
|
|
limit: 12,
|
|
|
|
click: function (data) {
|
|
|
|
//console.log(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
form.on('submit(cate-save)', function(data) {
|
|
|
|
$.ajax({
|
2023-05-05 11:58:42 +08:00
|
|
|
url: ADD_EDIT,
|
2023-03-16 22:40:15 +08:00
|
|
|
data: JSON.stringify(data.field),
|
|
|
|
dataType: 'json',
|
|
|
|
contentType: 'application/json',
|
|
|
|
type: 'post',
|
|
|
|
success: function(result) {
|
|
|
|
if (result.code === 0) {
|
|
|
|
layer.msg(result.msg, {
|
|
|
|
icon: 1,
|
|
|
|
time: 1000
|
|
|
|
}, function() {
|
2023-07-03 12:49:15 +08:00
|
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
|
|
|
|
window.parent.location.reload();
|
2023-03-16 22:40:15 +08:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
layer.msg(result.msg, {
|
|
|
|
icon: 2,
|
|
|
|
time: 1000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
(function (){
|
|
|
|
//分类菜单结构
|
|
|
|
$.ajax({
|
|
|
|
type: "get",
|
|
|
|
url: "{:url('content.forum/getCateTree')}",
|
|
|
|
success: function(res){
|
|
|
|
var data = res.data;
|
|
|
|
|
|
|
|
// 渲染下拉树
|
|
|
|
xmSelect.render({
|
|
|
|
el: '#menuSelectBox',
|
|
|
|
name: 'pid',
|
|
|
|
height: '250px',
|
|
|
|
layVerify: 'required',
|
|
|
|
layVerType: 'tips',
|
|
|
|
data: data,
|
|
|
|
initValue: [initPid],
|
|
|
|
model: {label: {type: 'text'}},
|
|
|
|
prop: {
|
|
|
|
name: 'catename',
|
|
|
|
value: 'id'
|
|
|
|
},
|
|
|
|
radio: true,
|
|
|
|
clickClose: true,
|
|
|
|
tree: {
|
|
|
|
show: true,
|
|
|
|
indent: 15,
|
|
|
|
strict: false,
|
|
|
|
expandedKeys: true
|
|
|
|
},
|
|
|
|
tips: '请选择上级菜单'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
</script>
|
2023-07-03 12:49:15 +08:00
|
|
|
{/block}
|