用户个人中心

This commit is contained in:
fthvgb1 2018-01-01 15:32:35 +08:00
parent 644dfb0896
commit b0a5057630
6 changed files with 3739 additions and 3635 deletions

View File

@ -31,4 +31,9 @@ class User extends Authenticatable
{
return asset($this->avatar);
}
public function topics()
{
return $this->hasMany(Topic::class);
}
}

7283
public/css/app.css vendored

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,18 @@ body {
border-top: 4px solid #00b5ad;
margin-bottom: 40px;
margin-top: 0px;
.dropdown-menu {
padding: 0px;
li a {
border-bottom: 1px solid #d8d8d8;
line-height: 2.4;
.glyphicon {
margin-right: 8px;
}
}
}
}
/* User register page */
@ -72,6 +84,29 @@ body {
margin-bottom: 0px;
}
}
.nav-tabs {
margin-bottom: 20px;
> li.active > a {
background-color: #fff;
}
}
.pagination {
margin: 12px 0;
}
.list-group {
.list-group-item {
border: none;
margin-bottom: 0px;
border-bottom: 1px solid #efefef;
.meta {
color: #b3b3b3;
}
}
}
}
/* Topic Index Page */

View File

@ -50,20 +50,24 @@
<ul class="dropdown-menu" role="menu">
<li>
<a href="{{route('users.show',[Auth::user()])}}">个人资料</a>
<a href="{{ route('users.edit', Auth::id()) }}">编辑资料</a>
<a href="{{ route('users.show', Auth::id()) }}">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
个人中心
</a>
</li>
<li>
<a href="{{ route('users.edit', Auth::id()) }}">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
编辑资料
</a>
</li>
<li>
<a href="{{ route('logout') }}"
onclick="event.preventDefault();document.getElementById('logout-form').submit();">
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
退出登录
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST"
style="display: none;">
{{ csrf_field() }}
</form>
</li>
</ul>
</li>

View File

@ -0,0 +1,23 @@
@if (count($topics))
<ul class="list-group">
@foreach ($topics as $topic)
<li class="list-group-item">
<a href="{{ route('topics.show', $topic->id) }}">
{{ $topic->title }}
</a>
<span class="meta pull-right">
{{ $topic->reply_count }} 回复
<span> </span>
{{ $topic->created_at->diffForHumans() }}
</span>
</li>
@endforeach
</ul>
@else
<div class="empty-block">暂无数据 ~_~</div>
@endif
{{-- 分页 --}}
{!! $topics->render() !!}

View File

@ -38,7 +38,11 @@
{{-- 用户发布的内容 --}}
<div class="panel panel-default">
<div class="panel-body">
暂无数据 ~_~
<ul class="nav nav-tabs">
<li class="active"><a href="#">Ta 的话题</a></li>
<li><a href="#">Ta 的回复</a></li>
</ul>
@include('users._topics', ['topics' => $user->topics()->recent()->paginate(5)])
</div>
</div>