make user report page be static

This commit is contained in:
Pig Fang 2020-01-21 11:07:20 +08:00
parent cd3260af3e
commit 4c066ac38a
5 changed files with 39 additions and 16 deletions

View File

@ -56,9 +56,11 @@ class ReportController extends Controller
public function track()
{
return Report::where('reporter', auth()->id())
$reports = Report::where('reporter', auth()->id())
->orderBy('report_at', 'desc')
->get();
return view('user.report', ['reports' => $reports]);
}
public function manage(Request $request)

View File

@ -28,11 +28,6 @@ export default [
component: () => import('../views/user/Bind.vue'),
el: 'form',
},
{
path: 'user/reports',
component: () => import('../views/user/Report.vue'),
el: '.content > .container-fluid',
},
{
path: 'user/profile',
module: [

View File

@ -1,3 +1,35 @@
{% extends 'user.base' %}
{% block title %}{{ trans('general.my-reports') }}{% endblock %}
{% block content %}
<div class="card">
<div class="card-body p-0">
<table class="table table-striped">
<thead>
<tr>
<th>{{ trans('front-end.report.tid') }}</th>
<th>{{ trans('front-end.report.reason') }}</th>
<th>{{ trans('front-end.report.status-title') }}</th>
<th>{{ trans('front-end.report.time') }}</th>
</tr>
</thead>
<tbody>
{% for report in reports %}
<tr>
<td>
{{ report.tid }}&nbsp;
<a href="{{ route('skinlib.show', {tid: report.tid}) }}" target="_blank">
<i class="fas fa-share"></i>
</a>
</td>
<td>{{ report.reason }}</td>
<td>{{ trans('front-end.report.status')[report.status] }}</td>
<td>{{ report.report_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@ -57,10 +57,7 @@ Route::prefix('user')
Route::get('score-info', 'UserController@scoreInfo')->name('score');
Route::post('sign', 'UserController@sign')->name('sign');
Route::prefix('reports')->group(function () {
Route::view('', 'user.report');
Route::get('list', 'ReportController@track');
});
Route::get('reports', 'ReportController@track');
Route::prefix('profile')->group(function () {
Route::get('', 'UserController@profile')->name('profile');

View File

@ -113,12 +113,9 @@ class ReportControllerTest extends TestCase
$report->save();
$this->actingAs($user)
->getJson('/user/reports/list')
->assertJson([[
'tid' => 1,
'reason' => 'test',
'status' => Report::PENDING,
]]);
->getJson('/user/reports')
->assertSee('test')
->assertSee(trans('front-end.report.status')[0]);
}
public function testManage()