This commit is contained in:
2025-12-25 06:02:38 +08:00
parent 20d230f6c8
commit 7c1d6d447e
44 changed files with 11475 additions and 561 deletions
+10 -8
View File
@@ -69,21 +69,21 @@ class BaseController
$user = ['id'=>0];
}
$savePath = $request->post('savePath','files');
$validate = Validate::rule('savePath', 'alphaNum');
$data = ['savePath' => $savePath];
if (!$validate->check($data)) {
return $this->fail( '参数错误:'.$validate->getError());
}
$savePath = trim($savePath,'/');
$savePath = 'upload/'.$savePath.'/'.$user['id'];
//$savePath = 'upload/'.$savePath.'/'.$user['id'];
$savePath = $savePath.'/'.$user['id'];
\support\Log::alert('savePath:'.$savePath);
$mimetype = explode(',',Config('site.upload_mimetype'));
$maxsize = Config('site.upload_maxsize')*1024*1024;
//多文件上传
$files = $request->file();
try {
$result = Storage::adapter('public')
$result = Storage::adapter('minio')
->path($savePath)
->size($maxsize)
->extYes($mimetype)
@@ -93,14 +93,16 @@ class BaseController
$save_datas[] = [
'user_id' => $user['id'],
'category' => 'default',
'title' => $fileinfo->origin_name,
'path' => $fileinfo->file_name,
'adapter' => $fileinfo->adapter,
'origin_name' => $fileinfo->origin_name,
'file_name' => $fileinfo->file_name,
'size' => $fileinfo->size,
'mime_type' => $fileinfo->mime_type,
'extension' => $fileinfo->extension,
'height' => $fileinfo->file_height,
'width' => $fileinfo->file_width,
'sha1' => sha1_file(public_path($fileinfo->file_name)),
'file_height' => $fileinfo->file_height,
'file_width' => $fileinfo->file_width,
'file_url' => $fileinfo->file_url,
'sha1' => $fileinfo->storage_key ?:sha1_file(public_path($fileinfo->file_name)),
'use_count' => 0,
];
}
+2 -1
View File
@@ -46,7 +46,8 @@
"firebase/php-jwt": "6.8",
"php-mcp/server": "^3.3",
"intervention/image": "^2.7.2",
"guzzlehttp/guzzle": "^7.5.0"
"guzzlehttp/guzzle": "^7.5.0",
"league/flysystem-aws-s3-v3": "^3.0"
},
"suggest": {
"ext-event": "For better performance. "
+5 -5
View File
@@ -64,16 +64,16 @@ return [
'minio' => [
'driver' => \Shopwwi\WebmanFilesystem\Adapter\S3AdapterFactory::class,
'credentials' => [
'key' => 'S3_KEY',
'secret' => 'S3_SECRET',
'key' => '8cF8LM6VD3uZHzibS9qB',
'secret' => 'jKXbzKi8rKPHSOqPPNj3Xwr6z2OBSwGH0d48I8p7',
],
'region' => 'S3_REGION',
'version' => 'latest',
'bucket_endpoint' => false,
'use_path_style_endpoint' => true,
'endpoint' => 'S3_ENDPOINT',
'bucket_name' => 'S3_BUCKET',
'url' => '' // 静态文件访问域名
'endpoint' => 'http://localhost:10005/',
'bucket_name' => 'openim',
'url' => 'http://156.238.245.175:10005/openim' // 静态文件访问域名
],
'oss' => [
'driver' => \Shopwwi\WebmanFilesystem\Adapter\AliyunOssAdapterFactory::class,
@@ -1,168 +0,0 @@
<?php
namespace plugin\admin\app\controller;
use support\Request;
use support\Response;
use support\think\Db;
use taoser\facade\Validate;
use Shopwwi\WebmanFilesystem\Facade\Storage;
/**
* 附件管理
*
* @icon fa fa-circle-o
*/
class AttachController extends Crud
{
/**
* @var \app\model\Files
*/
protected $model = null;
/**
* 构造函数
* @return void
*/
function __construct()
{
$this->model = new \app\model\Files();
}
function list(Request $request)
{
return view('', [
]);
}
function feupload(Request $request): Response
{
$user = ['id'=>admin_id()];
$savePath = $request->post('savePath','files');
$validate = Validate::rule('savePath', 'alphaNum');
$data = ['savePath' => $savePath];
if (!$validate->check($data)) {
return $this->fail( '参数错误:'.$validate->getError());
}
$savePath = trim($savePath,'/');
$savePath = 'upload/'.$savePath.'/'.$user['id'];
$maxSize = 1024*1024*100; //100M
//多文件上传
$files = $request->file();
try {
$result = Storage::adapter('public')
->path($savePath)
->size(1024*1024*10)
->extYes(['image/jpeg','image/png'])
->uploads($files,0,$maxSize,false);
$save_datas = [];
foreach($result as $k=>$fileinfo){
$save_datas[] = [
'user_id' => $user['id'],
'title' => $fileinfo->origin_name,
'path' => $fileinfo->file_name,
'size' => $fileinfo->size,
'mime_type' => $fileinfo->mime_type,
'extension' => $fileinfo->extension,
'height' => $fileinfo->file_height,
'width' => $fileinfo->file_width,
'sha1' => sha1_file(public_path($fileinfo->file_name)),
'use_count' => 0,
];
}
\app\model\Files::saveAll($save_datas);
return $this->success(__('successful'),[
'link' => $result[0]['path'],
]);
}catch (\Exception $e){
return $this->fail($e->getMessage());
}
}
function upload(Request $request): Response
{
log_alert(0);
$savePath = $request->post('savePath','files');
$validate = Validate::rule('savePath', 'alphaNum');
$data = ['savePath' => $savePath];
log_alert($data);
if (!$validate->check($data)) {
cp($validate->getError());
return $this->fail( '参数错误:'.$validate->getError());
}
log_alert('1');
$file = current($request->file());
if (!$file || !$file->isValid()) {
return $this->fail('未找到文件');
}
log_alert('2');
try {
$data = $this->base($request, $savePath);
} catch (\Exception $e) {
log_alert($e->getMessage());
//throw $th;
}
log_alert('3');
//cp($data);
return $this->success( '上传成功', [
'url' => $data['realpath'],
'name' => $data['name'],
'fullurl' => $data['url'],
'size' => $data['size'],
'url1' => $data['url'],
]);
}
/**
* 获取上传数据
* @param Request $request
* @param $savePath 保存位置
* @return array
* @throws \Exception
*/
protected function base(Request $request, $savePath): array
{
$user = ['id'=>admin_id()];
// 适配器 local默认是存储在runtime目录下 public默认是存储在public目录下
// 可访问的静态文件建议public
// 默认适配器是local
//Storage::adapter('public');
$savePath = trim($savePath,'/');
$savePath = 'upload/'.$savePath;
cp($savePath);
$file = current($request->file());
cp($file);
$mimetype = explode(',',Config('site.upload_mimetype'));
$maxsize = Config('site.upload_maxsize')*1024*1024;
$result = Storage::adapter('public')
->path($savePath)
->size($maxsize)
->extYes($mimetype)
->upload($file);
cp($result);
$save_datas = [
'user_id' => $user['id'],
'category' => 'default',
'title' => $result->origin_name,
'path' => $result->file_name,
'size' => $result->size,
'mime_type' => $result->mime_type,
'extension' => $result->extension,
'height' => $result->file_height,
'width' => $result->file_width,
'sha1' => sha1_file(public_path($result->file_name)),
'use_count' => 0,
];
(new \app\model\Files)->save($save_datas);
return [
'code' => 0,
'url' => $result->file_url,
'name' => $result->origin_name,
'realpath' => '/'.$result->file_name,
'size' => $result->size,
'mime_type' => $result->mime_type,
'image_with'=> $result->file_width,
'image_height' => $result->file_height,
'ext' => $result->extension,
];
}
}
+43 -85
View File
@@ -2,6 +2,7 @@
namespace plugin\admin\app\controller;
use Exception;
use support\Request;
use support\Response;
use support\think\Db;
@@ -30,80 +31,38 @@ class FilesController extends Crud
}
function list(Request $request)
{
return view('', [
$list = $this->model->paginate();
return $this->success(__('successful'),$list);
}
function felist(Request $request)
{
$list = $this->model->paginate();
$result = [];
$list->each(function($item)use(&$result){
array_push($result,[
'tag' => "test",
'name' => $item["origin_name"],
//'thumb'=> $item["file_url"],
'url' => $item["file_url"],
]);
});
return json($result);
}
function feupload(Request $request): Response
{
$user = ['id'=>admin_id()];
$savePath = $request->post('savePath','files');
$validate = Validate::rule('savePath', 'alphaNum');
$data = ['savePath' => $savePath];
if (!$validate->check($data)) {
return $this->fail( '参数错误:'.$validate->getError());
}
$savePath = trim($savePath,'/');
$savePath = 'upload/'.$savePath.'/'.$user['id'];
$maxSize = 1024*1024*100; //100M
//多文件上传
$files = $request->file();
try {
$result = Storage::adapter('public')
->path($savePath)
->size(1024*1024*10)
->extYes(['image/jpeg','image/png'])
->uploads($files,0,$maxSize,false);
$save_datas = [];
foreach($result as $k=>$fileinfo){
$save_datas[] = [
'user_id' => $user['id'],
'title' => $fileinfo->origin_name,
'path' => $fileinfo->file_name,
'size' => $fileinfo->size,
'mime_type' => $fileinfo->mime_type,
'extension' => $fileinfo->extension,
'height' => $fileinfo->file_height,
'width' => $fileinfo->file_width,
'sha1' => sha1_file(public_path($fileinfo->file_name)),
'use_count' => 0,
];
}
\app\model\Files::saveAll($save_datas);
return $this->success(__('successful'),[
'link' => $result[0]['path'],
$data = $this->base($request, $savePath);
return json([
'link' => $data['file_url'],
]);
}catch (\Exception $e){
return $this->fail($e->getMessage());
}
}
function upload(Request $request): Response
{
cp('0');
$savePath = $request->post('savePath','files');
$validate = Validate::rule('savePath', 'alphaNum');
$data = ['savePath' => $savePath];
cp($data);
if (!$validate->check($data)) {
cp($validate->getError());
return $this->fail( '参数错误:'.$validate->getError());
}
cp('1');
$file = current($request->file());
if (!$file || !$file->isValid()) {
return $this->fail('未找到文件');
}
cp('2');
$data = $this->base($request, $savePath);
cp('3');
//cp($data);
return $this->success( '上传成功', [
'url' => $data['realpath'],
'name' => $data['name'],
'fullurl' => $data['url'],
'size' => $data['size'],
'url1' => $data['url'],
]);
return $this->success( '上传成功', $data);
}
/**
@@ -113,48 +72,47 @@ class FilesController extends Crud
* @return array
* @throws \Exception
*/
protected function base(Request $request, $savePath): array
protected function base(Request $request, $savePath): mixed
{
$user = ['id'=>admin_id()];
// 适配器 local默认是存储在runtime目录下 public默认是存储在public目录下
// 可访问的静态文件建议public
// 默认适配器是local
//Storage::adapter('public');
$validate = Validate::rule('savePath', 'alphaNum');
$data = ['savePath' => $savePath];
if (!$validate->check($data)) {
throw new Exception( '参数错误:'.$validate->getError());
}
$savePath = trim($savePath,'/');
$savePath = 'upload/'.$savePath;
//$savePath = 'upload/'.$savePath;
//$savePath = $savePath;
$file = current($request->file());
if (!$file || !$file->isValid()) {
throw new Exception( '未找到文件');
}
$mimetype = explode(',',Config('site.upload_mimetype'));
$maxsize = Config('site.upload_maxsize')*1024*1024;
$result = Storage::adapter('public')
$result = Storage::adapter('minio')
->path($savePath)
->size($maxsize)
->extYes($mimetype)
->upload($file);
$save_datas = [
'user_id' => $user['id'],
'admin_id' => admin_id(),
'category' => 'default',
'title' => $result->origin_name,
'path' => $result->file_name,
'adapter' => $result->adapter,
'origin_name' => $result->origin_name,
'file_name' => $result->file_name,
'size' => $result->size,
'mime_type' => $result->mime_type,
'extension' => $result->extension,
'height' => $result->file_height,
'width' => $result->file_width,
'sha1' => sha1_file(public_path($result->file_name)),
'file_height' => $result->file_height,
'file_width' => $result->file_width,
'file_url' => $result->file_url,
'sha1' => $result->storage_key ?:sha1_file(public_path($result->file_name)),
'use_count' => 0,
];
(new \app\model\Files)->save($save_datas);
return [
'code' => 0,
'url' => $result->file_url,
'name' => $result->origin_name,
'realpath' => '/'.$result->file_name,
'size' => $result->size,
'mime_type' => $result->mime_type,
'image_with'=> $result->file_width,
'image_height' => $result->file_height,
'ext' => $result->extension,
];
return \app\model\Files::create($save_datas);
}
}
-30
View File
@@ -103,22 +103,6 @@ function refresh_admin_session(bool $force = false)
$session->set('admin', $admin);
}
function getConfig($name=''){
if($name){
if(strpos($name,'.')>-1){
$name = explode('.',$name);
if(Config('site.'.$name[0].'.type') == 'array'){
return Config('site.'.$name[0].'.value.'.$name[1]);
}else{
return Config('site.'.$name[0].'.value');
}
}else{
return Config('site.'.$name);
}
}else{
return Config('site');
}
}
function null($var='',$defaut=''){
if(isset($var) && !$var){
return $defaut;
@@ -126,17 +110,3 @@ function null($var='',$defaut=''){
return $var;
}
}
function buildFileInput($name='',$value='',$type='image',$limit=0,$allowChoose=true){
$tpl = '
<input id="c-'.$name.'" class="form-control" size="50" name="'.$name.'" type="hidden" value="'.null($value).'" data-tip="头像">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-'.$name.'">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-'.$name.'" data-mimetype="'.$type.'" data-multiple="'.($limit>0 ?'true' : 'false').'" data-preview-id="p-'.$name.'"></a>';
if($allowChoose){
$tpl.=' <a class="pic-add fachoose" style="height: auto;border: 0;" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-'.$name.'" data-mimetype="image/*" data-multiple="'.($limit>0 ?'true' : 'false').'" data-preview-id="p-'.$name.'"></a>';
}
$tpl.='
</li>
</ul>';
return $tpl;
}
+1
View File
@@ -28,6 +28,7 @@ class Config implements MiddlewareInterface
$config['action'] = $request->action_name;
$config['moduleurl'] = admin_path();
$config['admin_path'] = admin_path();
$config['domain'] = env_get('server.domain','');
$request->_view_vars = array_merge((array) $request->_view_vars,[
'user' => session('admin'),
'config' => $config
+2 -2
View File
@@ -47,8 +47,8 @@
<input id="c-avatar" class="form-control" size="50" name="avatar" type="hidden" value="{$row.avatar|null}" data-tip="头像">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.avatar" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.avatar" id="add-pic-btn" href="javascript:;" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
</li>
</ul>
</div>
+2 -2
View File
@@ -65,8 +65,8 @@
<input id="c-avatar" class="form-control" size="50" name="avatar" type="hidden" value="{$row.avatar|null}" data-tip="杀杀杀">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="javascript:;" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
</li>
</ul>
</div>
+4 -4
View File
@@ -102,8 +102,8 @@
<input id="c-image" class="form-control" size="50" name="image" type="hidden" value="{$row.image|default=''}" data-tip="image">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-image">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="javascript:;" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
</li>
</ul>
</div>
@@ -114,8 +114,8 @@
<input id="c-images" class="form-control" size="50" name="images" type="hidden" value="{$row.images|default=''}" data-tip="images">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-images">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.images" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-images" data-mimetype="image/*" data-multiple="false" data-preview-id="p-images"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-images" data-mimetype="image/*" data-multiple="false" data-preview-id="p-images"></a>
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.images" id="add-pic-btn" href="javascript:;" title="点击上传" data-input-id="c-images" data-mimetype="image/*" data-multiple="false" data-preview-id="p-images"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件" data-input-id="c-images" data-mimetype="image/*" data-multiple="false" data-preview-id="p-images"></a>
</li>
</ul>
</div>
+1 -4
View File
@@ -115,10 +115,7 @@
{case value="image" break="0"}{/case}
{case value="images"}
<div class="form-inline">
<!-- <input id="c-{$item.name}" class="form-control" size="50" name="{$item.name}" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
<span><button type="button" id="faupload-{$item.name}" class="btn btn-danger faupload" data-input-id="c-{$item.name}" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="{$item.type=='image'?'false':'true'}" data-preview-id="p-{$item.name}"><i class="fa fa-upload"></i>{:__('Upload')}</button></span>
<span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-mimetype="image/*" data-multiple="{$item.type=='image'?'false':'true'}"><i class="fa fa-list"></i> {:__('Choose')}</button></span> -->
{html:upload name="$item.name" value="$item.value" tip="$item.tip" /}
{html:upload name="$item.name" value="$item.value" tip="$item.tip" extend="$item.extend" /}
</div>
{/case}
{case value="file" break="0"}{/case}
+2 -2
View File
@@ -40,12 +40,12 @@
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;"
permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传"
permission="app.admin.files.upload" id="add-pic-btn" href="javascript:;" title="点击上传"
data-input-id="c-avatar"
data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp"
data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;"
permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件"
permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件"
data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false"
data-preview-id="p-avatar"></a>
</li>
+1 -1
View File
@@ -18,7 +18,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">文件</label>
<div class="col-xs-12 col-sm-8 col-md-6">
{:buildFileInput('file',$row['file'],'image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp,text/plain',0,false)}
{html:upload name="file" value="$row['file']" tip="文件" /}
</div>
</div>
{else /}
+2 -2
View File
@@ -15,8 +15,8 @@
<input id="c-image" class="form-control" size="50" name="image" type="hidden" value="{$row.image|default=''}" data-tip="image">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-image">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;display: none;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="javascript:;" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;display: none;" permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
</li>
</ul>
</div>
+1
View File
@@ -12,6 +12,7 @@
<link href="__CSS__/style.min.css" rel="stylesheet" />
<script type="text/javascript">
var _c = {$config| json_encode=JSON_UNESCAPED_UNICODE|raw};
window.Config = _c;
_c['cdnurl']="";
_c['version'] = Math.random();
var require = {
+2 -2
View File
@@ -15,8 +15,8 @@
<input id="c-image" class="form-control" size="50" name="image" type="hidden" value="{$row.image|default=''}" data-tip="image">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-image">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;display: none;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="javascript:;" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;display: none;" permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
</li>
</ul>
</div>
+2 -2
View File
@@ -89,8 +89,8 @@
<input id="c-avatar" class="form-control" size="50" name="avatar" type="hidden" value="{$row.avatar|default='__IMG__/user/avatar.svg'}" data-tip="头像">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="javascript:;" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
</li>
</ul>
</div>
+2 -2
View File
@@ -71,8 +71,8 @@
<input id="c-avatar" class="form-control" size="50" name="avatar" type="hidden" value="{$row.avatar|default='__IMG__/user/avatar.svg'}" data-tip="头像">
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="javascript:;" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="javascript:;" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
</li>
</ul>
</div>
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

+6 -3
View File
@@ -6,10 +6,13 @@ define(['form'], function (Form) {
$(this).parent().addClass('active');
$('.tab-pane').hide('active');
$($(this).attr('href')).show('active');
return false;
})
//return false;
});
if(location.hash){
$('.nav-tabs li a[href='+location.hash+']').trigger('click');
}
var form = $('#settingsform');
Config['upload_url'] = 'attach/upload';
//Config['upload_url'] = 'files/upload';
Form.api.bindevent(form,function(res){
if (res.code) {
return lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
+7 -7
View File
@@ -1,8 +1,8 @@
requirejs.config({
//urlArgs: "v=" + (new Date()).getTime(),
urlArgs: "v=" + (location.host == 'q.sjqqzc.top' ? (new Date()).getTime() : require.s.contexts._.config.config.version),
baseUrl: require.s.contexts._.config.config.cdnurl+require.s.contexts._.config.'js/',
urlArgs: "v=" + (location.host != window.Config.domain ? (new Date()).getTime() : window.Config.version),
baseUrl: window.Config.cdnurl+window.Config.admin_path+'/js/',
packages: [{
name: 'moment',
location: '../libs/moment',
@@ -12,7 +12,7 @@ requirejs.config({
'fast': '../libs/fast',
'upload': '../libs/require-upload',
'form': '../libs/require-form',
'dropzone': '../libs/dropzone.min',
'dropzone': '../libs/dropzone/dropzone.min',
'table': '../libs/require-table',
'jquery': '../libs/jquery.min',
'bootstrap': '../libs/bootstrap.min',
@@ -48,7 +48,7 @@ requirejs.config({
},
map: {
'*': {
'css': require.s.contexts._.config.'libs/require-css.min.js' // or whatever the path to require-css is
'css': '../libs/require-css.min.js' // or whatever the path to require-css is
}
},
shim: {
@@ -58,7 +58,7 @@ requirejs.config({
'tagsinput': {
deps: [
'jquery',
'css!'+require.s.contexts._.config.'libs/jquery-tags-input/jquery.tagsinput.min.css'
'css!'+window.Config.admin_path+'/libs/jquery-tags-input/jquery.tagsinput.min.css'
]
},
'yntree': {
@@ -68,7 +68,7 @@ requirejs.config({
},
'bootstrap-select': {
deps: [
'css!'+require.s.contexts._.config.'libs/bootstrap-select/dist/css/bootstrap-select.min.css'
'css!'+window.Config.admin_path+'/libs/bootstrap-select/dist/css/bootstrap-select.min.css'
]
},
'bootstrap-select-lang': ['bootstrap-select'],
@@ -131,7 +131,7 @@ requirejs.config({
'bootstrap-datetimepicker':{
deps: [
'jquery',
'css!'+require.s.contexts._.config.'libs/bootstrap-datetimepicker/style.css'
'css!'+window.Config.admin_path+'/libs/bootstrap-datetimepicker/style.css'
]
}
},
+70 -21
View File
@@ -1,5 +1,29 @@
define(['table', 'upload','form'], function (Table,Upload,Form) {
var User = {
imgpreview:function(e,v,d,index){
var that = $(e.currentTarget);
var srcs = [];
var index = $(that).parents('table').find('.img-center').index($(that))
$(that).parents('table').find('.img-center').each(function(v,k){
var src = $(that).attr('data-url') || $(that).attr('src');
srcs.push({
"src": src,
"alt": $(that).attr('alt') || $(that).attr('title') || src,
"pid":k,
"thumb": $(that).attr('data-url') || $(that).attr('src')
});
});
(parent ? parent.layer : layer).photos({
zIndex:19891033,
photos: { // 图片层的数据源
"title": "", // 相册标题
"id": 123, // 相册 id
"start": index, // 初始显示的图片序号,默认 0
"data": srcs
}
});
return false;
},
//Do setup work hereAction
index: function () {
@@ -31,19 +55,34 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
title: 'ID',
sortable: true // 是否排序
},
{
title: "adapter",
field: "adapter",
filter: "string",
},
{
title: "名字",
field: "title",
field: "origin_name",
filter: "string",
},
{
title: "文件",
field: "path",
formatter: function (v,d) {
field: "file_name",
formatter: function (v,d,index) {
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"].indexOf(d.extension.toLowerCase()) !== -1) {
return '<img src="' + Fast.api.cdnurl(v) + '" style="max-width:32px;max-height:32px;" />';
var value = d['file_url'] == null || d['file_url'].length === 0 ? '' : d['file_url'].toString();
value = value ? value : '/assets/img/blank.gif';
var classname = 'img-sm img-center previewitem';
var url = Fast.api.cdnurl(value, true);
url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload_thumbstyle;
return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" alt="'+d['origin_name']+'" /></a>';
}
return '<a href="' + d['file_url'] + '" target="_blank" title="'+d['origin_name']+'">' + v + '</a>';
},
events:{
'click .img-center': function(e,v,d,index){
User.imgpreview.call(this,e,d['file_url'],d,index);
}
return '<a href="' + encodeURI(v) + '" target="_blank">' + escape(v) + '</a>';
}
},
{
@@ -70,11 +109,11 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
},
{
title: "图片宽度",
field: "width",
field: "file_width",
},
{
title: "图片高度",
field: "height",
field: "file_height",
},{
title: "扩展名",
field: "extension",
@@ -170,27 +209,39 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
totalField: "count",
columns: [
[
{checkbox: true},
{
field: 'id',
title: 'ID',
filter: "number",
sortable: true // 是否排序
},
{
title: "adapter",
field: "adapter",
filter: "string",
},
{
title: "名字",
field: "title",
field: "origin_name",
filter: "string",
},
{
title: "文件",
field: "path",
filter: "string",
formatter: function (v,d) {
field: "file_name",
formatter: function (v,d,index) {
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"].indexOf(d.extension.toLowerCase()) !== -1) {
return '<img src="' + Fast.api.cdnurl(v) + '" style="max-width:32px;max-height:32px;" />';
var value = d['file_url'] == null || d['file_url'].length === 0 ? '' : d['file_url'].toString();
value = value ? value : '/assets/img/blank.gif';
var classname = 'img-sm img-center previewitem';
var url = Fast.api.cdnurl(value, true);
url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload_thumbstyle;
return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" alt="'+d['origin_name']+'" /></a>';
}
return '<a href="' + d['file_url'] + '" target="_blank" title="'+d['origin_name']+'">' + v + '</a>';
},
events:{
'click .img-center': function(e,v,d,index){
User.imgpreview.call(this,e,d['file_url'],d,index);
}
return '<a href="' + encodeURI(v) + '" target="_blank">' + escape(v) + '</a>';
}
},
{
@@ -211,19 +262,17 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
}
},
{
title: "mime类型",
title: "类型",
field: "mime_type",
hide: true,
visible: false,
},
{
title: "图片宽度",
field: "width",
visible: false,
field: "file_width",
},
{
title: "图片高度",
field: "height",
visible: false,
field: "file_height",
},{
title: "扩展名",
field: "extension",
File diff suppressed because one or more lines are too long
@@ -0,0 +1,468 @@
@-webkit-keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px);
}
}
@-moz-keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px);
}
}
@keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px);
}
}
@-webkit-keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
}
@-moz-keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
}
@keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
}
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
}
@-moz-keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
}
@keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
}
.dropzone, .dropzone * {
box-sizing: border-box;
}
.dropzone {
min-height: 150px;
border: 2px solid rgba(0, 0, 0, 0.3);
background: white;
padding: 20px 20px;
}
.dropzone.dz-clickable {
cursor: pointer;
}
.dropzone.dz-clickable * {
cursor: default;
}
.dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message * {
cursor: pointer;
}
.dropzone.dz-started .dz-message {
display: none;
}
.dropzone.dz-drag-hover {
border-style: solid;
}
.dropzone.dz-drag-hover .dz-message {
opacity: 0.5;
}
.dropzone .dz-message {
text-align: center;
margin: 2em 0;
}
.dropzone .dz-message .dz-button {
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
}
.dropzone .dz-preview {
position: relative;
display: inline-block;
vertical-align: top;
margin: 16px;
min-height: 100px;
}
.dropzone .dz-preview:hover {
z-index: 1000;
}
.dropzone .dz-preview:hover .dz-details {
opacity: 1;
}
.dropzone .dz-preview.dz-file-preview .dz-image {
border-radius: 20px;
background: #999;
background: linear-gradient(to bottom, #eee, #ddd);
}
.dropzone .dz-preview.dz-file-preview .dz-details {
opacity: 1;
}
.dropzone .dz-preview.dz-image-preview {
background: white;
}
.dropzone .dz-preview.dz-image-preview .dz-details {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-ms-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.dropzone .dz-preview .dz-remove {
font-size: 14px;
text-align: center;
display: block;
cursor: pointer;
border: none;
}
.dropzone .dz-preview .dz-remove:hover {
text-decoration: underline;
}
.dropzone .dz-preview:hover .dz-details {
opacity: 1;
}
.dropzone .dz-preview .dz-details {
z-index: 20;
position: absolute;
top: 0;
left: 0;
opacity: 0;
font-size: 13px;
min-width: 100%;
max-width: 100%;
padding: 2em 1em;
text-align: center;
color: rgba(0, 0, 0, 0.9);
line-height: 150%;
}
.dropzone .dz-preview .dz-details .dz-size {
margin-bottom: 1em;
font-size: 16px;
}
.dropzone .dz-preview .dz-details .dz-filename {
white-space: nowrap;
}
.dropzone .dz-preview .dz-details .dz-filename:hover span {
border: 1px solid rgba(200, 200, 200, 0.8);
background-color: rgba(255, 255, 255, 0.8);
}
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) {
overflow: hidden;
text-overflow: ellipsis;
}
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span {
border: 1px solid transparent;
}
.dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span {
background-color: rgba(255, 255, 255, 0.4);
padding: 0 0.4em;
border-radius: 3px;
}
.dropzone .dz-preview:hover .dz-image img {
-webkit-transform: scale(1.05, 1.05);
-moz-transform: scale(1.05, 1.05);
-ms-transform: scale(1.05, 1.05);
-o-transform: scale(1.05, 1.05);
transform: scale(1.05, 1.05);
-webkit-filter: blur(8px);
filter: blur(8px);
}
.dropzone .dz-preview .dz-image {
border-radius: 20px;
overflow: hidden;
width: 120px;
height: 120px;
position: relative;
display: block;
z-index: 10;
}
.dropzone .dz-preview .dz-image img {
display: block;
}
.dropzone .dz-preview.dz-success .dz-success-mark {
-webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
}
.dropzone .dz-preview.dz-error .dz-error-mark {
opacity: 1;
-webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
}
.dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark {
pointer-events: none;
opacity: 0;
z-index: 500;
position: absolute;
display: block;
top: 50%;
left: 50%;
margin-left: -27px;
margin-top: -27px;
}
.dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg {
display: block;
width: 54px;
height: 54px;
}
.dropzone .dz-preview.dz-processing .dz-progress {
opacity: 1;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
}
.dropzone .dz-preview.dz-complete .dz-progress {
opacity: 0;
-webkit-transition: opacity 0.4s ease-in;
-moz-transition: opacity 0.4s ease-in;
-ms-transition: opacity 0.4s ease-in;
-o-transition: opacity 0.4s ease-in;
transition: opacity 0.4s ease-in;
}
.dropzone .dz-preview:not(.dz-processing) .dz-progress {
-webkit-animation: pulse 6s ease infinite;
-moz-animation: pulse 6s ease infinite;
-ms-animation: pulse 6s ease infinite;
-o-animation: pulse 6s ease infinite;
animation: pulse 6s ease infinite;
}
.dropzone .dz-preview .dz-progress {
opacity: 1;
z-index: 1000;
pointer-events: none;
position: absolute;
height: 16px;
left: 50%;
top: 50%;
margin-top: -8px;
width: 80px;
margin-left: -40px;
background: rgba(255, 255, 255, 0.9);
-webkit-transform: scale(1);
border-radius: 8px;
overflow: hidden;
}
.dropzone .dz-preview .dz-progress .dz-upload {
background: #333;
background: linear-gradient(to bottom, #666, #444);
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 0;
-webkit-transition: width 300ms ease-in-out;
-moz-transition: width 300ms ease-in-out;
-ms-transition: width 300ms ease-in-out;
-o-transition: width 300ms ease-in-out;
transition: width 300ms ease-in-out;
}
.dropzone .dz-preview.dz-error .dz-error-message {
display: block;
}
.dropzone .dz-preview.dz-error:hover .dz-error-message {
opacity: 1;
pointer-events: auto;
}
.dropzone .dz-preview .dz-error-message {
pointer-events: none;
z-index: 1000;
position: absolute;
display: block;
display: none;
opacity: 0;
-webkit-transition: opacity 0.3s ease;
-moz-transition: opacity 0.3s ease;
-ms-transition: opacity 0.3s ease;
-o-transition: opacity 0.3s ease;
transition: opacity 0.3s ease;
border-radius: 8px;
font-size: 13px;
top: 130px;
left: -10px;
width: 140px;
background: #be2626;
background: linear-gradient(to bottom, #be2626, #a92222);
padding: 0.5em 1.2em;
color: white;
}
.dropzone .dz-preview .dz-error-message:after {
content: "";
position: absolute;
top: -6px;
left: 64px;
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #be2626;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
View File
@@ -125,6 +125,10 @@ define(['jquery', 'bootstrap', 'layer','lightyear'], function ($, undefined, Lay
},
//获取修复后可访问的cdn链接
cdnurl: function (url, domain) {
if(!url){return "";}
if(url.substring(0,4) == 'http'){
return url;
}
url = url.substring(0,1)==='/' ? url:'/'+url;
var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i");
var cdnurl = Config.cdnurl;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 KiB

@@ -0,0 +1,249 @@
/*!
* froala_editor v4.3.1 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2024 Froala Labs
*/
!function (e, a) {
"object" == typeof exports && "undefined" != typeof module ? a(require("froala-editor")) : "function" == typeof define && define.amd ? define(["froala-editor"], a) : a(e.FroalaEditor)
}
(this, function ($) {
"use strict";
if ($ = $ && $.hasOwnProperty("default") ? $["default"] : $, Object.assign($.DEFAULTS, {
imageManagerLoadURL: "https://i.froala.com/load-files",
imageManagerLoadMethod: "get",
imageManagerLoadParams: {}
, imageManagerPreloader: null,
imageManagerDeleteURL: "",
imageManagerDeleteMethod: "post",
imageManagerDeleteParams: {}
, imageManagerPageSize: 12,
imageManagerScrollOffset: 20,
imageManagerToggleTags: !0
}),
$.PLUGINS.imageManager = function (s) {
var g, l, i, o, d, m, c, f, u, p, h, v = s.$, M = "image_manager", e = 10, b = 11, w = 12, C = 13, L = 14, D = 15, t = 21, r = 22, n = {}
; function y() {
var e = v(window).outerWidth(); return e < 768 ? 2 : e < 1200 ? 3 : 4
}
function I() {
d.empty(); for (var e = 0; e < h; e++)d.append('<div class="fr-list-column"></div>')
}
function P() {
if (u < c.length && i[0].scrollTop >= i[0].scrollHeight - s.opts.imageManagerScrollOffset - i.outerHeight()) {
f++; for (var e = s.opts.imageManagerPageSize * (f - 1); e < Math.min(c.length, s.opts.imageManagerPageSize * f); e++)a(c[e])
}
}
function a(n) {
var i = new Image,
o = v(document.createElement("div")).attr("class", "fr-image-container fr-empty fr-image-" + p++).attr("data-loading", s.language.translate("Loading") + "..").attr("data-deleting", s.language.translate("Deleting") + ".."); R(!1),
i.onload = function () {
o.height(Math.floor(o.width() / i.width * i.height));
var t = v(document.createElement("img"));
if (n.thumb) t.attr("src", n.thumb); else {
if (O(L, n), !n.url) return O(D, n), !1; t.attr("src", n.url)
}
if (n.url && t.attr("data-url", n.url), n.tag) if (l.find(".fr-modal-more.fr-not-available").removeClass("fr-not-available"), l.find(".fr-modal-tags").show(), 0 <= n.tag.indexOf(",")) {
for (var e = n.tag.split(","), a = 0; a < e.length; a++)e[a] = e[a].trim(), 0 === m.find('a[title="'.concat(e[a], '"]')).length && m.append('<a role="button" title="'.concat(e[a], '">').concat(e[a], "</a>")); t.attr("data-tag", e.join())
}
else 0 === m.find('a[title="'.concat(n.tag.trim(), '"]')).length && m.append('<a role="button" title="'.concat(n.tag.trim(), '">').concat(n.tag.trim(), "</a>")), t.attr("data-tag", n.tag.trim()); for (var r in n.name && t.attr("alt", n.name), n) n.hasOwnProperty(r) && "thumb" !== r && "url" !== r && "tag" !== r && t.attr("data-".concat(r), n[r]); o.append(t).append(v(s.icon.create("imageManagerDelete")).addClass("fr-delete-img").attr("title", s.language.translate("Delete"))).append(v(s.icon.create("imageManagerInsert")).addClass("fr-insert-img").attr("title", s.language.translate("Insert"))), m.find(".fr-selected-tag").each(function (e, a) {
j(t, a.text) || o.hide()
}), t.on("load", function () {
o.removeClass("fr-empty"), o.height("auto"), u++, E(T(parseInt(t.parent().attr("class").match(/fr-image-(\d+)/)[1], 10) + 1)), R(!1), u % s.opts.imageManagerPageSize == 0 && P()
}), s.events.trigger("imageManager.imageLoaded", [t])
}
, i.onerror = function () {
u++, o.remove(), E(T(parseInt(o.attr("class").match(/fr-image-(\d+)/)[1], 10) + 1)), O(e, n), u % s.opts.imageManagerPageSize == 0 && P()
}
, i.src = n.thumb || n.url, S().append(o)
}
function S() {
var r, n; return d.find(".fr-list-column").each(function (e, a) {
var t = v(a); 0 === e ? (n = t.outerHeight(), r = t) : t.outerHeight() < n && (n = t.outerHeight(), r = t)
}), r
}
function T(e) {
e === undefined && (e = 0); for (var a = [], t = p - 1; e <= t; t--) {
var r = d.find(".fr-image-".concat(t)); r.length && (a.push(r), v(document.createElement("div")).attr("id", "fr-image-hidden-container").append(r), d.find(".fr-image-".concat(t)).remove())
}
return a
}
function E(e) {
for (var a = e.length - 1; 0 <= a; a--)S().append(e[a])
}
function R(e) {
if (e === undefined && (e = !0), !g.isVisible()) return !0; var a = y(); if (a !== h) {
h = a; var t = T(); I(), E(t)
}
s.modals.resize(M), e && P()
}
function U(e) {
for (var a, t = e[0].attributes, r = t.length, n = {}
; r--;)t[r] && "src" !== (a = t[r].name) && (n[a] = t[r].value); return n
}
function x(e) {
var a = v(e.currentTarget).siblings("img"), t = g.data("instance") || s, r = g.data("current-image"); if (s.modals.hide(M), t.image.showProgressBar(), r) r.data("fr-old-src", r.attr("src")), r.trigger("click"); else {
t.events.focus(!0), t.selection.restore(); var n = t.position.getBoundingRect(), i = n.left + n.width / 2 + v(s.doc).scrollLeft(), o = n.top + n.height + v(s.doc).scrollTop(); t.popups.setContainer("image.insert", s.$sc), t.popups.show("image.insert", i, o)
}
t.image.insert(a.data("url"), !1, U(a), r)
}
function q(e) {
var i = v(e.currentTarget).siblings("img"),
a = s.language.translate("Are you sure? Image will be deleted.");
confirm(a) && (s.opts.imageManagerDeleteURL ? !1 !== s.events.trigger("imageManager.beforeDeleteImage", [i]) && (i.parent().addClass("fr-image-deleting"),
v(this).ajax({
method: s.opts.imageManagerDeleteMethod,
url: s.opts.imageManagerDeleteURL,
data: Object.assign(Object.assign({
src: i.attr("src")
}
, U(i)), s.opts.imageManagerDeleteParams), crossDomain: s.opts.requestWithCORS, withCredentials: s.opts.requestWithCredentials, headers: s.opts.requestHeaders, done: function (e, a, t) {
s.events.trigger("imageManager.imageDeleted", [e]); var r = T(parseInt(i.parent().attr("class").match(/fr-image-(\d+)/)[1], 10) + 1); i.parent().remove(), E(r), function n() {
g.find("#fr-modal-tags > a").each(function () {
0 === g.find('#fr-image-list [data-tag*="'.concat(v(this).text(), '"]')).length && v(this).removeClass("fr-selected-tag").hide()
}), _()
}
(), R(!0)
}
, fail: function (e) {
O(t, e.response || e.responseText)
}
})) : O(r))
}
function O(e, a) {
10 <= e && e < 20 ? o.hide() : 20 <= e && e < 30 && v(".fr-image-deleting").removeClass("fr-image-deleting"), s.events.trigger("imageManager.error", [{
code: e, message: n[e]
}
, a])
}
function H() {
var e = l.find(".fr-modal-head-line").outerHeight(), a = m.outerHeight(); l.toggleClass("fr-show-tags"), l.hasClass("fr-show-tags") ? (l.css("height", e + a), i.css("marginTop", e + a), m.find("a").css("opacity", 1)) : (l.css("height", e), i.css("marginTop", e), m.find("a").css("opacity", 0))
}
function _() {
var e = m.find(".fr-selected-tag"); 0 < e.length ? (d.find("img").parents().show(), e.each(function (e, r) {
d.find("img").each(function (e, a) {
var t = v(a); j(t, r.text) || t.parent().hide()
})
})) : d.find("img").parents().show(), E(T()), P()
}
function k(e) {
e.preventDefault(); var a = v(e.currentTarget); a.toggleClass("fr-selected-tag"), s.opts.imageManagerToggleTags && a.siblings("a").removeClass("fr-selected-tag"), _()
}
function j(e, a) {
for (var t = (e.attr("data-tag") || "").split(","), r = 0; r < t.length; r++)if (t[r] === a) return !0; return !1
}
return n[e] = "Image cannot be loaded from the passed link.", n[b] = "Error during load images request.", n[w] = "Missing imageManagerLoadURL option.", n[C] = "Parsing load response failed.", n[L] = "Missing image thumb.", n[D] = "Missing image URL.", n[t] = "Error during delete image request.", n[r] = "Missing imageManagerDeleteURL option.", {
require: ["image"], _init: function z() {
if (!s.$wp && "IMG" !== s.el.tagName) return !1
}
, show: function G() {
if (!g) {
var e, a = '<button class="fr-command fr-btn fr-modal-more fr-not-available" id="fr-modal-more-'.concat(s.sid, '"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24""><path d="').concat($.SVG.tags, '"/></svg></button><h4 data-text="true">').concat(s.language.translate("Manage Images"), '</h4></div>\n <div class="fr-modal-tags" id="fr-modal-tags">'); e = s.opts.imageManagerPreloader ? '<img class="fr-preloader" id="fr-preloader" alt="'.concat(s.language.translate("Loading"), '.." src="').concat(s.opts.imageManagerPreloader, '" style="display: none;">') : '<span class="fr-preloader" id="fr-preloader" style="display: none;">'.concat(s.language.translate("Loading"), "</span>"), e += '<div class="fr-image-list" id="fr-image-list"></div>'; var t = s.modals.create(M, a, e); g = t.$modal, l = t.$head, i = t.$body
}
g.data("current-image", s.image.get()), s.modals.show(M), o || function r() {
o = g.find("#fr-preloader"), d = g.find("#fr-image-list"), m = g.find("#fr-modal-tags"), h = y(), I(), l.css("height", l.find(".fr-modal-head-line").outerHeight()), s.events.$on(v(s.o_win), "resize", function () {
R(! !c)
}), s.events.bindClick(d, ".fr-insert-img", x), s.events.bindClick(d, ".fr-delete-img", q), s.helpers.isMobile() && (s.events.bindClick(d, "div.fr-image-container", function (e) {
g.find(".fr-mobile-selected").removeClass("fr-mobile-selected"), v(e.currentTarget).addClass("fr-mobile-selected")
}), g.on(s._mousedown, function () {
g.find(".fr-mobile-selected").removeClass("fr-mobile-selected")
})), g.on(s._mousedown + " " + s._mouseup, function (e) {
e.stopPropagation()
}), g.on(s._mousedown, "*", function () {
s.events.disableBlur()
}), i.on("scroll", P), s.events.bindClick(g, "button#fr-modal-more-".concat(s.sid), H), s.events.bindClick(m, "a", k)
}
(), function n() {
o.show(), d.find(".fr-list-column").empty(), s.opts.imageManagerLoadURL ? v(this).ajax({
url: s.opts.imageManagerLoadURL,
method: s.opts.imageManagerLoadMethod,
data: s.opts.imageManagerLoadParams,
crossDomain: s.opts.requestWithCORS, withCredentials: s.opts.requestWithCredentials,
headers: s.opts.requestHeaders,
done: function (e, a, t) {
s.events.trigger("imageManager.imagesLoaded", [e]), function r(e, a) {
try {
d.find(".fr-list-column").empty(), p = u = f = 0, c = JSON.parse(e), P()
}
catch (t) {
O(C, a)
}
}
(e, t.response), o.hide()
}
, fail: function (e) {
O(b, e.response || e.responseText)
}
}) : O(w)
}
()
}
, hide: function N() {
s.modals.hide(M)
}
}
}
, !$.PLUGINS.image) throw new Error("Image manager plugin requires image plugin."); $.DEFAULTS.imageInsertButtons.push("imageManager"), $.RegisterCommand("imageManager", {
title: "Browse", undo: !1, focus: !1, modal: !0, callback: function () {
this.imageManager.show()
}
, plugin: "imageManager"
}), $.DefineIcon("imageManager", {
NAME: "folder", SVG_KEY: "imageManager"
}), $.DefineIcon("imageManagerInsert", {
NAME: "plus", SVG_KEY: "add"
}), $.DefineIcon("imageManagerDelete", {
NAME: "trash", SVG_KEY: "remove"
})
});
+1 -1
View File
@@ -7522,7 +7522,7 @@ define(['jquery', 'bootstrap', 'layer','template'], function ($, undefined, Laye
Layer.close(index);
});
l.find("input.js-icon-search").on('keyup', function () {
l.find.show();
l.find("#chooseicon ul li").show();
if ($(this).val() != '') {
l.find("#chooseicon ul").find("li:not([data-font*='" + $(this).val() + "'])").hide();
}
+10 -76
View File
@@ -260,7 +260,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
var nums = value === '' ? 0 : value.split(/\,/).length;
var files = data.url !== "" ? data.url.split(/\,/) : [];
$.each(files, function (i, j) {
var url = Config.fullmode ? Fast.api.cdnurl(j) : j;
var url = Config.upload_fullmode=="1" ? Fast.api.cdnurl(j) : j;
urlArr.push(url);
});
if (maxcount > 0) {
@@ -273,7 +273,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
var result = urlArr.join(",");
inputObj.val(result).trigger("change").trigger("validate");
} else {
var url = Config.fullmode ? Fast.api.cdnurl(data.url) : data.url;
var url = Config.upload_fullmode=="1" ? Fast.api.cdnurl(data.url) : data.url;
$("#" + input_id).val(url).trigger("change").trigger("validate");
}
}
@@ -624,7 +624,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
fileUploadMethod: 'POST',
// Set max file size to 20MB.
fileMaxSize: 20 * 1024 * 1024,
fileMaxSize: Config.upload_maxsize * 1024 * 1024,
// Allow to upload any file.
fileAllowedTypes: ['*'],
@@ -633,35 +633,8 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
'file.beforeUpload': function (files) {
// Return false if you want to stop the file upload.
},
'file.uploaded': function (response) {
// File was uploaded to the server.
},
'file.inserted': function ($file, response) {
// File was inserted in the editor.
},
'file.error': function (error, response) {
// Bad link.
if (error.code == 1) { }
// No link in upload response.
else if (error.code == 2) {}
// Error during file upload.
else if (error.code == 3) { }
// Parsing response failed.
else if (error.code == 4) { }
// File too text-large.
else if (error.code == 5) {}
// Invalid file type.
else if (error.code == 6) {}
// File can be uploaded only to same domain in IE 8 and IE 9.
else if (error.code == 7) {}
// Response contains the original server response to the request if available.
'image.beforeUpload': function (images) {
// Return false if you want to stop the image upload.
}
},
@@ -672,58 +645,19 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
imageUploadURL: uploadUrl,
// Additional upload params.
imageUploadParams: {from: 'editor'},
imageUploadParams: {save_path: 'editor'},
// Set request type.
imageUploadMethod: 'POST',
// Set max image size to 5MB.
imageMaxSize: 5 * 1024 * 1024,
imageMaxSize: Config.upload_maxsize * 1024 * 1024,
// Allow to upload PNG and JPG.
imageAllowedTypes: ['jpeg', 'jpg', 'png'],
events: {
'image.beforeUpload': function (images) {
// Return false if you want to stop the image upload.
},
'image.uploaded': function (response) {
// Image was uploaded to the server.
},
'image.inserted': function ($img, response) {
// Image was inserted in the editor.
},
'image.replaced': function ($img, response) {
// Image was replaced in the editor.
},
'image.error': function (error, response) {
// Bad link.
if (error.code == 1) { }
// No link in upload response.
else if (error.code == 2) { }
// Error during image upload.
else if (error.code == 3) { }
// Parsing response failed.
else if (error.code == 4) {}
// Image too text-large.
else if (error.code == 5) { }
// Invalid image type.
else if (error.code == 6) { }
// Image can be uploaded only to same domain in IE 8 and IE 9.
else if (error.code == 7) { }
// Response contains the original server response to the request if available.
}
},
// Set a preloader.
imageManagerPreloader: "/images/loader.gif",
imageManagerPreloader: Config.admin_path+"/images/loading.gif",
// Set page size.
imageManagerPageSize: 20,
@@ -732,7 +666,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
imageManagerScrollOffset: 10,
// Set the load images request URL.
imageManagerLoadURL: Config.admin_path+"/files/list",
imageManagerLoadURL: Config.admin_path+"/files/felist",
// Set the load images request type.
imageManagerLoadMethod: "GET",
@@ -744,7 +678,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
imageManagerDeleteURL: Config.admin_path+"/files/delete",
// Set the delete image request type.
imageManagerDeleteMethod: "DELETE",
imageManagerDeleteMethod: "POST",
// Additional delete params.
imageManagerDeleteParams: {param: 'value'},
+84 -84
View File
@@ -468,87 +468,86 @@ define(['jquery', 'bootstrap', 'moment', 'bootstrap-table', 'bootstrap-table-lan
}
});
//当内容渲染完成后
// table.on('post-body.bs.table', function (e, data) {
// $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
// if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").length > 0) {
// //拖拽选择复选框
// var posx, posy, dragdiv, drag = false, prepare = false;
// var mousemove = function (e) {
// if (drag) {
// var left = Math.min(e.pageX, posx);
// var top = Math.min(e.pageY, posy);
// var width = Math.abs(posx - e.pageX);
// var height = Math.abs(posy - e.pageY);
// dragdiv.css({left: left + "px", top: top + "px", width: width + "px", height: height + "px"});
// var dragrect = {x: left, y: top, width: width, height: height};
// $(Table.config.checkboxtd, table).each(function () {
// var checkbox = $("input:checkbox", this);
// var tdrect = this.getBoundingClientRect();
// tdrect.x += document.documentElement.scrollLeft;
// tdrect.y += document.documentElement.scrollTop;
table.on('post-body.bs.table', function (e, data) {
$(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
if ($(Table.config.checkboxtd + ":first", table).find("input[type='checkbox'][data-index]").length > 0) {
//拖拽选择复选框
var posx, posy, dragdiv, drag = false, prepare = false;
var mousemove = function (e) {
if (drag) {
var left = Math.min(e.pageX, posx);
var top = Math.min(e.pageY, posy);
var width = Math.abs(posx - e.pageX);
var height = Math.abs(posy - e.pageY);
dragdiv.css({left: left + "px", top: top + "px", width: width + "px", height: height + "px"});
var dragrect = {x: left, y: top, width: width, height: height};
$(Table.config.checkboxtd, table).each(function () {
var checkbox = $("input:checkbox", this);
var tdrect = this.getBoundingClientRect();
tdrect.x += document.documentElement.scrollLeft;
tdrect.y += document.documentElement.scrollTop;
// var td_min_x = tdrect.x;
// var td_min_y = tdrect.y;
// var td_max_x = tdrect.x + tdrect.width;
// var td_max_y = tdrect.y + tdrect.height;
var td_min_x = tdrect.x;
var td_min_y = tdrect.y;
var td_max_x = tdrect.x + tdrect.width;
var td_max_y = tdrect.y + tdrect.height;
// var drag_min_x = dragrect.x;
// var drag_min_y = dragrect.y;
// var drag_max_x = dragrect.x + dragrect.width;
// var drag_max_y = dragrect.y + dragrect.height;
// var overlapped = td_min_x <= drag_max_x && td_max_x >= drag_min_x && td_min_y <= drag_max_y && td_max_y >= drag_min_y;
// if (overlapped) {
// if (!$(this).hasClass("overlaped")) {
// $(this).addClass("overlaped");
// checkbox.trigger("click");
// }
// } else {
// if ($(this).hasClass("overlaped")) {
// $(this).removeClass("overlaped");
// checkbox.trigger("click");
// }
// }
// });
// }
// };
// var selectstart = function () {
// return false;
// };
// var mouseup = function () {
// if (drag) {
// $(document).off("mousemove", mousemove);
// $(document).off("selectstart", selectstart);
// dragdiv.remove();
// }
// drag = false;
// prepare = false;
// $(document.body).css({'MozUserSelect': '', 'webkitUserSelect': ''}).attr('unselectable', 'off');
// };
var drag_min_x = dragrect.x;
var drag_min_y = dragrect.y;
var drag_max_x = dragrect.x + dragrect.width;
var drag_max_y = dragrect.y + dragrect.height;
var overlapped = td_min_x <= drag_max_x && td_max_x >= drag_min_x && td_min_y <= drag_max_y && td_max_y >= drag_min_y;
if (overlapped) {
if (!$(this).hasClass("overlaped")) {
$(this).addClass("overlaped");
checkbox.trigger("click");
}
} else {
if ($(this).hasClass("overlaped")) {
$(this).removeClass("overlaped");
checkbox.trigger("click");
}
}
});
}
};
var selectstart = function () {
return false;
};
var mouseup = function () {
if (drag) {
$(document).off("mousemove", mousemove);
$(document).off("selectstart", selectstart);
dragdiv.remove();
}
drag = false;
prepare = false;
$(document.body).css({'MozUserSelect': '', 'webkitUserSelect': ''}).attr('unselectable', 'off');
};
// $(Table.config.checkboxtd, table).on("mousedown", function (e) {
// //禁止鼠标右键事件和文本框
// if (e.button === 2 || $(e.target).is("input")) {
// return false;
// }
// posx = e.pageX;
// posy = e.pageY;
// prepare = true;
// }).on("mousemove", function (e) {
// if (prepare && !drag) {
// drag = true;
// dragdiv = $("<div />");
// dragdiv.css({position: 'absolute', width: 0, height: 0, border: "1px dashed blue", background: "#0029ff", left: e.pageX + "px", top: e.pageY + "px", opacity: .1});
// dragdiv.appendTo(document.body);
// $(document.body).css({'MozUserSelect': 'none', 'webkitUserSelect': 'none'}).attr('unselectable', 'on');
// $(document).on("mousemove", mousemove).on("mouseup", mouseup).on("selectstart", selectstart);
// if (options.dragCheckboxMultiselect) {
// $(Table.config.checkboxtd, table).removeClass("overlaped");
// }
// }
// });
// }
// });
$(Table.config.checkboxtd, table).on("mousedown", function (e) {
//禁止鼠标右键事件和文本框
if (e.button === 2 || $(e.target).is("input")) {
return false;
}
posx = e.pageX;
posy = e.pageY;
prepare = true;
}).on("mousemove", function (e) {
if (prepare && !drag) {
drag = true;
dragdiv = $("<div />");
dragdiv.css({position: 'absolute', width: 0, height: 0, border: "1px dashed blue", background: "#0029ff", left: e.pageX + "px", top: e.pageY + "px", opacity: .1});
dragdiv.appendTo(document.body);
$(document.body).css({'MozUserSelect': 'none', 'webkitUserSelect': 'none'}).attr('unselectable', 'on');
$(document).on("mousemove", mousemove).on("mouseup", mouseup).on("selectstart", selectstart);
if (options.dragCheckboxMultiselect) {
$(Table.config.checkboxtd, table).removeClass("overlaped");
}
}
});
}
});
var exportDataType = options.exportDataType;
// 处理选中筛选框后按钮的状态统一变更
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) {
@@ -956,17 +955,18 @@ define(['jquery', 'bootstrap', 'moment', 'bootstrap-table', 'bootstrap-table-lan
var data = [];
value = value === null ? '' : value.toString();
var arr = value != '' ? value.split(",") : [];
debugger;
var url;
$.each(arr, function (index, value) {
url = Fast.api.cdnurl(value);
data.push({
src: url,
thumb: url.match(/^(\/|data:image\\)/) ? url : url + Config.thumbstyle
thumb: url.match(/^(\/|data:image\\)/) ? url : url + Config.upload_thumbstyle
});
});
Layer.photos({
photos: {
"start": $(this).parent().index(),
"start": 0,
"data": data
},
anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
@@ -985,21 +985,21 @@ define(['jquery', 'bootstrap', 'moment', 'bootstrap-table', 'bootstrap-table-lan
image: function (value, row, index) {
value = value == null || value.length === 0 ? '' : value.toString();
value = value ? value : '/assets/img/blank.gif';
var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center previewitem';
var url = Fast.api.cdnurl(value, true);
url = url.match(/^(\/|data:image\\)/) ? url : url + Config.thumbstyle;
url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload_thumbstyle;
return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>';
},
images: function (value, row, index) {
value = value == null || value.length === 0 ? '' : value.toString();
var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center previewitem';
var arr = value != '' ? value.split(',') : [];
var html = [];
var url;
$.each(arr, function (i, value) {
value = value ? value : '/assets/img/blank.gif';
url = Fast.api.cdnurl(value, true);
url = url.match(/^(\/|data:image\\)/) ? url : url + Config.thumbstyle;
url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload_thumbstyle;
html.push('<a href="javascript:"><img class="' + classname + '" src="' + url + '" /></a>');
});
return html.join(' ');
+12 -13
View File
@@ -5,7 +5,7 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
config: {
container: document.body,
classname: '.plupload:not([initialized]),.faupload:not([initialized])',
previewtpl: '<li class="col-xs-3"><a href="<%= fullurl%>" data-url="<%= url%>" target="_blank" class="thumbnail"><img src="<%= fullurl%>" onerror="this.src=\'' + Fast.api.fixurl("ajax/icon") + '?suffix=<%= suffix%>\';this.onerror=null;" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
previewtpl: '<li class="col-xs-3"><a href="<%= fullurl%>" data-url="<%= url%>" target="_blank" class="thumbnail"><img src="<%= fullurl%>" onerror="this.src=\'' + Fast.api.fixurl("ajax/icon") + '?suffix=<%= suffix%>\';this.onerror=null;" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="mdi mdi-trash-can-outline"></i></a></li>',
},
events: {
//初始化
@@ -28,7 +28,7 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
if ($(button).data("multiple") && inputObj.val() !== "") {
urlArr.push(inputObj.val());
}
var url = Config.fullmode ? Fast.api.cdnurl(data.url) : data.url;
var url = Config.upload_fullmode=="1" ? data.file_url : data.file_name;
urlArr.push(url);
inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
}
@@ -127,10 +127,10 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
}
$(this).attr("initialized", true);
var that = this;
var id = $(this).prop("id") || $(this).prop("name") || Dropzone.uuidv4();
var id = $(this).prop("id") || $(this).prop("name") || Dropzone.Dropzone.uuidv4();
var url = $(this).data("url");
var maxsize = $(this).data("maxsize");
var maxcount = $(this).data("maxcount");
var maxcount = $(this).data("maxcount") || 1;
var mimetype = $(this).data("mimetype");
var multipart = $(this).data("multipart");
var multiple = $(this).data("multiple");
@@ -142,22 +142,21 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
//上传URL
url = url ? url : Config.upload_url;
url = Fast.api.fixurl(url);
var chunking = false, chunkSize = 2097152, timeout = Config.upload_timeout || 600000;
var chunking = false, chunkSize = 2097152, timeout = Config.upload_timeout*1000 || 600000;
//最大可上传文件大小
maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload_maxsize;
maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload_maxsize + 'M';
//文件类型
mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload_mimetype;
//请求的表单参数
multipart = typeof multipart !== "undefined" ? multipart : Config.upload_multipart;
//是否支持批量上传
multiple = typeof multiple !== "undefined" ? multiple : true;
multiple = typeof multiple !== "undefined" ? multiple : false;
//后缀特殊处理
mimetype = mimetype.split(",").map(function (k) {
return k.indexOf("/") > -1 ? k : (!k || k === "*" || k.charAt(0) === "." ? k : "." + k);
}).join(",");
mimetype = mimetype === '*' ? null : mimetype;
//最大文件限制转换成mb
var maxFilesize = (function (maxsize) {
var matches = maxsize.toString().match(/^([0-9\.]+)(\w+)$/);
@@ -180,7 +179,7 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
// multipart.category = category;
}
Upload.list[id] = new Dropzone(this, $.extend({
Upload.list[id] = new Dropzone.Dropzone(this, $.extend({
url: url,
params: function (files, xhr, chunk) {
var params = multipart;
@@ -270,12 +269,12 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
},
uploadprogress: function (file, progress, bytesSent) {
if (file.upload.chunked) {
$(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('上传') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
$(this.element).prop("disabled", true).html("<i class='mdi mdi-cloud-upload-outline'></i> " + __('上传') + Math.floor((file.upload.bytesSent / file.size) * 100) + "%");
}
},
totaluploadprogress: function (progress, bytesSent) {
if (this.getActiveFiles().length > 0 && !this.options.chunking) {
$(this.element).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('上传') + Math.floor(progress) + "%");
$(this.element).prop("disabled", true).html("<i class='mdi mdi-cloud-upload-outline'></i> " + __('上传') + Math.floor(progress) + "%");
}
},
queuecomplete: function () {
@@ -364,7 +363,7 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
}
var suffix = /[\.]?([a-zA-Z0-9]+)$/.exec(j);
suffix = suffix ? suffix[1] : 'file';
j = Config.fullmode ? Fast.api.cdnurl(j) : j;
j = Config.upload_fullmode=="1" ? Fast.api.cdnurl(j) : j;
var value = (json && typeof json[i] !== 'undefined' ? json[i] : null);
var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: value, row: value, suffix: suffix};
//console.log(data,tpl)
@@ -427,7 +426,7 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
// AJAX异步上传
send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
var index = Layer.msg(__('上传中'), {offset: 't', time: 0});
var id = "dropzone-" + Dropzone.uuidv4();
var id = "dropzone-" + Dropzone.Dropzone.uuidv4();
$('<button type="button" id="' + id + '" class="btn btn-danger hidden faupload" />').appendTo("body");
$("#" + id).data("upload-complete", function (files) {
Layer.close(index);
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

+27 -23
View File
@@ -24,41 +24,45 @@ class Html extends \think\template\TagLib{
$multiple = isset($tag['multiple'])?$tag['multiple']:'';unset($tag['multiple']);
$maxcount = isset($tag['maxcount'])?$tag['maxcount']:'';unset($tag['maxcount']);
$maxsize = isset($tag['maxsize'])?$tag['maxsize']:'';unset($tag['maxsize']);
$extend = isset($tag['extend'])?$tag['extend']:'';unset($tag['extend']);
$url = isset($tag['url'])?$tag['url']:'';unset($tag['url']);
// 支持用函数传数组
$parseStr = '';
$name = $this->buildvar($name,$parseStr,'name');
$value = $this->buildvar($value,$parseStr,'value');
$mimetype = $this->buildvar($mimetype,$mimetype,'mimetype');
$multiple = $this->buildvar($multiple,$multiple,'multiple');
$maxcount = $this->buildvar($maxcount,$maxcount,'maxcount');
$maxsize = $this->buildvar($maxsize,$maxsize,'maxsize');
$url = $this->buildvar($url,$url,'url');
$extendData = $this->buildExtendData($tag);
$extendData .=' data-input-id="c-{'.$name.'}" data-preview-id="p-{'.$name.'}"';
if($mimetype){
$mimetype = $this->buildvar($mimetype,$mimetype,'mimetype');
$extendData .=' data-mimetype="{'.$mimetype.'}"';
}
if($multiple){
$multiple = $this->buildvar($multiple,$multiple,'multiple');
$extendData .=' data-multiple="{'.$multiple.'}"';
}
if($maxsize){
$maxsize = $this->buildvar($maxsize,$maxsize,'maxsize');
$extendData .=' data-maxsize="{'.$maxsize.'}"';
}
if($maxcount){
$maxcount = $this->buildvar($maxcount,$maxcount,'maxcount');
$extendData .=' data-maxcount="{'.$maxcount.'}"';
}
if($url){
$url = $this->buildvar($url,$url,'url');
$extendData .=' data-url="{'.$url.'}"';
}
$extendData.='{'.$extend.'}';
$parseStr .= '<input id="c-{'.$name.'}" class="form-control" size="50" name="{'.$name.'}" type="hidden" value="{'.$value.'}">';
$parseStr .= '<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-{'.$name.'}">';
$parseStr .= ' <li nodelete class="col-xs-4 col-sm-3 col-md-2">';
$parseStr .= ' <a class="pic-add faupload" style="height: auto;border: 0;"';
$parseStr .= ' permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传"';
$parseStr .= ' data-input-id="c-{'.$name.'}"';
$parseStr .= ' data-mimetype="{'.$mimetype.'}"';
$parseStr .= ' data-multiple="{'.$multiple.'}" ';
$parseStr .= ' data-maxsize="{'.$maxsize.'}" ';
$parseStr .= ' data-maxcount="{'.$maxcount.'}" ';
$parseStr .= ' data-url="{'.$url.'}" ';
$parseStr .= ' '.$extendData.' ';
$parseStr .= ' data-preview-id="p-{'.$name.'}"></a>';
$parseStr .= ' permission="app.admin.files.upload" id="add-pic-btn" href="javascript:;" title="点击上传"';
$parseStr .= ' '.$extendData.' ></a>';
$parseStr .= ' <a class="pic-add fachoose" style="height: auto;border: 0;"';
$parseStr .= ' permission="app.admin.files.list" ';
$parseStr .= ' id="choose-pic-btn" href="#!" title="选择文件"';
$parseStr .= ' data-input-id="c-{'.$name.'}" ';
$parseStr .= ' data-mimetype="{'.$mimetype.'}" ';
$parseStr .= ' data-multiple="{'.$multiple.'}" ';
$parseStr .= ' data-maxsize="{'.$maxsize.'}" ';
$parseStr .= ' data-maxcount="{'.$maxcount.'}" ';
$parseStr .= ' data-url="{'.$url.'}" ';
$parseStr .= ' '.$extendData.' ';
$parseStr .= ' data-preview-id="p-{'.$name.'}"></a>';
$parseStr .= ' id="choose-pic-btn" href="javascript:;" title="选择文件"';
$parseStr .= ' '.$extendData.' ></a>';
$parseStr .= ' </li>';
$parseStr .= '</ul>';
return $parseStr;