sugangqiang 2 年之前
父节点
当前提交
9e664adf12

+ 1 - 1
app/admin/view/layout/tab.html

@@ -6,7 +6,7 @@
             <li class="nav-header">
                 <div class="dropdown profile-element" style="text-align: center">
                     <span><img alt="image" class="img-circle" 
-                               {if condition="$user['avatar']"}src="{$user.avatar}"{else/}{if condition="$user['sex'] eq 1"}src="/static/img/photoBoy.png"{else/}src="/static/img/photoGirl.jpg"{/if}{/if}
+                               {if condition="$user['avatar']"}src="{$user.avatar|getStoragePath}"{else/}{if condition="$user['sex'] eq 1"}src="/static/img/photoBoy.png"{else/}src="/static/img/photoGirl.jpg"{/if}{/if}
                                width="64px" height="64px"/></span>
                     <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                         <span class="clear">

+ 55 - 15
app/common.php

@@ -262,36 +262,76 @@ function isExcelFile($mime) {
     ]);
 }
 
+/**
+ * 获取主机名带协议
+ * @return http[s]://xxxx
+ */
+function getHostWithProtocol() {
+    $protocol = (strpos(strtolower($_SERVER['SERVER_PROTOCOL']), 'http/2.0') !== false || $_SERVER["HTTPS"] == "on" || $_SERVER["REQUEST_SCHEME"] == "https" ? 'https' : 'http') . "://";
+    return $protocol . $_SERVER["HTTP_HOST"];
+}
+
 /**
  * 获得上传文件的路径
  * @param $path
  * @return string
  */
 function getStoragePath($path) {
-    if ($path) {
-        return "/storage/{$path}";
+    if (strpos($path, "jjrcw") === 0) {
+        $path = "https://rc.jucai.gov.cn/ftp/{$path}";
+    } else {
+        $path = getHostWithProtocol() . "/storage/{$path}";
     }
-    return "";
+    if (isImage($path))
+        return $path;
+    return getFileView($path);
 }
 
 function getFileView($path) {
-
-    $complete_path = "https://report.jinjianghc.com/" . getStoragePath($path);
-    return "https://fileview.jinjianghc.com/onlinePreview?url=" . base64_encode($complete_path);
+    //$complete_path = "https://report.jinjianghc.com/" . getStoragePath($path);
+    return "https://fileview.jinjianghc.com/onlinePreview?url=" . base64_encode($path);
 }
 
-function isImage($filename)
-{
+function isImage($filename) {
     $types = '.gif|.jpeg|.png|.bmp'; //定义检查的图片类型
-    if(file_exists($filename))
-    {
-        if ($info = getimagesize($filename)) return 0;
+    try {
+        $info = getimagesize($filename);
+        if ($info && stripos($types, image_type_to_extension($info['2'])) !== false) {
+            return true;
+        }
+        return false;
+    } catch (\think\exception $e) {
+        //文件不存在,根据拓展名返回
+        $types = "gif|jpg|jpeg|png|bmp";
+        $pathinfo = pathinfo($filename);
+        $ext = $pathinfo["extension"];
+        if ($pathinfo && stripos($types, $ext) !== false) {
+            return true;
+        }
+        return false;
+    }
+}
 
-        $ext = image_type_to_extension($info['2']);
-        return stripos($types,$ext);
+function chkEnterpriseFull($ep) {
+    $checkEnterpriseFullFields = ["industryFieldNew", "enterpriseType", "bankCard", "bankNetwork", "bank", "bankImg", "domainImg", "beian"];
+    $errorCounts = 0;
+    while ($chk = array_shift($checkEnterpriseFullFields)) {
+        if ($ep[$chk] == null)
+            $errorCounts++;
     }
-    else
-    {
+    if ($ep->special == 0 && $errorCounts > 0) {
+        echo sprintf("<script>"
+                . "parent.layer.confirm('系统升级,您的资料需要同步更新,请移步企业中心申请【机构信息变更】。',"
+                . "function(){"
+                . "var url='/enterprise/index/centerPage';"
+                . "top.$('a.J_menuItem[href=\"'+url+'\"]').click();clkTab();"
+                . "},function(){parent.layer.closeAll();});function clkTab(){setTimeout(function(){if(top.$('iframe.J_iframe[data-id=\"/enterprise/index/centerPage\"]').contents().find('a[href=\"#tab-2\"]').length==1){"
+                . "top.$('iframe.J_iframe[data-id=\"/enterprise/index/centerPage\"]').contents().find('*.active').removeClass('active');"
+                . "top.$('iframe.J_iframe[data-id=\"/enterprise/index/centerPage\"]').contents().find('ul.nav-tabs li').eq(1).addClass('active');"
+                . "top.$('iframe.J_iframe[data-id=\"/enterprise/index/centerPage\"]').contents().find('#tab-2').addClass('active');parent.layer.closeAll();"
+                . "}else{clkTab();}},20);};"
+                . "</script>");
         return false;
     }
+    return true;
 }

+ 1 - 1
app/common/api/VerifyApi.php

@@ -55,7 +55,7 @@ class VerifyApi {
                 $info["enterpriseTagName"] = DictApi::selectByParentCode("enterprise_tag")[$enterprise["enterpriseTag"]];
             }
             if ($info["headimgurl"]) {
-                $info["headimgurl"] = "/storage/" . $info["headimgurl"];
+                $info["headimgurl"] = getStoragePath($info["headimgurl"]);
             }
             if ($info["talent_arrange"]) {
                 $info["talentArrangeName"] = DictApi::selectByParentCode("talent_arrange")[$info["talent_arrange"]];

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

@@ -73,7 +73,8 @@ class Api extends BaseController {
                 $where[] = ["typeId", "=", $row["id"]];
                 $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"];
+                    $file["ext"] = pathinfo($file["url"])["extension"];
+                    $file["url"] = getStoragePath($file["url"]);
                 }
                 $rows[$key]["files"] = $files;
             }
@@ -220,7 +221,8 @@ class Api extends BaseController {
                 $where[] = ["typeId", "=", $row["id"]];
                 $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"];
+                    $file["ext"] = pathinfo($file["url"])["extension"];
+                    $file["url"] = getStoragePath($file["url"]);
                 }
                 $rows[$key]["files"] = $files;
             }
@@ -235,7 +237,7 @@ class Api extends BaseController {
         $where = [["mainId", "=", $mainId], ["typeId", "=", $typeId]];
         $list = Db::table("new_talent_file")->where($where)->select()->toArray();
         foreach ($list as $key => $item) {
-            $list[$key]["url"] = "/storage/" . $item["url"]; //获取系统配置无效,暂时这样
+            $list[$key]["url"] = getStoragePath($item["url"]);
         }
         return json($list);
     }
@@ -299,8 +301,9 @@ class Api extends BaseController {
         } else {
             $fileId = Db::table("new_talent_file")->insertGetId($data);
         }
+        $ext = pathinfo($filestd->filepath)["extension"];
         TalentLogApi::write($type, $mainId, 0, sprintf("%s附件,附件名为:%s", $change ? "修改" : "添加", $data["orignName"]), 1, $fileTypeId, $fileId);
-        $res = ["code" => 200, "msg" => "上传附件成功", "obj" => $index, "info" => "/storage/" . $filestd->filepath, "typeId" => $fileTypeId, "id" => $fileId, "orignName" => $data["orignName"]];
+        $res = ["code" => 200, "msg" => "上传附件成功", "obj" => $index, "ext" => $ext, "info" => getStoragePath($filestd->filepath), "typeId" => $fileTypeId, "id" => $fileId, "orignName" => $data["orignName"]];
         echo sprintf("<script>parent.%s(%s);</script>", $backName, json_encode($res));
     }
 
@@ -463,7 +466,7 @@ class Api extends BaseController {
         $res = TalentCommonFile::where($where)->order('sn')->select();
         if ($res) {
             foreach ($res as $k => &$v) {
-                $v['url'] = "/storage/" . $v['url'];
+                $v['url'] = getStoragePath($v['url']);
             }
         }
         return json($res);

+ 12 - 1
app/enterprise/api/TalentApi.php

@@ -27,8 +27,19 @@ class TalentApi {
         return true;
     }
 
+    static public function chkIsOwner($id, $uid) {
+        $info = self::getOne($id);
+        if ($info["enterprise_id"] != $uid)
+            return null;
+        return $info;
+    }
+
     public static function getOne($id) {
-        return Talent::findOrEmpty($id);
+        $one = Talent::findOrEmpty($id);
+        if ($one["headimgurl"]) {
+            $one["headimgurl"] = getStoragePath($one["headimgurl"]);
+        }
+        return $one;
     }
 
     public static function getList($request, $step = 0) {

+ 3 - 8
app/enterprise/controller/Base.php

@@ -36,8 +36,10 @@ class Base extends EnterpriseController {
         $request = $this->request;
         $param = $request->param();
         $id = isset($param["id"]) ? $param["id"] : 0;
-        $info = self::chkIsOwner($id, $this->user["uid"]);
+        $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
         $ep = EnterpriseApi::getOne($this->user["uid"]);
+        if (!chkEnterpriseFull($ep))
+            return;
         $tagList = DictApi::selectByParentCode('enterprise_tag');
         $streetList = DictApi::selectByParentCode('street');
         $industryFieldNew = DictApi::selectByParentCode('industry_field');
@@ -378,11 +380,4 @@ class Base extends EnterpriseController {
         return json(["msg" => "删除成功"]);
     }
 
-    static private function chkIsOwner($id, $uid) {
-        $where[] = ["id", "=", $id];
-        $where[] = ["enterprise_id", "=", $uid];
-        $info = TalentModel::where($where)->findOrEmpty()->toArray();
-        return $info;
-    }
-
 }

+ 7 - 7
app/enterprise/controller/Index.php

@@ -19,19 +19,21 @@ class Index extends EnterpriseController {
             "rolename" => $this->user["rolename"],
             "avatar" => $this->user["avatar"]
         ];
+        $ep = \app\common\api\EnterpriseApi::getOne($this->user["uid"]);
+        $vars["isEnterpriseFull"] = $ep["special"] == 1 ? 1 : $ep["enterpriseTag"];
         $menus = \app\common\api\MenuApi::getEnterpriseMenuByType($this->user["type"]);
         $vars["menus"] = $menus;
         return view("", $vars);
     }
 
-    public function centerPage(){
-        $ep = Enterprise::where('id',$this->user['uid'])->find();
+    public function centerPage() {
+        $ep = Enterprise::where('id', $this->user['uid'])->find();
         $ep['industryFieldNewName'] = DictApi::findDictByCode($ep['industryFieldNew'])->name ?? '';
         $ep['industryFieldOldName'] = DictApi::findDictByCode($ep['industryFieldOld'])->name ?? '';
         $ep['enterpriseTagName'] = DictApi::findDictByCode($ep['enterpriseTag'])->name ?? '';
         $ep['streetName'] = DictApi::findDictByCode($ep['street'])->name ?? '';
         $ep['enterpriseTypeName'] = DictApi::findDictByCode($ep['enterpriseType'])->name ?? '';
-        switch ($ep['type']){
+        switch ($ep['type']) {
             case 1:
                 $ep['typeName'] = '晋江市现代产业体系人才';
                 break;
@@ -42,7 +44,7 @@ class Index extends EnterpriseController {
                 $ep['typeName'] = '海峡计划团队';
                 break;
         }
-        switch ($ep['checkState']){
+        switch ($ep['checkState']) {
             case 1:
                 $ep['checkStateName'] = '待审核';
                 break;
@@ -56,7 +58,7 @@ class Index extends EnterpriseController {
                 $ep['checkStateName'] = '重新提交';
                 break;
         }
-        switch ($ep['active']){
+        switch ($ep['active']) {
             case 1:
                 $ep['activeName'] = '账号有效';
                 break;
@@ -69,6 +71,4 @@ class Index extends EnterpriseController {
         return view("", ['ep' => $ep]);
     }
 
-
-
 }

+ 1 - 8
app/enterprise/controller/Talent.php

@@ -60,7 +60,7 @@ class Talent extends EnterpriseController {
     public function submit() {
         $params = $this->request->param();
         $id = $params["id"];
-        if (!$info = self::chkIsOwner($id, $this->user["uid"]))
+        if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"]))
             return json(["msg" => "没有对应的人才认定申报信息"]);
         $checkState = $info["checkState"];
         if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::BASE_VERIFY_PASS) {
@@ -293,11 +293,4 @@ class Talent extends EnterpriseController {
         return json(["msg" => "删除成功"]);
     }
 
-    static public function chkIsOwner($id, $uid) {
-        $where[] = ["id", "=", $id];
-        $where[] = ["enterprise_id", "=", $uid];
-        $info = TalentModel::where($where)->findOrEmpty()->toArray();
-        return $info;
-    }
-
 }

+ 1 - 1
app/enterprise/view/base/first.html

@@ -99,7 +99,7 @@
                                                     <p style="text-align: center;color: red">
                                                         请上传近期免冠半身彩照(两寸)
                                                     </p>
-                                                    <img id="photoImg" {if condition="$row['headimgurl']"} src="/storage/{$row.headimgurl}" {else/} src="/static/img/photo.png" {/if} onclick="$('#photo').click();" style="height:147px;width:105px;margin:0 auto;display:block;">
+                                                    <img id="photoImg" {if condition="$row['headimgurl']"} src="{$row.headimgurl|getStoragePath}" {else/} src="/static/img/photo.png" {/if} onclick="$('#photo').click();" style="height:147px;width:105px;margin:0 auto;display:block;">
                                                          <hr />
                                                     附件:
                                                     <table class="fileTable"></table>

+ 19 - 0
app/enterprise/view/layout/right.html

@@ -99,11 +99,30 @@
 <script type="text/javascript">
     var task = null;
     var time = 10;
+    var isEnterpriseFull = '{$isEnterpriseFull}';
     window.onload=function (){
         var locked = sessionStorage.getItem('locked');
         if(locked)lockScreen();
         // setTimeLockScreen();
         initTime(time);
+        if(!isEnterpriseFull){
+            Feng.confirm("系统升级,您的资料需要同步更新,请移步企业中心申请【机构信息变更】。",function(){
+                $(".J_menuItem[href='/enterprise/index/centerPage']").click();
+                clkTab();
+            })
+        }
+    }
+    function clkTab(){
+            setTimeout(function(){
+                if($('iframe.J_iframe[data-id="/enterprise/index/centerPage"]').contents().find('a[href="#tab-2"]').length==1){
+                    $('iframe.J_iframe[data-id="/enterprise/index/centerPage"]').contents().find('*.active').removeClass('active');
+                    $('iframe.J_iframe[data-id="/enterprise/index/centerPage"]').contents().find('ul.nav-tabs li').eq(1).addClass('active');
+                    $('iframe.J_iframe[data-id="/enterprise/index/centerPage"]').contents().find('#tab-2').addClass('active');
+                }else{
+                    clkTab();
+                }
+            },20)
+
     }
 
     // 锁屏

+ 1 - 1
app/enterprise/view/talent/first.html

@@ -171,7 +171,7 @@
                                                         </div>  
                                                     </div>
                                                     <div class="col-sm-1">
-                                                        <img id="photoImg" {if condition="$row['headimgurl']"} src="/storage/{$row.headimgurl}" {else/} src="/static/img/photo.png" {/if} onclick="$('#photo').click()" style="height: 110px;width: 76px;padding-bottom: 5px;">
+                                                        <img id="photoImg" {if condition="$row['headimgurl']"} src="{$row.headimgurl}" {else/} src="/static/img/photo.png" {/if} onclick="$('#photo').click()" style="height: 110px;width: 76px;padding-bottom: 5px;">
                                                     </div>
                                                 </div>
                                                 <div class="row">

+ 2 - 2
public/static/js/common/Feng.js

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

+ 2 - 3
public/static/modular/gate/talentBase/talentInfo_info.js

@@ -653,7 +653,7 @@ TalentInfoInfoDlg.initFile = function () {
                         for (var key in files) {
                             var btn = TalentInfoInfoDlg.validUploadButton(2, data[k].id, files[key].id, i, k);
                             var sn = files[key].url.lastIndexOf(".");
-                            var suffix = files[key].url.substring(sn + 1, files[key].url.length);
+                            var suffix = files[key].ext;//files[key].url.substring(sn + 1, files[key].url.length);
                             var imgStr = "";
                             if (suffix == "pdf" || suffix == "PDF") {
                                 imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
@@ -662,7 +662,6 @@ TalentInfoInfoDlg.initFile = function () {
                             } else {
                                 imgStr = '<img class=\"imgUrl\" onclick=\"Feng.showImg(this)\"  src=\"' + files[key].url + '\" style=\"width:25px;height:25px;\">';
                             }
-                            console.log(imgStr)
 
                             html += '<li data-id="' + files[key].id + '">\n\
                                     <div><input type="hidden" name="uploadFiles[]" value="' + files[key].id + '"></div>\n' +
@@ -898,7 +897,7 @@ TalentInfoInfoDlg.callBack = function (data) {
         var tableIndex = $("#tableIndex").val();
         var trIndex = $("#trIndex").val();
         var sn = data.info.lastIndexOf(".");
-        var suffix = data.info.substring(sn + 1, data.info.length);
+        var suffix = data.ext;//data.info.substring(sn + 1, data.info.length);
         var imgStr = "";
         if (suffix == "pdf" || suffix == "PDF") {
             imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + data.info + "','" + data.id + "','" + data.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";

+ 3 - 3
public/static/modular/gate/talentInfo/talentInfo_info.js

@@ -341,7 +341,7 @@ TalentInfoInfoDlg.initFileTable = function () {
                                 btn = TalentInfoInfoDlg.validUploadButton(2, data[k].id, files[key].id, i, k);
                             }
                             var sn = files[key].url.lastIndexOf(".");
-                            var suffix = files[key].url.substring(sn + 1, files[key].url.length);
+                            var suffix = files[key].ext;//files[key].url.substring(sn + 1, files[key].url.length);
                             var imgStr = "";
                             if (suffix == "pdf" || suffix == "PDF") {
                                 imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
@@ -530,7 +530,7 @@ TalentInfoInfoDlg.ajaxGetConditionFile = function (source) {
                     var file = filetype.files[k];
                     var btn = TalentInfoInfoDlg.validUploadButton(2, filetype.id, file.id, tableIndex, key);
                     var sn = file.url.lastIndexOf(".");
-                    var suffix = file.url.substring(sn + 1, file.url.length);
+                    var suffix = file.ext;//file.url.substring(sn + 1, file.url.length);
                     var imgStr = "";
                     if (suffix == "pdf" || suffix == "PDF") {
                         imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + file.url + "','" + file.id + "','" + file.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
@@ -847,7 +847,7 @@ TalentInfoInfoDlg.callBack = function (data) {
         var tableIndex = $("#tableIndex").val();
         var trIndex = $("#trIndex").val();
         var sn = data.info.lastIndexOf(".");
-        var suffix = data.info.substring(sn + 1, data.info.length);
+        var suffix = data.ext;//data.info.substring(sn + 1, data.info.length);
         var imgStr = "";
         if (suffix == "pdf" || suffix == "PDF") {
             imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + data.info + "','" + data.id + "','" + data.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";

+ 1 - 1
public/static/modular/gate/talentInfo/talentInfo_select.js

@@ -115,7 +115,7 @@ TalentInfoInfoDlg.initFileTable = function () {
                         var html = '<ul class="imgs"><li style="width: 80%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">操作</li>';
                         for (var key in files) {
                             var sn = files[key].url.lastIndexOf(".");
-                            var suffix = files[key].url.substring(sn + 1, files[key].url.length);
+                            var suffix = files[key].ext;//files[key].url.substring(sn + 1, files[key].url.length);
                             var imgStr = "";
                             if (suffix == "pdf" || suffix == "PDF") {
                                 imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";

+ 1 - 1
public/static/modular/talentIdentify/talentInfo/talentInfo_common_check.js

@@ -118,7 +118,7 @@ TalentInfoInfoDlg.initFileTable = function () {
                         var html = '<ul class="imgs"><li style="width: 60%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 15%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 25%;font-weight: bold;padding-top: 5px;">操作</li>';
                         for (var key in files) {
                             var sn = files[key].url.lastIndexOf(".");
-                            var suffix = files[key].url.substring(sn + 1, files[key].url.length);
+                            var suffix = files[key].ext;//files[key].url.substring(sn + 1, files[key].url.length);
                             var imgStr = "";
                             if (suffix == "pdf" || suffix == "PDF") {
                                 imgStr = "<button type='button'  onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";