qrcode.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>二维码</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  7. <meta name="generator" content="www.leipi.org"/>
  8. <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
  9. <!--[if lte IE 6]>
  10. <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-ie6.css">
  11. <![endif]-->
  12. <!--[if lte IE 7]>
  13. <link rel="stylesheet" type="text/css" href="bootstrap/css/ie.css">
  14. <![endif]-->
  15. <link rel="stylesheet" href="leipi.style.css">
  16. <script type="text/javascript" src="../dialogs/internal.js"></script>
  17. <script type="text/javascript">
  18. function createElement(type, name) {
  19. var element = null;
  20. try {
  21. element = document.createElement('<' + type + ' name="' + name + '">');
  22. } catch (e) {
  23. }
  24. if (element == null) {
  25. element = document.createElement(type);
  26. element.name = name;
  27. }
  28. return element;
  29. }
  30. </script>
  31. </head>
  32. <body>
  33. <div class="content">
  34. <table class="table table-bordered table-striped table-hover">
  35. <tr>
  36. <th><span>控件名称</span><span class="label label-important">*</span></th>
  37. <th><span>类型</span></th>
  38. </tr>
  39. <tr>
  40. <td>
  41. <input id="orgname" placeholder="必填项" type="text"/>
  42. </td>
  43. <td>
  44. <select id="orgtype" class="form-control">
  45. <option value="text">文本</option>
  46. <option value="url">超链接 url</option>
  47. <option value="tel">电话</option>
  48. </select>
  49. </td>
  50. </tr>
  51. <tr>
  52. <th><span>文本框样式</span></th>
  53. <td>
  54. 宽 <input id="orgwidth" type="text" value="40" class="input-small span1" placeholder="auto"/> px
  55. &nbsp;&nbsp;
  56. 高 <input id="orgheight" type="text" value="40" class="input-small span1" placeholder="auto"/> px
  57. </td>
  58. </tr>
  59. <tr>
  60. <td colspan="2">
  61. <label for="orgvalue">内容</label>
  62. <textarea class="input-block-level" rows="3" id="orgvalue" placeholder="二维码内容..."></textarea>
  63. </td>
  64. </tr>
  65. </table>
  66. <div class="alert alert-danger">提示:二维码只支持少量内容,请不要加入大量内容</div>
  67. </div>
  68. <script type="text/javascript">
  69. var oNode = null, thePlugins = 'qrcode';
  70. window.onload = function () {
  71. if (UE.plugins[thePlugins].editdom) {
  72. oNode = UE.plugins[thePlugins].editdom;
  73. var gValue = oNode.getAttribute('value').replace(/&quot;/g, "\""),
  74. gTitle = oNode.getAttribute('title').replace(/&quot;/g, "\""), gWidth = oNode.getAttribute('orgwidth'),
  75. gHeight = oNode.getAttribute('orgheight'), gType = oNode.getAttribute('orgtype');
  76. $G('orgvalue').value = gValue;
  77. $G('orgname').value = gTitle;
  78. $G('orgwidth').value = gWidth;
  79. $G('orgheight').value = gHeight;
  80. $G('orgtype').value = gType;
  81. }
  82. }
  83. dialog.oncancel = function () {
  84. if (UE.plugins[thePlugins].editdom) {
  85. delete UE.plugins[thePlugins].editdom;
  86. }
  87. };
  88. dialog.onok = function () {
  89. if ($G('orgname').value == '') {
  90. alert('控件名称不能为空');
  91. return false;
  92. }
  93. var gValue = $G('orgvalue').value.replace(/\"/g, "&quot;"),
  94. gTitle = $G('orgname').value.replace(/\"/g, "&quot;"), gFontSize, gWidth = $G('orgwidth').value,
  95. gHeight = $G('orgheight').value, gType = $G('orgtype').value;
  96. if (!oNode) {
  97. try {
  98. oNode = createElement('img', 'leipiNewField');
  99. oNode.setAttribute('title', gTitle);
  100. oNode.setAttribute('name', 'leipiNewField');
  101. oNode.setAttribute('value', gValue);
  102. oNode.setAttribute('orgtype', gType);
  103. oNode.setAttribute('leipiPlugins', thePlugins);
  104. oNode.setAttribute('src', editor.options.UEDITOR_HOME_URL + UE.leipiFormDesignUrl + '/images/qrcode.gif');
  105. if (gWidth != '') {
  106. oNode.style.width = gWidth + 'px';
  107. }
  108. oNode.setAttribute('orgwidth', gWidth);
  109. if (gHeight != '') {
  110. oNode.style.height = gHeight + 'px';
  111. }
  112. oNode.setAttribute('orgheight', gHeight);
  113. editor.execCommand('insertHtml', oNode.outerHTML);
  114. return true;
  115. } catch (e) {
  116. try {
  117. editor.execCommand('error');
  118. } catch (e) {
  119. alert('控件异常,请到 [雷劈网] 反馈或寻求帮助!');
  120. }
  121. return false;
  122. }
  123. } else {
  124. oNode.setAttribute('title', gTitle);
  125. oNode.setAttribute('orgtype', gType);
  126. oNode.setAttribute('value', gValue);
  127. //oNode.innerHTML = $G('orgvalue').value;
  128. if (gWidth != '') {
  129. oNode.style.width = gWidth + 'px';
  130. } else {
  131. oNode.style.width = '';
  132. }
  133. oNode.setAttribute('orgwidth', gWidth);
  134. if (gHeight != '') {
  135. oNode.style.height = gHeight + 'px';
  136. } else {
  137. oNode.style.height = '';
  138. }
  139. oNode.setAttribute('orgheight', gHeight);
  140. delete UE.plugins[thePlugins].editdom;
  141. return true;
  142. }
  143. };
  144. </script>
  145. </body>
  146. </html>