国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
6.5KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="<?php echo $cfg_soft_lang; ?>">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
  6. <title>搜索关键词管理</title>
  7. <link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
  8. <link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="/static/web/css/admin.css">
  10. <script src="/static/web/js/jquery.min.js"></script>
  11. <script src="/static/web/js/bootstrap.min.js"></script>
  12. <script src="/static/web/js/webajax.js"></script>
  13. <script src="/static/web/js/admin.main.js"></script>
  14. <script>
  15. var pageno = 1;
  16. var totalrow = "<?php echo $totalRow?>";
  17. var pagesize = "<?php echo $pagesize?>";
  18. var orderby = "<?php echo $orderby?>";
  19. //加载列表
  20. function ReloadPage(ordertype) {
  21. orderby = ordertype;
  22. var listArea = $Obj('rslist');
  23. var errMsg = "<a href=\"javascript:ReloadPage('" + ordertype + "')\">重新加载列表</a>";
  24. fetch("search_keywords_main.php?dopost=getlist&pageno=" + pageno + "&orderby=" + ordertype).then(resp => {
  25. if (resp.ok) {
  26. return resp.text()
  27. }
  28. throw new Error(errMsg);
  29. }).then((d) => {
  30. listArea.innerHTML = d;
  31. }).catch((error) => {
  32. listArea.innerHTML = errMsg;
  33. });
  34. }
  35. //载入指定页的列表
  36. function LoadPage(npage) {
  37. pageno = npage;
  38. ReloadPage(orderby);
  39. ReloadPageNum(pageno);
  40. }
  41. //更新一个关键词
  42. function UpdateNote(nid) {
  43. var listArea = $Obj('rslist');
  44. var kw = $Obj('keyword' + nid).value;
  45. var kws = $Obj('spwords' + nid).value;
  46. var ct = $Obj('count' + nid).value;
  47. var errMsg = "<a href=\"javascript:LoadPage('" + pageno + "')\">重新加载列表</a>";
  48. <?php if (strtolower(substr($cfg_soft_lang, 0, 3)) == 'utf') {?>
  49. const formData = new FormData()
  50. formData.append('dopost', 'update');
  51. formData.append('aid', nid);
  52. formData.append('keyword', kw);
  53. formData.append('spwords', kws);
  54. formData.append('count', ct);
  55. formData.append('pageno', pageno);
  56. formData.append('orderby', orderby);
  57. fetch('search_keywords_main.php', {
  58. method: 'POST',
  59. body: formData
  60. })
  61. .then(r => {
  62. if (r.ok) {
  63. return r.text()
  64. }
  65. throw new Error(errMsg);
  66. })
  67. .then(d => {
  68. listArea.innerHTML = d;
  69. }).catch((error) => {
  70. $DE('edsta').innerHTML = errMsg;
  71. });
  72. <?php }?>
  73. ShowMsg('成功更新关键词');
  74. //myajax.SendGet("search_keywords_main.php?dopost=update&aid="+nid+"&keyword="+kw+"&spwords="+kws+"&count="+ct+"&pageno="+pageno);
  75. }
  76. //删除关键词
  77. function DelNote(nid) {
  78. var listArea = $Obj('rslist');
  79. totalrow = totalrow - 1;
  80. var pagenum = Math.ceil(totalrow / pagesize);
  81. if (pagenum <= pageno) pageno = pagenum;
  82. var errMsg = "<a href=\"javascript:LoadPage('" + pageno + "')\">重新加载列表</a>";
  83. fetch("search_keywords_main.php?dopost=del&aid=" + nid + "&pageno=" + pageno + "&orderby=" + orderby).then(resp => {
  84. if (resp.ok) {
  85. return resp.text()
  86. }
  87. throw new Error(errMsg);
  88. }).then((d) => {
  89. listArea.innerHTML = d;
  90. }).catch((error) => {
  91. listArea.innerHTML = errMsg;
  92. });
  93. ReloadPageNum(pageno);
  94. }
  95. function ReloadPageNum(startnum) {
  96. var ListArea = $Obj('pagelist');
  97. var pagenum = Math.ceil(totalrow / pagesize);
  98. var listsize = 6;
  99. var ahtml = "<ul class='pagination justify-content-end'>";
  100. var startloop = 1;
  101. var endnum = 0;
  102. ahtml += "<li class='page-item disabled'><span class='page-link'>" + pagenum + "页" + totalrow + "条</span></li>";
  103. if (pageno > 1 && pageno != 1) ahtml += "<li class='page-item'><a href='javascript:LoadPage(1);' class='page-link'>首页</a></li>";
  104. if (pageno > 1) ahtml += "<li class='page-item'><a href='javascript:LoadPage(" + (pageno - 1) + ");' class='page-link'>上页</a></li>";
  105. if (startnum >= pagenum - listsize) {
  106. startloop = pagenum - (listsize * 2);
  107. if (startloop < 1) startloop = 1;
  108. for (i = startloop; i <= pagenum; i++) {
  109. if (i == pageno) ahtml += "<li class='page-item'><span class='page-link'>" + i + "</span></li>";
  110. else ahtml += "<li class='page-item'><a href='javascript:LoadPage(" + i + ");' class='page-link'>" + i + "</a></li>";
  111. }
  112. } else if (pagenum < listsize) {
  113. for (i = 1; i <= pagenum; i++) {
  114. if (i == pageno) ahtml += "<li class='page-item'><span class='page-link'>" + i + "</span></li>";
  115. else ahtml += "<li class='page-item'><a href='javascript:LoadPage(" + i + ");' class='page-link'>" + i + "</a></li>";
  116. }
  117. } else {
  118. startloop = startnum - listsize;
  119. if (startloop < 1) { startloop = 1; endnum = startloop + (listsize * 2); }
  120. else { endnum = startnum + listsize; }
  121. if (endnum >= pagenum) endnum = pagenum;
  122. for (i = startloop; i <= endnum; i++) {
  123. if (i == pageno) ahtml += "<li class='page-item'><span class='page-link'>" + i + "</span></li>";
  124. else ahtml += "<li class='page-item'><a href='javascript:LoadPage(" + i + ");' class='page-link'>" + i + "</a></li>";
  125. }
  126. }
  127. if (pageno < pagenum) ahtml += "<li class='page-item'><a href='javascript:LoadPage(" + (pageno + 1) + ");' class='page-link'>下页</a></li>";
  128. if (pageno != pagenum && pagenum > 1) ahtml += "<li class='page-item'><a href='javascript:LoadPage(" + pagenum + ");' class='page-link'>末页</a></li>";
  129. ListArea.innerHTML = ahtml+"</ul>";
  130. }
  131. </script>
  132. </head>
  133. <body>
  134. <div class="container-fluid">
  135. <ol class="breadcrumb">
  136. <li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li>
  137. <li class="breadcrumb-item active">搜索关键词管理</li>
  138. </ol>
  139. <div class="card shadow-sm">
  140. <div class="card-header">搜索关键词管理</div>
  141. <div class="card-body">
  142. <div id="rslist" ><?php GetKeywordList($dsql,$pageno,$pagesize,$orderby);?></div>
  143. <div id="pagelist"></div>
  144. <script>ReloadPageNum(1);</script>
  145. </div>
  146. </div>
  147. </div>
  148. <script>
  149. function selAll() {
  150. var celements = document.getElementsByName('aids[]');
  151. for (i=0;i<celements.length;i++) {
  152. if (!celements[i].checked) celements[i].checked = true;
  153. else celements[i].checked = false;
  154. }
  155. }
  156. function noselAll() {
  157. var celements = document.getElementsByName('aids[]');
  158. for (i=0;i<celements.length;i++) {
  159. if (celements[i].checked = true) {
  160. celements[i].checked = false;
  161. }
  162. }
  163. }
  164. function delall() {
  165. DedeConfirm("您确定要删除关键词吗").then((v) => {
  166. document.form3.dopost.value = 'delall';
  167. document.form3.submit();
  168. }).catch((e) => {
  169. console.log(e);
  170. });
  171. }
  172. </script>
  173. </body>
  174. </html>