校园论坛
This commit is contained in:
@@ -7,6 +7,7 @@ use Modules\SystemAgent\Providers\SystemAgentServiceProvider;
|
|||||||
use Modules\SystemTool\Providers\SystemToolServiceProvider;
|
use Modules\SystemTool\Providers\SystemToolServiceProvider;
|
||||||
use Modules\SystemUser\Providers\SystemUserServiceProvider;
|
use Modules\SystemUser\Providers\SystemUserServiceProvider;
|
||||||
use Modules\Member\Providers\MemberServiceProvider;
|
use Modules\Member\Providers\MemberServiceProvider;
|
||||||
|
use Modules\Forum\Providers\ForumServiceProvider;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
AppServiceProvider::class,
|
AppServiceProvider::class,
|
||||||
@@ -16,4 +17,5 @@ return [
|
|||||||
SystemUserServiceProvider::class,
|
SystemUserServiceProvider::class,
|
||||||
SystemToolServiceProvider::class,
|
SystemToolServiceProvider::class,
|
||||||
MemberServiceProvider::class,
|
MemberServiceProvider::class,
|
||||||
|
ForumServiceProvider::class,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -394,6 +394,89 @@ class SysUserSeeder extends Seeder
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'type' => 'menu',
|
||||||
|
'name' => '校园论坛',
|
||||||
|
'local' => 'menu.forum',
|
||||||
|
'icon' => 'MessageOutlined',
|
||||||
|
'key' => 'forum',
|
||||||
|
'children' => [
|
||||||
|
[
|
||||||
|
'type' => 'route',
|
||||||
|
'name' => '话题管理',
|
||||||
|
'key' => 'forum.category',
|
||||||
|
'path' => '/forum/category',
|
||||||
|
'local' => 'menu.forum.category',
|
||||||
|
'children' => [
|
||||||
|
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.category.query'],
|
||||||
|
['type' => 'rule', 'name' => '新增分类', 'key' => 'forum.category.create'],
|
||||||
|
['type' => 'rule', 'name' => '修改分类', 'key' => 'forum.category.update'],
|
||||||
|
['type' => 'rule', 'name' => '删除分类', 'key' => 'forum.category.delete'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'route',
|
||||||
|
'name' => '帖子管理',
|
||||||
|
'key' => 'forum.post',
|
||||||
|
'path' => '/forum/post',
|
||||||
|
'local' => 'menu.forum.post',
|
||||||
|
'children' => [
|
||||||
|
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post.query'],
|
||||||
|
['type' => 'rule', 'name' => '新增帖子', 'key' => 'forum.post.create'],
|
||||||
|
['type' => 'rule', 'name' => '修改帖子', 'key' => 'forum.post.update'],
|
||||||
|
['type' => 'rule', 'name' => '删除帖子', 'key' => 'forum.post.delete'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'route',
|
||||||
|
'name' => '评论管理',
|
||||||
|
'key' => 'forum.comment',
|
||||||
|
'path' => '/forum/comment',
|
||||||
|
'local' => 'menu.forum.comment',
|
||||||
|
'children' => [
|
||||||
|
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.comment.query'],
|
||||||
|
['type' => 'rule', 'name' => '新增评论', 'key' => 'forum.comment.create'],
|
||||||
|
['type' => 'rule', 'name' => '修改评论', 'key' => 'forum.comment.update'],
|
||||||
|
['type' => 'rule', 'name' => '删除评论', 'key' => 'forum.comment.delete'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'route',
|
||||||
|
'name' => '敏感词管理',
|
||||||
|
'key' => 'forum.sensitive-word',
|
||||||
|
'path' => '/forum/sensitive-word',
|
||||||
|
'local' => 'menu.forum.sensitive-word',
|
||||||
|
'children' => [
|
||||||
|
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.sensitive-word.query'],
|
||||||
|
['type' => 'rule', 'name' => '新增敏感词', 'key' => 'forum.sensitive-word.create'],
|
||||||
|
['type' => 'rule', 'name' => '修改敏感词', 'key' => 'forum.sensitive-word.update'],
|
||||||
|
['type' => 'rule', 'name' => '删除敏感词', 'key' => 'forum.sensitive-word.delete'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'route',
|
||||||
|
'name' => '点赞记录',
|
||||||
|
'key' => 'forum.post-like',
|
||||||
|
'path' => '/forum/post-like',
|
||||||
|
'local' => 'menu.forum.post-like',
|
||||||
|
'children' => [
|
||||||
|
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post-like.query'],
|
||||||
|
['type' => 'rule', 'name' => '删除记录', 'key' => 'forum.post-like.delete'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'route',
|
||||||
|
'name' => '收藏记录',
|
||||||
|
'key' => 'forum.post-favorite',
|
||||||
|
'path' => '/forum/post-favorite',
|
||||||
|
'local' => 'menu.forum.post-favorite',
|
||||||
|
'children' => [
|
||||||
|
['type' => 'rule', 'name' => '查询列表', 'key' => 'forum.post-favorite.query'],
|
||||||
|
['type' => 'rule', 'name' => '删除记录', 'key' => 'forum.post-favorite.delete'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'type' => 'route',
|
'type' => 'route',
|
||||||
'name' => 'XinAdmin',
|
'name' => 'XinAdmin',
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\AnnoRoute\Attribute\DeleteRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\GetRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\PostRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\PutRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\RequestAttribute;
|
||||||
|
use Modules\Common\Http\Controllers\BaseController;
|
||||||
|
use Modules\Forum\Http\Requests\ForumCategoryFormRequest;
|
||||||
|
use Modules\Forum\Models\ForumCategoryModel;
|
||||||
|
|
||||||
|
#[RequestAttribute('/forum/category', 'forum.category')]
|
||||||
|
class ForumCategoryController extends BaseController
|
||||||
|
{
|
||||||
|
protected array $searchField = [
|
||||||
|
'status' => '=',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected array $quickSearchField = ['name', 'slug'];
|
||||||
|
|
||||||
|
#[GetRoute(authorize: 'query')]
|
||||||
|
public function query(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$params = $request->all();
|
||||||
|
$pageSize = $params['pageSize'] ?? 10;
|
||||||
|
$query = ForumCategoryModel::query();
|
||||||
|
$data = $this->buildSearch($params, $query)
|
||||||
|
->paginate($pageSize)
|
||||||
|
->toArray();
|
||||||
|
return $this->success($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[PostRoute(authorize: 'create')]
|
||||||
|
public function create(ForumCategoryFormRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
ForumCategoryModel::create($request->validated());
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[PutRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'update',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function update(int $id, ForumCategoryFormRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumCategoryModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('分类不存在');
|
||||||
|
}
|
||||||
|
$model->update($request->validated());
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[DeleteRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'delete',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function delete(int $id): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumCategoryModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('分类不存在');
|
||||||
|
}
|
||||||
|
$model->delete();
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\AnnoRoute\Attribute\DeleteRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\GetRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\PostRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\PutRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\RequestAttribute;
|
||||||
|
use Modules\Common\Http\Controllers\BaseController;
|
||||||
|
use Modules\Forum\Http\Requests\ForumCommentFormRequest;
|
||||||
|
use Modules\Forum\Models\ForumCommentModel;
|
||||||
|
|
||||||
|
#[RequestAttribute('/forum/comment', 'forum.comment')]
|
||||||
|
class ForumCommentController extends BaseController
|
||||||
|
{
|
||||||
|
protected array $searchField = [
|
||||||
|
'status' => '=',
|
||||||
|
'post_id' => '=',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected array $quickSearchField = ['content'];
|
||||||
|
|
||||||
|
#[GetRoute(authorize: 'query')]
|
||||||
|
public function query(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$params = $request->all();
|
||||||
|
$pageSize = $params['pageSize'] ?? 10;
|
||||||
|
$query = ForumCommentModel::query();
|
||||||
|
$data = $this->buildSearch($params, $query)
|
||||||
|
->paginate($pageSize)
|
||||||
|
->toArray();
|
||||||
|
return $this->success($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[PostRoute(authorize: 'create')]
|
||||||
|
public function create(ForumCommentFormRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
ForumCommentModel::create($request->validated());
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[PutRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'update',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function update(int $id, ForumCommentFormRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumCommentModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('评论不存在');
|
||||||
|
}
|
||||||
|
$model->update($request->validated());
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[DeleteRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'delete',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function delete(int $id): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumCommentModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('评论不存在');
|
||||||
|
}
|
||||||
|
$model->delete();
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\AnnoRoute\Attribute\DeleteRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\GetRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\PostRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\PutRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\RequestAttribute;
|
||||||
|
use Modules\Common\Http\Controllers\BaseController;
|
||||||
|
use Modules\Forum\Http\Requests\ForumPostFormRequest;
|
||||||
|
use Modules\Forum\Models\ForumPostModel;
|
||||||
|
|
||||||
|
#[RequestAttribute('/forum/post', 'forum.post')]
|
||||||
|
class ForumPostController extends BaseController
|
||||||
|
{
|
||||||
|
protected array $searchField = [
|
||||||
|
'status' => '=',
|
||||||
|
'is_hot' => '=',
|
||||||
|
'is_top' => '=',
|
||||||
|
'category_id' => '=',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected array $quickSearchField = ['title'];
|
||||||
|
|
||||||
|
#[GetRoute(authorize: 'query')]
|
||||||
|
public function query(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$params = $request->all();
|
||||||
|
$pageSize = $params['pageSize'] ?? 10;
|
||||||
|
$query = ForumPostModel::query();
|
||||||
|
$data = $this->buildSearch($params, $query)
|
||||||
|
->paginate($pageSize)
|
||||||
|
->toArray();
|
||||||
|
return $this->success($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[PostRoute(authorize: 'create')]
|
||||||
|
public function create(ForumPostFormRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
ForumPostModel::create($request->validated());
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[PutRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'update',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function update(int $id, ForumPostFormRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumPostModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('帖子不存在');
|
||||||
|
}
|
||||||
|
$model->update($request->validated());
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[DeleteRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'delete',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function delete(int $id): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumPostModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('帖子不存在');
|
||||||
|
}
|
||||||
|
$model->delete();
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\AnnoRoute\Attribute\DeleteRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\GetRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\RequestAttribute;
|
||||||
|
use Modules\Common\Http\Controllers\BaseController;
|
||||||
|
use Modules\Forum\Models\ForumPostFavoriteModel;
|
||||||
|
|
||||||
|
#[RequestAttribute('/forum/post-favorite', 'forum.post-favorite')]
|
||||||
|
class ForumPostFavoriteController extends BaseController
|
||||||
|
{
|
||||||
|
protected array $searchField = [
|
||||||
|
'post_id' => '=',
|
||||||
|
];
|
||||||
|
|
||||||
|
#[GetRoute(authorize: 'query')]
|
||||||
|
public function query(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$params = $request->all();
|
||||||
|
$pageSize = $params['pageSize'] ?? 10;
|
||||||
|
$query = ForumPostFavoriteModel::query();
|
||||||
|
$data = $this->buildSearch($params, $query)
|
||||||
|
->paginate($pageSize)
|
||||||
|
->toArray();
|
||||||
|
return $this->success($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[DeleteRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'delete',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function delete(int $id): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumPostFavoriteModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('收藏记录不存在');
|
||||||
|
}
|
||||||
|
$model->delete();
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\AnnoRoute\Attribute\DeleteRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\GetRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\RequestAttribute;
|
||||||
|
use Modules\Common\Http\Controllers\BaseController;
|
||||||
|
use Modules\Forum\Models\ForumPostLikeModel;
|
||||||
|
|
||||||
|
#[RequestAttribute('/forum/post-like', 'forum.post-like')]
|
||||||
|
class ForumPostLikeController extends BaseController
|
||||||
|
{
|
||||||
|
protected array $searchField = [
|
||||||
|
'post_id' => '=',
|
||||||
|
];
|
||||||
|
|
||||||
|
#[GetRoute(authorize: 'query')]
|
||||||
|
public function query(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$params = $request->all();
|
||||||
|
$pageSize = $params['pageSize'] ?? 10;
|
||||||
|
$query = ForumPostLikeModel::query();
|
||||||
|
$data = $this->buildSearch($params, $query)
|
||||||
|
->paginate($pageSize)
|
||||||
|
->toArray();
|
||||||
|
return $this->success($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[DeleteRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'delete',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function delete(int $id): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumPostLikeModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('点赞记录不存在');
|
||||||
|
}
|
||||||
|
$model->delete();
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\AnnoRoute\Attribute\DeleteRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\GetRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\PostRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\PutRoute;
|
||||||
|
use Modules\AnnoRoute\Attribute\RequestAttribute;
|
||||||
|
use Modules\Common\Http\Controllers\BaseController;
|
||||||
|
use Modules\Forum\Http\Requests\ForumSensitiveWordFormRequest;
|
||||||
|
use Modules\Forum\Models\ForumSensitiveWordModel;
|
||||||
|
|
||||||
|
#[RequestAttribute('/forum/sensitive-word', 'forum.sensitive-word')]
|
||||||
|
class ForumSensitiveWordController extends BaseController
|
||||||
|
{
|
||||||
|
protected array $searchField = [
|
||||||
|
'status' => '=',
|
||||||
|
'type' => '=',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected array $quickSearchField = ['word'];
|
||||||
|
|
||||||
|
#[GetRoute(authorize: 'query')]
|
||||||
|
public function query(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$params = $request->all();
|
||||||
|
$pageSize = $params['pageSize'] ?? 10;
|
||||||
|
$query = ForumSensitiveWordModel::query();
|
||||||
|
$data = $this->buildSearch($params, $query)
|
||||||
|
->paginate($pageSize)
|
||||||
|
->toArray();
|
||||||
|
return $this->success($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[PostRoute(authorize: 'create')]
|
||||||
|
public function create(ForumSensitiveWordFormRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
ForumSensitiveWordModel::create($request->validated());
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[PutRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'update',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function update(int $id, ForumSensitiveWordFormRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumSensitiveWordModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('敏感词不存在');
|
||||||
|
}
|
||||||
|
$model->update($request->validated());
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[DeleteRoute(
|
||||||
|
route: '/{id}',
|
||||||
|
authorize: 'delete',
|
||||||
|
where: ['id' => '[0-9]+']
|
||||||
|
)]
|
||||||
|
public function delete(int $id): JsonResponse
|
||||||
|
{
|
||||||
|
$model = ForumSensitiveWordModel::find($id);
|
||||||
|
if (empty($model)) {
|
||||||
|
return $this->error('敏感词不存在');
|
||||||
|
}
|
||||||
|
$model->delete();
|
||||||
|
return $this->success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Modules\Common\Http\Requests\BaseFormRequest;
|
||||||
|
|
||||||
|
class ForumCategoryFormRequest extends BaseFormRequest
|
||||||
|
{
|
||||||
|
protected $stopOnFirstFailure = true;
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
if (!$this->isUpdate()) {
|
||||||
|
return [
|
||||||
|
'name' => 'required|max:50',
|
||||||
|
'slug' => 'required|max:50|unique:forum_categories,slug',
|
||||||
|
'parent_id' => 'nullable|integer',
|
||||||
|
'description' => 'nullable|max:255',
|
||||||
|
'icon' => 'nullable|max:255',
|
||||||
|
'sort' => 'nullable|integer',
|
||||||
|
'status' => 'nullable|integer|in:0,1',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $this->route('id');
|
||||||
|
return [
|
||||||
|
'name' => 'required|max:50',
|
||||||
|
'slug' => [
|
||||||
|
'required',
|
||||||
|
'max:50',
|
||||||
|
Rule::unique('forum_categories', 'slug')->ignore($id),
|
||||||
|
],
|
||||||
|
'parent_id' => 'nullable|integer',
|
||||||
|
'description' => 'nullable|max:255',
|
||||||
|
'icon' => 'nullable|max:255',
|
||||||
|
'sort' => 'nullable|integer',
|
||||||
|
'status' => 'nullable|integer|in:0,1',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name.required' => '分类名称不能为空',
|
||||||
|
'slug.required' => '分类标识不能为空',
|
||||||
|
'slug.unique' => '分类标识已存在',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Requests;
|
||||||
|
|
||||||
|
use Modules\Common\Http\Requests\BaseFormRequest;
|
||||||
|
|
||||||
|
class ForumCommentFormRequest extends BaseFormRequest
|
||||||
|
{
|
||||||
|
protected $stopOnFirstFailure = true;
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'post_id' => 'required|integer',
|
||||||
|
'user_id' => 'required|integer',
|
||||||
|
'content' => 'required',
|
||||||
|
'parent_id' => 'nullable|integer',
|
||||||
|
'reply_to' => 'nullable|integer',
|
||||||
|
'status' => 'nullable|integer|in:0,1',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'post_id.required' => '帖子ID不能为空',
|
||||||
|
'user_id.required' => '评论用户不能为空',
|
||||||
|
'content.required' => '评论内容不能为空',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Requests;
|
||||||
|
|
||||||
|
use Modules\Common\Http\Requests\BaseFormRequest;
|
||||||
|
|
||||||
|
class ForumPostFormRequest extends BaseFormRequest
|
||||||
|
{
|
||||||
|
protected $stopOnFirstFailure = true;
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title' => 'required|max:100',
|
||||||
|
'content' => 'required',
|
||||||
|
'category_id' => 'nullable|integer',
|
||||||
|
'user_id' => 'required|integer',
|
||||||
|
'images' => 'nullable|array',
|
||||||
|
'is_hot' => 'nullable|integer|in:0,1',
|
||||||
|
'is_top' => 'nullable|integer|in:0,1',
|
||||||
|
'status' => 'nullable|integer|in:0,1,2',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title.required' => '帖子标题不能为空',
|
||||||
|
'content.required' => '帖子内容不能为空',
|
||||||
|
'user_id.required' => '发布用户不能为空',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Modules\Common\Http\Requests\BaseFormRequest;
|
||||||
|
|
||||||
|
class ForumSensitiveWordFormRequest extends BaseFormRequest
|
||||||
|
{
|
||||||
|
protected $stopOnFirstFailure = true;
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
if (!$this->isUpdate()) {
|
||||||
|
return [
|
||||||
|
'word' => 'required|max:100|unique:forum_sensitive_words,word',
|
||||||
|
'replacement' => 'nullable|max:100',
|
||||||
|
'type' => 'nullable|integer|in:1,2',
|
||||||
|
'status' => 'nullable|integer|in:0,1',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $this->route('id');
|
||||||
|
return [
|
||||||
|
'word' => [
|
||||||
|
'required',
|
||||||
|
'max:100',
|
||||||
|
Rule::unique('forum_sensitive_words', 'word')->ignore($id),
|
||||||
|
],
|
||||||
|
'replacement' => 'nullable|max:100',
|
||||||
|
'type' => 'nullable|integer|in:1,2',
|
||||||
|
'status' => 'nullable|integer|in:0,1',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'word.required' => '敏感词不能为空',
|
||||||
|
'word.unique' => '敏感词已存在',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ForumCategoryModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'forum_categories';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'parent_id',
|
||||||
|
'name',
|
||||||
|
'slug',
|
||||||
|
'description',
|
||||||
|
'icon',
|
||||||
|
'sort',
|
||||||
|
'status',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'parent_id' => 'integer',
|
||||||
|
'sort' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ForumCommentModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'forum_comments';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'post_id',
|
||||||
|
'user_id',
|
||||||
|
'parent_id',
|
||||||
|
'reply_to',
|
||||||
|
'content',
|
||||||
|
'like_count',
|
||||||
|
'status',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'post_id' => 'integer',
|
||||||
|
'user_id' => 'integer',
|
||||||
|
'parent_id' => 'integer',
|
||||||
|
'reply_to' => 'integer',
|
||||||
|
'like_count' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ForumPostFavoriteModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'forum_post_favorites';
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'post_id',
|
||||||
|
'user_id',
|
||||||
|
'created_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'post_id' => 'integer',
|
||||||
|
'user_id' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ForumPostLikeModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'forum_post_likes';
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'post_id',
|
||||||
|
'user_id',
|
||||||
|
'created_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'post_id' => 'integer',
|
||||||
|
'user_id' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class ForumPostModel extends Model
|
||||||
|
{
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
|
protected $table = 'forum_posts';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'category_id',
|
||||||
|
'title',
|
||||||
|
'content',
|
||||||
|
'images',
|
||||||
|
'view_count',
|
||||||
|
'comment_count',
|
||||||
|
'like_count',
|
||||||
|
'favorite_count',
|
||||||
|
'is_hot',
|
||||||
|
'is_top',
|
||||||
|
'status',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'user_id' => 'integer',
|
||||||
|
'category_id' => 'integer',
|
||||||
|
'images' => 'array',
|
||||||
|
'view_count' => 'integer',
|
||||||
|
'comment_count' => 'integer',
|
||||||
|
'like_count' => 'integer',
|
||||||
|
'favorite_count' => 'integer',
|
||||||
|
'is_hot' => 'integer',
|
||||||
|
'is_top' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ForumSensitiveWordModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'forum_sensitive_words';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'word',
|
||||||
|
'replacement',
|
||||||
|
'type',
|
||||||
|
'status',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'type' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Forum\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Modules\AnnoRoute\AnnoRoute;
|
||||||
|
|
||||||
|
class ForumServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
public function boot(AnnoRoute $annoRoute): void
|
||||||
|
{
|
||||||
|
$annoRoute->register(base_path('modules/Forum/Http/Controllers'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
export default interface IForumCategory {
|
||||||
|
id?: number;
|
||||||
|
parent_id?: number;
|
||||||
|
name?: string;
|
||||||
|
slug?: string;
|
||||||
|
description?: string;
|
||||||
|
icon?: string;
|
||||||
|
sort?: number;
|
||||||
|
status?: number;
|
||||||
|
created_at?: string;
|
||||||
|
updated_at?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
export default interface IForumComment {
|
||||||
|
id?: number;
|
||||||
|
post_id?: number;
|
||||||
|
user_id?: number;
|
||||||
|
parent_id?: number;
|
||||||
|
reply_to?: number;
|
||||||
|
content?: string;
|
||||||
|
like_count?: number;
|
||||||
|
status?: number;
|
||||||
|
created_at?: string;
|
||||||
|
updated_at?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
export default interface IForumPost {
|
||||||
|
id?: number;
|
||||||
|
user_id?: number;
|
||||||
|
category_id?: number;
|
||||||
|
title?: string;
|
||||||
|
content?: string;
|
||||||
|
images?: string[];
|
||||||
|
view_count?: number;
|
||||||
|
comment_count?: number;
|
||||||
|
like_count?: number;
|
||||||
|
favorite_count?: number;
|
||||||
|
is_hot?: number;
|
||||||
|
is_top?: number;
|
||||||
|
status?: number;
|
||||||
|
created_at?: string;
|
||||||
|
updated_at?: string;
|
||||||
|
deleted_at?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export default interface IForumPostFavorite {
|
||||||
|
id?: number;
|
||||||
|
post_id?: number;
|
||||||
|
user_id?: number;
|
||||||
|
created_at?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export default interface IForumPostLike {
|
||||||
|
id?: number;
|
||||||
|
post_id?: number;
|
||||||
|
user_id?: number;
|
||||||
|
created_at?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export default interface IForumSensitiveWord {
|
||||||
|
id?: number;
|
||||||
|
word?: string;
|
||||||
|
replacement?: string;
|
||||||
|
type?: number;
|
||||||
|
status?: number;
|
||||||
|
created_at?: string;
|
||||||
|
updated_at?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
export default {
|
||||||
|
"forum.category.page.title": "Topic Categories",
|
||||||
|
"forum.category.page.description": "Manage campus forum topic categories with parent-child structure",
|
||||||
|
"forum.category.id": "ID",
|
||||||
|
"forum.category.parent_id": "Parent Category",
|
||||||
|
"forum.category.name": "Name",
|
||||||
|
"forum.category.name.required": "Category name is required",
|
||||||
|
"forum.category.slug": "Slug",
|
||||||
|
"forum.category.slug.required": "Category slug is required",
|
||||||
|
"forum.category.description": "Description",
|
||||||
|
"forum.category.icon": "Icon",
|
||||||
|
"forum.category.sort": "Sort",
|
||||||
|
"forum.category.status": "Status",
|
||||||
|
"forum.category.status.0": "Disabled",
|
||||||
|
"forum.category.status.1": "Active",
|
||||||
|
"forum.category.created_at": "Created At",
|
||||||
|
"forum.category.updated_at": "Updated At",
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
export default {
|
||||||
|
"forum.comment.page.title": "Comment Management",
|
||||||
|
"forum.comment.page.description": "Manage campus forum post comments, support view and review",
|
||||||
|
"forum.comment.id": "ID",
|
||||||
|
"forum.comment.post_id": "Post",
|
||||||
|
"forum.comment.user_id": "User",
|
||||||
|
"forum.comment.parent_id": "Parent Comment",
|
||||||
|
"forum.comment.reply_to": "Reply To",
|
||||||
|
"forum.comment.content": "Content",
|
||||||
|
"forum.comment.content.required": "Comment content is required",
|
||||||
|
"forum.comment.like_count": "Likes",
|
||||||
|
"forum.comment.status": "Status",
|
||||||
|
"forum.comment.status.0": "Hidden",
|
||||||
|
"forum.comment.status.1": "Active",
|
||||||
|
"forum.comment.created_at": "Commented At",
|
||||||
|
"forum.comment.updated_at": "Updated At",
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export default {
|
||||||
|
"forum.post-favorite.page.title": "Favorite Records",
|
||||||
|
"forum.post-favorite.page.description": "View campus forum post favorite records",
|
||||||
|
"forum.post-favorite.id": "ID",
|
||||||
|
"forum.post-favorite.post_id": "Post ID",
|
||||||
|
"forum.post-favorite.user_id": "User ID",
|
||||||
|
"forum.post-favorite.created_at": "Favorited At",
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export default {
|
||||||
|
"forum.post-like.page.title": "Like Records",
|
||||||
|
"forum.post-like.page.description": "View campus forum post like records",
|
||||||
|
"forum.post-like.id": "ID",
|
||||||
|
"forum.post-like.post_id": "Post ID",
|
||||||
|
"forum.post-like.user_id": "User ID",
|
||||||
|
"forum.post-like.created_at": "Liked At",
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
export default {
|
||||||
|
"forum.post.page.title": "Post Management",
|
||||||
|
"forum.post.page.description": "Manage campus forum posts, support pin, hot, review and more",
|
||||||
|
"forum.post.id": "ID",
|
||||||
|
"forum.post.user_id": "Author",
|
||||||
|
"forum.post.category_id": "Category",
|
||||||
|
"forum.post.title": "Title",
|
||||||
|
"forum.post.title.required": "Post title is required",
|
||||||
|
"forum.post.content": "Content",
|
||||||
|
"forum.post.content.required": "Post content is required",
|
||||||
|
"forum.post.images": "Images",
|
||||||
|
"forum.post.view_count": "Views",
|
||||||
|
"forum.post.comment_count": "Comments",
|
||||||
|
"forum.post.like_count": "Likes",
|
||||||
|
"forum.post.favorite_count": "Favorites",
|
||||||
|
"forum.post.is_hot": "Hot",
|
||||||
|
"forum.post.is_hot.0": "No",
|
||||||
|
"forum.post.is_hot.1": "Yes",
|
||||||
|
"forum.post.is_top": "Pinned",
|
||||||
|
"forum.post.is_top.0": "No",
|
||||||
|
"forum.post.is_top.1": "Yes",
|
||||||
|
"forum.post.status": "Status",
|
||||||
|
"forum.post.status.0": "Draft",
|
||||||
|
"forum.post.status.1": "Published",
|
||||||
|
"forum.post.status.2": "Hidden",
|
||||||
|
"forum.post.created_at": "Posted At",
|
||||||
|
"forum.post.updated_at": "Updated At",
|
||||||
|
};
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export default {
|
||||||
|
"forum.sensitive-word.page.title": "Sensitive Words",
|
||||||
|
"forum.sensitive-word.page.description": "Manage campus forum sensitive word filter rules, support replace and block modes",
|
||||||
|
"forum.sensitive-word.id": "ID",
|
||||||
|
"forum.sensitive-word.word": "Word",
|
||||||
|
"forum.sensitive-word.word.required": "Sensitive word is required",
|
||||||
|
"forum.sensitive-word.replacement": "Replacement",
|
||||||
|
"forum.sensitive-word.type": "Type",
|
||||||
|
"forum.sensitive-word.type.1": "Replace",
|
||||||
|
"forum.sensitive-word.type.2": "Block",
|
||||||
|
"forum.sensitive-word.status": "Status",
|
||||||
|
"forum.sensitive-word.status.0": "Disabled",
|
||||||
|
"forum.sensitive-word.status.1": "Enabled",
|
||||||
|
"forum.sensitive-word.created_at": "Created At",
|
||||||
|
"forum.sensitive-word.updated_at": "Updated At",
|
||||||
|
};
|
||||||
@@ -24,6 +24,13 @@ import aiAgent from "./ai/agent";
|
|||||||
import memberUser from "./member/user";
|
import memberUser from "./member/user";
|
||||||
import memberAddress from "./member/address";
|
import memberAddress from "./member/address";
|
||||||
|
|
||||||
|
import forumCategory from "./forum/category";
|
||||||
|
import forumPost from "./forum/post";
|
||||||
|
import forumComment from "./forum/comment";
|
||||||
|
import forumSensitiveWord from "./forum/sensitive-word";
|
||||||
|
import forumPostLike from "./forum/post-like";
|
||||||
|
import forumPostFavorite from "./forum/post-favorite";
|
||||||
|
|
||||||
import userProfile from "./user/profile";
|
import userProfile from "./user/profile";
|
||||||
|
|
||||||
import xinForm from "./components/xin-form";
|
import xinForm from "./components/xin-form";
|
||||||
@@ -54,6 +61,12 @@ export default {
|
|||||||
...aiAgent,
|
...aiAgent,
|
||||||
...memberUser,
|
...memberUser,
|
||||||
...memberAddress,
|
...memberAddress,
|
||||||
|
...forumCategory,
|
||||||
|
...forumPost,
|
||||||
|
...forumComment,
|
||||||
|
...forumSensitiveWord,
|
||||||
|
...forumPostLike,
|
||||||
|
...forumPostFavorite,
|
||||||
...userProfile,
|
...userProfile,
|
||||||
...xinForm,
|
...xinForm,
|
||||||
...xinTable,
|
...xinTable,
|
||||||
|
|||||||
@@ -47,5 +47,12 @@ export default {
|
|||||||
"menu.member": "Mini Program Users",
|
"menu.member": "Mini Program Users",
|
||||||
"menu.member.user": "User List",
|
"menu.member.user": "User List",
|
||||||
"menu.member.address": "Address Management",
|
"menu.member.address": "Address Management",
|
||||||
|
"menu.forum": "Campus Forum",
|
||||||
|
"menu.forum.category": "Categories",
|
||||||
|
"menu.forum.post": "Posts",
|
||||||
|
"menu.forum.comment": "Comments",
|
||||||
|
"menu.forum.sensitive-word": "Sensitive Words",
|
||||||
|
"menu.forum.post-like": "Like Records",
|
||||||
|
"menu.forum.post-favorite": "Favorite Records",
|
||||||
"menu.xin-admin": "XinAdmin",
|
"menu.xin-admin": "XinAdmin",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
export default {
|
||||||
|
"forum.category.page.title": "话题分类",
|
||||||
|
"forum.category.page.description": "管理校园论坛话题分类,支持父子级分类结构",
|
||||||
|
"forum.category.id": "ID",
|
||||||
|
"forum.category.parent_id": "父级分类",
|
||||||
|
"forum.category.name": "分类名称",
|
||||||
|
"forum.category.name.required": "分类名称不能为空",
|
||||||
|
"forum.category.slug": "标识",
|
||||||
|
"forum.category.slug.required": "分类标识不能为空",
|
||||||
|
"forum.category.description": "描述",
|
||||||
|
"forum.category.icon": "图标",
|
||||||
|
"forum.category.sort": "排序",
|
||||||
|
"forum.category.status": "状态",
|
||||||
|
"forum.category.status.0": "禁用",
|
||||||
|
"forum.category.status.1": "正常",
|
||||||
|
"forum.category.created_at": "创建时间",
|
||||||
|
"forum.category.updated_at": "更新时间",
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
export default {
|
||||||
|
"forum.comment.page.title": "评论管理",
|
||||||
|
"forum.comment.page.description": "管理校园论坛帖子评论,支持查看和审核评论",
|
||||||
|
"forum.comment.id": "ID",
|
||||||
|
"forum.comment.post_id": "所属帖子",
|
||||||
|
"forum.comment.user_id": "评论用户",
|
||||||
|
"forum.comment.parent_id": "父评论",
|
||||||
|
"forum.comment.reply_to": "回复用户",
|
||||||
|
"forum.comment.content": "评论内容",
|
||||||
|
"forum.comment.content.required": "评论内容不能为空",
|
||||||
|
"forum.comment.like_count": "点赞数",
|
||||||
|
"forum.comment.status": "状态",
|
||||||
|
"forum.comment.status.0": "隐藏",
|
||||||
|
"forum.comment.status.1": "正常",
|
||||||
|
"forum.comment.created_at": "评论时间",
|
||||||
|
"forum.comment.updated_at": "更新时间",
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export default {
|
||||||
|
"forum.post-favorite.page.title": "收藏记录",
|
||||||
|
"forum.post-favorite.page.description": "查看校园论坛帖子收藏记录",
|
||||||
|
"forum.post-favorite.id": "ID",
|
||||||
|
"forum.post-favorite.post_id": "帖子ID",
|
||||||
|
"forum.post-favorite.user_id": "用户ID",
|
||||||
|
"forum.post-favorite.created_at": "收藏时间",
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export default {
|
||||||
|
"forum.post-like.page.title": "点赞记录",
|
||||||
|
"forum.post-like.page.description": "查看校园论坛帖子点赞记录",
|
||||||
|
"forum.post-like.id": "ID",
|
||||||
|
"forum.post-like.post_id": "帖子ID",
|
||||||
|
"forum.post-like.user_id": "用户ID",
|
||||||
|
"forum.post-like.created_at": "点赞时间",
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
export default {
|
||||||
|
"forum.post.page.title": "帖子管理",
|
||||||
|
"forum.post.page.description": "管理校园论坛帖子,支持置顶、热门、审核等操作",
|
||||||
|
"forum.post.id": "ID",
|
||||||
|
"forum.post.user_id": "发布用户",
|
||||||
|
"forum.post.category_id": "所属分类",
|
||||||
|
"forum.post.title": "帖子标题",
|
||||||
|
"forum.post.title.required": "帖子标题不能为空",
|
||||||
|
"forum.post.content": "帖子内容",
|
||||||
|
"forum.post.content.required": "帖子内容不能为空",
|
||||||
|
"forum.post.images": "图片",
|
||||||
|
"forum.post.view_count": "浏览数",
|
||||||
|
"forum.post.comment_count": "评论数",
|
||||||
|
"forum.post.like_count": "点赞数",
|
||||||
|
"forum.post.favorite_count": "收藏数",
|
||||||
|
"forum.post.is_hot": "热门",
|
||||||
|
"forum.post.is_hot.0": "否",
|
||||||
|
"forum.post.is_hot.1": "是",
|
||||||
|
"forum.post.is_top": "置顶",
|
||||||
|
"forum.post.is_top.0": "否",
|
||||||
|
"forum.post.is_top.1": "是",
|
||||||
|
"forum.post.status": "状态",
|
||||||
|
"forum.post.status.0": "草稿",
|
||||||
|
"forum.post.status.1": "发布",
|
||||||
|
"forum.post.status.2": "隐藏",
|
||||||
|
"forum.post.created_at": "发布时间",
|
||||||
|
"forum.post.updated_at": "更新时间",
|
||||||
|
};
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export default {
|
||||||
|
"forum.sensitive-word.page.title": "敏感词管理",
|
||||||
|
"forum.sensitive-word.page.description": "管理校园论坛敏感词过滤规则,支持替换和禁止发布两种模式",
|
||||||
|
"forum.sensitive-word.id": "ID",
|
||||||
|
"forum.sensitive-word.word": "敏感词",
|
||||||
|
"forum.sensitive-word.word.required": "敏感词不能为空",
|
||||||
|
"forum.sensitive-word.replacement": "替换词",
|
||||||
|
"forum.sensitive-word.type": "类型",
|
||||||
|
"forum.sensitive-word.type.1": "替换",
|
||||||
|
"forum.sensitive-word.type.2": "禁止发布",
|
||||||
|
"forum.sensitive-word.status": "状态",
|
||||||
|
"forum.sensitive-word.status.0": "禁用",
|
||||||
|
"forum.sensitive-word.status.1": "启用",
|
||||||
|
"forum.sensitive-word.created_at": "创建时间",
|
||||||
|
"forum.sensitive-word.updated_at": "更新时间",
|
||||||
|
};
|
||||||
@@ -24,6 +24,13 @@ import aiAgent from "./ai/agent";
|
|||||||
import memberUser from "./member/user";
|
import memberUser from "./member/user";
|
||||||
import memberAddress from "./member/address";
|
import memberAddress from "./member/address";
|
||||||
|
|
||||||
|
import forumCategory from "./forum/category";
|
||||||
|
import forumPost from "./forum/post";
|
||||||
|
import forumComment from "./forum/comment";
|
||||||
|
import forumSensitiveWord from "./forum/sensitive-word";
|
||||||
|
import forumPostLike from "./forum/post-like";
|
||||||
|
import forumPostFavorite from "./forum/post-favorite";
|
||||||
|
|
||||||
import userProfile from "./user/profile";
|
import userProfile from "./user/profile";
|
||||||
|
|
||||||
import xinForm from "./components/xin-form";
|
import xinForm from "./components/xin-form";
|
||||||
@@ -54,6 +61,12 @@ export default {
|
|||||||
...aiAgent,
|
...aiAgent,
|
||||||
...memberUser,
|
...memberUser,
|
||||||
...memberAddress,
|
...memberAddress,
|
||||||
|
...forumCategory,
|
||||||
|
...forumPost,
|
||||||
|
...forumComment,
|
||||||
|
...forumSensitiveWord,
|
||||||
|
...forumPostLike,
|
||||||
|
...forumPostFavorite,
|
||||||
...userProfile,
|
...userProfile,
|
||||||
...xinForm,
|
...xinForm,
|
||||||
...xinTable,
|
...xinTable,
|
||||||
|
|||||||
@@ -47,5 +47,12 @@ export default {
|
|||||||
"menu.member": "小程序用户",
|
"menu.member": "小程序用户",
|
||||||
"menu.member.user": "用户列表",
|
"menu.member.user": "用户列表",
|
||||||
"menu.member.address": "地址管理",
|
"menu.member.address": "地址管理",
|
||||||
|
"menu.forum": "校园论坛",
|
||||||
|
"menu.forum.category": "话题管理",
|
||||||
|
"menu.forum.post": "帖子管理",
|
||||||
|
"menu.forum.comment": "评论管理",
|
||||||
|
"menu.forum.sensitive-word": "敏感词管理",
|
||||||
|
"menu.forum.post-like": "点赞记录",
|
||||||
|
"menu.forum.post-favorite": "收藏记录",
|
||||||
"menu.xin-admin": "XinAdmin",
|
"menu.xin-admin": "XinAdmin",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
import { Tag, Typography } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
import XinTable from '@/components/XinTable';
|
||||||
|
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||||
|
import type IForumCategory from '@/domain/iForumCategory';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
|
const { Title, Text } = Typography;
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
const Table: React.FC = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const columns: XinTableColumn<IForumCategory>[] = [
|
||||||
|
{
|
||||||
|
title: t('forum.category.id'),
|
||||||
|
dataIndex: 'id',
|
||||||
|
hideInForm: true,
|
||||||
|
sorter: true,
|
||||||
|
align: 'center',
|
||||||
|
width: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.name'),
|
||||||
|
dataIndex: 'name',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
required: true,
|
||||||
|
rules: [{ required: true, message: t('forum.category.name.required') }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.slug'),
|
||||||
|
dataIndex: 'slug',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
required: true,
|
||||||
|
rules: [{ required: true, message: t('forum.category.slug.required') }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.parent_id'),
|
||||||
|
dataIndex: 'parent_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.description'),
|
||||||
|
dataIndex: 'description',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.icon'),
|
||||||
|
dataIndex: 'icon',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.sort'),
|
||||||
|
dataIndex: 'sort',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.status'),
|
||||||
|
dataIndex: 'status',
|
||||||
|
valueType: 'radioButton',
|
||||||
|
fieldProps: {
|
||||||
|
options: [
|
||||||
|
{ value: 0, label: t('forum.category.status.0') },
|
||||||
|
{ value: 1, label: t('forum.category.status.1') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
render: (value: number) => {
|
||||||
|
return value === 1
|
||||||
|
? <Tag color="success">{t('forum.category.status.1')}</Tag>
|
||||||
|
: <Tag color="error">{t('forum.category.status.0')}</Tag>;
|
||||||
|
},
|
||||||
|
filters: [
|
||||||
|
{ text: t('forum.category.status.0'), value: 0 },
|
||||||
|
{ text: t('forum.category.status.1'), value: 1 },
|
||||||
|
],
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.created_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'created_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.category.updated_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'updated_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tableProps: XinTableProps<IForumCategory> = {
|
||||||
|
api: '/forum/category',
|
||||||
|
columns,
|
||||||
|
rowKey: 'id',
|
||||||
|
accessName: 'forum.category',
|
||||||
|
formProps: {
|
||||||
|
grid: true,
|
||||||
|
colProps: { span: 12 },
|
||||||
|
rowProps: { gutter: [30, 0] },
|
||||||
|
layout: 'vertical',
|
||||||
|
},
|
||||||
|
modalProps: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
cardProps: {
|
||||||
|
variant: 'borderless',
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
size: 'small',
|
||||||
|
style: { marginBottom: 0 },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="mb-5">
|
||||||
|
<Title level={3}>{t('forum.category.page.title')}</Title>
|
||||||
|
<Text type="secondary">{t('forum.category.page.description')}</Text>
|
||||||
|
</div>
|
||||||
|
<XinTable<IForumCategory> {...tableProps} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Table;
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
import { Tag, Typography } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
import XinTable from '@/components/XinTable';
|
||||||
|
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||||
|
import type IForumComment from '@/domain/iForumComment';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
|
const { Title, Text } = Typography;
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
const Table: React.FC = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const columns: XinTableColumn<IForumComment>[] = [
|
||||||
|
{
|
||||||
|
title: t('forum.comment.id'),
|
||||||
|
dataIndex: 'id',
|
||||||
|
hideInForm: true,
|
||||||
|
sorter: true,
|
||||||
|
align: 'center',
|
||||||
|
width: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.post_id'),
|
||||||
|
dataIndex: 'post_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.user_id'),
|
||||||
|
dataIndex: 'user_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
required: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.parent_id'),
|
||||||
|
dataIndex: 'parent_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.reply_to'),
|
||||||
|
dataIndex: 'reply_to',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.content'),
|
||||||
|
dataIndex: 'content',
|
||||||
|
valueType: 'text',
|
||||||
|
hideInTable: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
required: true,
|
||||||
|
rules: [{ required: true, message: t('forum.comment.content.required') }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.like_count'),
|
||||||
|
dataIndex: 'like_count',
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.status'),
|
||||||
|
dataIndex: 'status',
|
||||||
|
valueType: 'radioButton',
|
||||||
|
fieldProps: {
|
||||||
|
options: [
|
||||||
|
{ value: 0, label: t('forum.comment.status.0') },
|
||||||
|
{ value: 1, label: t('forum.comment.status.1') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
render: (value: number) => {
|
||||||
|
return value === 1
|
||||||
|
? <Tag color="success">{t('forum.comment.status.1')}</Tag>
|
||||||
|
: <Tag color="error">{t('forum.comment.status.0')}</Tag>;
|
||||||
|
},
|
||||||
|
filters: [
|
||||||
|
{ text: t('forum.comment.status.0'), value: 0 },
|
||||||
|
{ text: t('forum.comment.status.1'), value: 1 },
|
||||||
|
],
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.created_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'created_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.comment.updated_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'updated_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tableProps: XinTableProps<IForumComment> = {
|
||||||
|
api: '/forum/comment',
|
||||||
|
columns,
|
||||||
|
rowKey: 'id',
|
||||||
|
accessName: 'forum.comment',
|
||||||
|
scroll: { x: 1200 },
|
||||||
|
formProps: {
|
||||||
|
grid: true,
|
||||||
|
colProps: { span: 12 },
|
||||||
|
rowProps: { gutter: [30, 0] },
|
||||||
|
layout: 'vertical',
|
||||||
|
},
|
||||||
|
modalProps: {
|
||||||
|
width: 700,
|
||||||
|
},
|
||||||
|
cardProps: {
|
||||||
|
variant: 'borderless',
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
size: 'small',
|
||||||
|
style: { marginBottom: 0 },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="mb-5">
|
||||||
|
<Title level={3}>{t('forum.comment.page.title')}</Title>
|
||||||
|
<Text type="secondary">{t('forum.comment.page.description')}</Text>
|
||||||
|
</div>
|
||||||
|
<XinTable<IForumComment> {...tableProps} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Table;
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import { Typography } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
import XinTable from '@/components/XinTable';
|
||||||
|
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||||
|
import type IForumPostFavorite from '@/domain/iForumPostFavorite';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
|
const { Title, Text } = Typography;
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
const Table: React.FC = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const columns: XinTableColumn<IForumPostFavorite>[] = [
|
||||||
|
{
|
||||||
|
title: t('forum.post-favorite.id'),
|
||||||
|
dataIndex: 'id',
|
||||||
|
hideInForm: true,
|
||||||
|
sorter: true,
|
||||||
|
align: 'center',
|
||||||
|
width: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post-favorite.post_id'),
|
||||||
|
dataIndex: 'post_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post-favorite.user_id'),
|
||||||
|
dataIndex: 'user_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post-favorite.created_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'created_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tableProps: XinTableProps<IForumPostFavorite> = {
|
||||||
|
api: '/forum/post-favorite',
|
||||||
|
columns,
|
||||||
|
rowKey: 'id',
|
||||||
|
accessName: 'forum.post-favorite',
|
||||||
|
createShow: false,
|
||||||
|
editShow: false,
|
||||||
|
formProps: {
|
||||||
|
grid: true,
|
||||||
|
colProps: { span: 12 },
|
||||||
|
rowProps: { gutter: [30, 0] },
|
||||||
|
layout: 'vertical',
|
||||||
|
},
|
||||||
|
modalProps: {
|
||||||
|
width: 500,
|
||||||
|
},
|
||||||
|
cardProps: {
|
||||||
|
variant: 'borderless',
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
size: 'small',
|
||||||
|
style: { marginBottom: 0 },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="mb-5">
|
||||||
|
<Title level={3}>{t('forum.post-favorite.page.title')}</Title>
|
||||||
|
<Text type="secondary">{t('forum.post-favorite.page.description')}</Text>
|
||||||
|
</div>
|
||||||
|
<XinTable<IForumPostFavorite> {...tableProps} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Table;
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import { Typography } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
import XinTable from '@/components/XinTable';
|
||||||
|
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||||
|
import type IForumPostLike from '@/domain/iForumPostLike';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
|
const { Title, Text } = Typography;
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
const Table: React.FC = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const columns: XinTableColumn<IForumPostLike>[] = [
|
||||||
|
{
|
||||||
|
title: t('forum.post-like.id'),
|
||||||
|
dataIndex: 'id',
|
||||||
|
hideInForm: true,
|
||||||
|
sorter: true,
|
||||||
|
align: 'center',
|
||||||
|
width: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post-like.post_id'),
|
||||||
|
dataIndex: 'post_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post-like.user_id'),
|
||||||
|
dataIndex: 'user_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post-like.created_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'created_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tableProps: XinTableProps<IForumPostLike> = {
|
||||||
|
api: '/forum/post-like',
|
||||||
|
columns,
|
||||||
|
rowKey: 'id',
|
||||||
|
accessName: 'forum.post-like',
|
||||||
|
createShow: false,
|
||||||
|
editShow: false,
|
||||||
|
formProps: {
|
||||||
|
grid: true,
|
||||||
|
colProps: { span: 12 },
|
||||||
|
rowProps: { gutter: [30, 0] },
|
||||||
|
layout: 'vertical',
|
||||||
|
},
|
||||||
|
modalProps: {
|
||||||
|
width: 500,
|
||||||
|
},
|
||||||
|
cardProps: {
|
||||||
|
variant: 'borderless',
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
size: 'small',
|
||||||
|
style: { marginBottom: 0 },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="mb-5">
|
||||||
|
<Title level={3}>{t('forum.post-like.page.title')}</Title>
|
||||||
|
<Text type="secondary">{t('forum.post-like.page.description')}</Text>
|
||||||
|
</div>
|
||||||
|
<XinTable<IForumPostLike> {...tableProps} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Table;
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
import { Tag, Typography } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
import XinTable from '@/components/XinTable';
|
||||||
|
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||||
|
import type IForumPost from '@/domain/iForumPost';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
|
const { Title, Text } = Typography;
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
const Table: React.FC = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const columns: XinTableColumn<IForumPost>[] = [
|
||||||
|
{
|
||||||
|
title: t('forum.post.id'),
|
||||||
|
dataIndex: 'id',
|
||||||
|
hideInForm: true,
|
||||||
|
sorter: true,
|
||||||
|
align: 'center',
|
||||||
|
width: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.title'),
|
||||||
|
dataIndex: 'title',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
required: true,
|
||||||
|
rules: [{ required: true, message: t('forum.post.title.required') }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.user_id'),
|
||||||
|
dataIndex: 'user_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
required: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.category_id'),
|
||||||
|
dataIndex: 'category_id',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.content'),
|
||||||
|
dataIndex: 'content',
|
||||||
|
valueType: 'text',
|
||||||
|
hideInTable: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
required: true,
|
||||||
|
rules: [{ required: true, message: t('forum.post.content.required') }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.view_count'),
|
||||||
|
dataIndex: 'view_count',
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.comment_count'),
|
||||||
|
dataIndex: 'comment_count',
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.like_count'),
|
||||||
|
dataIndex: 'like_count',
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.favorite_count'),
|
||||||
|
dataIndex: 'favorite_count',
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.is_hot'),
|
||||||
|
dataIndex: 'is_hot',
|
||||||
|
valueType: 'radioButton',
|
||||||
|
fieldProps: {
|
||||||
|
options: [
|
||||||
|
{ value: 0, label: t('forum.post.is_hot.0') },
|
||||||
|
{ value: 1, label: t('forum.post.is_hot.1') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
render: (value: number) => {
|
||||||
|
return value === 1
|
||||||
|
? <Tag color="red">{t('forum.post.is_hot.1')}</Tag>
|
||||||
|
: <Tag>{t('forum.post.is_hot.0')}</Tag>;
|
||||||
|
},
|
||||||
|
filters: [
|
||||||
|
{ text: t('forum.post.is_hot.0'), value: 0 },
|
||||||
|
{ text: t('forum.post.is_hot.1'), value: 1 },
|
||||||
|
],
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.is_top'),
|
||||||
|
dataIndex: 'is_top',
|
||||||
|
valueType: 'radioButton',
|
||||||
|
fieldProps: {
|
||||||
|
options: [
|
||||||
|
{ value: 0, label: t('forum.post.is_top.0') },
|
||||||
|
{ value: 1, label: t('forum.post.is_top.1') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
render: (value: number) => {
|
||||||
|
return value === 1
|
||||||
|
? <Tag color="blue">{t('forum.post.is_top.1')}</Tag>
|
||||||
|
: <Tag>{t('forum.post.is_top.0')}</Tag>;
|
||||||
|
},
|
||||||
|
filters: [
|
||||||
|
{ text: t('forum.post.is_top.0'), value: 0 },
|
||||||
|
{ text: t('forum.post.is_top.1'), value: 1 },
|
||||||
|
],
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.status'),
|
||||||
|
dataIndex: 'status',
|
||||||
|
valueType: 'radioButton',
|
||||||
|
fieldProps: {
|
||||||
|
options: [
|
||||||
|
{ value: 0, label: t('forum.post.status.0') },
|
||||||
|
{ value: 1, label: t('forum.post.status.1') },
|
||||||
|
{ value: 2, label: t('forum.post.status.2') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
render: (value: number) => {
|
||||||
|
const colorMap: Record<number, string> = { 0: 'default', 1: 'success', 2: 'warning' };
|
||||||
|
const labelMap: Record<number, string> = { 0: t('forum.post.status.0'), 1: t('forum.post.status.1'), 2: t('forum.post.status.2') };
|
||||||
|
return <Tag color={colorMap[value] || 'default'}>{labelMap[value] || '-'}</Tag>;
|
||||||
|
},
|
||||||
|
filters: [
|
||||||
|
{ text: t('forum.post.status.0'), value: 0 },
|
||||||
|
{ text: t('forum.post.status.1'), value: 1 },
|
||||||
|
{ text: t('forum.post.status.2'), value: 2 },
|
||||||
|
],
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.created_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'created_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.post.updated_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'updated_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tableProps: XinTableProps<IForumPost> = {
|
||||||
|
api: '/forum/post',
|
||||||
|
columns,
|
||||||
|
rowKey: 'id',
|
||||||
|
accessName: 'forum.post',
|
||||||
|
scroll: { x: 1600 },
|
||||||
|
formProps: {
|
||||||
|
grid: true,
|
||||||
|
colProps: { span: 12 },
|
||||||
|
rowProps: { gutter: [30, 0] },
|
||||||
|
layout: 'vertical',
|
||||||
|
},
|
||||||
|
modalProps: {
|
||||||
|
width: 800,
|
||||||
|
},
|
||||||
|
cardProps: {
|
||||||
|
variant: 'borderless',
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
size: 'small',
|
||||||
|
style: { marginBottom: 0 },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="mb-5">
|
||||||
|
<Title level={3}>{t('forum.post.page.title')}</Title>
|
||||||
|
<Text type="secondary">{t('forum.post.page.description')}</Text>
|
||||||
|
</div>
|
||||||
|
<XinTable<IForumPost> {...tableProps} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Table;
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
import { Tag, Typography } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
import XinTable from '@/components/XinTable';
|
||||||
|
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||||
|
import type IForumSensitiveWord from '@/domain/iForumSensitiveWord';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
|
const { Title, Text } = Typography;
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
const Table: React.FC = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const columns: XinTableColumn<IForumSensitiveWord>[] = [
|
||||||
|
{
|
||||||
|
title: t('forum.sensitive-word.id'),
|
||||||
|
dataIndex: 'id',
|
||||||
|
hideInForm: true,
|
||||||
|
sorter: true,
|
||||||
|
align: 'center',
|
||||||
|
width: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.sensitive-word.word'),
|
||||||
|
dataIndex: 'word',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
required: true,
|
||||||
|
rules: [{ required: true, message: t('forum.sensitive-word.word.required') }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.sensitive-word.replacement'),
|
||||||
|
dataIndex: 'replacement',
|
||||||
|
valueType: 'text',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.sensitive-word.type'),
|
||||||
|
dataIndex: 'type',
|
||||||
|
valueType: 'radioButton',
|
||||||
|
fieldProps: {
|
||||||
|
options: [
|
||||||
|
{ value: 1, label: t('forum.sensitive-word.type.1') },
|
||||||
|
{ value: 2, label: t('forum.sensitive-word.type.2') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
render: (value: number) => {
|
||||||
|
return value === 2
|
||||||
|
? <Tag color="red">{t('forum.sensitive-word.type.2')}</Tag>
|
||||||
|
: <Tag color="blue">{t('forum.sensitive-word.type.1')}</Tag>;
|
||||||
|
},
|
||||||
|
filters: [
|
||||||
|
{ text: t('forum.sensitive-word.type.1'), value: 1 },
|
||||||
|
{ text: t('forum.sensitive-word.type.2'), value: 2 },
|
||||||
|
],
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.sensitive-word.status'),
|
||||||
|
dataIndex: 'status',
|
||||||
|
valueType: 'radioButton',
|
||||||
|
fieldProps: {
|
||||||
|
options: [
|
||||||
|
{ value: 0, label: t('forum.sensitive-word.status.0') },
|
||||||
|
{ value: 1, label: t('forum.sensitive-word.status.1') },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
render: (value: number) => {
|
||||||
|
return value === 1
|
||||||
|
? <Tag color="success">{t('forum.sensitive-word.status.1')}</Tag>
|
||||||
|
: <Tag color="error">{t('forum.sensitive-word.status.0')}</Tag>;
|
||||||
|
},
|
||||||
|
filters: [
|
||||||
|
{ text: t('forum.sensitive-word.status.0'), value: 0 },
|
||||||
|
{ text: t('forum.sensitive-word.status.1'), value: 1 },
|
||||||
|
],
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.sensitive-word.created_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'created_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('forum.sensitive-word.updated_at'),
|
||||||
|
hideInForm: true,
|
||||||
|
hideInSearch: true,
|
||||||
|
dataIndex: 'updated_at',
|
||||||
|
align: 'center',
|
||||||
|
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tableProps: XinTableProps<IForumSensitiveWord> = {
|
||||||
|
api: '/forum/sensitive-word',
|
||||||
|
columns,
|
||||||
|
rowKey: 'id',
|
||||||
|
accessName: 'forum.sensitive-word',
|
||||||
|
formProps: {
|
||||||
|
grid: true,
|
||||||
|
colProps: { span: 12 },
|
||||||
|
rowProps: { gutter: [30, 0] },
|
||||||
|
layout: 'vertical',
|
||||||
|
},
|
||||||
|
modalProps: {
|
||||||
|
width: 600,
|
||||||
|
},
|
||||||
|
cardProps: {
|
||||||
|
variant: 'borderless',
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
size: 'small',
|
||||||
|
style: { marginBottom: 0 },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="mb-5">
|
||||||
|
<Title level={3}>{t('forum.sensitive-word.page.title')}</Title>
|
||||||
|
<Text type="secondary">{t('forum.sensitive-word.page.description')}</Text>
|
||||||
|
</div>
|
||||||
|
<XinTable<IForumSensitiveWord> {...tableProps} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Table;
|
||||||
Reference in New Issue
Block a user