Skip to content

Commit 59947e2

Browse files
committedDec 23, 2022
更新:修复已知Bug,优化主题
·
v2.7.7v2.1.7
1 parent c8ea0ed commit 59947e2

File tree

9 files changed

+166
-160
lines changed

9 files changed

+166
-160
lines changed
 

‎app/Plugins/Comment/resources/views/Widget/topic.blade.php

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,57 +25,9 @@
2525
<div class="mb-1" id="topic-comment-model">
2626
<form action="" method="post" @@submit.prevent="submit">
2727
<div class="row">
28-
@if(get_options("comment_emoji_close",'false')!=="true" && count((new \App\Plugins\Core\src\Lib\Emoji())->get()))
29-
<div class="col-md-4">
30-
<div class="card">
31-
<ul class="nav nav-tabs" data-bs-toggle="tabs" style="flex-wrap: inherit;
32-
width: 100%;
33-
height: 3.333333rem;
34-
padding: 0.373333rem 0.32rem 0;
35-
box-sizing: border-box;
36-
/* 下面是实现横向滚动的关键代码 */
37-
display: inline;
38-
float: left;
39-
white-space: nowrap;
40-
overflow-x: scroll;
41-
-webkit-overflow-scrolling: touch; /*解决在ios滑动不顺畅问题*/
42-
overflow-y: hidden;">
43-
@foreach((new \App\Plugins\Core\src\Lib\Emoji())->get() as $key => $value)
44-
<li class="nav-item">
45-
<a href="#emoji-list-{{$key}}"
46-
class="nav-link @if ($loop->first) active @endif"
47-
data-bs-toggle="tab">{{$key}}</a>
48-
</li>
49-
@endforeach
50-
</ul>
51-
<div class="card-body">
52-
<div class="tab-content">
53-
@foreach((new \App\Plugins\Core\src\Lib\Emoji())->get() as $key => $value)
54-
<div class="tab-pane @if ($loop->first) active @endif show"
55-
id="emoji-list-{{$key}}" style="max-height: 220px;overflow-x: hidden;">
56-
<div class="row">
57-
@if($value['type'] === 'image')
58-
@foreach($value['container'] as $emojis)
59-
<div @@click="selectEmoji('{{$emojis['text']}}')"
60-
class="col-3 col-sm-2 col-md-4 col-lg-3 hvr-glow emoji-picker"
61-
emoji-data="{{$emojis['text']}}">{!! $emojis['icon'] !!}</div>
62-
@endforeach
63-
@endif
64-
</div>
65-
</div>
66-
@endforeach
67-
</div>
68-
</div>
69-
</div>
70-
</div>
71-
<div class="col-md-8">
72-
<div id="topic-comment"></div>
73-
</div>
74-
@else
75-
<div class="col-md-12">
76-
<div id="topic-comment"></div>
77-
</div>
78-
@endif
28+
<div class="col-md-12">
29+
<div id="topic-comment"></div>
30+
</div>
7931
</div>
8032
<button class="btn btn-azure">评论</button>
8133
</form>
Lines changed: 70 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,85 @@
11
<div class="row row-cards justify-content-center">
2-
<div class="card">
2+
<div class="col-12">
3+
<ol class="breadcrumb breadcrumb-arrows" aria-label="breadcrumbs">
4+
<li class="breadcrumb-item"><a href="/">首页</a></li>
5+
<li class="breadcrumb-item"><a href="/tags">标签列表</a></li>
6+
<li class="breadcrumb-item active" aria-current="page"><a href="">{!! $data->icon !!} {{$data->name}}</a></li>
7+
</ol>
8+
</div>
9+
<div class="col-12">
10+
<div class="card">
311

