Commit bfec0bd9 authored by hujun's avatar hujun

富文本文件上传

parent 6d73c242
......@@ -47,4 +47,27 @@ class UploadImg extends Basic
}
}
/**
* 富文本文件上传
*/
public function uploadEditor() {
header('Access-Control-Allow-Origin:*');
set_time_limit(0);
$file = $_FILES['image'];
if (empty($file)) {
$file = $_FILES['upload'];
}
$type = request()->param('type');
$uploadResult = $this->uFService->upload($file, $type);
$cb = $_GET['CKEditorFuncNum']; //获得ck的回调id
try {
$url = $uploadResult["msg"]['internet_img_name']; //我自己的放置上传图片的逻辑,返回图片放置后的url
echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($cb,'".$url."','');</script>";
}catch (\Exception $e) {
$erro = $e->getMessage();
echo "<script>window.parent.CKEDITOR.tools.callFunction($cb, '','$erro');</script>"; //图片上传失败,通知ck失败消息
}
}
}
\ No newline at end of file
......@@ -42,4 +42,27 @@ class UploadImg extends Basic
}
}
/**
* 富文本文件上传
*/
public function uploadEditor() {
header('Access-Control-Allow-Origin:*');
set_time_limit(0);
$file = $_FILES['image'];
if (empty($file)) {
$file = $_FILES['upload'];
}
$type = request()->param('type');
$uploadResult = $this->uFService->upload($file, $type);
$cb = $_GET['CKEditorFuncNum']; //获得ck的回调id
try {
$url = $uploadResult["msg"]['internet_img_name']; //我自己的放置上传图片的逻辑,返回图片放置后的url
echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($cb,'".$url."','');</script>";
}catch (\Exception $e) {
$erro = $e->getMessage();
echo "<script>window.parent.CKEDITOR.tools.callFunction($cb, '','$erro');</script>"; //图片上传失败,通知ck失败消息
}
}
}
\ No newline at end of file
......@@ -323,11 +323,10 @@
<div class="col-sm-9">
<div class="" style="width: 100%;">
<div class="input-group" style="width: 100%;" id="dajiangtang">
<?php
create_editor('goods_sup_id','');
<?php
create_editor('goods_sup_id','',['filebrowserUploadUrl'=>IMAGES_URL.'index/uploadEditor?type=business_school']);
?>
</div>
</div>
</div>
......
......@@ -282,7 +282,7 @@
<!--<label for="" style="width: 100%;">内容</label>-->
<div class="input-group" style="width: 100%;" id="dajiangtang">
<?php
create_editor('goods_sup_id','');
create_editor('goods_sup_id','', ['filebrowserUploadUrl'=>IMAGES_URL.'index/uploadEditor?type=business_school']);
?>
</div>
</div>
......
......@@ -321,6 +321,7 @@ Route::group('index', [
'agentEvaluateNumAndFraction' => [ 'index/broker/agentEvaluateNumAndFraction', [ 'method' => 'POST|GET' ] ],//经纪人列表计算-评价次数和分数 朱伟 2018-07-03
'uploadImg' => [ 'index/UploadImg/uploadImg', [ 'method' => 'POST' ] ],//全局图片上传
'uploadEditor' => [ 'index/UploadImg/uploadEditor', [ 'method' => 'POST' ] ],//全局图片上传
'followUpList' => [ 'index/HouseFollowUp/followUpList', [ 'method' => 'GET' ] ],//商铺跟进liu
'userModalList' => [ 'index/Member/userDetail', [ 'method' => 'GET' ] ], //客户跟进模态框,公用
'inspectionRecordList' => [ 'index/InspectionRecord/inspectionRecordList', [ 'method' => 'GET' ] ],//约带看记录liu
......@@ -736,6 +737,7 @@ Route::group('broker', [
'addSupervise' => ['api_broker/Supervise/addSupervise', ['method' => 'POST|GET']], //新增-监督执行
'superviseUploadImg' => ['api_broker/Supervise/superviseUploadImg', ['method' => 'POST|GET']], //监督执行-上传图片
'uploadImg' => ['api_broker/UploadImg/uploadImg', ['method' => 'POST|GET']], //图片上传
'uploadEditor' => ['api_broker/UploadImg/uploadEditor', ['method' => 'POST|GET']], //图片上传
'business_school' => ['api_broker/news/index', ['method' => 'GET']], //商学院资讯列表
'getNewsInfo' => ['api_broker/news/getNewsInfo', ['method' => 'GET']], //商学院资讯详情
'getNewsLabel' => ['api_broker/news/getNewsLabel', ['method' => 'GET']], //商学院标签
......
......@@ -26,5 +26,4 @@ CKEDITOR.editorConfig = function( config )
{ name: 'colors', items : [ 'TextColor','BGColor' ] },
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
];
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment