用户个人中心

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); return asset($this->avatar);
} }
public function topics()
{
return $this->hasMany(Topic::class);
}
} }

39
public/css/app.css vendored
View File

@ -1,6 +1,4 @@
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600); @import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600);@charset "UTF-8";
@charset "UTF-8";
/*! /*!
* Bootstrap v3.3.7 (http://getbootstrap.com) * Bootstrap v3.3.7 (http://getbootstrap.com)
@ -8405,6 +8403,19 @@ body {
margin-top: 0px; margin-top: 0px;
} }
.navbar-static-top .dropdown-menu {
padding: 0px;
}
.navbar-static-top .dropdown-menu li a {
border-bottom: 1px solid #d8d8d8;
line-height: 2.4;
}
.navbar-static-top .dropdown-menu li a .glyphicon {
margin-right: 8px;
}
/* User register page */ /* User register page */
.register-page img.captcha { .register-page img.captcha {
@ -8419,6 +8430,28 @@ body {
margin-bottom: 0px; margin-bottom: 0px;
} }
.users-show-page .nav-tabs {
margin-bottom: 20px;
}
.users-show-page .nav-tabs > li.active > a {
background-color: #fff;
}
.users-show-page .pagination {
margin: 12px 0;
}
.users-show-page .list-group .list-group-item {
border: none;
margin-bottom: 0px;
border-bottom: 1px solid #efefef;
}
.users-show-page .list-group .list-group-item .meta {
color: #b3b3b3;
}
/* Topic Index Page */ /* Topic Index Page */
.topics-index-page .topic-list .nav > li > a, .topics-index-page .topic-list .nav > li > a,

View File

@ -54,6 +54,18 @@ body {
border-top: 4px solid #00b5ad; border-top: 4px solid #00b5ad;
margin-bottom: 40px; margin-bottom: 40px;
margin-top: 0px; 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 */ /* User register page */
@ -72,6 +84,29 @@ body {
margin-bottom: 0px; 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 */ /* Topic Index Page */

View File

@ -50,20 +50,24 @@
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li> <li>
<a href="{{route('users.show',[Auth::user()])}}">个人资料</a> <a href="{{ route('users.show', Auth::id()) }}">
<a href="{{ route('users.edit', Auth::id()) }}">编辑资料</a> <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>
<li> <li>
<a href="{{ route('logout') }}" <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> </a>
<form id="logout-form" action="{{ route('logout') }}" method="POST"
style="display: none;">
{{ csrf_field() }}
</form>
</li> </li>
</ul> </ul>
</li> </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 panel-default">
<div class="panel-body"> <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>
</div> </div>