viewPost.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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, maximum-scale=1">
  7. <title>发布文章</title>
  8. <link rel="stylesheet" href="../../../assets/libs/layui/css/layui.css"/>
  9. <link rel="stylesheet" href="../../../assets/module/inputTags.css"/>
  10. <link rel="stylesheet" href="../../../assets/module/admin.css?v=312"/>
  11. <link rel="stylesheet" href="../../../assets/module/formSelects/formSelects-v4.css"/>
  12. <style>
  13. .time-box {
  14. overflow: hidden;
  15. padding: 0px 30px;
  16. padding-top: 20px;
  17. }
  18. .time1 {
  19. float: left;
  20. margin-right: 50px;
  21. }
  22. .fu {
  23. display: inline-block;
  24. font-size: 16px;
  25. color: #fff;
  26. margin-bottom: 10px;
  27. margin-top: 10px;
  28. padding: 10px 20px;
  29. background: #3a98ff;
  30. }
  31. .line {
  32. margin-top: -10px;
  33. border-bottom: 2px solid #3a98ff;
  34. margin-bottom: 25px;
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <!-- 页面加载loading -->
  40. <div class="page-loading">
  41. <div class="ball-loader">
  42. <span></span><span></span><span></span><span></span>
  43. </div>
  44. </div>
  45. <!-- 正文开始 -->
  46. <div class="layui-row" style="margin-top: 10px;background: white">
  47. <div style="width:93%;margin:0 auto;padding-bottom: 5px;">
  48. <!--<div class="layui-inline pull-right" style="padding-top: 14px;">
  49. <button class="layui-btn icon-btn" onclick="goBack()">返 回</button>
  50. </div>-->
  51. <div style="padding-top: 20px;text-align: right;">
  52. <button class="layui-btn icon-btn" onclick="history.back()">返 回</button>
  53. <!--<a href="javascript:void(0)" style="color: #5b9bd1;font-size: 16px;" onclick="goBack()">返回</a>&nbsp;&nbsp;-->
  54. </div>
  55. <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
  56. <legend id="postTitle"></legend>
  57. <div class="layui-field-box">
  58. <div class="time-box">
  59. <h4><span class="time1" id="postAuthor">发布人:</span></h4>
  60. <h4><span class="time1" id="createdTime">时间:</span></h4>
  61. </div>
  62. <hr class="layui-bg-gray">
  63. <blockquote class="layui-elem-quote layui-quote-nm" id="postContent">
  64. </blockquote>
  65. </div>
  66. </fieldset>
  67. <!--<hr class="layui-bg-gray">-->
  68. </blockquote>
  69. <div style="margin-bottom: 30px;">
  70. <!-- 缩略图Div -->
  71. <div id="postPicUrlDiv" style="display: none">
  72. <span class="fu">缩略图:</span>
  73. <div class="line"></div>
  74. <p>
  75. <a target="_blank" id="postPicUrlA">
  76. <img style="width: 230px;height: 200px;" id="postPicUrlImg" src="">
  77. </a>
  78. </p>
  79. </div>
  80. <span class="fu">附件</span>
  81. <div class="line"></div>
  82. <p style="color: indianred;">
  83. 温馨提示:图片可直接点击查看大图,文件可点击下载
  84. </p>
  85. <div id="attachmentDiv" style="display: none">
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <!-- js部分 -->
  91. <script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>
  92. <script type="text/javascript" src="../../../assets/js/common.js?v=312"></script>
  93. <script type="text/javascript" src="../../../assets/libs/jquery/jquery-3.2.1.min.js"></script>
  94. <script type="text/javascript" src="../../../assets/module/inputTags.js"></script>
  95. <script src="../../../assets/libs/wangEditor/wangEditor.js"></script>
  96. <script>
  97. var typePage = '';
  98. layui.use(['layer', 'form', 'table', 'admin', 'zTree', 'uParas', 'upload', 'inputTags', 'formSelects'], function () {
  99. var $ = layui.jquery;
  100. var layer = layui.layer;
  101. var admin = layui.admin;
  102. var uParas = layui.uParas;
  103. var postId = uParas.getUrlParam("postId");
  104. typePage = uParas.getUrlParam("type");
  105. admin.req(uParas.baseUrl + '/ent/post/get/' + postId, {}, function (resp) {
  106. if (resp.code == 1) {
  107. var post = resp.data.post;
  108. // 填充数据
  109. $("#postTitle").text(post.postTitle);
  110. $("#postAuthor").text("发布人:" + post.postAuthor);
  111. $("#createdTime").text("时间:" + post.createdTime);
  112. $("#postContent").html(post.postContent);
  113. if (post.postPicUrl && post.postPicUrl != '') {
  114. $("#postPicUrlImg").attr("src", post.postPicUrl);
  115. $("#postPicUrlA").attr("href", post.postPicUrl);
  116. $("#postPicUrlDiv").show();
  117. }
  118. //附件初始化
  119. var attachList = resp.data.attachList;
  120. if (attachList && attachList.length > 0) {
  121. for (var i = 0; i < attachList.length; i++) {
  122. fileHtml(attachList[i].extName, attachList[i].savePath, attachList[i].attName)
  123. }
  124. $("#attachmentDiv").show();
  125. }
  126. } else {
  127. layer.msg(resp.msg)
  128. }
  129. }, 'GET');
  130. function fileHtml(ext, path, oriFileName) {
  131. //文件信息置入隐藏域
  132. var html = '<p style="padding-top: 5px;">';
  133. html += ' <a target="_blank" href="' + path + '" style="color: #5b9bd1" download="' + oriFileName + '">';
  134. html += oriFileName;
  135. html += '</a></p>';
  136. $("#attachmentDiv").append(html);
  137. }
  138. });
  139. //删除附件
  140. function deleteFile(obj) {
  141. var pDiv = $(obj).parent();
  142. pDiv.remove();
  143. }
  144. </script>
  145. </body>
  146. </html>