4-
<div class="card-header">
5-
<ul class="nav nav-pills card-header-pills">
6-
@if(!count(request()->all()))
7-
<li class="nav-item">
8-
<a class="nav-link active fw-bold" href="/tags/{{$data->id}}.html">
9-
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1 d-none d-sm-block" width="24"
10-
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
11-
stroke-linecap="round" stroke-linejoin="round">
12-
<path d="M0 0h24v24H0z" stroke="none"/>
13-
<circle cx="12" cy="12" r="9"/>
14-
<path d="M12 7v5l3 3"/>
15-
</svg>
16-
{{__('app.latest')}}</a>
17-
</li>
18-
@else
19-
<li class="nav-item">
20-
<a class="nav-link" href="/tags/{{$data->id}}.html">
21-
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1 d-none d-sm-block" width="24"
22-
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
23-
stroke-linecap="round" stroke-linejoin="round">
24-
<path d="M0 0h24v24H0z" stroke="none"/>
25-
<circle cx="12" cy="12" r="9"/>
26-
<path d="M12 7v5l3 3"/>
27-
</svg>
28-
{{__('app.latest')}}</a>
29-
</li>
30-
@endif
31-
@foreach($topic_menu as $data)
32-
@if(\Hyperf\Utils\Str::contains(core_http_url(),$data['parameter']))
12+
<div class="card-header">
13+
<ul class="nav nav-pills card-header-pills">
14+
@if(!count(request()->all()))
3315
<li class="nav-item">
34-
<a class="nav-link active fw-bold" href="{{$data['url']}}">
35-
{!!$data['icon']!!}{{$data['name']}}</a>
16+
<a class="nav-link active fw-bold" href="/tags/{{$data->id}}.html">
17+
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1 d-none d-sm-block" width="24"
18+
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
19+
stroke-linecap="round" stroke-linejoin="round">
20+
<path d="M0 0h24v24H0z" stroke="none"/>
21+
<circle cx="12" cy="12" r="9"/>
22+
<path d="M12 7v5l3 3"/>
23+
</svg>
24+
{{__('app.latest')}}</a>
3625
</li>
3726
@else
3827
<li class="nav-item">
39-
<a class="nav-link" href="{{$data['url']}}">
40-
{!!$data['icon']!!}{{$data['name']}}</a>
28+
<a class="nav-link" href="/tags/{{$data->id}}.html">
29+
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1 d-none d-sm-block" width="24"
30+
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
31+
stroke-linecap="round" stroke-linejoin="round">
32+
<path d="M0 0h24v24H0z" stroke="none"/>
33+
<circle cx="12" cy="12" r="9"/>
34+
<path d="M12 7v5l3 3"/>
35+
</svg>
36+
{{__('app.latest')}}</a>
4137
</li>
4238
@endif
43-
@endforeach
44-
<li class="nav-item ms-auto">
45-
<div class="dropdown">
46-
<a href="#" class="btn-action dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><!-- Download SVG icon from http://tabler-icons.io/i/dots-vertical -->
47-
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><circle cx="12" cy="12" r="1" /><circle cx="12" cy="19" r="1" /><circle cx="12" cy="5" r="1" /></svg>
48-
</a>
49-
<div class="dropdown-menu dropdown-menu-end">
50-
@foreach(Itf()->get('ui-home-tabs-dropdown') as $k=>$v)
51-
@if(call_user_func($v['enable'])===true)
52-
@include($v['view'])
53-
@endif
54-
@endforeach
39+
@foreach($topic_menu as $data)
40+
@if(\Hyperf\Utils\Str::contains(core_http_url(),$data['parameter']))
41+
<li class="nav-item">
42+
<a class="nav-link active fw-bold" href="{{$data['url']}}">
43+
{!!$data['icon']!!}{{$data['name']}}</a>
44+
</li>
45+
@else
46+
<li class="nav-item">
47+
<a class="nav-link" href="{{$data['url']}}">
48+
{!!$data['icon']!!}{{$data['name']}}</a>
49+
</li>
50+
@endif
51+
@endforeach
52+
<li class="nav-item ms-auto">
53+
<div class="dropdown">
54+
<a href="#" class="btn-action dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><!-- Download SVG icon from http://tabler-icons.io/i/dots-vertical -->
55+
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><circle cx="12" cy="12" r="1" /><circle cx="12" cy="19" r="1" /><circle cx="12" cy="5" r="1" /></svg>
56+
</a>
57+
<div class="dropdown-menu dropdown-menu-end">
58+
@foreach(Itf()->get('ui-home-tabs-dropdown') as $k=>$v)
59+
@if(call_user_func($v['enable'])===true)
60+
@include($v['view'])
61+
@endif
62+
@endforeach
63+
</div>
5564
</div>
56-
</div>
57-
</li>
58-
</ul>
59-
</div>
65+
</li>
66+
</ul>
67+
</div>
6068

