Skip to content

Commit

Permalink
更新:修复已知Bug,优化主题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchunshu committed Dec 23, 2022
1 parent c8ea0ed commit 59947e2
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 160 deletions.
54 changes: 3 additions & 51 deletions app/Plugins/Comment/resources/views/Widget/topic.blade.php
Expand Up @@ -25,57 +25,9 @@
<div class="mb-1" id="topic-comment-model">
<form action="" method="post" @@submit.prevent="submit">
<div class="row">
@if(get_options("comment_emoji_close",'false')!=="true" && count((new \App\Plugins\Core\src\Lib\Emoji())->get()))
<div class="col-md-4">
<div class="card">
<ul class="nav nav-tabs" data-bs-toggle="tabs" style="flex-wrap: inherit;
width: 100%;
height: 3.333333rem;
padding: 0.373333rem 0.32rem 0;
box-sizing: border-box;
/* 下面是实现横向滚动的关键代码 */
display: inline;
float: left;
white-space: nowrap;
overflow-x: scroll;
-webkit-overflow-scrolling: touch; /*解决在ios滑动不顺畅问题*/
overflow-y: hidden;">
@foreach((new \App\Plugins\Core\src\Lib\Emoji())->get() as $key => $value)
<li class="nav-item">
<a href="#emoji-list-{{$key}}"
class="nav-link @if ($loop->first) active @endif"
data-bs-toggle="tab">{{$key}}</a>
</li>
@endforeach
</ul>
<div class="card-body">
<div class="tab-content">
@foreach((new \App\Plugins\Core\src\Lib\Emoji())->get() as $key => $value)
<div class="tab-pane @if ($loop->first) active @endif show"
id="emoji-list-{{$key}}" style="max-height: 220px;overflow-x: hidden;">
<div class="row">
@if($value['type'] === 'image')
@foreach($value['container'] as $emojis)
<div @@click="selectEmoji('{{$emojis['text']}}')"
class="col-3 col-sm-2 col-md-4 col-lg-3 hvr-glow emoji-picker"
emoji-data="{{$emojis['text']}}">{!! $emojis['icon'] !!}</div>
@endforeach
@endif
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
<div class="col-md-8">
<div id="topic-comment"></div>
</div>
@else
<div class="col-md-12">
<div id="topic-comment"></div>
</div>
@endif
<div class="col-md-12">
<div id="topic-comment"></div>
</div>
</div>
<button class="btn btn-azure">评论</button>
</form>
Expand Down
131 changes: 70 additions & 61 deletions app/Plugins/Topic/resources/views/Tags/data/index.blade.php
@@ -1,76 +1,85 @@
<div class="row row-cards justify-content-center">
<div class="card">
<div class="col-12">
<ol class="breadcrumb breadcrumb-arrows" aria-label="breadcrumbs">
<li class="breadcrumb-item"><a href="/">首页</a></li>
<li class="breadcrumb-item"><a href="/tags">标签列表</a></li>
<li class="breadcrumb-item active" aria-current="page"><a href="">{!! $data->icon !!} {{$data->name}}</a></li>
</ol>
</div>
<div class="col-12">
<div class="card">

