first commit
This commit is contained in:
66
app/admin/view/tpl/edit_tpl.html
Normal file
66
app/admin/view/tpl/edit_tpl.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<include file="/public/header" />
|
||||
<link href="/static/js/codemirror/lib/codemirror.css" rel="stylesheet">
|
||||
<script src="/static/js/codemirror/lib/codemirror.js"></script>
|
||||
<link href="/static/js/codemirror/theme/monokai.css" rel="stylesheet">
|
||||
<script src="/static/js/codemirror/mode/htmlmixed/htmlmixed.js"></script>
|
||||
<script src="/static/js/codemirror/mode/htmlembedded/htmlembedded.js"></script>
|
||||
<script src="/static/js/codemirror/mode/xml/xml.js"></script>
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-card" >
|
||||
<div class="layui-card-body">
|
||||
<!-- begin code -->
|
||||
<textarea id="htmlcode" name="htmlcode" >{$content}</textarea>
|
||||
<!-- end code-->
|
||||
<div id="htmlshow" style="margin-top: 20px">{$content|raw}</div>
|
||||
<div class="" style="text-align: center;margin-top: 10px">
|
||||
<button class="layui-btn layui-btn-primary" sa-event="closeDialog">取消</button>
|
||||
<button class="layui-btn layui-btn-normal layui-btn-save" lay-tpl="{$tpl}" >保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<include file="/public/footer" />
|
||||
|
||||
<script>
|
||||
layui.use(['layer','jquery','admin'],function(){
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var admin = layui.admin;
|
||||
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("htmlcode"), {
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
mode: "text/html",
|
||||
theme:"monokai",
|
||||
matchBrackets: true
|
||||
});
|
||||
|
||||
editor.on('change',function(){
|
||||
$('#htmlshow').html(editor.getValue());
|
||||
});
|
||||
|
||||
// 提交数据
|
||||
$('.layui-btn-save').on('click',function(){
|
||||
var tpl = $(this).attr('lay-tpl');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{:url('/Tpl/editTpl')}",
|
||||
data: {tpl:tpl,content:editor.getValue()},
|
||||
success: function (res) {
|
||||
if(res.code == 200){
|
||||
layer.msg(res.msg);
|
||||
admin.event.closeDialog();
|
||||
}else {
|
||||
layer.error(res.msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return false;
|
||||
})
|
||||
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
51
app/admin/view/tpl/show_tpl.html
Normal file
51
app/admin/view/tpl/show_tpl.html
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
<include file="/public/header" />
|
||||
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-card" >
|
||||
<div class="layui-card-body">
|
||||
<table class="layui-table layui-text">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>名称</th>
|
||||
<th>路径</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><volist name="$list" id="vo">
|
||||
<tr>
|
||||
<td>{$key}</td>
|
||||
<td>{$vo.name}</td>
|
||||
<td>{$vo.path}</td>
|
||||
<td><a href="javascript:void(0)" class="editTpl"data-url="{:url('/Tpl/editTpl')}?p={$vo.param}" >编辑</a></td>
|
||||
</tr></volist>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<include file="/public/footer" />
|
||||
|
||||
<script>
|
||||
layui.use(['layer','jquery'],function(){
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
|
||||
// 提交数据
|
||||
$('.editTpl').on('click',function(){
|
||||
var url = $(this).data('url');
|
||||
top.layer.open({
|
||||
type:2
|
||||
,area: ['80%','80%']
|
||||
,title: '编辑模板'
|
||||
,content: url
|
||||
,success: function() {
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user