更换后台UI,使用adminlteUI
This commit is contained in:
@@ -13,11 +13,57 @@ use think\facade\Filesystem;
|
||||
|
||||
class Upload extends Base {
|
||||
|
||||
// 使用内置PHP模板引擎渲染模板输出
|
||||
protected $tpl_config = [
|
||||
'view_dir_name' => 'viewlte',
|
||||
'tpl_replace_string' => [
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/admin/images',
|
||||
'__css__' => '/static/admin/css',
|
||||
'__js__' => '/static/admin/js',
|
||||
'__plugins__' => '/static/plugins',
|
||||
'__public__' => '/static/admin',
|
||||
],
|
||||
];
|
||||
|
||||
public $data = ['data' => [], 'code' => 0, 'msg' => ''];
|
||||
|
||||
protected function initialize() {
|
||||
}
|
||||
|
||||
public function index(){
|
||||
$param = $this->request->get();
|
||||
|
||||
if (!isset($param['name'])) {
|
||||
return $this->error('非法操作');
|
||||
}
|
||||
$this->data = [
|
||||
'from' => $this->request->param('from'),
|
||||
'param' => $param,
|
||||
'require' => [
|
||||
'jsname' => 'upload',
|
||||
'actionname' => 'index'
|
||||
]
|
||||
];
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function server(){
|
||||
$param = $this->request->get();
|
||||
if (!isset($param['name'])) {
|
||||
return $this->error('非法操作');
|
||||
}
|
||||
$this->data = [
|
||||
'from' => $this->request->param('from'),
|
||||
'param' => $param,
|
||||
'require' => [
|
||||
'jsname' => 'upload',
|
||||
'actionname' => 'server'
|
||||
]
|
||||
];
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function upload(){
|
||||
$upload_type = $this->request->get('filename', 'images', 'trim');
|
||||
$config = $this->$upload_type();
|
||||
@@ -26,10 +72,10 @@ class Upload extends Base {
|
||||
try {
|
||||
validate(['file'=>'filesize:10240|fileExt:jpg|image:200,200,jpg'])
|
||||
->check([$file]);
|
||||
$data['status'] = 1;
|
||||
$data['code'] = 1;
|
||||
$data['info'] = $this->save($file, $upload_type);
|
||||
} catch (think\exception\ValidateException $e) {
|
||||
$data['status'] = 0;
|
||||
$data['code'] = 0;
|
||||
$data['info'] = $e->getMessage();
|
||||
}
|
||||
return json($data);
|
||||
|
||||
Reference in New Issue
Block a user