<div class="card-header">
<ul class="nav nav-pills card-header-pills">
@if(!count(request()->all()))
<li class="nav-item">
<a class="nav-link active fw-bold" href="/tags/{{$data->id}}.html">
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1 d-none d-sm-block" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path d="M0 0h24v24H0z" stroke="none"/>
<circle cx="12" cy="12" r="9"/>
<path d="M12 7v5l3 3"/>
</svg>
{{__('app.latest')}}</a>
</li>
@else
<li class="nav-item">
<a class="nav-link" href="/tags/{{$data->id}}.html">
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1 d-none d-sm-block" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path d="M0 0h24v24H0z" stroke="none"/>
<circle cx="12" cy="12" r="9"/>
<path d="M12 7v5l3 3"/>
</svg>
{{__('app.latest')}}</a>
</li>
@endif
@foreach($topic_menu as $data)
@if(\Hyperf\Utils\Str::contains(core_http_url(),$data['parameter']))
<div class="card-header">
<ul class="nav nav-pills card-header-pills">
@if(!count(request()->all()))
<li class="nav-item">
<a class="nav-link active fw-bold" href="{{$data['url']}}">
{!!$data['icon']!!}{{$data['name']}}</a>
<a class="nav-link active fw-bold" href="/tags/{{$data->id}}.html">
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1 d-none d-sm-block" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path d="M0 0h24v24H0z" stroke="none"/>
<circle cx="12" cy="12" r="9"/>
<path d="M12 7v5l3 3"/>
</svg>
{{__('app.latest')}}</a>
</li>
@else
<li class="nav-item">
<a class="nav-link" href="{{$data['url']}}">
{!!$data['icon']!!}{{$data['name']}}</a>
<a class="nav-link" href="/tags/{{$data->id}}.html">
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1 d-none d-sm-block" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path d="M0 0h24v24H0z" stroke="none"/>
<circle cx="12" cy="12" r="9"/>
<path d="M12 7v5l3 3"/>
</svg>
{{__('app.latest')}}</a>
</li>
@endif
@endforeach
<li class="nav-item ms-auto">
<div class="dropdown">
<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 -->
<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>
</a>
<div class="dropdown-menu dropdown-menu-end">
@foreach(Itf()->get('ui-home-tabs-dropdown') as $k=>$v)
@if(call_user_func($v['enable'])===true)
@include($v['view'])
@endif
@endforeach
@foreach($topic_menu as $data)
@if(\Hyperf\Utils\Str::contains(core_http_url(),$data['parameter']))
<li class="nav-item">
<a class="nav-link active fw-bold" href="{{$data['url']}}">
{!!$data['icon']!!}{{$data['name']}}</a>
</li>
@else
<li class="nav-item">
<a class="nav-link" href="{{$data['url']}}">
{!!$data['icon']!!}{{$data['name']}}</a>
</li>
@endif
@endforeach
<li class="nav-item ms-auto">
<div class="dropdown">
<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 -->
<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>
</a>
<div class="dropdown-menu dropdown-menu-end">
@foreach(Itf()->get('ui-home-tabs-dropdown') as $k=>$v)
@if(call_user_func($v['enable'])===true)
@include($v['view'])
@endif
@endforeach
</div>
</div>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>

@if($page->count())
@foreach($page as $data)
@include('App::index.style2')
@endforeach
@else
<div class="col-md-12">
<div class="border-0 card card-body">
<div class="text-center card-title">{{__("app.No more results")}}</div>
@if($page->count())
@foreach($page as $data)
@include('App::index.style2')
@endforeach
@else
<div class="col-md-12">
<div class="border-0 card card-body">
<div class="text-center card-title">{{__("app.No more results")}}</div>
</div>
</div>
@endif
<div class="mt-2">
{!! make_page($page) !!}
</div>
@endif
<div class="mt-2">
{!! make_page($page) !!}
</div>
</div>
</div>
19 changes: 11 additions & 8 deletions app/Plugins/Topic/src/Controllers/ApiController.php
Expand Up @@ -21,6 +21,7 @@
use Hyperf\HttpServer\Annotation\PostMapping;
use Hyperf\RateLimit\Annotation\RateLimit;
use Hyperf\Utils\Arr;
use Swoole\Timer;

