From 0d81965cc853399c91f812d8645d54b8cbbccb91 Mon Sep 17 00:00:00 2001 From: sunhao Date: Wed, 4 Sep 2024 11:45:58 +0800 Subject: [PATCH] * [refac] refactor. --- module/tutorial/ui/index.html.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/module/tutorial/ui/index.html.php b/module/tutorial/ui/index.html.php index 8c4d850dcd..95f2a5dadc 100644 --- a/module/tutorial/ui/index.html.php +++ b/module/tutorial/ui/index.html.php @@ -15,6 +15,7 @@ set::zui(true); /* 将所有教程按类型进行分组。Grouped all guides by type. */ $groupedGuides = array(); +$currentType = 'starter'; // 当前选中的类型。Current active type. foreach($guides as $guideName => $guide) { $taskIndex = 0; @@ -31,20 +32,8 @@ foreach($guides as $guideName => $guide) $guide->tasks[$tasID] = $task; } $groupedGuides[$guide->type][$guideName] = $guide; -} -/* 当前选中的类型。Current active type. */ -$currentType = 'starter'; -if($currentTask) -{ - foreach($guides as $guide) - { - if($currentTask === $guide->name || str_starts_with($currentTask, "$guide->name.")) - { - $currentType = $guide->type; - break; - } - } + if($currentTask === $guideName || str_starts_with($currentTask, "$guideName.")) $currentType = $guide->type; } $buildStepItem = function(array $step, int $index)