更换后台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);
|
||||
|
||||
@@ -21,6 +21,7 @@ class Base extends BaseC {
|
||||
|
||||
// 使用内置PHP模板引擎渲染模板输出
|
||||
protected $tpl_config = [
|
||||
'view_dir_name' => 'view',
|
||||
'tpl_replace_string' => [
|
||||
'__static__' => '/static',
|
||||
'__img__' => '/static/admin/images',
|
||||
@@ -141,6 +142,7 @@ class Base extends BaseC {
|
||||
}
|
||||
|
||||
protected function getMenu() {
|
||||
$addon = $this->request->param('addon', false);
|
||||
$hover_url = str_replace(".", "/", strtolower($this->request->controller()));
|
||||
$controller = str_replace(".", "/", strtolower($this->request->controller()));
|
||||
$menu = array(
|
||||
@@ -161,7 +163,7 @@ class Base extends BaseC {
|
||||
unset($menu['main'][$value['id']]);
|
||||
continue; //继续循环
|
||||
}
|
||||
if ($controller == $value['url']) {
|
||||
if (false !== strripos($controller, $value['url'])) {
|
||||
$value['style'] = "active";
|
||||
}
|
||||
$menu['main'][$value['id']] = $value;
|
||||
@@ -175,6 +177,11 @@ class Base extends BaseC {
|
||||
//内容管理菜单
|
||||
$pid = Menu::where("pid =0 AND url like '%admin/category%'")->value('id');
|
||||
}
|
||||
if ($addon) {
|
||||
//扩展管理菜单
|
||||
$pid = Menu::where("pid =0 AND url like '%admin/addons%'")->value('id');
|
||||
$this->getAddonsMenu();
|
||||
}
|
||||
if ($pid) {
|
||||
$map['pid'] = $pid;
|
||||
$map['hide'] = 0;
|
||||
|
||||
@@ -49,7 +49,8 @@ class Content extends Base {
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
'model_name' => $this->modelInfo['name'],
|
||||
'model_id' => $this->modelInfo['id']
|
||||
'model_id' => $this->modelInfo['id'],
|
||||
'meta_title' => $this->modelInfo['title'].'列表'
|
||||
);
|
||||
if ($this->modelInfo['template_list']) {
|
||||
$template = 'admin/content/' . $this->modelInfo['template_list'];
|
||||
@@ -74,11 +75,12 @@ class Content extends Base {
|
||||
} else {
|
||||
$info = [
|
||||
'model_name' => $this->modelInfo['name'],
|
||||
'model_id' => $this->modelInfo['id'],
|
||||
'model_id' => $this->modelInfo['id']
|
||||
];
|
||||
$this->data = [
|
||||
'info' => $info,
|
||||
'fieldGroup' => Attribute::getField($this->modelInfo),
|
||||
'meta_title' => $this->modelInfo['title'].'添加'
|
||||
];
|
||||
|
||||
if ($this->modelInfo['template_add']) {
|
||||
@@ -114,6 +116,7 @@ class Content extends Base {
|
||||
$this->data = array(
|
||||
'info' => $info,
|
||||
'fieldGroup' => Attribute::getField($this->modelInfo, 'edit'),
|
||||
'meta_title' => $this->modelInfo['title'].'修改'
|
||||
);
|
||||
if ($this->modelInfo['template_edit']) {
|
||||
$template = 'admin/content/' . $this->modelInfo['template_edit'];
|
||||
|
||||
Reference in New Issue
Block a user