解决linux下文件名大小写的bug、完善用户中心
This commit is contained in:
@@ -10,17 +10,24 @@ namespace app\controller\user;
|
||||
|
||||
use think\facade\View;
|
||||
use think\facade\Cache;
|
||||
use \app\controller\Base as BaseC;
|
||||
use app\controller\Base as BaseC;
|
||||
use app\model\Model;
|
||||
use app\model\Form;
|
||||
|
||||
class Base extends BaseC {
|
||||
|
||||
protected function initialize() {
|
||||
$url = str_replace(".", "/", strtolower($this->request->controller())) . '/' . $this->request->action();
|
||||
if (!is_login() and !in_array($url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) {
|
||||
$this->redirect('/admin/index/login');
|
||||
$this->redirect('/user/index/login');
|
||||
}
|
||||
|
||||
if (!in_array($url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) {
|
||||
if (!in_array($url, array('user/index/login', 'user/index/logout', 'user/index/verify'))) {
|
||||
$map = [];
|
||||
$model = Model::where($map)->column('name, title, icon', 'name');
|
||||
View::assign('model', $model);
|
||||
$form = Form::where($map)->column('id, name, title', 'name');
|
||||
View::assign('form', $form);
|
||||
View::assign('meta_title', isset($this->data['meta_title']) ? $this->data['meta_title'] : $this->getCurrentTitle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,17 +8,54 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\user;
|
||||
|
||||
use think\facade\Db;
|
||||
use app\model\Model;
|
||||
use app\model\Attribute;
|
||||
|
||||
/**
|
||||
* @title 内容模块
|
||||
*/
|
||||
class Content extends Base {
|
||||
|
||||
public $modelInfo = [];
|
||||
public $model = null;
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
$this->modelInfo = Model::where('name', $this->request->param('name'))->find()->append(['grid_list', 'attr_group'])->toArray();
|
||||
$this->model = Db::name($this->modelInfo['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 内容首页
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index() {
|
||||
return $this->fetch();
|
||||
if ($this->modelInfo['list_grid'] == '') {
|
||||
return $this->error("列表定义不正确!", url('/user/model/edit', array('id' => $this->modelInfo['id'])));
|
||||
}
|
||||
$order = "id desc";
|
||||
$map = [];
|
||||
$map[] = ['uid', '=', session('userInfo.uid')];
|
||||
|
||||
$list = $this->model->where($map)->order($order)->paginate($this->modelInfo['list_row'], false, array(
|
||||
'query' => $this->request->param(),
|
||||
));
|
||||
|
||||
$this->data = array(
|
||||
'grid' => $this->modelInfo['grid_list'],
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
'model_name' => $this->modelInfo['name'],
|
||||
'model_id' => $this->modelInfo['id'],
|
||||
'meta_title' => $this->modelInfo['title'].'列表'
|
||||
);
|
||||
if ($this->modelInfo['template_list']) {
|
||||
$template = 'user@content/' . $this->modelInfo['template_list'];
|
||||
} else {
|
||||
$template = 'user@content/index';
|
||||
}
|
||||
return $this->fetch($template);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
25
app/controller/user/Form.php
Normal file
25
app/controller/user/Form.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\user;
|
||||
|
||||
use app\model\Member;
|
||||
|
||||
/**
|
||||
* @title 表单管理
|
||||
*/
|
||||
class Form extends Base {
|
||||
|
||||
/**
|
||||
* @title 表单数据列表
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index(){
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\user;
|
||||
|
||||
use app\model\Member;
|
||||
|
||||
/**
|
||||
* @title 用户中心
|
||||
*/
|
||||
@@ -24,40 +22,42 @@ class Index extends Base {
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 个人资料
|
||||
* @title 用户登录
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function profile() {
|
||||
if ($this->request->isPost()) {
|
||||
$reuslt = (new Member())->editUser($this->request, session('userInfo.uid'));
|
||||
if (false !== $reuslt) {
|
||||
return $this->success('修改成功!');
|
||||
} else {
|
||||
return $this->error('修改失败');
|
||||
public function login() {
|
||||
return $this->fetch();
|
||||
}
|
||||
}else{
|
||||
$info = Member::find(session('userInfo.uid'));
|
||||
$this->data = [
|
||||
'info' => $info,
|
||||
'keyList' => Member::$useredit
|
||||
];
|
||||
return $this->fetch('user@/edit');
|
||||
|
||||
/**
|
||||
* @title 用户退出
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function logout() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 用户注册
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function register() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 忘记密码
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function forget() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 重置密码
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function repasswd() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 上传头像
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function avatar() {
|
||||
public function resetpasswd() {
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
@@ -8,48 +8,47 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\user;
|
||||
|
||||
/**
|
||||
* @title 登录注册
|
||||
*/
|
||||
class Login extends Base {
|
||||
use app\model\Member;
|
||||
|
||||
/**
|
||||
* @title 用户登录
|
||||
* @title 用户管理
|
||||
*/
|
||||
class User extends Base {
|
||||
/**
|
||||
* @title 个人资料
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index() {
|
||||
return $this->fetch();
|
||||
public function profile() {
|
||||
if ($this->request->isPost()) {
|
||||
$reuslt = (new Member())->editUser($this->request, session('userInfo.uid'));
|
||||
if (false !== $reuslt) {
|
||||
return $this->success('修改成功!');
|
||||
} else {
|
||||
return $this->error('修改失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 用户退出
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function logout() {
|
||||
return $this->fetch();
|
||||
}else{
|
||||
$info = Member::find(session('userInfo.uid'));
|
||||
$this->data = [
|
||||
'info' => $info,
|
||||
'keyList' => Member::$useredit
|
||||
];
|
||||
return $this->fetch('user@/edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 用户注册
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function register() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 忘记密码
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function forget() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 重置密码
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function resetpasswd() {
|
||||
public function repasswd() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 上传头像
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function avatar() {
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
@import url(../../common/css/font-awesome.min.css);
|
||||
@import url(../../plugins/bootstrap/css/bootstrap.min.css);
|
||||
@import url(../../plugins/adminlte/css/adminlte.min.css);
|
||||
@import url(../../plugins/adminlte/css/AdminLTE.min.css);
|
||||
@import url(../../plugins/adminlte/css/skins/_all-skins.min.css);
|
||||
|
||||
.user-list tbody td>img {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import url(font-awesome.min.css);
|
||||
@import url(../../plugins/bootstrap/css/bootstrap.min.css);
|
||||
@import url(../../plugins/adminlte/css/adminlte.min.css);
|
||||
@import url(../../plugins/adminlte/css/AdminLTE.min.css);
|
||||
@import url(../../plugins/adminlte/css/skins/_all-skins.min.css);
|
||||
@@ -32,9 +32,9 @@
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">我的内容 <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="#">文章列表</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#">图片列表</a></li>
|
||||
{volist name="model" id="item"}
|
||||
<li><a href="{:url('/user/'.$item['name'].'/index')}"><i class="fa fa-{$item['icon']|default='file-o'}"></i> <span>{$item['title']}列表</span></a></li>
|
||||
{/volist}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -100,10 +100,10 @@
|
||||
<!-- Menu Footer-->
|
||||
<li class="user-footer">
|
||||
<div class="pull-left">
|
||||
<a href="{:url('/user/index/profile')}" class="btn btn-default btn-flat">个人资料</a>
|
||||
<a href="{:url('/user/user/profile')}" class="btn btn-default btn-flat">个人资料</a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="{:url('/user/login/logout')}" class="btn btn-default btn-flat">退出</a>
|
||||
<a href="{:url('/user/index/logout')}" class="btn btn-default btn-flat">退出</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -139,18 +139,22 @@
|
||||
</div>
|
||||
<div class="pull-left info">
|
||||
<p>{:session('userInfo.nickname')}</p>
|
||||
<a href="{:url('/user/index/profile')}"><i class="fa fa-circle text-success"></i> {:session('userInfo.username')}</a>
|
||||
<a href="{:url('/user/user/profile')}"><i class="fa fa-circle text-success"></i> {:session('userInfo.username')}</a>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="sidebar-menu">
|
||||
<li class="header">基础信息</li>
|
||||
<li><a href="{:url('/user/index/profile')}"><i class="fa fa-book"></i> <span>个人资料</span></a></li>
|
||||
<li><a href="{:url('/user/index/avatar')}"><i class="fa fa-book"></i> <span>我的头像</span></a></li>
|
||||
<li><a href="{:url('/user/index/repasswd')}"><i class="fa fa-book"></i> <span>修改密码</span></a></li>
|
||||
<li><a href="{:url('/user/user/profile')}"><i class="fa fa-book"></i> <span>个人资料</span></a></li>
|
||||
<li><a href="{:url('/user/user/avatar')}"><i class="fa fa-book"></i> <span>我的头像</span></a></li>
|
||||
<li><a href="{:url('/user/user/repasswd')}"><i class="fa fa-book"></i> <span>修改密码</span></a></li>
|
||||
<li class="header">我的内容</li>
|
||||
<li><a href="#"><i class="fa fa-book"></i> <span>我的内容</span></a></li>
|
||||
{volist name="model" id="item"}
|
||||
<li><a href="{:url('/user/'.$item['name'].'/index')}"><i class="fa fa-{$item['icon']|default='file-o'}"></i> <span>{$item['title']}列表</span></a></li>
|
||||
{/volist}
|
||||
<li class="header">我的表单</li>
|
||||
<li><a href="#"><i class="fa fa-book"></i> <span>我的内容</span></a></li>
|
||||
{volist name="form" id="item"}
|
||||
<li><a href="{:url('/user/form/index', ['form_id'=>$item['id']])}"><i class="fa fa-{$item['icon']|default='file-o'}"></i> <span>{$item['title']}列表</span></a></li>
|
||||
{/volist}
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
71
public/template/default/user/content_index.html
Normal file
71
public/template/default/user/content_index.html
Normal file
@@ -0,0 +1,71 @@
|
||||
{extend name="base" /}
|
||||
{block name="body"}
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{$meta_title}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<form method="get">
|
||||
<div class="col-sm-12 col-md-4 col-lg-3">
|
||||
<input type="text" class="form-control" name="keyword" value="{$keyword|default=''}" placeholder="请输入关键字">
|
||||
</div>
|
||||
{if isset($cate_list)}
|
||||
<div class="col-sm-12 col-md-4 col-lg-3">
|
||||
<select name="category" id="category" class="form-control">
|
||||
<option value="">请选择栏目</option>
|
||||
{volist name="cate_list" id="item"}
|
||||
<option value="{$item['id']}" {if isset($category) && $item['id'] == $category}selected{/if}>{$item['title_show']}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="col-sm-12 col-md-4">
|
||||
<button class="btn btn-primary" type="submit">搜索</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="table-responsive clearfix">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
|
||||
{volist name="grid" id="item"}
|
||||
<th>{$item['title']}</th>
|
||||
{/volist}
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if condition="empty($list)"}
|
||||
{php}
|
||||
$cow = count($grid)+2;
|
||||
{/php}
|
||||
<tr>
|
||||
<td colspan="{$cow}" align="center">暂无数据!</td>
|
||||
</tr>
|
||||
{else/}
|
||||
{volist name="list" id="item"}
|
||||
<tr>
|
||||
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
|
||||
{volist name="grid" id="vo"}
|
||||
{if isset($vo['format'])}
|
||||
<td>{$item[$vo['field']]|$vo['format']}</td>
|
||||
{else/}
|
||||
<td>{$item[$vo['field']]}</td>
|
||||
{/if}
|
||||
{/volist}
|
||||
<td>
|
||||
<a href="{:url('/admin/'.$model_name.'/edit', ['id'=>$item['id']])}" >编辑</a>
|
||||
<a href="{:url('/admin/'.$model_name.'/del', ['id'=>$item['id']])}" class="ajax-get confirm">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
{$page|raw}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
10
public/template/default/user/user_avatar.html
Normal file
10
public/template/default/user/user_avatar.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{extend name="base" /}
|
||||
{block name="body"}
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{$meta_title}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
@@ -29,8 +29,6 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="table-responsive clearfix">
|
||||
|
||||
<div class="table-responsive clearfix">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
@@ -84,7 +82,6 @@
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{$page|raw}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user