diff --git a/app/controller/manager/Block.php b/app/controller/manager/Block.php index 7dfc544..e165138 100644 --- a/app/controller/manager/Block.php +++ b/app/controller/manager/Block.php @@ -20,6 +20,7 @@ use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; use think\exception\ValidateException; +use think\facade\Config as CConfig; /** @@ -31,6 +32,7 @@ class Block extends Base protected function initialize() { + parent::initialize(); $action = $this->request->action(); $cid = $this->request->param('cid/d'); @@ -44,7 +46,12 @@ class Block extends Base $this->data['currentList'] = $currentShowFields; } $this->data['jsonList'] = $this->xmSelectJson([$cid]); - + CConfig::load('extra/upload', 'system_upload'); + if(empty(config('system_upload'))){ + $this->data['uploadConfig'] = System::findById(1); + }else{ + $this->data['uploadConfig'] = config('system_upload'); + } } public function index() @@ -176,6 +183,7 @@ class Block extends Base $this->data['maxKey'] = 0; } $this->data["item"] = $item; + $this->data["config"] = $item; $this->data["types"] = BlockModel::getTypes(); return $this->view(); diff --git a/app/controller/manager/Config.php b/app/controller/manager/Config.php index 471691c..4d419f6 100644 --- a/app/controller/manager/Config.php +++ b/app/controller/manager/Config.php @@ -3,6 +3,7 @@ namespace app\controller\manager; +use app\model\System; use Exception; use think\facade\Config as CConfig; @@ -63,7 +64,25 @@ class Config extends Base } } - + public function upload() + { + if ($this->request->isPost()) { + $data = input("post."); + System::updateById(1,$data); + unset($data['_token']); + $php = var_export($data, true); + file_put_contents($this->extraPath . 'upload.php', 'json(); + } else { + CConfig::load('extra/upload', 'system_upload'); + if(empty(config('system_upload'))){ + $this->data['item'] = System::findById(1); + }else{ + $this->data['item'] = config('system_upload'); + } + return $this->view(); + } + } public function __call($name, $args) { if ($this->request->isPost()) { diff --git a/app/model/Block.php b/app/model/Block.php index e9d38e4..f75f2ca 100644 --- a/app/model/Block.php +++ b/app/model/Block.php @@ -140,7 +140,7 @@ class Block extends Base public function getContentAttr($value,$data) { if($data['type'] == self::ING_LIST){ - return json_decode($value,true) + return json_decode($value,true); } return $value; } diff --git a/config/database.php b/config/database.php index abcadc5..dcb1938 100644 --- a/config/database.php +++ b/config/database.php @@ -24,11 +24,11 @@ return [ // 服务器地址 'hostname' => Env::get('database.hostname', '183.221.101.89'), // 数据库名 - 'database' => Env::get('database.database', 'newest_cms'), + 'database' => Env::get('database.database', 'luck_draw'), // 用户名 - 'username' => Env::get('database.username', 'newest_cms'), + 'username' => Env::get('database.username', 'luck_draw'), // 密码 - 'password' => Env::get('database.password', '7pMZSGFP3fGm526w'), + 'password' => Env::get('database.password', '722s6Gm5n3M3mmpn'), // 端口 'hostport' => Env::get('database.hostport', '3306'), // 数据库连接参数 diff --git a/public/static/manager/js/block.js b/public/static/manager/js/block.js index 2d6da06..06196c1 100644 --- a/public/static/manager/js/block.js +++ b/public/static/manager/js/block.js @@ -11,6 +11,8 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'tree', 'xmSelect', ' let parentMenu = $('#parent-menu'); let menuList = parentMenu.data('menu') ? parentMenu.data('menu') : []; let showList = parentMenu.data('show') ? parentMenu.data('show') : [];//各栏目 可展示字段列表 + + let image_exts = $('#image_exts').data('exts') ? parentMenu.data('exts') : "jpg|png|gif|bmp|jpeg";//图片上传后缀 xmSelect.render({ el: '#parent-menu', paging: false, @@ -208,7 +210,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'tree', 'xmSelect', ' , field: 'image_image' , accept: 'images' , acceptMime: 'images/*' - , exts: 'jpg|png|gif|bmp|jpeg' + , exts: image_exts , size: 50 * 1204 , number: 0 , multiple: false @@ -299,7 +301,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'tree', 'xmSelect', '
- +
diff --git a/view/manager/block/add.html b/view/manager/block/add.html index a4233c9..75fc40e 100644 --- a/view/manager/block/add.html +++ b/view/manager/block/add.html @@ -3,6 +3,8 @@ .upload-file-div{position: relative} .upload-file-div-close{position: absolute;right: 0;top: 0;} +
+
@@ -34,16 +36,16 @@
-
- -
- -
-
+
+ +
+ +
+
@@ -72,14 +74,28 @@
-
@@ -99,14 +115,26 @@
-
@@ -134,7 +162,7 @@ data-multiple='false' data-mimetype='' data-acceptMime='file/*' - data-exts='{:str_replace(",","|",$system["file_type"])}' + data-exts="{:str_replace(',','|',$uploadConfig['file_type'])}" class="layui-btn layui-btn-danger upload-btn"> 上传 @@ -170,7 +198,7 @@ data-multiple='false' data-mimetype='' data-acceptMime='video/*' - data-exts='{:str_replace(",","|",$system["file_type"])}' + data-exts="{:str_replace(',','|',$uploadConfig['video_type'])}" class="layui-btn layui-btn-danger upload-btn"> 上传 diff --git a/view/manager/block/edit.html b/view/manager/block/edit.html index 4aca6d4..9f0fbff 100644 --- a/view/manager/block/edit.html +++ b/view/manager/block/edit.html @@ -3,6 +3,7 @@ .upload-file-div{position: relative} .upload-file-div-close{position: absolute;right: 0;top: 0;} +
@@ -53,7 +54,6 @@
-
@@ -74,14 +74,26 @@
-
@@ -92,7 +104,7 @@