优化后台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() {
|
||||
|
||||
@@ -1 +1 @@
|
||||
<textarea name="{$name}" id="{$name}" class="form-editor" style="width: 100%">{$value}</textarea>
|
||||
<textarea name="{$name}" id="{$name}" class="form-editor" data-items="{$items|default='full'}" style="width: 100%">{$value}</textarea>
|
||||
@@ -5,22 +5,17 @@
|
||||
{else/}
|
||||
<input type="hidden" name="{$name}" id="field_{$name}" value="">
|
||||
{/if}
|
||||
<div id="fileList_{$name}" class="upload-file-list-info" style="width:280px;">
|
||||
<div id="fileList_{$name}" class="img-list">
|
||||
{if $value}
|
||||
{php}
|
||||
$images = get_cover($value);
|
||||
{/php}
|
||||
<li class="affix-list-item" id="WU_FILE_0">
|
||||
<div class="upload-file-info">
|
||||
<span class="webuploader-pick-file-close" data-queued-id="WU_FILE_0" data-id="{$value}" data-fileurl="{$images['path']}"><i class="close"></i></span>
|
||||
<span class="fname"></span>
|
||||
<span class="fsize">上传时间:{$images['create_time']}</span>
|
||||
<div class="clearfix"></div>
|
||||
<div class="item" data-id="{$images['id']}">
|
||||
<div class="thumb">
|
||||
<div class="close"><i class="fa fa-close"></i></div>
|
||||
<img src="{$images['path']}" alt="{$images['create_time']}">
|
||||
</div>
|
||||
<div class="filebox image">
|
||||
<img src="{:config('config.base_url')}{$images['path']}" class="img-responsive">
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -218,6 +218,7 @@ class Member extends Model {
|
||||
$data['salt'] = \xin\helper\Str::random(6);
|
||||
return self::update($data, ['uid' => $data]);
|
||||
}else{
|
||||
unset($data['password']);
|
||||
return $this->where('uid', $data['uid'])->save($data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user