61-
@if($page->count())
62-
@foreach($page as $data)
63-
@include('App::index.style2')
64-
@endforeach
65-
@else
66-
<div class="col-md-12">
67-
<div class="border-0 card card-body">
68-
<div class="text-center card-title">{{__("app.No more results")}}</div>
69+
@if($page->count())
70+
@foreach($page as $data)
71+
@include('App::index.style2')
72+
@endforeach
73+
@else
74+
<div class="col-md-12">
75+
<div class="border-0 card card-body">
76+
<div class="text-center card-title">{{__("app.No more results")}}</div>
77+
</div>
6978
</div>
79+
@endif
80+
<div class="mt-2">
81+
{!! make_page($page) !!}
7082
</div>
71-
@endif
72-
<div class="mt-2">
73-
{!! make_page($page) !!}
7483
</div>
7584
</div>
7685
</div>

‎app/Plugins/Topic/src/Controllers/ApiController.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Hyperf\HttpServer\Annotation\PostMapping;
2222
use Hyperf\RateLimit\Annotation\RateLimit;
2323
use Hyperf\Utils\Arr;
24+
use Swoole\Timer;
2425

2526
#[Controller(prefix: '/api/topic')]
2627
#[RateLimit(create: 1, capacity: 3)]
@@ -71,7 +72,7 @@ public function get_WithTopic_Data()
7172
$user_avatar = super_avatar($data->user);
7273
$title = \Hyperf\Utils\Str::limit($data->title, 20);
7374
$username = $data->user->username;
74-
$summary = '作者:'.$username;
75+
$summary = '作者:' . $username;
7576
return Json_Api(200, true, [
7677
'avatar' => $user_avatar,
7778
'title' => $title,
@@ -312,13 +313,15 @@ public function get_user_ip()
312313
$updateds = request()->input('updateds');
313314
$data = [];
314315
foreach ($updateds as $updated_id) {
315-
$updated = TopicUpdated::query()->where(['id' => $updated_id])->first();
316-
if ($updated->user_ip) {
317-
$data[] = [
318-
'updated_id' => $updated->id,
319-
'text' => 'IP归属地:' . core_default(get_client_ip_data($updated->user_ip)['pro'], '未知'),
320-
];
321-
}
316+
Timer::tick(1000, function () use ($updated_id, $data) {
317+
$updated = TopicUpdated::query()->where(['id' => $updated_id])->first();
318+
if ($updated->user_ip) {
319+
$data[] = [
320+
'updated_id' => $updated->id,
321+
'text' => 'IP归属地:' . core_default(get_client_ip_data($updated->user_ip)['pro'], '未知'),
322+
];
323+
}
324+
});
322325
}
323326
return Json_Api(200, true, $data);
324327
}

‎app/Themes/CodeFec/resources/views/layouts/themes/header-right.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@if(auth()->check())
1212

13-
<div class="nav-item d-none d-lg-flex me-3">
13+
<div class="nav-item d-none d-md-flex me-3">
1414
<a href="/user/notice" class="px-0 nav-link">
1515
<!-- Download SVG icon from http://tabler-icons.io/i/bell -->
1616
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"

‎app/Themes/CodeFec/resources/views/topic/show/content.blade.php

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<div class="row row-cards justify-content-center">
22
<div class="col-md-12" id="topic">
3-
<div class="border-0 card">
3+
<div class="card">
4+
<div class="card-header">
5+
<ol class="breadcrumb breadcrumb-arrows" aria-label="breadcrumbs">
6+
<li class="breadcrumb-item"><a href="/">首页</a></li>
7+
<li class="breadcrumb-item"><a href="/tags/{{$data->tag->id}}.html">
8+
{!! $data->tag->icon !!}
9+
{{$data->tag->name}}
10+
</a></li>
11+
<li class="breadcrumb-item active" aria-current="page"><a href="">{{$data->title}}</a></li>
12+
</ol>
13+
</div>
414
<div class="card-body topic">
515
@if ($data->essence > 0)
616
<div class="ribbon bg-green text-h3">
@@ -52,10 +62,43 @@
5262

5363
{{-- 上下页--}}
5464
@include('App::topic.show.include.lfpage')
55-
{{-- 显示评论--}}
56-
@include('Comment::Widget.show-topic')
57-
{{-- 评论--}}
58-
@include('Comment::Widget.topic')
65+
@if(isset($data->post->options->disable_comment) && !$data->post->options->disable_comment)
66+
{{-- 显示评论--}}
67+
@include('Comment::Widget.show-topic')
68+
{{-- 评论--}}
69+
@include('Comment::Widget.topic')
70+
@else
71+
<div class="col-md-12">
72+
<div class="border-0 card">
73+
<div class="empty">
74+
<div class="empty-icon"><!-- Download SVG icon from http://tabler-icons.io/i/mood-sad -->
75+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-ban" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
76+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
77+
<circle cx="12" cy="12" r="9"></circle>
78+
<line x1="5.7" y1="5.7" x2="18.3" y2="18.3"></line>
79+
</svg>
80+
</div>
81+
<p class="empty-title">禁止评论</p>
82+
<p class="empty-subtitle text-muted">
83+
此帖子关闭了评论及回复功能
84+
</p>
85+
@if(!auth()->check())
86+
<div class="empty-action">
87+
<a href="/login" class="btn btn-primary">
88+
<!-- Download SVG icon from http://tabler-icons.io/i/search -->
89+
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-login" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
90+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
91+
<path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"></path>
92+
<path d="M20 12h-13l3 -3m0 6l-3 -3"></path>
93+
</svg>
94+
登陆
95+
</a>
96+
</div>
97+
@endif
98+
</div>
99+
</div>
100+
</div>
101+
@endif
59102

60103
@if(auth()->check())
61104
{{-- 举报模态--}}

‎app/Themes/CodeFec/resources/views/topic/show/ol.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<ol class="breadcrumb" aria-label="breadcrumbs">
2-
<li data-bs-toggle="tooltip" data-bs-placement="top" title="{{__('app.tag')}}" class="breadcrumb-item"><a href="/tags/{{$data->tag->id}}.html">
2+
<li data-bs-toggle="tooltip" data-bs-placement="top" title="{{__('app.tag')}}" class="breadcrumb-item">
3+
<a href="/tags/{{$data->tag->id}}.html">
34
{!! $data->tag->icon !!}
45
{{$data->tag->name}}
56
</a>

‎app/Themes/CodeFec/resources/views/topic/show/show.blade.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@
4545
@if($comment_page)
4646
<script>var comment_id ={{$comment_page}}</script>
4747
@endif
48-
<script src="{{ mix('plugins/Topic/js/topic.js') }}"></script>
4948
<script src="{{mix('plugins/Topic/js/core.js')}}"></script>
50-
<script src="{{mix('plugins/Comment/js/topic.js')}}"></script>
5149
<script src="{{file_hash('tabler/libs/plyr/dist/plyr.min.js')}}"></script>
5250
<style>
5351
/* for block of numbers */
Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
1-
2-
{{-- 作者信息--}}
3-
<div class="col-md-12">
4-
<a class="card card-link" href="/users/{{$data->user->username}}.html">
5-
<div class="card-cover card-cover-blurred text-center" style="background-image: url({{get_user_settings(auth()->id(),'backgroundImg','/plugins/Core/image/user_background.jpg')}})">
6-
<span class="avatar avatar-xl avatar-thumb avatar-rounded" style="background-image: url({{super_avatar($data->user)}})"></span>
7-
</div>
8-
<div class="card-body text-center">
9-
<div class="card-title mb-1">{{$data->user->username}}</div>
10-
<div class="text-muted">本文作者,至今共发布{{$data->user->topic->count()}}篇文章</div>
1+
<div class="col-12 d-none d-lg-inline-flex">
2+
<div class="row row-cards">
3+
{{-- 作者信息--}}
4+
<div class="col-md-12">
5+
<a class="card card-link" href="/users/{{$data->user->username}}.html">
6+
<div class="card-cover card-cover-blurred text-center" style="background-image: url({{get_user_settings(auth()->id(),'backgroundImg','/plugins/Core/image/user_background.jpg')}})">
7+
<span class="avatar avatar-xl avatar-thumb avatar-rounded" style="background-image: url({{super_avatar($data->user)}})"></span>
8+
</div>
9+
<div class="card-body text-center">
10+
<div class="card-title mb-1">{{$data->user->username}}</div>
11+
<div class="text-muted">本文作者,至今共发布{{$data->user->topic->count()}}篇文章</div>
12+
</div>
13+
</a>
1114
</div>
12-
</a>
13-
</div>
1415

15-
{{-- 标签信息--}}
16-
<div class="col-md-12">
17-
<a href="/tags/{{$data->tag->id}}.html" class="card card-link text-primary-fg" style="background-color: {{$data->tag->color}}!important;">
18-
<div class="card-stamp">
19-
<div class="card-stamp-icon bg-yellow">
20-
<!-- Download SVG icon from http://tabler-icons.io/i/star -->
21-
{!! $data->tag->icon !!}
22-
</div>
16+
{{-- 标签信息--}}
17+
<div class="col-md-12">
18+
<a href="/tags/{{$data->tag->id}}.html" class="card card-link text-primary-fg" style="background-color: {{$data->tag->color}}!important;">
19+
<div class="card-stamp">
20+
<div class="card-stamp-icon bg-yellow">
21+
<!-- Download SVG icon from http://tabler-icons.io/i/star -->
22+
{!! $data->tag->icon !!}
23+
</div>
24+
</div>
25+
<div class="card-body">
26+
<h3 class="card-title">{{$data->tag->name}}</h3>
27+
<p>{{ \Hyperf\Utils\Str::limit(core_default($data->tag->description, __("app.no description")), 32) }}</p>
28+
</div>
29+
</a>
2330
</div>
24-
<div class="card-body">
25-
<h3 class="card-title">{{$data->tag->name}}</h3>
26-
<p>{{ \Hyperf\Utils\Str::limit(core_default($data->tag->description, __("app.no description")), 32) }}</p>
27-
</div>
28-
</a>
29-
</div>
30-
31-
32-
33-
31+
</div>
32+
</div>

‎public/mix-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"/js/admin/pay.js": "/js/admin/pay.js?id=476f7157fca67c342d8c",
1313
"/plugins/User/js/order.js": "/plugins/User/js/order.js?id=75d4436e905e45647c23",
1414
"/plugins/Core/js/app.js": "/plugins/Core/js/app.js?id=802dc3d10d90c4074bfb",
15-
"/plugins/Topic/js/topic.js": "/plugins/Topic/js/topic.js?id=29e388129057c5289f63",
15+
"/plugins/Topic/js/topic.js": "/plugins/Topic/js/topic.js?id=2441d18b977cde255036",
16+
"/plugins/Topic/js/core.js": "/plugins/Topic/js/core.js?id=931e8d42fabe735b4daf",
1617
"/plugins/Topic/css/app.css": "/plugins/Topic/css/app.css?id=7a04749a2ef2c33ea28f",
1718
"/css/app.css": "/css/app.css?id=68b329da9893e34099c7"
1819
}

0 commit comments

Comments
 (0)
Please sign in to comment.