浏览代码

附件预览下载

MaiXinRong 2 年之前
父节点
当前提交
83e779c9bb
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      app/public/js/payment_safe.js

+ 11 - 0
app/public/js/payment_safe.js

@@ -786,6 +786,17 @@ $(document).ready(function() {
     $('body').on('click', '[name=del-file]', function() {
        attObj.deleteAtt(parseInt(this.getAttribute('file_id')));
     });
+    $('body').on('click', 'a[file_id]', function() {
+        const file_id = parseInt(this.getAttribute('file_id'));
+        const file = attObj.atts.find(x => { return x.id === file_id; });
+        if (!file) return;
+
+        if (file.viewpath) {
+            window.open(file.viewpath, '_blank');
+        } else {
+            AliOss.downloadFile(file.filepath, `${file.filename}${file.fileext}`)
+        }
+    });
     $('.page-select').click(function() {
         const content = this.getAttribute('content');
         if (content === 'pre') {