#[Controller(prefix: '/api/topic')]
#[RateLimit(create: 1, capacity: 3)]
Expand Down Expand Up @@ -71,7 +72,7 @@ public function get_WithTopic_Data()
$user_avatar = super_avatar($data->user);
$title = \Hyperf\Utils\Str::limit($data->title, 20);
$username = $data->user->username;
$summary = '作者:'.$username;
$summary = '作者:' . $username;
return Json_Api(200, true, [
'avatar' => $user_avatar,
'title' => $title,
Expand Down Expand Up @@ -312,13 +313,15 @@ public function get_user_ip()
$updateds = request()->input('updateds');
$data = [];
foreach ($updateds as $updated_id) {
$updated = TopicUpdated::query()->where(['id' => $updated_id])->first();
if ($updated->user_ip) {
$data[] = [
'updated_id' => $updated->id,
'text' => 'IP归属地:' . core_default(get_client_ip_data($updated->user_ip)['pro'], '未知'),
];
}
Timer::tick(1000, function () use ($updated_id, $data) {
$updated = TopicUpdated::query()->where(['id' => $updated_id])->first();
if ($updated->user_ip) {
$data[] = [
'updated_id' => $updated->id,
'text' => 'IP归属地:' . core_default(get_client_ip_data($updated->user_ip)['pro'], '未知'),
];
}
});
}
return Json_Api(200, true, $data);
}
Expand Down
Expand Up @@ -10,7 +10,7 @@

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

<div class="nav-item d-none d-lg-flex me-3">
<div class="nav-item d-none d-md-flex me-3">
<a href="/user/notice" class="px-0 nav-link">
<!-- Download SVG icon from http://tabler-icons.io/i/bell -->
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
Expand Down
53 changes: 48 additions & 5 deletions app/Themes/CodeFec/resources/views/topic/show/content.blade.php
@@ -1,6 +1,16 @@
<div class="row row-cards justify-content-center">
<div class="col-md-12" id="topic">
<div class="border-0 card">
<div class="card">
<div class="card-header">
<ol class="breadcrumb breadcrumb-arrows" aria-label="breadcrumbs">
<li class="breadcrumb-item"><a href="/">首页</a></li>
<li class="breadcrumb-item"><a href="/tags/{{$data->tag->id}}.html">
{!! $data->tag->icon !!}
{{$data->tag->name}}
</a></li>
<li class="breadcrumb-item active" aria-current="page"><a href="">{{$data->title}}</a></li>
</ol>
</div>
<div class="card-body topic">
@if ($data->essence > 0)
<div class="ribbon bg-green text-h3">
Expand Down Expand Up @@ -52,10 +62,43 @@

{{-- 上下页--}}
@include('App::topic.show.include.lfpage')
{{-- 显示评论--}}
@include('Comment::Widget.show-topic')
{{-- 评论--}}
@include('Comment::Widget.topic')
@if(isset($data->post->options->disable_comment) && !$data->post->options->disable_comment)
{{-- 显示评论--}}
@include('Comment::Widget.show-topic')
{{-- 评论--}}
@include('Comment::Widget.topic')
@else
<div class="col-md-12">
<div class="border-0 card">
<div class="empty">
<div class="empty-icon"><!-- Download SVG icon from http://tabler-icons.io/i/mood-sad -->
<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">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<circle cx="12" cy="12" r="9"></circle>
<line x1="5.7" y1="5.7" x2="18.3" y2="18.3"></line>
</svg>
</div>
<p class="empty-title">禁止评论</p>
<p class="empty-subtitle text-muted">
此帖子关闭了评论及回复功能
</p>
@if(!auth()->check())
<div class="empty-action">
<a href="/login" class="btn btn-primary">
<!-- Download SVG icon from http://tabler-icons.io/i/search -->
<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">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<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>
<path d="M20 12h-13l3 -3m0 6l-3 -3"></path>
</svg>
登陆
</a>
</div>
@endif
</div>
</div>
</div>
@endif

@if(auth()->check())
{{-- 举报模态--}}
Expand Down
3 changes: 2 additions & 1 deletion app/Themes/CodeFec/resources/views/topic/show/ol.blade.php
@@ -1,5 +1,6 @@
<ol class="breadcrumb" aria-label="breadcrumbs">
<li data-bs-toggle="tooltip" data-bs-placement="top" title="{{__('app.tag')}}" class="breadcrumb-item"><a href="/tags/{{$data->tag->id}}.html">
<li data-bs-toggle="tooltip" data-bs-placement="top" title="{{__('app.tag')}}" class="breadcrumb-item">
<a href="/tags/{{$data->tag->id}}.html">
{!! $data->tag->icon !!}
{{$data->tag->name}}
</a>
Expand Down
2 changes: 0 additions & 2 deletions app/Themes/CodeFec/resources/views/topic/show/show.blade.php
Expand Up @@ -45,9 +45,7 @@
@if($comment_page)
<script>var comment_id ={{$comment_page}}</script>
@endif
<script src="{{ mix('plugins/Topic/js/topic.js') }}"></script>
<script src="{{mix('plugins/Topic/js/core.js')}}"></script>
<script src="{{mix('plugins/Comment/js/topic.js')}}"></script>
<script src="{{file_hash('tabler/libs/plyr/dist/plyr.min.js')}}"></script>
<style>
/* for block of numbers */
Expand Down

0 comments on commit 59947e2

Please sign in to comment.