edit_content.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!doctype html>
  2. <!--suppress JSAnnotator -->
  3. <html>
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="viewport"
  7. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  8. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  9. <title>编辑内容</title>
  10. <link href="{__FRAME_PATH}css/font-awesome.min.css" rel="stylesheet">
  11. <link href="{__ADMIN_PATH}plug/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
  12. <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/jquery.min.js"></script>
  13. <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/third-party/template.min.js"></script>
  14. <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.config.js"></script>
  15. <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/umeditor/umeditor.min.js"></script>
  16. <script type="text/javascript" src="{__ADMIN_PATH}plug/umeditor/lang/zh-cn/zh-cn.js"></script>
  17. <style>
  18. .edui-btn-toolbar .edui-btn.edui-active{ display: none;}
  19. .edui-container{overflow: initial !important;}
  20. button.btn-success.dim { box-shadow: inset 0 0 0 #1872ab,0 5px 0 0 #1872ab,0 10px 5px #999; }
  21. .float-e-margins .btn { margin-bottom: 5px; }
  22. button.dim { display: inline-block; color: #fff; text-decoration: none; text-transform: uppercase; text-align: center; padding-top: 6px; margin-right: 10px; position: relative; cursor: pointer; border-radius: 5px; font-weight: 600; margin-bottom: 20px!important; }
  23. .btn-success { background-color: #1c84c6; border-color: #1c84c6; color: #FFF; }
  24. .btn { border-radius: 3px; }
  25. .btn-success { color: #fff; background-color: #5cb85c; border-color: #4cae4c; }
  26. .btn { display: inline-block; padding: 6px 12px; margin-bottom: 0; font-size: 14px; font-weight: 400; line-height: 1.42857143; text-align: center; white-space: nowrap; vertical-align: middle; -ms-touch-action: manipulation; touch-action: manipulation; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; background-image: none; border: 1px solid transparent; border-radius: 4px; }
  27. button, input, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; }
  28. button.btn-success.dim:active { box-shadow: inset 0 0 0 #1872ab,0 2px 0 0 #1872ab,0 5px 3px #999; }
  29. button.dim:active { bottom: 4px; }
  30. .btn-success.active, .btn-success:active, .open .dropdown-toggle.btn-success { background-image: none; }
  31. .btn-success.active, .btn-success:active, .btn-success:focus, .btn-success:hover, .open .dropdown-toggle.btn-success { background-color: #1a7bb9; border-color: #1a7bb9; color: #FFF; }
  32. .dim{bottom: 7px; right: 8px; z-index: 1003; position: fixed !important;}
  33. </style>
  34. </head>
  35. <body>
  36. <button class="btn btn-success dim" data-url="{$action}" type="button"><i class="fa fa-upload"></i>
  37. </button>
  38. <script type="text/plain" id="myEditor" style="width:100%;">
  39. <p>这里可以写一些输入内容</p>
  40. </script>
  41. <script type="text/javascript">
  42. $eb = parent._mpApi;
  43. $('.dim').on('click',function(){
  44. $eb.axios.post($(this).data('url'),{'{$field}':getContent()}).then(function(res){
  45. if(res.status == 200 && res.data.code == 200){
  46. $eb.message('success','保存成功!');
  47. } else
  48. return Promise.reject(res.data.msg || '保存失败!');
  49. }).catch(function(err){
  50. $eb.message('error',err);
  51. })
  52. });
  53. var editor = document.getElementById('myEditor');
  54. editor.style.height = document.body.scrollHeight+'px';
  55. //实例化编辑器
  56. var um = UM.getEditor('myEditor',{
  57. fullscreen:true
  58. });
  59. function getContent() {
  60. return (UM.getEditor('myEditor').getContent());
  61. }
  62. function hasContent() {
  63. return (UM.getEditor('myEditor').hasContents());
  64. }
  65. </script>
  66. </body>
  67. </html>