Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

3 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>章节管理 - 原创专区 - {$kx.config.sitename}</title>
  6. <link rel="stylesheet" href="{$kx.config.resurl}/template/kxwebno1/author/css/style.css"/>
  7. <link rel="shortcut icon" type="image/ico" href="/favicon.ico"/>
  8. <meta name="author" content="www.ptcms.com">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  10. <meta name="renderer" content="webkit">
  11. <meta name="viewport" content="width=device-width"/>
  12. <meta name="applicable-device" content="pc">
  13. <meta http-equiv="Cache-Control" content="no-siteapp"/>
  14. <meta http-equiv="Cache-Control" content="no-transform"/>
  15. <link rel="canonical" href="{$kx.config.pcurl}__SELF__"/>
  16. <style>
  17. .labels {
  18. height: 51px;
  19. }
  20. .labels li {
  21. padding: 15px 40px;
  22. background-color: #e5e5e5;
  23. color: #929297;
  24. display: inline-block;
  25. float: left;
  26. }
  27. .labels li:hover,
  28. .labels li.active {
  29. background-color: #fff;
  30. color: #323237;
  31. }
  32. .container {
  33. padding: 20px;
  34. }
  35. .container .head {
  36. width: 100%;
  37. height: 50px;
  38. }
  39. .container .head button {
  40. padding: 5px 20px;
  41. background-color: #fff;
  42. border: 1px solid #C9C9C9;
  43. margin: 0 5px;
  44. border-radius: 2px;
  45. cursor: pointer;
  46. }
  47. .container .head button:hover {
  48. border-color: #f55;
  49. color: #f55;
  50. }
  51. .container .content .warning {
  52. background-color: #F7F8F8;
  53. border-top: 2px solid #f0f1f1;
  54. }
  55. .container .content textarea {
  56. color: #323237;
  57. }
  58. .container .content textarea[name=postscript] {
  59. border-top: 1px solid #f3f3f3 !important;
  60. }
  61. /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
  62. .container .content textarea::-webkit-scrollbar {
  63. width: 8px;
  64. height: 16px;
  65. background-color: #f5f4f5;
  66. }
  67. /*定义滑块 内阴影+圆角*/
  68. .container .content textarea::-webkit-scrollbar-thumb {
  69. background-color: #929297;
  70. }
  71. </style>
  72. </head>
  73. <body>
  74. {include file="/author/system/header"}
  75. <div class="body">
  76. {include file="/author/system/left"}
  77. <div class="right">
  78. <div class="labels">
  79. <ul>
  80. <a href="{link=author.chapter.index novelid=$kx.get.novelid type='draft'}"><li class="{=$type=='draft'?'active':''}">草稿箱</li></a>
  81. <a href="{link=author.chapter.index novelid=$kx.get.novelid type='published'}"><li class="{=$type=='published'?'active':''}">已发布</li></a>
  82. <a href="{link=author.chapter.index novelid=$kx.get.novelid type='recycle'}"><li class="{=$type=='recycle'?'active':''}">回收站</li></a>
  83. <a href="{link=author.novel.index novelid=$kx.get.novelid}"><li>作品设置</li></a>
  84. </ul>
  85. <a href="{link=author.chapter.add novelid=$kx.get.novelid}" class="fr color1 bg-red plr20 ptb10">
  86. <img class="pr10 vertical-middle" style="height: 16px;width:16px;"
  87. src="{$kx.config.resurl}/template/kxwebno1/author/images/icon-edit.png" alt="新建章节">新建章节
  88. </a>
  89. </div>
  90. <div class="container bg-white">
  91. <form method="post">
  92. <div class="head">
  93. <a href="javascript:history.back();" class="fl ptb5 plr20 border-radius2 mlr5"
  94. style="background-color:#f5f4f5;border 1px solid #f5f4f5">
  95. <img class="mr10 vertical-middle"
  96. src="{$kx.config.resurl}/template/kxwebno1/author/images/icon-return.png"
  97. style="width: 8px;height: 16px;" alt="返回">返回
  98. </a>
  99. <div class="fl ml30 pt5">
  100. <label for="chapter_type" class="ptb5 color0 vertical-middle">类型</label>
  101. {if in_array($novel.type,[\App\Model\Novel\Novel::TYPE_TOLL,\App\Model\Novel\Novel::TYPE_VIP_FREE])}
  102. <input type="hidden" name="chapter_type" value="{=\App\Model\Novel\Chapter::TYPE_TOLL}">
  103. <span class="ptb5 color0 vertical-middle">收费章节</span>
  104. {else}
  105. <input type="hidden" name="chapter_type" value="{=\App\Model\Novel\Chapter::TYPE_FREE}">
  106. <span class="ptb5 color0 vertical-middle">公众章节</span>
  107. {/if}
  108. </div>
  109. <span style="line-height: 30px;margin-left: 10px;" id="auto_save_tips"></span>
  110. <button type="submit" class="fr color2 border-red" name="status" value="publish">发布</button>
  111. <button type="submit" class="fr" name="status" value="draft">保存草稿</button>
  112. {if $kx.get.type != 'published'}
  113. <button type="button" class="fr">删除</button>
  114. {/if}
  115. </div>
  116. <div class="content">
  117. <p class="plr15 ptb5 warning">警告:根据国家相关法律规定要求,禁止上传任何色情、低俗、涉政等违法违规内容。一旦出现我们将根据法规进行审核处理。</p>
  118. <div class="mtb15">
  119. <label class="color0 size24 bold">章节名称:</label>
  120. <input class="border-none size24 bold color0" style="width: 700px;" type="text" name="name"
  121. placeholder="请输入" value="{$chapter.name}">
  122. <span class="fr mt20">字数 <span class="input-number-tip">{=\Kuxin\Helper\Json::decode($chapter.note)['words']}</span></span>
  123. </div>
  124. <textarea name="content" class="w100 plr10 ptb10 border-none" style="width:930px;height:405px;"
  125. placeholder="章节内容">{$chapter.content}</textarea>
  126. <textarea name="postscript" class="w100 plr10 ptb10 border-none" style="width:930px;height:50px"
  127. placeholder="作者想说的话">{$chapter.postscript}</textarea>
  128. </div>
  129. </form>
  130. </div>
  131. </div>
  132. </div>
  133. {include file="/author/system/footer"}
  134. <script>
  135. var isSave = true;
  136. $("textarea").on('keydown', function (e) {
  137. if (e.keyCode === 9) {
  138. e.preventDefault();
  139. var indent = ' ';
  140. var start = this.selectionStart;
  141. var end = this.selectionEnd;
  142. var selected = window.getSelection().toString();
  143. selected = indent + selected.replace(/\n/g, '\n' + indent);
  144. this.value = this.value.substring(0, start) + selected + this.value.substring(end);
  145. this.setSelectionRange(start + indent.length, start + selected.length);
  146. }
  147. });
  148. $("textarea[name=content]").on('keyup', function () {
  149. var str = $(this).val();
  150. var len = str.length;
  151. var reLen = 0;
  152. for (var i = 0; i < len; i++) {
  153. if (str.charCodeAt(i) < 33) {
  154. continue;
  155. }
  156. if (str.charCodeAt(i) >= 0 || str.charCodeAt(i) <= 128) {
  157. reLen += 1;
  158. } else {
  159. reLen += 2;
  160. }
  161. }
  162. $(".input-number-tip").html(reLen);
  163. });
  164. $("form").submit(function () {
  165. $('button[type=submit]').click(function(){return false});
  166. });
  167. var save_key = 'author_{$kx.get.novelid}_{$type}_{=$chapter.id?:0}';
  168. function load() {
  169. var data = window.localStorage.getItem(save_key);
  170. if (data && (data = JSON.parse(data))){
  171. if(confirm('上次的编辑在 '+data.saveTime+' 有未正确的保存,是否恢复?')){
  172. $('input[name=chapter_type]').val(data.type);
  173. $('input[name=name]').val(data.name);
  174. $('textarea[name=content]').val(data.content);
  175. $('textarea[name=postscript]').val(data.postscript);
  176. }else{
  177. remove();
  178. }
  179. }
  180. }
  181. $('input[name=name],textarea[name=content],textarea[name=postscript]').keyup(function () {
  182. isSave = false;
  183. });
  184. load();
  185. function save() {
  186. if(!isSave && ($('textarea[name=content]').val() || $('textarea[name=postscript]').val())){
  187. var saveTime = (new Date()).toLocaleString();
  188. window.localStorage.setItem(save_key, JSON.stringify({
  189. type: $('input[name=chapter_type]').val(),
  190. name: $('input[name=name]').val(),
  191. content: $('textarea[name=content]').val(),
  192. postscript: $('textarea[name=postscript]').val(),
  193. saveTime: saveTime
  194. }));
  195. $('#auto_save_tips').text('自动保存于:'+saveTime);
  196. isSave = true;
  197. }
  198. }
  199. function remove() {
  200. window.localStorage.removeItem(save_key)
  201. }
  202. setInterval(function () {save();},10000);
  203. $('form').submit(function () {
  204. remove(save_key);
  205. return true;
  206. });
  207. </script>
  208. </body>
  209. </html>