config.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <!-- 富文本 -->
  2. <form>
  3. <input type="hidden" name="model_id" value="2" />
  4. <h2 class="attr-title">富文本</h2>
  5. <div class="layui-form-item">
  6. <label class="layui-form-label sm">背景颜色</label>
  7. <div class="layui-input-block">
  8. <div class="color-wrapper">
  9. <input data-js="color" type="text" name="back_color" value="{$config_info.back_color|default=''}" />
  10. </div>
  11. </div>
  12. </div>
  13. <div class="layui-form-item">
  14. <label class="layui-form-label sm">上边距</label>
  15. <div class="layui-input-block">
  16. <div class="range-wrapper">
  17. <input type="range" name="padding_top" value="{$config_info.padding_top|default='0'}" onchange="$(this).next().text($(this).val())">
  18. <span>{$config_info.padding_top|default='0'}</span>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="layui-form-item">
  23. <label class="layui-form-label sm">下边距</label>
  24. <div class="layui-input-block">
  25. <div class="range-wrapper">
  26. <input type="range" name="padding_bottom" value="{$config_info.padding_bottom|default='0'}" onchange="$(this).next().text($(this).val())">
  27. <span>{$config_info.padding_bottom|default='0'}</span>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="layui-form-item">
  32. <label class="layui-form-label sm">文本宽度</label>
  33. <div class="layui-input-block">
  34. <input type="text" name="model_width" value="{$config_info.model_width|default=''}" placeholder="请输入文本宽度" class="layui-input">
  35. </div>
  36. </div>
  37. <div class="layui-form-item">
  38. <label class="layui-form-label sm">文本高度</label>
  39. <div class="layui-input-block">
  40. <input type="text" name="model_height" value="{$config_info.model_height|default=''}" placeholder="请输入文本高度" class="layui-input">
  41. </div>
  42. </div>
  43. <div class="layui-form-item">
  44. <label class="layui-form-label sm">文本内容</label>
  45. <div class="layui-input-block">
  46. <textarea name="editor_content" id="editor_content" style="width:100%;">{if isset($config_info.editor_content)}{$config_info.editor_content|raw}{/if}</textarea>
  47. <div class="uploader-wrapper">
  48. <div>
  49. <div class="uploader-icon iconfont">&#xe6bf;</div>
  50. <div class="uploader-text">图片上传</div>
  51. <input type='file' class='uploader-file' onchange='uploadFile($(this),insertEditorImage)'>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </form>
  57. <script>
  58. if(typeof(loadConfig2)=='undefined'){
  59. function loadConfig2(obj){
  60. obj.find('[data-js="color"]').colorpicker({showOn: 'both'});
  61. obj.find('#editor_content').attr('id','editor_content_'+obj.attr('data-id'))
  62. ue['i_'+obj.attr('data-id')]=UE.getEditor('editor_content_'+obj.attr('data-id'),{toolbars:[[
  63. 'fullscreen', 'source', '|', 'undo', 'redo', '|',
  64. 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
  65. 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
  66. 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
  67. 'directionalityltr', 'directionalityrtl', 'indent', '|',
  68. 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
  69. 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
  70. 'emotion', 'map', 'gmap', 'insertcode', 'template', '|',
  71. 'horizontal', 'date', 'time', 'spechars', '|',
  72. 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
  73. 'searchreplace', 'help', 'drafts', 'charts'
  74. ]]})
  75. ue['i_'+obj.attr('data-id')].addListener('blur',function(editor){
  76. obj.find('[name="editor_content"]').val(ue['i_'+obj.attr('data-id')].getContent())
  77. obj.find('form').change()
  78. });
  79. }
  80. }
  81. if(typeof(insertEditorImage)=='undefined'){
  82. function insertEditorImage(src,obj){
  83. ue['i_'+obj.parents('[data-type="config"]').attr('data-id')].execCommand('insertimage', {src:src});
  84. }
  85. }
  86. </script>