123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>可视化编辑</title>
- <script type="text/javascript">
- var eyou_basefile = "{$Request.baseFile}";
- var module_name = "{$Think.const.MODULE_NAME}";
- var __root_dir__ = "__ROOT_DIR__";
- var __lang__ = "{$admin_lang}";
- </script>
- {load href="__STATIC__/common/js/jquery.min.js" /}
- {load href="__PUBLIC__/plugins/layer-v3.1.0/layer.js" /}
- {load href="__STATIC__/admin/js/global.js" /}
- <link rel="stylesheet" type="text/css" href="__STATIC__/admin/js/codemirror/codemirror.css">
- <script type="text/javascript" src="__STATIC__/admin/js/codemirror/codemirror.js"></script>
- <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/xml/xml.js"></script>
- <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/javascript/javascript.js"></script>
- <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/css/css.js"></script>
- <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/php/php.js"></script>
- <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/clike/clike.js"></script>
- <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/htmlmixed/htmlmixed.js"></script>
- <style type="text/css">
- .ncap-form-default {
- padding: 10px 0;
- overflow: hidden;
- }
- a {
- text-decoration: none;
- }
- a.ncap-btn-big {
- font: bold 14px/20px "microsoft yahei", arial;
- color: #777;
- background-color: #ECF0F1;
- text-align: center;
- vertical-align: middle;
- display: inline-block;
- height: 20px;
- padding: 7px 19px;
- border: solid 1px #BEC3C7;
- border-radius: 3px;
- cursor: pointer;
- }
- a.ncap-btn-green {
- background-color: #4fc0e8;
- color: #FFF;
- text-shadow: 0 -1px 0 rgba(0,0,0,0.10);
- border-color: #3aa8cf;
- }
- .ckeditor {
- /*height: auto;*/
- /*height: 500px;*/
- }
- .panel-default {
- /*height: 510px;*/
- }
- .CodeMirror{
- height: 460px;
- }
- </style>
- </head>
- <body>
- <div class="panel panel-default">
- <div class="span12 ckeditor">
- <form class="form-horizontal" id="post_form" onsubmit="return check_submit();">
- <div class="control-group">
- <textarea id="post_content" name="content">{$field.info.value|default=''}</textarea>
- </div>
- <div class="control-group ncap-form-default">
- <div class="controls">
- <input type="hidden" name="id" value="{$field.id|default=''}">
- <input type="hidden" name="type" value="{$field.type|default=''}">
- <input type="hidden" name="page" value="{$field.page|default=''}">
- <input type="hidden" name="v" value="{$v|default='pc'}">
- <input type="hidden" name="lang" value="{$field.lang|default='cn'}">
- <input type="hidden" name="idcode" value="{$field.idcode|default=''}">
- <input type="hidden" name="iframe" value="1">
- <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <script type="text/javascript">
-
- var editor = CodeMirror.fromTextArea(document.getElementById('post_content'), {
- lineNumbers: true,
- lineWrapping: true,
- autofocus:true, //自动聚焦
- mode: 'text/html',
- });
-
- var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
-
- function check_submit()
- {
- if ($('input[name=id]').val() == '' || $('input[name=id]').val() == undefined || $('input[name=type]').val() == '' || $('input[name=page]').val() == '') {
- parent.showErrorMsg('缺少系统参数:id、type、page,尝试请求技术支持!');
- return false;
- }
-
- $('textarea[name=content]').val(editor.getValue());
- parent.eyou_layer_loading('正在处理');
- var url = "{:url('api/Uiset/submit', ['_ajax'=>1])}";
- $.ajax({
- url: url,
- type: 'POST',
- dataType: 'JSON',
- data: $('#post_form').serialize(),
- success: function(res){
- parent.layer.closeAll();
- if (res.code == 1) {
- $('#workspace', window.parent.document).attr('src', $('#workspace', window.parent.document).attr('src'));
- parent.layer.msg(res.msg, {icon: 1, shade: 0.3, time: 1000});
- } else {
- parent.eyou_showErrorAlert(res.msg);
- }
- },
- error: function(e){
- parent.layer.closeAll();
- parent.eyou_showErrorAlert(e.responseText);
- }
- });
- }
- </script>
- </body>
- </html>
|