国内流行的内容管理系统(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.

248 lines
9.7KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
  7. <title>{dede:field.title/}-{dede:global.cfg_webname/}</title>
  8. <meta name="keywords" content="{dede:field.keywords/}">
  9. <meta name="description" content="{dede:field.description function='html2text(@me)'/}">
  10. <link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
  11. <link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
  12. <link rel="stylesheet" href="/static/web/css/style.css">
  13. <link rel="shortcut icon" href="/static/web/img/favicon.ico">
  14. <link rel="stylesheet" href="/static/ckeditor/plugins/codesnippet/lib/highlight/styles/default.css">
  15. </head>
  16. <body class="body-bg">
  17. {dede:include filename='top.htm'/}
  18. {dede:include filename='head.htm'/}
  19. <div class="container py-3">
  20. <nav aria-label="breadcrumb">
  21. <ol class="breadcrumb mb-0">
  22. <li class="breadcrumb-item">当前位置</li>
  23. {dede:field name='position'/}
  24. </ol>
  25. </nav>
  26. </div>
  27. <main class="container py-3">
  28. <div class="row">
  29. <div class="col-md-9">
  30. <article class="article-main bg-white shadow-sm rounded p-3">
  31. <div class="title">
  32. <h1>{dede:field.title/}</h1>
  33. </div>
  34. <div class="meta py-3">
  35. <a href="{dede:field.userurl/}" target="_blank"><span><img src="{dede:field.face/}" class="user-img-xs mr-1">{dede:field.uname/}</span></a>
  36. <span><i class="fa fa-calendar mr-1"></i>{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}</span>
  37. <span><i class="fa fa-globe mr-1"></i>{dede:field.source/}</span>
  38. <span><i class="fa fa-user mr-1"></i>{dede:field.writer/}</span>
  39. <span><i class="fa fa-eye mr-1"></i><script src="{dede:global.cfg_phpurl/}/count.php?view=yes&aid={dede:field.id/}&mid={dede:field name='mid'/}"></script>次</span>
  40. </div>
  41. <div class="column py-3">{dede:pagetitle/}</div>
  42. <div class="body py-3">{dede:field.body/}</div>
  43. <div class="edit py-3">责任编辑:{dede:adminname/}</div>
  44. <nav class="column-page py-3">
  45. <ul class="pagination justify-content-center">{dede:pagebreak/}</ul>
  46. </nav>
  47. <div class="page py-3 row">
  48. <div class="col-md-4 prenext">
  49. <div class="pagination-previous mb-3">{dede:prenext get='pre'/}</div>
  50. <div class="pagination-next">{dede:prenext get='next'/}</div>
  51. </div>
  52. <div class="col-md-8">
  53. <div class="row actbox">
  54. <ul>
  55. <li><i class="fa fa-star-o mr-2"></i><a href="{dede:global.cfg_phpurl/}/stow.php?aid={dede:field.id/}" target="_blank">收藏</a></li>
  56. <li><i class="fa fa-bug mr-2"></i><a href="javascript:ErrorAddSave({dede:field.id/}, '{dede:field.title/}');">挑错</a></li>
  57. <li><i class="fa fa-thumbs-o-up mr-2"></i><a href="{dede:global.cfg_phpurl/}/recommend.php?aid={dede:field.id/}" target="_blank">推荐</a></li>
  58. <li><i class="fa fa-print mr-2"></i><a href="javascript:;" onclick="window.print();">打印</a></li>
  59. </ul>
  60. </div>
  61. </div>
  62. </div>
  63. {dede:include filename='widget_article_likes.htm'/}
  64. {dede:include filename='widget_article_feedback.htm'/}
  65. </article>
  66. </div>
  67. <aside class="col-md-3">
  68. <div class="pb-3">{dede:include filename='widget_search.htm'/}</div>
  69. <div class="py-3">{dede:include filename='widget_menu.htm'/}</div>
  70. <div class="pt-3">{dede:include filename='widget_hot.htm'/}</div>
  71. </aside>
  72. </div>
  73. </main>
  74. <script>const PHPURL = '{dede:global.cfg_phpurl/}';</script>
  75. {dede:include filename='foot.htm'/}
  76. <script src="/static/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js"></script>
  77. <script>hljs.initHighlightingOnLoad();</script>
  78. <script>
  79. //获取顶踩数据
  80. function GetDigg(aid,cid) {
  81. let url = `{dede:global.cfg_phpurl/}/digg_ajax.php?id=${aid}&cid=${cid}&format=json`;
  82. $.get(url, function (data) {
  83. let reval = JSON.parse(data);
  84. if (reval.code === 200) {
  85. $("#goodpost").html(reval.data.goodpost);
  86. $("#badpost").html(reval.data.badpost);
  87. $("#goodper").css("width", `${reval.data.goodper}%`)
  88. $("#badper").css("width", `${reval.data.badper}%`)
  89. }
  90. })
  91. }
  92. function PostDigg(ftype, aid) {
  93. var saveid = GetCookie('diggid');
  94. if (saveid != null) {
  95. var saveids = saveid.split(',');
  96. var hasid = false;
  97. saveid = '';
  98. j = 1;
  99. for (i = saveids.length - 1; i >= 0; i--) {
  100. if (saveids[i] == aid && hasid) continue;
  101. else {
  102. if (saveids[i] == aid && !hasid) hasid = true;
  103. saveid += (saveid == '' ? saveids[i] : ',' + saveids[i]);
  104. j++;
  105. if (j == 20 && hasid) break;
  106. if (j == 19 && !hasid) break;
  107. }
  108. }
  109. if (hasid) { ShowMsg("您已经顶过该帖,请不要重复顶帖"); return; }
  110. else saveid += ',' + aid;
  111. SetCookie('diggid', saveid, 1);
  112. }
  113. else {
  114. SetCookie('diggid', aid, 1);
  115. }
  116. let url = "{dede:global.cfg_phpurl/}/digg_ajax.php?action=" + ftype + "&id=" + aid + "&format=json&cid={dede:field.channel/}";
  117. $.get(url, function (data) {
  118. let reval = JSON.parse(data);
  119. if (reval.code === 200) {
  120. $("#goodpost").html(reval.data.goodpost);
  121. $("#badpost").html(reval.data.badpost);
  122. $("#goodper").css("width", `${reval.data.goodper}%`)
  123. $("#badper").css("width", `${reval.data.badper}%`)
  124. }
  125. });
  126. }
  127. GetDigg("{dede:field.id/}", "{dede:field.channel/}");
  128. //发表评论
  129. function SendFeedback() {
  130. let feedback = {
  131. action: "send",
  132. comtype: "comments",
  133. aid: "{dede:field.id/}",
  134. msg: $("#iptMsg").val(),
  135. username: $("#iptUsername").val(),
  136. validate: $("#iptValidate").val(),
  137. notuser: $("#iptAny").is(":checked") ? "1" : "",
  138. };
  139. $.post("{dede:global.cfg_phpurl/}/feedback.php", feedback, function (data) {
  140. let result = JSON.parse(data);
  141. if (result.code === 200) {
  142. ShowAlert("#feedback-alert", result.msg, "success");
  143. $("#iptMsg").val("");
  144. $("#iptValidate").val("");
  145. ($("#iptUsername").attr("disabled") !== "disabled") && $("#iptUsername").val("");
  146. $("#validateimg").attr("src", '{dede:global.cfg_phpurl/}/vdimgck.php?' + new Date().getTime() + Math.round(Math.random() * 10000));
  147. } else {
  148. ShowAlert("#feedback-alert", `评论失败:${result.msg}`, "danger");
  149. $("#validateimg").attr("src", '{dede:global.cfg_phpurl/}/vdimgck.php?' + new Date().getTime() + Math.round(Math.random() * 10000));
  150. }
  151. });
  152. }
  153. //进行回复,回复必须登录
  154. function SendReplyFeedback(fid) {
  155. let content = $(`._feedback_reply[for="${fid}"]`).find(".iptReplyContent").val();
  156. let reply = {
  157. action : "send",
  158. comtype : "reply",
  159. fid : fid,
  160. aid : "{dede:field.id/}",
  161. msg : content,
  162. }
  163. $.post("{dede:global.cfg_phpurl/}/feedback.php", reply, function (data) {
  164. let result = JSON.parse(data);
  165. if (result.code === 200) {
  166. ShowAlert(`._feedback_reply[for="${fid}"]`, result.msg, "success");
  167. } else {
  168. ShowAlert(`._feedback_reply[for="${fid}"]`, `评论失败:${result.msg}`, "danger");
  169. }
  170. })
  171. $(`._feedback_reply[for="${fid}"]`).find(".btn-send").attr("disabled", "disabled");
  172. }
  173. //回复某个评论
  174. function ReplyFeedback(fid) {
  175. let replyPannel = `<div class="form-group">
  176. <div class="input-group">
  177. <input type="text" class="form-control iptReplyContent">
  178. <button type="button" class="btn btn-success btn-send" onclick='SendReplyFeedback(${fid})'>评论</button>
  179. </div>
  180. </div>`;
  181. $.get("{dede:global.cfg_memberurl/}/api.php?format=json", function(result) {
  182. if (result.code !== 200) {
  183. $(`._feedback_reply`).html("");
  184. ShowAlert(`._feedback_reply[for="${fid}"]`, '回复需要登录会员中心,您可以<a href="{dede:global.cfg_memberurl/}/login.php">点击登录</a>后再来回复', 'warning', 5000);
  185. } else {
  186. $(`._feedback_reply`).html("");
  187. $(`._feedback_reply[for="${fid}"]`).html(replyPannel);
  188. }
  189. });
  190. $(`._feedback_reply[for="${fid}"]`).html('<i class="fa fa-spinner"></i>');
  191. }
  192. //加载回复评论
  193. function LoadReplyFeedbacks(fid) {
  194. $(`.feedback_replies[for="${fid}"]`).html('<i class="fa fa-spinner"></i>');
  195. $.get("{dede:global.cfg_phpurl/}/feedback.php", {
  196. "aid" : "{dede:field.id/}",
  197. "fid" : fid,
  198. }, function (data) {
  199. let result = JSON.parse(data);
  200. let tpl = `<div class="media py-3">
  201. <img src="~face~" class="face mr-3">
  202. <div class="media-body">
  203. <div class="feedback-infos pb-3">
  204. <div class="feedback-basic">
  205. <span>~username~</span>
  206. <span>~dtimestr~</span>
  207. </div>
  208. <div class="feedback-action">
  209. <a href="javascript:GoodFeedback(~id~, ~good~)">
  210. <i class="fa fa-thumbs-up"></i>
  211. <i id="feedbackGood~id~">~good~</i>
  212. </a>
  213. </div>
  214. </div>
  215. <div class="feedback-content">~msg~</div>
  216. </div>
  217. </div>`;
  218. if (result.code === 200) {
  219. $(`.feedback_replies[for="${fid}"]`).html("");
  220. for (let i = 0; i < result.data.length; i++) {
  221. const feedback = result.data[i];
  222. let rs = tpl;
  223. for (const key in feedback) {
  224. if (feedback.hasOwnProperty(key)) {
  225. rs = rs.replace(new RegExp(`~${key}~`,"gm"), feedback[key])
  226. }
  227. }
  228. $(`.feedback_replies[for="${fid}"]`).append(rs);
  229. }
  230. }
  231. })
  232. }
  233. //赞
  234. function GoodFeedback(fid, g) {
  235. let good = {
  236. action : "send",
  237. feedbacktype : "good",
  238. good : g,
  239. fid : fid,
  240. }
  241. $.post("{dede:global.cfg_phpurl/}/feedback.php", good, function (data) {
  242. let result = JSON.parse(data);
  243. $(`#feedbackGood${fid}`).html(result.data);
  244. })
  245. }
  246. </script>
  247. </body>
  248. </html>