|
|
@@ -3,11 +3,13 @@
|
|
|
namespace App\Filament\Pages;
|
|
|
|
|
|
use App\Services\QuestionServiceApi;
|
|
|
+use App\Services\QuestionBankService;
|
|
|
use BackedEnum;
|
|
|
use Filament\Notifications\Notification;
|
|
|
use Filament\Pages\Page;
|
|
|
use UnitEnum;
|
|
|
use Livewire\Attributes\Computed;
|
|
|
+use Illuminate\Support\Facades\Cache;
|
|
|
|
|
|
class QuestionManagement extends Page
|
|
|
{
|
|
|
@@ -73,12 +75,18 @@ class QuestionManagement extends Page
|
|
|
public function deleteQuestion(string $questionCode): void
|
|
|
{
|
|
|
try {
|
|
|
- $service = app(QuestionBankService::class);
|
|
|
+ $service = app(\App\Services\QuestionBankService::class);
|
|
|
$result = $service->deleteQuestion($questionCode);
|
|
|
|
|
|
if ($result) {
|
|
|
Notification::make()->title('删除成功')->body("题目 {$questionCode} 已删除")->success()->send();
|
|
|
- $this->dispatch('refresh-page');
|
|
|
+
|
|
|
+ // 清除所有缓存,确保页面刷新
|
|
|
+ Cache::flush();
|
|
|
+
|
|
|
+ // 重新加载页面数据
|
|
|
+ $this->dispatch('$refresh');
|
|
|
+
|
|
|
} else {
|
|
|
Notification::make()->title('删除失败')->body("题目 {$questionCode} 不存在或已被删除")->warning()->send();
|
|
|
}
|