浏览代码

预览添加

laiguoran 3 年之前
父节点
当前提交
1b222477f4
共有 3 个文件被更改,包括 7 次插入2 次删除
  1. 5 1
      app/public/js/stage.js
  2. 1 0
      app/service/stage_shoufang_att.js
  3. 1 1
      app/view/stage/modal.ejs

+ 5 - 1
app/public/js/stage.js

@@ -4358,12 +4358,16 @@ $(document).ready(() => {
             for (const att of result) {
                 html += `<tr><td>${att.filename}${att.fileext} ` + makeEditHtml(att.id, att.filename, att.fileext, att.extra_upload) +
                     `<td>${moment(att.in_time).format('YYYY-MM-DD HH:mm')}</td><td>` +
-                    `<a href="${att.filepath}" target="_blank"><i class="fa fa-download"></i></a>` + makeDelHtml(att.id, att.extra_upload) +`</td></tr>`;
+                    `<a href="${att.filepath}" target="_blank"><i data-toggle="tooltip" data-placement="left" data-original-title="下载" class="fa fa-download"></i></a>` + makeViewHtml(att) + makeDelHtml(att.id, att.extra_upload) +`</td></tr>`;
             }
             $('#shoufang-flie-list').html(html);
             $('[data-toggle="tooltip"]').tooltip()
         });
 
+        function makeViewHtml(att) {
+            return att.viewpath ? `<a href="${att.viewpath}" target="_blank" class="ml-1"><i data-toggle="tooltip" data-placement="left" data-original-title="预览" class="fa fa-eye"></i></a>` : '';
+        }
+
         function makeDelHtml(fid, extra_upload) {
             return sfAttDelPower &&
             (stage.status !== auditConst.status.checked || (stage.status === auditConst.status.checked && extra_upload)) ?

+ 1 - 0
app/service/stage_shoufang_att.js

@@ -99,6 +99,7 @@ module.exports = app => {
             for (const att of result) {
                 // if (!ctx.helper.canPreview(att.fileext)) att.filepath = `/wap/shoufang/download/file/${att.id}`;
                 // else att.filepath = att.filepath.replace(/^app|\/app/, '');
+                if (ctx.helper.canPreview(att.fileext)) att.viewpath = att.filepath.replace(/^app|\/app/, '');
                 att.filepath = `/wap/shoufang/download/file/${att.id}`;
             }
             return result;

+ 1 - 1
app/view/stage/modal.ejs

@@ -547,7 +547,7 @@
             </div>
             <div class="modal-body modal-height-300" style="overflow: auto;overflow-x:hidden;">
                 <table class="table table-sm table-bordered table-hover" style="word-break:break-all; table-layout: fixed">
-                    <tr><th>文件名</th><th width="120">上传时间</th><th width="50">下载</th></tr>
+                    <tr><th>文件名</th><th width="120">上传时间</th><th width="70">下载</th></tr>
                     <tbody id="shoufang-flie-list">
 
                     </tbody>