viewPost.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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. fieldset:hover {
  37. background: #F2F2F2;
  38. display: block;
  39. }
  40. </style>
  41. </head>
  42. <body>
  43. <!-- 页面加载loading -->
  44. <div class="page-loading">
  45. <div class="ball-loader">
  46. <span></span><span></span><span></span><span></span>
  47. </div>
  48. </div>
  49. <!-- 正文开始 -->
  50. <div class="layui-row" style="margin-top: 10px;background: white">
  51. <div style="width:93%;margin:0 auto;padding-bottom: 5px;word-wrap:break-word; overflow:hidden;">
  52. <div style="padding-top: 20px;text-align: right;border: 0px;">
  53. <button class="layui-btn icon-btn" onclick="history.back()">返 回</button>
  54. </div>
  55. <fieldset class="layui-elem-field " style="margin-top: 10px;border: 0px">
  56. <fieldset class="layui-elem-field layui-field-title">
  57. <legend>详情信息</legend>
  58. </fieldset>
  59. <div class="layui-field-box">
  60. <legend id="postTitle"></legend>
  61. <div class="time-box">
  62. <h4><span class="time1" id="postAuthor">发布人:</span></h4>
  63. <h4><span class="time1" id="createdTime">时间:</span></h4>
  64. <h4 style="display: none"><span class="time1" id="groupName">所属部门:</span></h4>
  65. </div>
  66. <!--<hr class="layui-bg-gray">-->
  67. <div class="time-box" id="postDesc" style="display: none">
  68. </div>
  69. <!--<hr class="layui-bg-gray">-->
  70. <div id="showPostContent" style="display: none;margin-left: 30px">
  71. <blockquote class="layui-elem-quote layui-quote-nm" id="postContent">
  72. </div>
  73. </blockquote>
  74. </div>
  75. </fieldset>
  76. <!--<hr class="layui-bg-gray">-->
  77. </blockquote>
  78. <div style="margin-bottom: 30px;">
  79. <!-- 缩略图Div -->
  80. <div id="postPicUrlDiv" style="display: none">
  81. <fieldset class="layui-elem-field layui-field-title">
  82. <legend>缩略图</legend>
  83. </fieldset>
  84. <!--<span class="fu">缩略图:</span>-->
  85. <!--<div class="line"></div>-->
  86. <p style="margin-left: 30px;">
  87. <a target="_blank" id="postPicUrlA">
  88. <img style="width: 60px;height: 60px;" id="postPicUrlImg" src="">
  89. </a>
  90. </p>
  91. </div>
  92. <fieldset class="layui-elem-field layui-field-title">
  93. <legend>附加文件</legend>
  94. </fieldset>
  95. <!--<span class="fu">附件</span>-->
  96. <!--<div class="line"></div>-->
  97. <p style="color: indianred;margin-left: 30px;margin-top: -25px;" class="pull-right">
  98. 温馨提示:图片可点击查看,文件可点击下载
  99. </p>
  100. <div id="attachmentDiv" style="display: none;margin-left: 30px;">
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <!-- js部分 -->
  106. <script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>
  107. <script type="text/javascript" src="../../../assets/js/common.js?v=312"></script>
  108. <script type="text/javascript" src="../../../assets/libs/jquery/jquery-3.2.1.min.js"></script>
  109. <script type="text/javascript" src="../../../assets/module/inputTags.js"></script>
  110. <script src="../../../assets/libs/wangEditor/wangEditor.js"></script>
  111. <script>
  112. var typePage = '';
  113. var baseUrl = '';
  114. layui.use(['layer', 'form', 'table', 'admin', 'zTree', 'uParas', 'upload', 'inputTags', 'formSelects'], function () {
  115. var $ = layui.jquery;
  116. var layer = layui.layer;
  117. var admin = layui.admin;
  118. var uParas = layui.uParas;
  119. var postId = uParas.getUrlParam("postId");
  120. typePage = uParas.getUrlParam("type");
  121. baseUrl = uParas.baseUrl;
  122. admin.req(uParas.baseUrl + '/ent/post/get/' + postId, {}, function (resp) {
  123. if (resp.code == 1) {
  124. var post = resp.data.post;
  125. // 填充数据
  126. $("#postTitle").text('《' + post.postTitle + '》');
  127. $("#postAuthor").text("发布人:" + post.postAuthor);
  128. $("#createdTime").text("时间:" + post.createdTime);
  129. $("#groupName").text("所属部门:" + post.groupName);
  130. debugger
  131. if (post.postContent != null && post.postContent != '' && post.postContent != '<p><br></p>') {
  132. $("#postContent").html(post.postContent);
  133. $("#showPostContent").show();
  134. }
  135. if (post.groupName != null && post.groupName != '') {
  136. $("#groupName").html(post.groupName);
  137. $("#groupName").show();
  138. }
  139. if (post.postDesc != null && post.postDesc != '') {
  140. $("#postDesc").html(post.postDesc);
  141. $("#postDesc").show();
  142. }
  143. if (post.postPicUrl && post.postPicUrl != '') {
  144. $("#postPicUrlImg").attr("src", post.postPicUrl);
  145. $("#postPicUrlA").attr("href", post.postPicUrl);
  146. $("#postPicUrlDiv").show();
  147. }
  148. //附件初始化
  149. var attachList = resp.data.attachList;
  150. if (attachList && attachList.length > 0) {
  151. for (var i = 0; i < attachList.length; i++) {
  152. fileHtml(attachList[i].extName, attachList[i].savePath, attachList[i].attName)
  153. }
  154. $("#attachmentDiv").show();
  155. }
  156. } else {
  157. layer.msg(resp.msg)
  158. }
  159. }, 'GET');
  160. function fileHtml(ext, path, oriFileName) {
  161. //文件图标
  162. var url = "https://view.officeapps.live.com/op/view.aspx?src=http://";
  163. var hint = '附件';
  164. var glanceOver = '';
  165. var download = '';
  166. var icon = '';
  167. if (ext === 'xlsx' || ext === 'xls') {
  168. hint = 'Excel 工作表';
  169. glanceOver = '<a target="_blank" href="' + path + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right">在线预览</a>';
  170. download = '<a target="_blank" href="' + path + '" download="' + oriFileName + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right"><i class="layui-icon">&#xe601;</i> 下载</a>';
  171. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/excel.png" alt="">';
  172. } else if (ext === 'docx' || ext === 'doc') {
  173. hint = 'Work 文档';
  174. glanceOver = '<a target="_blank" href="' + path + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right">在线预览</a>';
  175. download = '<a target="_blank" href="' + path + '" download="' + oriFileName + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right"><i class="layui-icon">&#xe601;</i> 下载</a>';
  176. icon = '<img style="width: 20px;height: 20px;" download="' + oriFileName + '" src="../../../assets/module/img/uploader/word.png" alt="">';
  177. } else if (ext === 'ppt' || ext === 'pptx') {
  178. hint = 'PPT 演示文稿';
  179. glanceOver = '<a target="_blank" href="' + path + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right">在线预览</a>';
  180. download = '<a target="_blank" href="' + path + '" download="' + oriFileName + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right"><i class="layui-icon">&#xe601;</i> 下载</a>';
  181. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/ppt.png" alt="">';
  182. } else if (ext === 'pdf' || ext === 'pdf') {
  183. hint = 'PDF 文档';
  184. glanceOver = '<a target="_blank" href="' + path + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right">在线预览</a>';
  185. download = '<a target="_blank" href="' + path + '" download="' + oriFileName + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right"><i class="layui-icon">&#xe638;</i> 预览</a>';
  186. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/pdf.png" alt="">';
  187. } else if (ext === 'txt' || ext === 'txt') {
  188. hint = '文本 文档';
  189. glanceOver = '<a target="_blank" href="' + path + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right">在线预览</a>';
  190. download = '<a target="_blank" href="' + path + '" download="' + oriFileName + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right"><i class="layui-icon">&#xe638;</i> 预览</a>';
  191. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/txt.png" alt="">';
  192. } else if (ext === 'zip' || ext === 'zip') {
  193. hint = '压缩 文件';
  194. download = '<a target="_blank" href="' + path + '" download="' + oriFileName + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right"><i class="layui-icon">&#xe601;</i> 下载</a>';
  195. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/zip.png" alt="">';
  196. } else if (ext === 'rar' || ext === 'rar') {
  197. hint = '压缩 文件';
  198. download = '<a target="_blank" href="' + path + '" download="' + oriFileName + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right"><i class="layui-icon">&#xe601;</i> 下载</a>';
  199. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/rar.png" alt="">';
  200. } else if (ext === 'bmp' || ext === 'jpg' || ext === 'jpeg' || ext === 'png' || ext === 'gif') {
  201. hint = '照片 附件';
  202. glanceOver = '<a target="_blank" href="' + path + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right">在线预览</a>';
  203. download = '<a target="_blank" href="' + path + '" download="' + oriFileName + '" style="color: #5b9bd1;margin-right: 15px;cursor: pointer;" class="pull-right"><i class="layui-icon">&#xe638;</i> 预览</a>';
  204. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/img.png" alt="">';
  205. } else if (ext === 'audio' || ext === 'audio') {
  206. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/audio.png" alt="">';
  207. } else if (ext === 'video' || ext === 'video') {
  208. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/video.png" alt="">';
  209. } else {
  210. icon = '<img style="width: 20px;height: 20px;" src="../../../assets/module/img/uploader/file.png" alt="">';
  211. }
  212. //文件信息置入隐藏域
  213. var html = '<fieldset class="layui-elem-field " style="padding-top: 5px;padding: 6px;margin-bottom: 5px">';
  214. html += '<legend style="font-size: 8px">' + hint + '</legend>';
  215. html += '<a target="_blank" href="' + path + '" style="color: #5b9bd1" download="' + oriFileName + '">';
  216. html += icon + ' ' + oriFileName;
  217. html += '</a>';
  218. // html += glanceOver; //在线预览
  219. html += download;
  220. html += '</fieldset>';
  221. $("#attachmentDiv").append(html);
  222. }
  223. });
  224. //删除附件
  225. function deleteFile(obj) {
  226. var pDiv = $(obj).parent();
  227. pDiv.remove();
  228. }
  229. /*在线浏览*/
  230. function GridClickButton_Detail(filePath) {
  231. debugger
  232. // var i = filePath.lastIndexOf("/");
  233. // var fileName = filePath.substr(i,filePath.length);
  234. var url = "https://view.officeapps.live.com/op/view.aspx?src=http://" + baseUrl + filePath;
  235. window.open(url);
  236. }
  237. </script>
  238. </body>
  239. </html>