xheditor.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>测试页面</title>
  6. <meta name="description" content="">
  7. <meta name="keywords" content="">
  8. <!--include header base-->
  9. <meta name="author" content="Roobo:F2E">
  10. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  11. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  12. <!-- Set render engine for 360 browser -->
  13. <meta name="renderer" content="webkit">
  14. <!-- Add to homescreen for Chrome on Android -->
  15. <meta name="mobile-web-app-capable" content="yes">
  16. <!--<link rel="icon" type="image/png" sizes="192x192" href="img/favicon/android-icon-192x192.png">-->
  17. <!-- Add to homescreen for Safari on iOS -->
  18. <meta name="apple-mobile-web-app-capable" content="yes">
  19. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  20. <!--<link href="../css/css.css" rel="stylesheet" type="text/css">-->
  21. <script src="../js/config/base_config.js"></script>
  22. <script type="text/javascript" src="../untils/jquery-1.4.4.min.js"></script>
  23. <script type="text/javascript" src="../untils/xheditor-1.1.14-zh-cn.min.js"></script>
  24. <script type="text/javascript">
  25. $(document).ready(function(){
  26. // if(window.top != window.self)
  27. // window.top.location.href = location.href;
  28. formRefresh();
  29. //初始化xhEditor编辑器插件
  30. $('#scontext').xheditor({
  31. tools: 'simple',
  32. skin: 'default',
  33. html5Upload: false,
  34. upMultiple: 5,
  35. upImgUrl: baseConfig.URL.imageHost + "test/img",
  36. upImgExt: "jpg,jpeg,gif,bmp,png",
  37. upMediaUrl: baseConfig.URL.imageHost + "test/img",
  38. upMediaExt: "flv,avi"
  39. });
  40. });
  41. function formRefresh(){
  42. $.ajax( {
  43. url: baseConfig.URL.ininXHeditor,
  44. dataType: 'json',
  45. type: 'post',
  46. data:$("#testForm").serialize(),
  47. success : function(data,textStatus) {
  48. console.log(data);
  49. if(data.status=="SUCCESS"){
  50. $("#scontext").val(data.editorContext);
  51. $("#info_id").val(data.info.id);
  52. $("#title").val(data.info.title);
  53. }
  54. },
  55. error : function() {
  56. alert("404");
  57. }
  58. });
  59. }
  60. function htmltoWord(){
  61. $("#testForm").attr("action",baseConfig.URL.htmlToWord);
  62. $('#testForm').submit();
  63. }
  64. function fileExport(){
  65. $("#testForm").attr("action",baseConfig.URL.exportFile);
  66. $('#testForm').submit();
  67. //
  68. // $.ajax( {
  69. // url: baseConfig.URL.exportFile,
  70. // dataType: 'json',
  71. // type: 'post',
  72. // data:$("#testForm").serialize(),
  73. // success : function(data,textStatus) {
  74. // console.log(data);
  75. // },
  76. // error : function() {
  77. // alert("404");
  78. // }
  79. // });
  80. }
  81. function formSubmit(){
  82. $("#scontext").val($("#scontext").val());
  83. alert($("#scontext").val());
  84. $("#testForm").attr("action",baseConfig.URL.saveXHeditor);
  85. $('#testForm').submit();
  86. }
  87. function callback(objStatus){
  88. alert(objStatus);
  89. }
  90. </script>
  91. </head>
  92. <body >
  93. <iframe name="hidden_frameFile" id="hidden_frameFile" style="display:none"></iframe>
  94. <form name="testForm" id="testForm" action="/test/save" method="post" target="hidden_frameFile" >
  95. <input name="baseUrl" id="baseUrl" type="hidden">
  96. <input name="prv_url" id="prv_url" type="hidden">
  97. id :<input name="id" id="info_id" >
  98. <br>title:<input name="title" id="title" >
  99. <br>html:<textarea id="scontext" name="scontext" rows="25" style="width:80%; border: 1px solid"></textarea>
  100. </form>
  101. <a href="#" onclick="formRefresh()">刷新</a>
  102. <br><a href="#" onclick="formSubmit()">保存</a>
  103. <br><a href="#" onclick="htmltoWord()">转成word导出</a>
  104. <br><input type="button" onclick="fileExport()" value="导出"/>
  105. </body>
  106. </html>