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

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