国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

320 satır
12KB

  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. <script>
  14. var shortname = "{dede:global.art_shortname/}";
  15. var npage = parseInt("{dede:field name = 'nowpage'/}");
  16. var totalpage = parseInt("{dede:field name = 'totalpage'/}");
  17. var namehand = "{dede:field name='namehand'/}";
  18. var displaytype = "{dede:field name='displaytype'/}";
  19. var gtimer = null;
  20. //大图
  21. function dPlayBig() {
  22. var imgObj = document.getElementById("bigimg");
  23. window.open(imgObj.src);
  24. }
  25. //停止幻灯
  26. function dStopPlay() {
  27. if (gtimer) clearTimeout(gtimer);
  28. else dPlayNext();
  29. }
  30. //开始幻灯
  31. function dStartPlay() {
  32. if (npage != totalpage) {
  33. gtimer = setTimeout("dPlayNext()", 1000);
  34. }
  35. }
  36. //上一张
  37. function dPlayPre() {
  38. if (npage < 2) {
  39. ShowMsg("这是第一页");
  40. } else {
  41. if (npage == 2) {
  42. if (namehand != '') location.href = namehand + shortname;
  43. else location.href = "{dede:global.cfg_phpurl/}/view.php?aid={dede:field.id/}";
  44. } else if (displaytype == 'st' && namehand != '') {
  45. location.href = namehand + "-" + (npage - 1) + shortname;
  46. } else {
  47. location.href = "{dede:global.cfg_phpurl/}/view.php?aid={dede:field.id/}&pageno=" + (npage - 1);
  48. }
  49. }
  50. }
  51. //下一张
  52. function dPlayNext() {
  53. if (npage == totalpage) {
  54. ShowMsg("没有了哦");
  55. } else {
  56. if (displaytype == 'st' && namehand != '') location.href = namehand + "-" + (npage + 1) + shortname;
  57. else location.href = "{dede:global.cfg_phpurl/}/view.php?aid={dede:field.id/}&pageno=" + (npage + 1);
  58. }
  59. }
  60. </script>
  61. </head>
  62. <body class="body-bg">
  63. {dede:include filename='top.htm'/}
  64. {dede:include filename='head.htm'/}
  65. <div class="container py-3">
  66. <nav aria-label="breadcrumb">
  67. <ol class="breadcrumb mb-0">
  68. <li class="breadcrumb-item">当前位置</li>
  69. {dede:field name='position'/}
  70. </ol>
  71. </nav>
  72. </div>
  73. <main class="container py-3">
  74. <div class="row">
  75. <div class="col-md-9">
  76. <article class="article-main bg-white shadow-sm rounded p-3">
  77. <div class="title">
  78. <h1>{dede:field.title/}</h1>
  79. </div>
  80. <div class="meta py-3">
  81. <a href="{dede:field.userurl/}"><span><img src="{dede:field.face/}" class="user-img-xs mr-1">{dede:field.uname/}</span></a>
  82. <span><i class="fa fa-calendar mr-1"></i>{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}</span>
  83. <span><i class="fa fa-globe mr-1"></i>{dede:field.source/}</span>
  84. <span><i class="fa fa-user mr-1"></i>{dede:field.writer/}</span>
  85. <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>
  86. </div>
  87. <div class="picbox py-3">
  88. {dede:field name='pagestyle' alt='输出不同的图片头信息' runphp='yes'}
  89. if (@me==3) {
  90. @me = '<div class="row">';
  91. } else if (@me==2) {
  92. @me = "<div class='text-center mb-3'>
  93. <a href='javascript:dPlayBig();' class='btn btn-success btn-sm'>原图片</a>
  94. <a href='javascript:dPlayPre();' class='btn btn-success btn-sm'>上一张</a>
  95. <a href='javascript:dPlayNext();' class='btn btn-success btn-sm'>下一张</a>
  96. <a href='javascript:dStopPlay();' class='btn btn-success btn-sm'>自动/暂停播放</a>
  97. </div>";
  98. } else {
  99. @me = '';
  100. }
  101. {/dede:field}
  102. <!--如果使用的是多页单图模式幻灯,把href里的链接改为javascript:dPlayNext();表示点击看下一页-->
  103. {dede:field name='imgurls' alt='输出不同的图片信息'}
  104. [field:pagestyle runphp='yes'] @me= (@me==3 ? '<div class="col-4">' : '');[/field:pagestyle]
  105. <p><a href='[field:linkurl/]'><img src='[field:imgsrc/]' [field:imgwidth/] id='bigimg' alt='[field:alttext/]' title='[field:alttext/]'></a></p>
  106. <p class='text-center'><a href='[field:linkurl/]'>([field:alttext/])</a></p>
  107. [field:pagestyle runphp='yes'] @me = (@me==3 ? '</div>' : ''); [/field:pagestyle]
  108. {/dede:field}
  109. {dede:field name='pagestyle' alt='输出不同的图片尾信息' runphp='yes'}
  110. if (@me==3) {
  111. @me = '</div>';
  112. } else if (@me==2) {
  113. @me = "<script>dStartPlay();</script>";
  114. } else {
  115. @me = '';
  116. }
  117. {/dede:field}
  118. </div>
  119. <div class="body py-3">{dede:field.body/}</div>
  120. <div class="edit py-3">责任编辑:{dede:adminname/}</div>
  121. <div class="page py-3 row">
  122. <div class="col-md-4 prenext">
  123. <div class="pagination-previous mb-3">{dede:prenext get='pre'/}</div>
  124. <div class="pagination-next">{dede:prenext get='next'/}</div>
  125. </div>
  126. <div class="col-md-8">
  127. <div class="row actbox">
  128. <ul>
  129. <li><i class="fa fa-star-o mr-2"></i><a href="{dede:global.cfg_phpurl/}/stow.php?aid={dede:field.id/}">收藏</a></li>
  130. <li><i class="fa fa-bug mr-2"></i><a href="javascript:ErrorAddSave({dede:field.id/}, '{dede:field.title/}');">挑错</a></li>
  131. <li><i class="fa fa-thumbs-o-up mr-2"></i><a href="{dede:global.cfg_phpurl/}/recommend.php?aid={dede:field.id/}">推荐</a></li>
  132. <li><i class="fa fa-print mr-2"></i><a href="javascript:;" onclick="window.print();">打印</a></li>
  133. </ul>
  134. </div>
  135. </div>
  136. </div>
  137. {dede:include filename='widget_article_likes.htm'/}
  138. {dede:include filename='widget_article_feedback.htm'/}
  139. </article>
  140. </div>
  141. <aside class="col-md-3">
  142. <div class="pb-3">{dede:include filename='widget_search.htm'/}</div>
  143. <div class="py-3">{dede:include filename='widget_menu.htm'/}</div>
  144. <div class="pt-3">{dede:include filename='widget_hot.htm'/}</div>
  145. </aside>
  146. </div>
  147. </main>
  148. <script>const PHPURL = '{dede:global.cfg_phpurl/}';</script>
  149. {dede:include filename='foot.htm'/}
  150. <script>
  151. //获取顶踩数据
  152. function GetDigg(aid,cid) {
  153. let url = `{dede:global.cfg_phpurl/}/digg_ajax.php?id=${aid}&cid=${cid}&format=json`;
  154. $.get(url, function (data) {
  155. let reval = JSON.parse(data);
  156. if (reval.code === 200) {
  157. $("#goodpost").html(reval.data.goodpost);
  158. $("#badpost").html(reval.data.badpost);
  159. $("#goodper").css("width", `${reval.data.goodper}%`)
  160. $("#badper").css("width", `${reval.data.badper}%`)
  161. }
  162. })
  163. }
  164. function PostDigg(ftype, aid) {
  165. var saveid = GetCookie('diggid');
  166. if (saveid != null) {
  167. var saveids = saveid.split(',');
  168. var hasid = false;
  169. saveid = '';
  170. j = 1;
  171. for (i = saveids.length - 1; i >= 0; i--) {
  172. if (saveids[i] == aid && hasid) continue;
  173. else {
  174. if (saveids[i] == aid && !hasid) hasid = true;
  175. saveid += (saveid == '' ? saveids[i] : ',' + saveids[i]);
  176. j++;
  177. if (j == 20 && hasid) break;
  178. if (j == 19 && !hasid) break;
  179. }
  180. }
  181. if (hasid) { ShowMsg("您已经顶过该帖,请不要重复顶帖"); return; }
  182. else saveid += ',' + aid;
  183. SetCookie('diggid', saveid, 1);
  184. }
  185. else {
  186. SetCookie('diggid', aid, 1);
  187. }
  188. let url = "{dede:global.cfg_phpurl/}/digg_ajax.php?action=" + ftype + "&id=" + aid + "&format=json&cid={dede:field.channel/}";
  189. $.get(url, function (data) {
  190. let reval = JSON.parse(data);
  191. if (reval.code === 200) {
  192. $("#goodpost").html(reval.data.goodpost);
  193. $("#badpost").html(reval.data.badpost);
  194. $("#goodper").css("width", `${reval.data.goodper}%`)
  195. $("#badper").css("width", `${reval.data.badper}%`)
  196. }
  197. });
  198. }
  199. GetDigg("{dede:field.id/}", "{dede:field.channel/}");
  200. //发表评论
  201. function SendFeedback() {
  202. let feedback = {
  203. action: "send",
  204. comtype: "comments",
  205. aid: "{dede:field.id/}",
  206. msg: $("#iptMsg").val(),
  207. username: $("#iptUsername").val(),
  208. validate: $("#iptValidate").val(),
  209. notuser: $("#iptAny").is(":checked") ? "1" : "",
  210. };
  211. $.post("{dede:global.cfg_phpurl/}/feedback.php", feedback, function (data) {
  212. let result = JSON.parse(data);
  213. if (result.code === 200) {
  214. ShowAlert("#feedback-alert", result.msg, "success");
  215. $("#iptMsg").val("");
  216. $("#iptValidate").val("");
  217. ($("#iptUsername").attr("disabled") !== "disabled") && $("#iptUsername").val("");
  218. $("#validateimg").attr("src", '{dede:global.cfg_phpurl/}/vdimgck.php?' + new Date().getTime() + Math.round(Math.random() * 10000));
  219. } else {
  220. ShowAlert("#feedback-alert", `评论失败:${result.msg}`, "danger");
  221. $("#validateimg").attr("src", '{dede:global.cfg_phpurl/}/vdimgck.php?' + new Date().getTime() + Math.round(Math.random() * 10000));
  222. }
  223. });
  224. }
  225. //进行回复,回复必须登录
  226. function SendReplyFeedback(fid) {
  227. let content = $(`._feedback_reply[for="${fid}"]`).find(".iptReplyContent").val();
  228. let reply = {
  229. action : "send",
  230. comtype : "reply",
  231. fid : fid,
  232. aid : "{dede:field.id/}",
  233. msg : content,
  234. }
  235. $.post("{dede:global.cfg_phpurl/}/feedback.php", reply, function (data) {
  236. let result = JSON.parse(data);
  237. if (result.code === 200) {
  238. ShowAlert(`._feedback_reply[for="${fid}"]`, result.msg, "success");
  239. } else {
  240. ShowAlert(`._feedback_reply[for="${fid}"]`, `评论失败:${result.msg}`, "danger");
  241. }
  242. })
  243. $(`._feedback_reply[for="${fid}"]`).find(".btn-send").attr("disabled", "disabled");
  244. }
  245. //回复某个评论
  246. function ReplyFeedback(fid) {
  247. let replyPannel = `<div class="form-group">
  248. <div class="input-group">
  249. <input type="text" class="form-control iptReplyContent">
  250. <button type="button" class="btn btn-success btn-send" onclick='SendReplyFeedback(${fid})'>评论</button>
  251. </div>
  252. </div>`;
  253. $.get("{dede:global.cfg_memberurl/}/api.php?format=json", function(result) {
  254. if (result.code !== 200) {
  255. $(`._feedback_reply`).html("");
  256. ShowAlert(`._feedback_reply[for="${fid}"]`, '回复需要登录会员中心,您可以<a href="{dede:global.cfg_memberurl/}/login.php">点击登录</a>后再来回复', 'warning', 5000);
  257. } else {
  258. $(`._feedback_reply`).html("");
  259. $(`._feedback_reply[for="${fid}"]`).html(replyPannel);
  260. }
  261. });
  262. $(`._feedback_reply[for="${fid}"]`).html('<i class="fa fa-spinner"></i>');
  263. }
  264. //加载回复评论
  265. function LoadReplyFeedbacks(fid) {
  266. $(`.feedback_replies[for="${fid}"]`).html('<i class="fa fa-spinner"></i>');
  267. $.get("{dede:global.cfg_phpurl/}/feedback.php", {
  268. "aid" : "{dede:field.id/}",
  269. "fid" : fid,
  270. }, function (data) {
  271. let result = JSON.parse(data);
  272. let tpl = `<div class="media py-3">
  273. <img src="~face~" class="face mr-3">
  274. <div class="media-body">
  275. <div class="feedback-infos pb-3">
  276. <div class="feedback-basic">
  277. <span>~username~</span>
  278. <span>~dtimestr~</span>
  279. </div>
  280. <div class="feedback-action">
  281. <a href="javascript:GoodFeedback(~id~, ~good~)">
  282. <i class="fa fa-thumbs-up"></i>
  283. <i id="feedbackGood~id~">~good~</i>
  284. </a>
  285. </div>
  286. </div>
  287. <div class="feedback-content">~msg~</div>
  288. </div>
  289. </div>`;
  290. if (result.code === 200) {
  291. $(`.feedback_replies[for="${fid}"]`).html("");
  292. for (let i = 0; i < result.data.length; i++) {
  293. const feedback = result.data[i];
  294. let rs = tpl;
  295. for (const key in feedback) {
  296. if (feedback.hasOwnProperty(key)) {
  297. rs = rs.replace(new RegExp(`~${key}~`,"gm"), feedback[key])
  298. }
  299. }
  300. $(`.feedback_replies[for="${fid}"]`).append(rs);
  301. }
  302. }
  303. })
  304. }
  305. //赞
  306. function GoodFeedback(fid, g) {
  307. let good = {
  308. action : "send",
  309. feedbacktype : "good",
  310. good : g,
  311. fid : fid,
  312. }
  313. $.post("{dede:global.cfg_phpurl/}/feedback.php", good, function (data) {
  314. let result = JSON.parse(data);
  315. $(`#feedbackGood${fid}`).html(result.data);
  316. })
  317. }
  318. </script>
  319. </body>
  320. </html>