用户个人中心
This commit is contained in:
parent
644dfb0896
commit
b0a5057630
@ -31,4 +31,9 @@ class User extends Authenticatable
|
||||
{
|
||||
return asset($this->avatar);
|
||||
}
|
||||
|
||||
public function topics()
|
||||
{
|
||||
return $this->hasMany(Topic::class);
|
||||
}
|
||||
}
|
||||
|
39
public/css/app.css
vendored
39
public/css/app.css
vendored
@ -1,6 +1,4 @@
|
||||
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600);
|
||||
|
||||
@charset "UTF-8";
|
||||
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600);@charset "UTF-8";
|
||||
|
||||
/*!
|
||||
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
||||
@ -8405,6 +8403,19 @@ body {
|
||||
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 */
|
||||
|
||||
.register-page img.captcha {
|
||||
@ -8419,6 +8430,28 @@ body {
|
||||
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 */
|
||||
|
||||
.topics-index-page .topic-list .nav > li > a,
|
||||
|
35
resources/assets/sass/app.scss
vendored
35
resources/assets/sass/app.scss
vendored
@ -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 */
|
||||
|
@ -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>
|
||||
|
23
resources/views/users/_topics.blade.php
Normal file
23
resources/views/users/_topics.blade.php
Normal 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() !!}
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user