Răsfoiți Sursa

修改PDF预览操作

sandm 2 ani în urmă
părinte
comite
27e377bd49

+ 1 - 0
app/admin/view/layout/content.html

@@ -30,6 +30,7 @@
 <!--    <link href="/static/js/plugins/kendoui/styles/kendo.bootstrap.min.css" rel="stylesheet">-->
 
     <!-- 全局js -->
+    <script src="/static/js/base64.min.js?v=5.3.5"></script>
     <script src="/static/js/jquery.min.js?v=2.1.4"></script>
     <script src="/static/js/bootstrap.min.js?v=3.3.6"></script>
     <script src="/static/js/plugins/webuiPopover/dist/jquery.webui-popover.min.js"></script>

+ 17 - 0
app/common.php

@@ -275,6 +275,23 @@ function getStoragePath($path) {
 }
 
 function getFileView($path) {
+
     $complete_path = "https://report.jinjianghc.com/" . getStoragePath($path);
     return "https://fileview.jinjianghc.com/onlinePreview?url=" . base64_encode($complete_path);
 }
+
+function isImage($filename)
+{
+    $types = '.gif|.jpeg|.png|.bmp'; //定义检查的图片类型
+    if(file_exists($filename))
+    {
+        if ($info = getimagesize($filename)) return 0;
+
+        $ext = image_type_to_extension($info['2']);
+        return stripos($types,$ext);
+    }
+    else
+    {
+        return false;
+    }
+}

+ 5 - 0
app/common/controller/Api.php

@@ -212,6 +212,11 @@ class Api extends BaseController {
                 $files = Db::table("new_talent_file")->where($where)->field("id,typeId,orignName,url")->order("sn asc")->select()->toArray();
                 foreach ($files as &$file) {
                     $file["url"] = "/storage/" . $file["url"];
+//                    if(!isImage(getStoragePath($file["url"]))){
+//                        $file["url"] = getFileView($file["url"]);
+//                    }else{
+//                        $file["url"] = "/storage/" . $file["url"];
+//                    }
                 }
                 $rows[$key]["files"] = $files;
             }

+ 1 - 0
app/enterprise/view/layout/content.html

@@ -30,6 +30,7 @@
 <!--    <link href="/static/js/plugins/kendoui/styles/kendo.bootstrap.min.css" rel="stylesheet">-->
 
     <!-- 全局js -->
+    <script src="/static/js/base64.min.js?v=5.3.5"></script>
     <script src="/static/js/jquery.min.js?v=2.1.4"></script>
     <script src="/static/js/bootstrap.min.js?v=3.3.6"></script>
     <script src="/static/js/plugins/webuiPopover/dist/jquery.webui-popover.min.js"></script>

Fișier diff suprimat deoarece este prea mare
+ 6 - 0
public/static/js/base64.min.js


+ 3 - 1
public/static/js/common/Feng.js

@@ -494,6 +494,8 @@ var Feng = {
         if(Feng.isEmptyStr(title)){
             title = "预览";
         }
+        let origin = window.location.origin;
+        let full_url = "https://fileview.jinjianghc.com/onlinePreview?url=" + encodeURIComponent(Base64.encode(url));
         var index = layer.open({
             id:id,
             type: 2,
@@ -502,7 +504,7 @@ var Feng = {
             area: ['600px', '350px'], //宽高
             fix: false, //不固定
             maxmin: true,
-            content: url,
+            content: full_url,
         });
         // layer.full(index);
     },

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff