优化后台UI
完善表单上传组件
This commit is contained in:
@@ -10,6 +10,7 @@ namespace app\controller;
|
||||
|
||||
use think\facade\Session;
|
||||
use think\facade\Filesystem;
|
||||
use think\facade\Db;
|
||||
|
||||
class Upload extends Base {
|
||||
|
||||
@@ -53,9 +54,22 @@ class Upload extends Base {
|
||||
if (!isset($param['name'])) {
|
||||
return $this->error('非法操作');
|
||||
}
|
||||
$pageConfig = [
|
||||
'list_rows' => $this->request->param('list_rows', 20),
|
||||
'page' => $this->request->param('page', 1),
|
||||
'query' => $this->request->param()
|
||||
];
|
||||
if($param['type'] == 'file'){
|
||||
$list = Db::name('File')->paginate($pageConfig);
|
||||
}else{
|
||||
$list = Db::name('Picture')->paginate($pageConfig);
|
||||
}
|
||||
|
||||
$this->data = [
|
||||
'from' => $this->request->param('from'),
|
||||
'param' => $param,
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
'require' => [
|
||||
'jsname' => 'upload',
|
||||
'actionname' => 'server'
|
||||
@@ -81,7 +95,7 @@ class Upload extends Base {
|
||||
return json($data);
|
||||
}
|
||||
|
||||
protected function images(){
|
||||
protected function image(){
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class Index extends Base {
|
||||
\think\facade\Log::clear();
|
||||
}
|
||||
}
|
||||
return $this->success("更新成功!", url('/admin/index/index'));
|
||||
return $this->success("更新成功!", url('/admin/index/clear'));
|
||||
} else {
|
||||
$keylist = array(
|
||||
array('name' => 'clear', 'title' => '更新缓存', 'type' => 'checkbox', 'help' => '', 'option' => array(
|
||||
|
||||
@@ -61,7 +61,6 @@ class User extends Base {
|
||||
public function edit(Member $member) {
|
||||
if ($this->request->isPost()) {
|
||||
$reuslt = $member->editUser($this->request);
|
||||
|
||||
if (false !== $reuslt) {
|
||||
return $this->success('修改成功!', url('/admin/user/index'));
|
||||
} else {
|
||||
@@ -165,49 +164,7 @@ class User extends Base {
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 修改昵称
|
||||
* @author huajie <banhuajie@163.com>
|
||||
*/
|
||||
public function submitNickname() {
|
||||
|
||||
//获取参数
|
||||
$nickname = input('post.nickname');
|
||||
$password = input('post.password');
|
||||
if (empty($nickname)) {
|
||||
return $this->error('请输入昵称');
|
||||
}
|
||||
if (empty($password)) {
|
||||
return $this->error('请输入密码');
|
||||
}
|
||||
|
||||
//密码验证
|
||||
$User = new UserApi();
|
||||
$uid = $User->login(UID, $password, 4);
|
||||
if ($uid == -2) {
|
||||
return $this->error('密码不正确');
|
||||
}
|
||||
|
||||
$Member = model('Member');
|
||||
$data = $Member->create(array('nickname' => $nickname));
|
||||
if (!$data) {
|
||||
return $this->error($Member->getError());
|
||||
}
|
||||
|
||||
$res = $Member->where(array('uid' => $uid))->save($data);
|
||||
|
||||
if ($res) {
|
||||
$user = session('user_auth');
|
||||
$user['username'] = $data['nickname'];
|
||||
session('user_auth', $user);
|
||||
session('user_auth_sign', data_auth_sign($user));
|
||||
return $this->success('修改昵称成功!');
|
||||
} else {
|
||||
return $this->error('修改昵称失败!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 修改密码初始化
|
||||
* @title 修改密码
|
||||
* @author huajie <banhuajie@163.com>
|
||||
*/
|
||||
public function editpwd() {
|
||||
|
||||
Reference in New Issue
Block a user