fix
This commit is contained in:
parent
276ab30a07
commit
c9bc301604
@ -5,6 +5,7 @@
|
||||
// Created by 安礼成 on 2025/2/19.
|
||||
//
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct API {
|
||||
|
||||
@ -44,9 +45,14 @@ struct API {
|
||||
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
||||
|
||||
// Convert parameters to JSON data
|
||||
let parameters: [String:String] = [
|
||||
let parameters: [String:Any] = [
|
||||
"user_id": userId,
|
||||
"token": token
|
||||
"token": token,
|
||||
"info": [
|
||||
"version": await UIDevice.current.systemVersion,
|
||||
"lang": NSLocale.preferredLanguages.first ?? "",
|
||||
"vendorId": await UIDevice.current.identifierForVendor?.uuidString ?? ""
|
||||
]
|
||||
]
|
||||
let jsonData = try! JSONSerialization.data(withJSONObject: parameters, options: [])
|
||||
request.httpBody = jsonData
|
||||
|
||||
@ -65,9 +65,6 @@ final class IndexModel {
|
||||
// 转换后的数据, 方便在一次循环中展示数据
|
||||
var dramaGroupElements: [GroupElement] = []
|
||||
|
||||
// 判断GroupLabel的显示方式
|
||||
var showFloatGroupLabel: Bool = false
|
||||
|
||||
var follow_num: String = "0"
|
||||
|
||||
// 用来显示固定栏目的group_name
|
||||
@ -130,7 +127,7 @@ final class IndexModel {
|
||||
func offsetChanged(offset: Double) {
|
||||
// 判断当前的offset在那个视图所在的区间
|
||||
var rangeGroupId: String? = nil
|
||||
let (spacing, labelHeight, elementHeight) = self.elementHeight
|
||||
let (_, labelHeight, elementHeight) = self.elementHeight
|
||||
|
||||
self.dramaGroupElements.forEach { element in
|
||||
switch element {
|
||||
@ -166,9 +163,9 @@ final class IndexModel {
|
||||
|
||||
await MainActor.run {
|
||||
self.updateDramaGroups = result.update_dramas
|
||||
self.dramaGroupElements = transformUpdateDramaGroups(groups: result.update_dramas)
|
||||
|
||||
self.fixedDramaGroup = result.update_dramas.first
|
||||
|
||||
self.dramaGroupElements = transformUpdateDramaGroups(groups: result.update_dramas)
|
||||
self.follow_num = result.follow_num >= 100 ? "99+" : "\(result.follow_num)"
|
||||
}
|
||||
}
|
||||
@ -217,6 +214,8 @@ final class IndexModel {
|
||||
displayDramaGroups(self.updateDramaGroups, label: "before")
|
||||
await MainActor.run {
|
||||
self.updateDramaGroups = preappendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
|
||||
self.fixedDramaGroup = self.updateDramaGroups.first
|
||||
|
||||
self.dramaGroupElements = transformUpdateDramaGroups(groups: self.updateDramaGroups)
|
||||
}
|
||||
displayDramaGroups(self.updateDramaGroups, label: "after")
|
||||
@ -235,6 +234,8 @@ final class IndexModel {
|
||||
displayDramaGroups(self.updateDramaGroups, label: "before")
|
||||
await MainActor.run {
|
||||
self.updateDramaGroups = appendMergeDramaGroups(groups: self.updateDramaGroups, mergeGroups: groups)
|
||||
self.fixedDramaGroup = self.updateDramaGroups.first
|
||||
|
||||
self.dramaGroupElements = transformUpdateDramaGroups(groups: self.updateDramaGroups)
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,6 @@ struct dimensionhubApp: App {
|
||||
WindowGroup {
|
||||
NavigationStack(path: $appNav.path) {
|
||||
IndexView()
|
||||
//TestView()
|
||||
.navigationDestination(for: AppNavigation.Destination.self) { dest in
|
||||
switch dest {
|
||||
case .detail(id: let id):
|
||||
@ -59,6 +58,7 @@ struct dimensionhubApp: App {
|
||||
.navigationViewStyle(.stack)
|
||||
.tint(.black)
|
||||
.environmentObject(appNav)
|
||||
.preferredColorScheme(.light)
|
||||
}
|
||||
.modelContainer(sharedModelContainer)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user