From 7255bb3c5a9c3aa980b9e7cd63fb1b6788645205 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Mon, 31 Mar 2025 17:33:54 +0800 Subject: [PATCH] fix --- dimensionhub/Views/IndexView.swift | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dimensionhub/Views/IndexView.swift b/dimensionhub/Views/IndexView.swift index 5d5bb69..7fff574 100644 --- a/dimensionhub/Views/IndexView.swift +++ b/dimensionhub/Views/IndexView.swift @@ -57,7 +57,7 @@ final class IndexModel { var follow_num: String = "0" // 用来显示固定栏目的group_name - var fixedGroupName: String = "" + var fixedDramaGroup: UpdateDramaGroup? = nil @ObservationIgnored private var isLoaded = false @@ -78,6 +78,7 @@ final class IndexModel { print("index load data get error_code: \(code), message: \(message)") case .result(let result): self.updateDramaGroups = result.update_dramas + self.fixedDramaGroup = result.update_dramas.first self.follow_num = result.follow_num >= 100 ? "99+" : "\(result.follow_num)" } self.isLoaded = true @@ -381,12 +382,16 @@ extension IndexView { HStack { Text("🔍") Spacer() - Text(indexModel.fixedGroupName) - .font(.system(size: 18)) - .fontWeight(.regular) - .onTapGesture { - print("call me here") - } + if let fixedDramaGroup = indexModel.fixedDramaGroup { + Text(fixedDramaGroup.group_name) + .font(.system(size: 18)) + .fontWeight(.regular) + .onTapGesture { + selectGroupId = fixedDramaGroup.group_id + indexModel.selectedDate = fixedDramaGroup.group_id + showDateNavPopover = true + } + } } .padding(8) .background(.white) @@ -431,7 +436,7 @@ extension IndexView { geometry in Color.clear.onChange(of: geometry.frame(in: .named("indexScrollView")).minY) {_, y in if abs(y) <= 5 { - model.fixedGroupName = group.group_name + model.fixedDramaGroup = group } } })