This commit is contained in:
f4ilji
2024-11-13 13:38:58 +05:00
parent 462680ba77
commit f091b29b63
22 changed files with 488 additions and 418 deletions
@@ -27,10 +27,10 @@ use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
class ContentBuilderItem class ContentBuilderItem
{ {
public static function getItem() public static function getItem(string $name)
{ {
return return
Builder::make('content')->label('')->blocks([ Builder::make($name)->label('')->blocks([
Builder\Block::make('heading')->label('Заголовок') Builder\Block::make('heading')->label('Заголовок')
->schema([ ->schema([
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)), TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
+1 -1
View File
@@ -95,7 +95,7 @@ class PageForm
TextInput::make('search_data')->hidden(), TextInput::make('search_data')->hidden(),
]), ]),
Forms\Components\Tabs\Tab::make('Контент')->schema([ Forms\Components\Tabs\Tab::make('Контент')->schema([
ContentBuilderItem::getItem() ContentBuilderItem::getItem('content')
]), ]),
Forms\Components\Tabs\Tab::make('Настройки')->schema([ Forms\Components\Tabs\Tab::make('Настройки')->schema([
Select::make('template')->options(self::getPageTemplates())->required(), Select::make('template')->options(self::getPageTemplates())->required(),
@@ -0,0 +1,130 @@
<?php
namespace App\Filament\Components\Forms;
use App\Enums\CustomFormStatus;
use App\Enums\PostStatus;
use App\Filament\Components\Forms\ItemForm\Pages\ContentBuilderItem;
use App\Helpers\ByteConverter;
use App\Models\Category;
use App\Models\CustomForm;
use App\Models\Page;
use App\Models\Post;
use Filament\Forms;
use Filament\Forms\Components\Builder;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Form;
use Filament\Resources\Components\Tab;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
use Symfony\Component\Finder\Finder;
class UserDetailForm
{
public static function getForm(Form $form): Form
{
return $form
->schema([
Forms\Components\Card::make()->schema([
Forms\Components\Grid::make(2)->schema([
Forms\Components\Toggle::make('is_only_worker')
->inline(false)
->label('Только сотрудник')
]),
]),
Tabs::make('Tabs')
->tabs([
Tabs\Tab::make('Основная информация')
->schema([
Forms\Components\FileUpload::make('photo')
->label('Фотография')
->image()
->optimize('jpg')
->resize(30)
->disk('public')
->imageEditor()
->directory('images')
->imageEditor(),
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('contactEmail')
->label('Контактный Email')
->maxLength(255),
Forms\Components\TextInput::make('contactPhone')
->label('Контактный телефон')
->maxLength(255),
]),
]),
Tabs\Tab::make('Образование')
->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('academicTitle')
->label('Ученая степень')
->maxLength(255),
Forms\Components\TextInput::make('AcademicDegree')
->label('Ученое звание')
->maxLength(255),
]),
Forms\Components\Repeater::make('education')->schema([
Forms\Components\TextInput::make('year')->label('Года обучения')->string()->required(),
Forms\Components\TextInput::make('content')->label('Общая информация')->string()->required(),
Forms\Components\TextInput::make('institution')->label('Учебное заведение')->string()->required()
])->label('Образование'),
Forms\Components\Repeater::make('professionalRetraining')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Профессиональная переподготовка'),
Forms\Components\Repeater::make('professionalDevelopment')
->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Повышение квалификации'),
Forms\Components\Repeater::make('awards')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Награды'),
]),
Tabs\Tab::make('Преподавание')
->schema([
Forms\Components\Grid::make(2)->schema([
Forms\Components\TextInput::make('workExperience.total')
->label('Стаж работы в общем')
->numeric(),
Forms\Components\TextInput::make('workExperience.byProf')
->label('Стаж работы по специальности')
->numeric(),
]),
Forms\Components\Repeater::make('professDisciplines')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
]),
Tabs\Tab::make('Научная деятельность')
->schema([
Forms\Components\Repeater::make('attendedConferences')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
Forms\Components\Repeater::make('participationScienceProjects')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
Forms\Components\Repeater::make('publications')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
]),
Tabs\Tab::make('Другое')
->schema([
ContentBuilderItem::getItem('other')
]),
])->columnSpanFull(),
]);
}
}
@@ -51,7 +51,8 @@ class CreatePost extends CreateRecord
{ {
$this->record->seo()->create($this->seoData); $this->record->seo()->create($this->seoData);
$this->sendNotify($this->record, auth()->user()); $this->sendNotify($this->record, auth()->user());
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, Carbon::parse($this->record->publish_at)->timestamp); $publish_date = ($this->record->publish_at > now()) ? Carbon::parse($this->record->publish_at)->timestamp : null;
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, $publish_date);
} }
private function generateSeo(array $data) : array private function generateSeo(array $data) : array
@@ -268,6 +269,7 @@ class CreatePost extends CreateRecord
$post_id = $this->record->id; $post_id = $this->record->id;
dispatch(new CreateVkPost($title, $text, $images, $post_id, $publish_date)); dispatch(new CreateVkPost($title, $text, $images, $post_id, $publish_date));
} }
} }
@@ -36,7 +36,8 @@ class EditPost extends EditRecord
protected function afterSave(): void protected function afterSave(): void
{ {
$this->record->seo()->update($this->seoData); $this->record->seo()->update($this->seoData);
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, Carbon::parse($this->record->publish_at)->timestamp); $publish_date = ($this->record->publish_at > now()) ? Carbon::parse($this->record->publish_at)->timestamp : null;
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, $publish_date);
} }
private function setPreviewText(array $data) : string|null private function setPreviewText(array $data) : string|null
+2 -91
View File
@@ -2,6 +2,7 @@
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Components\Forms\UserDetailForm;
use App\Filament\Resources\UserDetailResource\Pages; use App\Filament\Resources\UserDetailResource\Pages;
use App\Filament\Resources\UserDetailResource\RelationManagers; use App\Filament\Resources\UserDetailResource\RelationManagers;
use App\Models\UserDetail; use App\Models\UserDetail;
@@ -30,97 +31,7 @@ class UserDetailResource extends Resource
public static function form(Form $form): Form public static function form(Form $form): Form
{ {
return $form return UserDetailForm::getForm($form);
->schema([
Forms\Components\Card::make()->schema([
Forms\Components\Grid::make(2)->schema([
Forms\Components\Select::make('user_id')
->relationship('user', 'email')
->searchable()
->required()
->preload()
->label('Пользователь'),
Forms\Components\Toggle::make('is_only_worker')
->inline(false)
->label('Только сотрудник')
]),
]),
Tabs::make('Tabs')
->tabs([
Tabs\Tab::make('Основная информация')
->schema([
Forms\Components\FileUpload::make('photo')
->label('Фотография')
->image()
->optimize('jpg')
->resize(30)
->disk('public')
->imageEditor()
->directory('images')
->imageEditor(),
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('contactEmail')
->label('Контактный Email')
->maxLength(255),
Forms\Components\TextInput::make('contactPhone')
->label('Контактный телефон')
->maxLength(255),
]),
]),
Tabs\Tab::make('Образование')
->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('academicTitle')
->label('Ученая степень')
->maxLength(255),
Forms\Components\TextInput::make('AcademicDegree')
->label('Ученое звание')
->maxLength(255),
]),
Forms\Components\TextInput::make('education')
->label('Образование')
->maxLength(255),
Forms\Components\Repeater::make('professionalRetraining')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Профессиональная переподготовка'),
Forms\Components\Repeater::make('professionalDevelopment')
->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Повышение квалификации'),
Forms\Components\Repeater::make('awards')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Награды'),
]),
Tabs\Tab::make('Преподавание')
->schema([
Forms\Components\TextInput::make('workExperience')
->label('Стаж работы')
->numeric(),
Forms\Components\Repeater::make('professDisciplines')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
]),
Tabs\Tab::make('Научная деятельность')
->schema([
Forms\Components\Repeater::make('attendedConferences')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
Forms\Components\Repeater::make('participationScienceProjects')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
Forms\Components\Repeater::make('publications')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
]),
Tabs\Tab::make('Другое')
->schema([
Forms\Components\Textarea::make('other')
->columnSpanFull(),
]),
])->columnSpanFull(),
]);
} }
public static function table(Table $table): Table public static function table(Table $table): Table
@@ -2,6 +2,7 @@
namespace App\Filament\Resources\UserResource\RelationManagers; namespace App\Filament\Resources\UserResource\RelationManagers;
use App\Filament\Components\Forms\UserDetailForm;
use App\Models\User; use App\Models\User;
use Filament\Forms; use Filament\Forms;
use Filament\Forms\Components\Tabs; use Filament\Forms\Components\Tabs;
@@ -20,87 +21,7 @@ class UserDetailRelationManager extends RelationManager
public function form(Form $form): Form public function form(Form $form): Form
{ {
return $form return UserDetailForm::getForm($form);
->schema([
Forms\Components\Card::make()->schema([
Forms\Components\Toggle::make('is_only_worker')
->inline(false)
->label('Только сотрудник')
]),
Tabs::make('Tabs')
->tabs([
Tabs\Tab::make('Основная информация')
->schema([
Forms\Components\FileUpload::make('photo')
->label('Фото')
->image()
->disk('public')
->directory('images')
->imageEditor()
->required(),
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('contactEmail')
->label('Контактный Email')
->maxLength(255),
Forms\Components\TextInput::make('contactPhone')
->label('Контактный телефон')
->maxLength(255),
]),
]),
Tabs\Tab::make('Образование')
->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('academicTitle')
->label('Ученая степень')
->maxLength(255),
Forms\Components\TextInput::make('AcademicDegree')
->label('Ученое звание')
->maxLength(255),
]),
Forms\Components\TextInput::make('education')
->label('Образование')
->maxLength(255),
Forms\Components\Repeater::make('professionalRetraining')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Профессиональная переподготовка'),
Forms\Components\Repeater::make('professionalDevelopment')
->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Повышение квалификации'),
Forms\Components\Repeater::make('awards')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Награды'),
]),
Tabs\Tab::make('Преподавание')
->schema([
Forms\Components\TextInput::make('workExperience')
->label('Стаж работы')
->numeric(),
Forms\Components\Repeater::make('professDisciplines')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Преподаваемые дисциплины'),
]),
Tabs\Tab::make('Научная деятельность')
->schema([
Forms\Components\Repeater::make('attendedConferences')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Участие в конференциях'),
Forms\Components\Repeater::make('participationScienceProjects')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Участие в научных проектах'),
Forms\Components\Repeater::make('publications')->schema([
Forms\Components\TextInput::make('item')->label('')->string()->required()
])->label('Публикации'),
]),
Tabs\Tab::make('Другое')
->schema([
Forms\Components\Textarea::make('other')
->columnSpanFull(),
]),
])->columnSpanFull(),
]);
} }
+1 -1
View File
@@ -32,7 +32,7 @@ class CreateVkPost implements ShouldQueue
readonly private string $text, readonly private string $text,
readonly private array $images = [], readonly private array $images = [],
readonly private int $post_id, readonly private int $post_id,
readonly private int $publish_date, readonly private int|null $publish_date = null,
) )
{} {}
+1 -1
View File
@@ -32,7 +32,7 @@ class UpdateVkPost implements ShouldQueue
readonly private string $text, readonly private string $text,
readonly private array $images = [], readonly private array $images = [],
readonly private int $post_id, readonly private int $post_id,
readonly private int $publish_date, readonly private int|null $publish_date = null,
) )
{} {}
+2
View File
@@ -14,6 +14,8 @@ class UserDetail extends Model
protected $casts = [ protected $casts = [
'is_only_worker' => 'boolean', 'is_only_worker' => 'boolean',
'awards' => 'array', 'awards' => 'array',
'education' => 'array',
'workExperience' => 'array',
'professDisciplines' => 'array', 'professDisciplines' => 'array',
'professionalRetraining' => 'array', 'professionalRetraining' => 'array',
'professionalDevelopment' => 'array', 'professionalDevelopment' => 'array',
+2 -2
View File
@@ -28,7 +28,7 @@ class VkService
return $this->wallService->getPostById($id); return $this->wallService->getPostById($id);
} }
public function createPost(string $title, string $message, array $images = [], int $publish_date = null) public function createPost(string $title, string $message, array $images = [], int|null $publish_date = null)
{ {
$from_group = 1; $from_group = 1;
$album_attachment = ''; $album_attachment = '';
@@ -40,7 +40,7 @@ class VkService
return $this->wallService->createPost($message, $from_group, $album_attachment, $publish_date); return $this->wallService->createPost($message, $from_group, $album_attachment, $publish_date);
} }
public function updatePost(int $id, string $title, string $message, array $images = [], int $publish_date = null) public function updatePost(int $id, string $title, string $message, array $images = [], int|null $publish_date = null)
{ {
$from_group = 1; $from_group = 1;
$vk_post = $this->wallService->getPostById($id); $vk_post = $this->wallService->getPostById($id);
+2 -14
View File
@@ -46,7 +46,7 @@ class VkWallService
public function createPost(string $message, int $from_group, string $attachments = '', int $publish_date) public function createPost(string $message, int $from_group, string $attachments = '', int|null $publish_date = null)
{ {
$params = [ $params = [
'owner_id' => '-' . $this->publicId, 'owner_id' => '-' . $this->publicId,
@@ -79,7 +79,7 @@ class VkWallService
} }
} }
public function updatePost(int $post_id, string $message = '', int $from_group = 1, string $attachments = '', int $publish_date) public function updatePost(int $post_id, string $message = '', int $from_group = 1, string $attachments = '', int|null $publish_date = null)
{ {
if (empty($message) && empty($attachments)) { if (empty($message) && empty($attachments)) {
return [ return [
@@ -89,18 +89,6 @@ class VkWallService
} }
$params = [
'owner_id' => '-' . $this->publicId,
'post_id' => $post_id,
'message' => $message,
'attachments' => $attachments,
'access_token' => $this->wallToken,
'v' => '5.131',
];
try { try {
return $this->vk->wall()->edit( return $this->vk->wall()->edit(
$this->vkAuthService->getToken()->access_token, $this->vkAuthService->getToken()->access_token,
@@ -19,12 +19,12 @@ return new class extends Migration
$table->string('photo')->nullable(); // Фото $table->string('photo')->nullable(); // Фото
$table->string('academicTitle')->nullable(); // Ученая степень $table->string('academicTitle')->nullable(); // Ученая степень
$table->string('AcademicDegree')->nullable(); // Ученое звание $table->string('AcademicDegree')->nullable(); // Ученое звание
$table->string('education')->nullable(); // Образование $table->text('education')->nullable(); // Образование
$table->text('awards')->nullable(); // Награды $table->text('awards')->nullable(); // Награды
$table->text('professDisciplines')->nullable(); // Преподаваемые программы $table->text('professDisciplines')->nullable(); // Преподаваемые программы
$table->text('professionalRetraining')->nullable(); // Профессиональная переподготовка $table->text('professionalRetraining')->nullable(); // Профессиональная переподготовка
$table->text('professionalDevelopment')->nullable(); // Повышение квалификации $table->text('professionalDevelopment')->nullable(); // Повышение квалификации
$table->integer('workExperience')->nullable(); // Стаж работы $table->text('workExperience')->nullable(); // Стаж работы
$table->text('attendedConferences')->nullable(); // Участие в конференциях $table->text('attendedConferences')->nullable(); // Участие в конференциях
$table->text('participationScienceProjects')->nullable(); // Участие в научных проектах $table->text('participationScienceProjects')->nullable(); // Участие в научных проектах
$table->text('publications')->nullable(); // Публикации $table->text('publications')->nullable(); // Публикации
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up() : void
{
Schema::table('user_details', function (Blueprint $table) {
$table->text('education')->change(); // Изменяем тип на text
});
}
public function down() : void
{
Schema::table('user_details', function (Blueprint $table) {
$table->string('education')->change(); // Возвращаем тип обратно на string
});
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('user_details', function (Blueprint $table) {
$table->text('workExperience')->change(); // Изменяем тип на text
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('user_details', function (Blueprint $table) {
$table->integer('workExperience')->change();
});
}
};
+9 -9
View File
@@ -23,15 +23,15 @@ services:
command: > command: >
sh -c "php artisan inertia:start-ssr & php-fpm" sh -c "php artisan inertia:start-ssr & php-fpm"
php-queue: # php-queue:
restart: always # restart: always
build: # build:
context: . # context: .
dockerfile: _docker/app/Dockerfile # dockerfile: _docker/app/Dockerfile
volumes: # volumes:
- ./:/var/www # - ./:/var/www
container_name: ntspi-php-queue # container_name: ntspi-php-queue
command: php artisan queue:work --tries=3 --timeout=90 # Настройте параметры по необходимости # command: php artisan queue:work --tries=3 --timeout=90 # Настройте параметры по необходимости
db: db:
image: mysql:8.0 image: mysql:8.0
@@ -0,0 +1,60 @@
<!-- NavLink.vue -->
<template>
<div>
<h2 :id="generateSlug(title)" class="mb-3 font-medium text-gray-800 dark:text-neutral-200">
{{ title }}
</h2>
<template v-for="education in educations">
<div class="grid grid-cols-1 sm:grid-cols-1 my-4">
<div class="p-4 border border-gray-200 rounded-lg dark:border-neutral-700">
<h3 class="mb-1 text-xs text-gray-600 dark:text-neutral-400">
{{ education.year }}
</h3>
<p class="font-semibold text-sm text-gray-800 dark:text-neutral-200">
{{ education.content }}
</p>
<p class="mt-1 text-sm text-gray-600 dark:text-neutral-400">
{{ education.institution }}
</p>
</div>
</div>
</template>
</div>
</template>
<script>
import slugify from "slugify";
export default {
name: 'EducationBlock',
props: {
educations: {
type: Object,
required: true
},
title: {
type: String,
required: true
}
},
methods: {
generateSlug(text) {
return slugify(text, {
lower: true,
strict: true,
locale: "ru",
});
},
}
}
</script>
<style scoped>
/* Добавьте стили, если это необходимо */
</style>
@@ -0,0 +1,46 @@
<!-- NavLink.vue -->
<template>
<div>
<h2 :id="generateSlug(nameList)" class="mb-3 font-medium text-gray-800 dark:text-neutral-200">
{{ nameList }}
</h2>
<ul class="list-disc ms-6 mt-3 space-y-1.5">
<template v-for="el in list">
<li class="ps-1 text-sm text-gray-600 dark:text-neutral-400">
{{ el.item }}
</li>
</template>
</ul>
</div>
</template>
<script>
import slugify from "slugify";
export default {
name: 'ListBlock',
props: {
list: {
type: String,
required: true
},
nameList: {
type: String,
required: true,
},
},
methods: {
generateSlug(text) {
return slugify(text, {
lower: true,
strict: true,
locale: "ru",
});
},
}
}
</script>
<style scoped>
/* Добавьте стили, если это необходимо */
</style>
@@ -0,0 +1,42 @@
<!-- NavLink.vue -->
<template>
<div>
<h2 :id="generateSlug(nameList)" class="mb-3 font-medium text-gray-800 dark:text-neutral-200">
{{ nameList }}
</h2>
<BaseBuilder :blocks="blocks" />
</div>
</template>
<script>
import slugify from "slugify";
import BaseBuilder from "@/Components/BaseComponents/BaseBuilderUi/BaseBuilder.vue";
export default {
name: 'OtherBlock',
components: {BaseBuilder},
props: {
blocks: {
type: String,
required: true
},
nameList: {
type: String,
required: true,
},
},
methods: {
generateSlug(text) {
return slugify(text, {
lower: true,
strict: true,
locale: "ru",
});
},
}
}
</script>
<style scoped>
/* Добавьте стили, если это необходимо */
</style>
@@ -0,0 +1,49 @@
<!-- NavLink.vue -->
<template>
<h2 :id="generateSlug(title)" class="mb-3 font-medium text-gray-800 dark:text-neutral-200">
{{ title }}
</h2>
<div class="grid grid-cols-1 sm:grid-cols-1 gap-3">
<p class="mt-1 text-sm text-gray-600 dark:text-neutral-400">
Стаж работы: {{ workExpTotal }}
</p>
<p class="mt-1 text-sm text-gray-600 dark:text-neutral-400">
Стаж по специальности: {{ workExpByProf }}
</p>
</div>
</template>
<script>
import slugify from "slugify";
export default {
name: 'WorkExperienceBlock',
props: {
workExpTotal: {
type: String,
required: true
},
workExpByProf: {
type: String,
required: true
},
title: {
type: String,
required: true
},
},
methods: {
generateSlug(text) {
return slugify(text, {
lower: true,
strict: true,
locale: "ru",
});
},
}
}
</script>
<style scoped>
/* Добавьте стили, если это необходимо */
</style>
@@ -0,0 +1,40 @@
<!-- NavLink.vue -->
<template>
<a :class="linkClass"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
:href="href">
{{ label }}
</a>
</template>
<script>
export default {
name: 'PersonNavLink',
props: {
label: {
type: String,
required: true
},
href: {
type: String,
required: true
},
isActive: {
type: Boolean,
default: false
}
},
computed: {
linkClass() {
return {
'translate-x-2 text-[#135aae]': this.isActive,
'bg-transperant text-gray-600 hover:text-gray-900': !this.isActive
};
}
}
}
</script>
<style scoped>
/* Добавьте стили, если это необходимо */
</style>
+37 -212
View File
@@ -8,90 +8,13 @@
<main class="flex-grow"> <main class="flex-grow">
<div class="relative mb-auto mx-auto mt-[67px] max-w-screen-xl px-4 py-10 md:flex md:flex-row md:py-10"> <div class="relative mb-auto mx-auto mt-[67px] max-w-screen-xl px-4 py-10 md:flex md:flex-row md:py-10">
<div class="w-full h-[67px] fixed pointer-events-none" id="visor"></div> <PageNavigateLinks :header-navs="headerNavs" />
<nav class="order-last hidden w-56 shrink-0 lg:block">
<div class="sticky top-[110px] h-[calc(100vh-110px)]">
<div class="text-gray-1000 mb-2 text-md font-medium">На этой странице</div>
<ul class="styled-scrollbar max-h-[70vh] space-y-1.5 overflow-y-auto py-2 text-sm">
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'education', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'education' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#education">Образование
</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'awards', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'awards' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#awards">Награды</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'professionalRetraining', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'professionalRetraining' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#professionalRetraining">Профессиональная переподготовка
</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'professionalDevelopment', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'professionalDevelopment' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#professionalDevelopment">Повышение квалификации
</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'professDisciplines', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'professDisciplines' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#professDisciplines">Преподаваемые дисциплины
</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'workExperience', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'workExperience' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#workExperience">Стаж работы
</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'attendedConferences', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'attendedConferences' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#attendedConferences">Участие в конференциях
</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'participationScienceProjects', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'participationScienceProjects' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#participationScienceProjects">Участие в научных проектах
</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'publications', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'publications' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#publications">Публикации
</a>
</li>
<li class="anchor-li">
<a :class="{ 'translate-x-2 text-[#135aae]' : currentNavSection === 'other', 'bg-transperant text-gray-600 hover:text-gray-900' : currentNavSection !== 'other' }"
class="duration-150 block py-1 px-2 leading-[1.6] rounded-md"
href="#other">Другое
</a>
</li>
<transition name="fade">
<li class="anchor-li flex items-center py-2 border-t" v-if="scrollTop" @click.prevent="scrollToTop">
<button class="bg-transperant text-gray-600 cursor-pointer hover:text-gray-900 duration-300 block px-2 leading-[1.6] rounded-md">К началу</button>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-[17px] text-gray-600">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 11.25l-3-3m0 0l-3 3m3-3v7.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</li>
</transition>
</ul>
</div>
</nav>
<section class="w-full min-w-0 mt-1 max-w-6xl px-1 md:px-6" style=""> <section class="w-full min-w-0 mt-1 max-w-6xl px-1 md:px-6" style="">
<div class="w-full mx-auto sm:px-6 lg:px-8"> <div class="w-full mx-auto sm:px-6 lg:px-8">
<PersonBreadcrumbs class="mb-4" :person-name="person.data.name" /> <PersonBreadcrumbs class="mb-4" :person-name="person.data.name" />
<!-- Profile -->
<div class="flex items-center gap-x-10 gap-y-4 flex-wrap"> <div class="flex items-center gap-x-10 gap-y-4 flex-wrap">
<PersonAvatarBlock :photo="person.data.details.photo" /> <PersonAvatarBlock :photo="person.data.details.photo" />
<div class="grow"> <div class="grow">
@@ -146,167 +69,46 @@
</div> </div>
</div> </div>
<!-- End Profile -->
<div class="mt-10 sm:mt-14"> <div class="mt-10 sm:mt-14">
<h2 id="education" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <EducationBlock v-if="person.data.details.education.length > 0" title="Направление подготовки" :educations="person.data.details.education" />
Направление подготовки
</h2>
<div class="grid grid-cols-1 sm:grid-cols-1 gap-3">
<div class="p-4 border border-gray-200 rounded-lg dark:border-neutral-700">
<h3 class="mb-1 text-xs text-gray-600 dark:text-neutral-400">
2012 - 2013
</h3>
<p class="font-semibold text-sm text-gray-800 dark:text-neutral-200">
{{ person.data.details.education }}
</p>
<p class="mt-1 text-sm text-gray-600 dark:text-neutral-400">
The University of Manchester
</p>
</div>
</div>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<h2 id="awards" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <ListBlock v-if="person.data.details.awards.length > 0" name-list="Награды" :list="person.data.details.awards" />
Награды
</h2>
<ul class="list-disc ms-6 mt-3 space-y-1.5">
<template v-for="award in person.data.details.awards">
<li class="ps-1 text-sm text-gray-600 dark:text-neutral-400">
{{ award.item }}
</li>
</template>
</ul>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<h2 id="professionalRetraining" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <ListBlock v-if="person.data.details.professionalRetraining.length > 0" name-list="Профессиональная переподготовка" :list="person.data.details.professionalRetraining" />
Профессиональная переподготовка
</h2>
<ul class="list-disc ms-6 mt-3 space-y-1.5">
<template v-for="professionalRetraining in person.data.details.professionalRetraining">
<li class="ps-1 text-sm text-gray-600 dark:text-neutral-400">
{{ professionalRetraining.item }}
</li>
</template>
</ul>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<h2 id="professionalDevelopment" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <ListBlock v-if="person.data.details.professionalDevelopment.length > 0" name-list="Повышение квалификации" :list="person.data.details.professionalDevelopment" />
Повышение квалификации
</h2>
<ul class="list-disc ms-6 mt-3 space-y-1.5">
<template v-for="professionalDevelopment in person.data.details.professionalDevelopment">
<li class="ps-1 text-sm text-gray-600 dark:text-neutral-400">
{{ professionalDevelopment.item }}
</li>
</template>
</ul>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<h2 id="professDisciplines" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <ListBlock v-if="person.data.details.professDisciplines.length > 0" name-list="Преподаваемые дисциплины" :list="person.data.details.professDisciplines" />
Преподаваемые дисциплины
</h2>
<ul class="list-disc ms-6 mt-3 space-y-1.5">
<template v-for="professDiscipline in person.data.details.professDisciplines">
<li class="ps-1 text-sm text-gray-600 dark:text-neutral-400">
{{ professDiscipline.item }}
</li>
</template>
</ul>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<h2 id="workExperience" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <WorkExperienceBlock v-if="person.data.details.workExperience" title="Стаж" :work-exp-by-prof="person.data.details.workExperience.byProf" :work-exp-total="person.data.details.workExperience.total" />
Стаж
</h2>
<div class="grid grid-cols-1 sm:grid-cols-1 gap-3">
<p class="mt-1 text-sm text-gray-600 dark:text-neutral-400">
Стаж работы: {{ person.data.details.workExperience }}
</p>
<p class="mt-1 text-sm text-gray-600 dark:text-neutral-400">
Стаж по специальности: {{ person.data.details.workExperience }}
</p>
</div>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<h2 id="attendedConferences" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <ListBlock v-if="person.data.details.attendedConferences.length > 0" name-list="Участие в конференциях" :list="person.data.details.attendedConferences" />
Участие в конференциях
</h2>
<ul class="list-disc ms-6 mt-3 space-y-1.5">
<template v-for="attendedConference in person.data.details.attendedConferences">
<li class="ps-1 text-sm text-gray-600 dark:text-neutral-400">
{{ attendedConference.item }}
</li>
</template>
</ul>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<h2 id="participationScienceProjects" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <ListBlock v-if="person.data.details.participationScienceProjects.length > 0" name-list="Участие в научных проектах" :list="person.data.details.participationScienceProjects" />
Участие в научных проектах
</h2>
<ul class="list-disc ms-6 mt-3 space-y-1.5">
<template v-for="participationScienceProject in person.data.details.participationScienceProjects">
<li class="ps-1 text-sm text-gray-600 dark:text-neutral-400">
{{ participationScienceProject.item }}
</li>
</template>
</ul>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<h2 id="publications" class="mb-3 font-medium text-gray-800 dark:text-neutral-200"> <ListBlock v-if="person.data.details.publications.length > 0" name-list="Публикации" :list="person.data.details.publications" />
Публикации
</h2>
<ul class="list-disc ms-6 mt-3 space-y-1.5">
<template v-for="publication in person.data.details.publications">
<li class="ps-1 text-sm text-gray-600 dark:text-neutral-400">
{{ publication.item }}
</li>
</template>
</ul>
</div> </div>
<div class="mt-8">
<OtherBlock name-list="Другое" :blocks="person.data.details.other" />
</div>
<!-- About -->
<!-- End About -->
<!-- Projects -->
<!-- End Projects -->
<!-- Testimonials -->
<!-- End Testimonials -->
<!-- Skills -->
<!-- End Skills -->
<!-- Work Experience -->
<!-- End Work Experience -->
<!-- Education -->
<!-- End Education -->
<!-- Articles -->
<!-- End Articles -->
<!-- Subscribe -->
<!-- End Subscribe -->
</div> </div>
</section> </section>
</div> </div>
@@ -332,6 +134,12 @@ import MainPageNavBar from "@/Navbars/MainPageNavbar.vue";
import AppHead from "@/Components/AppHead.vue"; import AppHead from "@/Components/AppHead.vue";
import PersonBreadcrumbs from "@/Components/BuilderUi/Persons/PersonBreadcrumbs.vue"; import PersonBreadcrumbs from "@/Components/BuilderUi/Persons/PersonBreadcrumbs.vue";
import PersonAvatarBlock from "@/Components/BuilderUi/Persons/PersonAvatarBlock.vue"; import PersonAvatarBlock from "@/Components/BuilderUi/Persons/PersonAvatarBlock.vue";
import PersonNavLink from "@/Components/BuilderUi/Persons/PersonNavLink.vue";
import PageNavigateLinks from "@/Components/BuilderUi/Pages/PageNavigateLinks.vue";
import EducationBlock from "@/Components/BuilderUi/Persons/Blocks/EducationBlock.vue";
import ListBlock from "@/Components/BuilderUi/Persons/Blocks/ListBlock.vue";
import WorkExperienceBlock from "@/Components/BuilderUi/Persons/Blocks/WorkExperienceBlock.vue";
import OtherBlock from "@/Components/BuilderUi/Persons/Blocks/OtherBlock.vue";
export default { export default {
@@ -340,6 +148,7 @@ export default {
return { return {
scrollTop: false, scrollTop: false,
currentNavSection: null, currentNavSection: null,
headerNavs: []
} }
}, },
@@ -353,6 +162,12 @@ export default {
}, },
components: { components: {
OtherBlock,
WorkExperienceBlock,
ListBlock,
EducationBlock,
PageNavigateLinks,
PersonNavLink,
PersonAvatarBlock, PersonAvatarBlock,
PersonBreadcrumbs, PersonBreadcrumbs,
AppHead, AppHead,
@@ -427,10 +242,20 @@ export default {
scrollToTop() { scrollToTop() {
window.scrollTo(0, 0) window.scrollTo(0, 0)
}, },
extractH2Headers() {
const h2Elements = document.querySelectorAll('h2'); // выбираем все h2 на странице
this.headerNavs = Array.from(h2Elements).map(h2 => ({
id: h2.id, // id заголовка
text: h2.textContent // содержимое заголовка
}));
}
}, },
mounted() { mounted() {
this.extractH2Headers();
window.addEventListener("scroll", this.onScroll) window.addEventListener("scroll", this.onScroll)