No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

code_m.htm 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>可视化编辑</title>
  5. <script type="text/javascript">
  6. var eyou_basefile = "{$Request.baseFile}";
  7. var module_name = "{$Think.const.MODULE_NAME}";
  8. var __root_dir__ = "__ROOT_DIR__";
  9. var __lang__ = "{$admin_lang}";
  10. </script>
  11. {load href="__STATIC__/common/js/jquery.min.js" /}
  12. {load href="__PUBLIC__/plugins/layer-v3.1.0/layer.js" /}
  13. {load href="__STATIC__/admin/js/global.js" /}
  14. <link rel="stylesheet" type="text/css" href="__STATIC__/admin/js/codemirror/codemirror.css">
  15. <script type="text/javascript" src="__STATIC__/admin/js/codemirror/codemirror.js"></script>
  16. <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/xml/xml.js"></script>
  17. <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/javascript/javascript.js"></script>
  18. <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/css/css.js"></script>
  19. <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/php/php.js"></script>
  20. <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/clike/clike.js"></script>
  21. <script type="text/javascript" src="__STATIC__/admin/js/codemirror/mode/htmlmixed/htmlmixed.js"></script>
  22. <style type="text/css">
  23. .ncap-form-default {
  24. padding: 10px 0;
  25. overflow: hidden;
  26. }
  27. a {
  28. text-decoration: none;
  29. }
  30. a.ncap-btn-big {
  31. font: bold 14px/20px "microsoft yahei", arial;
  32. color: #777;
  33. background-color: #ECF0F1;
  34. text-align: center;
  35. vertical-align: middle;
  36. display: inline-block;
  37. height: 20px;
  38. padding: 7px 19px;
  39. border: solid 1px #BEC3C7;
  40. border-radius: 3px;
  41. cursor: pointer;
  42. }
  43. a.ncap-btn-green {
  44. background-color: #4fc0e8;
  45. color: #FFF;
  46. text-shadow: 0 -1px 0 rgba(0,0,0,0.10);
  47. border-color: #3aa8cf;
  48. }
  49. .ckeditor {
  50. /*height: auto;*/
  51. /*height: 500px;*/
  52. }
  53. .panel-default {
  54. /*height: 510px;*/
  55. }
  56. .CodeMirror{
  57. height: 460px;
  58. }
  59. </style>
  60. </head>
  61. <body>
  62. <div class="panel panel-default">
  63. <div class="span12 ckeditor">
  64. <form class="form-horizontal" id="post_form" onsubmit="return check_submit();">
  65. <div class="control-group">
  66. <textarea id="post_content" name="content">{$field.info.value|default=''}</textarea>
  67. </div>
  68. <div class="control-group ncap-form-default">
  69. <div class="controls">
  70. <input type="hidden" name="id" value="{$field.id|default=''}">
  71. <input type="hidden" name="type" value="{$field.type|default=''}">
  72. <input type="hidden" name="page" value="{$field.page|default=''}">
  73. <input type="hidden" name="v" value="{$v|default='pc'}">
  74. <input type="hidden" name="lang" value="{$field.lang|default='cn'}">
  75. <input type="hidden" name="idcode" value="{$field.idcode|default=''}">
  76. <input type="hidden" name="iframe" value="1">
  77. <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
  78. </div>
  79. </div>
  80. </form>
  81. </div>
  82. </div>
  83. </div>
  84. <script type="text/javascript">
  85. var editor = CodeMirror.fromTextArea(document.getElementById('post_content'), {
  86. lineNumbers: true,
  87. lineWrapping: true,
  88. autofocus:true, //自动聚焦
  89. mode: 'text/html',
  90. });
  91. var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  92. function check_submit()
  93. {
  94. if ($('input[name=id]').val() == '' || $('input[name=id]').val() == undefined || $('input[name=type]').val() == '' || $('input[name=page]').val() == '') {
  95. parent.showErrorMsg('缺少系统参数:id、type、page,尝试请求技术支持!');
  96. return false;
  97. }
  98. $('textarea[name=content]').val(editor.getValue());
  99. parent.eyou_layer_loading('正在处理');
  100. var url = "{:url('api/Uiset/submit', ['_ajax'=>1])}";
  101. $.ajax({
  102. url: url,
  103. type: 'POST',
  104. dataType: 'JSON',
  105. data: $('#post_form').serialize(),
  106. success: function(res){
  107. parent.layer.closeAll();
  108. if (res.code == 1) {
  109. $('#workspace', window.parent.document).attr('src', $('#workspace', window.parent.document).attr('src'));
  110. parent.layer.msg(res.msg, {icon: 1, shade: 0.3, time: 1000});
  111. } else {
  112. parent.eyou_showErrorAlert(res.msg);
  113. }
  114. },
  115. error: function(e){
  116. parent.layer.closeAll();
  117. parent.eyou_showErrorAlert(e.responseText);
  118. }
  119. });
  120. }
  121. </script>
  122. </body>
  123. </html>