增加群管理页面
authorliangzhenying <867174124@qq.com>
Thu, 12 Feb 2026 08:35:08 +0000 (16:35 +0800)
committerliangzhenying <867174124@qq.com>
Thu, 12 Feb 2026 08:35:08 +0000 (16:35 +0800)
28 files changed:
ShenYin/ShenYin.xcodeproj/project.pbxproj
ShenYin/ShenYin/Api/HttpClient.swift
ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Contents.json [new file with mode: 0644]
ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Slice 281@2x.png [new file with mode: 0644]
ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Slice 281@3x.png [new file with mode: 0644]
ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Contents.json [new file with mode: 0644]
ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Slice 282@2x.png [new file with mode: 0644]
ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Slice 282@3x.png [new file with mode: 0644]
ShenYin/ShenYin/Cache/UserInfo.swift
ShenYin/ShenYin/Sdk/JoySdk/tool/CCDevice.swift
ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberCell.swift [new file with mode: 0644]
ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberModel.swift [new file with mode: 0644]
ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberVC.swift [new file with mode: 0644]
ShenYin/ShenYin/UI/Sport/Sport/Group/MyGroup/MyGroupView.swift
ShenYin/ShenYin/UI/Sport/Sport/Group/Other/GroupRoleVC.swift
ShenYin/ShenYin/UI/Sport/Sport/Group/add/AddGroupVC.swift
ShenYin/ShenYin/UI/Sport/Sport/Light/LightSetVC.swift
ShenYin/ShenYin/UI/Sport/Sport/Light/ModeView.swift
ShenYin/ShenYin/UI/Sport/Sport/Light/StateView.swift
ShenYin/ShenYin/UI/Sport/Sport/Ready/Navbar.swift
ShenYin/ShenYin/UI/Sport/Sport/Ready/ReadyHeader.swift
ShenYin/ShenYin/UI/Sport/Sport/Ready/ReadyVC.swift
ShenYin/ShenYin/UI/Sport/Sport/Root/SportTypeView.swift
ShenYin/ShenYin/UI/Sport/Sport/SportDetail/SportDetailBoard.swift
ShenYin/ShenYin/UI/Sport/Sport/SportDetail/SportDetailVC.swift
ShenYin/ShenYin/UI/Sport/Sport/Sporting/DetailBoard.swift
ShenYin/ShenYin/UI/Sport/Sport/Sporting/SimpleBoard.swift
ShenYin/ShenYin/UI/Sport/Sport/Tools/SportManager.swift

index a881ca5..edce901 100644 (file)
@@ -17,8 +17,8 @@
                644D1BB5EDD3EA1D77C57786 /* Pods_DeepChordsSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 248D8B53B5A178ACA5867275 /* Pods_DeepChordsSdk.framework */; };
                7666589AAA94A323B6090425 /* Pods_playboy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4F1BB919D567C3B6B0EBAA7 /* Pods_playboy.framework */; };
                7A6613B4B617D6E71D34944C /* Pods_ShenYin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90FF0C8B0D4D6AE0933FA672 /* Pods_ShenYin.framework */; };
-               817510A595D00CAD05E3772C /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
-               F2E449CAD5874BE652A69B50 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
+               817510A595D00CAD05E3772C /* (null) in Frameworks */ = {isa = PBXBuildFile; };
+               F2E449CAD5874BE652A69B50 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
 /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
 
 /* Begin PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
-               3FCC8B152F1E0280004C2A13 /* Exceptions for "ShenYin" folder in "Embed Frameworks" build phase */ = {
+               3FCC8B152F1E0280004C2A13 /* Exceptions for "ShenYin" folder in "Embed Frameworks" phase from "ShenYin" target */ = {
                        isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
+                       attributesByRelativePath = {
+                               Sdk/JoySdk/tool/JoyGemAI.framework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+                       };
                        buildPhase = 3FEFE9092F1B252000D82F17 /* Embed Frameworks */;
                        membershipExceptions = (
                                Sdk/JoySdk/tool/JoyGemAI.framework,
                        );
                };
-               3FCC8B1A2F1E030E004C2A13 /* Exceptions for "ShenYin" folder in "Embed Frameworks" build phase */ = {
+               3FCC8B1A2F1E030E004C2A13 /* Exceptions for "ShenYin" folder in "Embed Frameworks" phase from "playboy" target */ = {
                        isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
+                       attributesByRelativePath = {
+                               Sdk/DcSdk/tool/JLAudioUnitKit.xcframework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+                       };
                        buildPhase = 3FD1DFEF2F0E00BF00A62733 /* Embed Frameworks */;
                        membershipExceptions = (
                                Sdk/DcSdk/tool/JLAudioUnitKit.xcframework,
                        );
                };
-               3FFB77C62F17A11100EF9A60 /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" build phase */ = {
+               3FFB77C62F17A11100EF9A60 /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" phase from "DeepChordsSdk" target */ = {
                        isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
+                       attributesByRelativePath = {
+                               StarburstSdk.framework = (CodeSignOnCopy, RemoveHeadersOnCopy, );
+                       };
                        buildPhase = 3FFB77C52F17A11100EF9A60 /* Embed Frameworks */;
                        membershipExceptions = (
                                StarburstSdk.framework,
                0D54E0F02F0A61E600A80EE7 /* DeepChordsSdk */ = {
                        isa = PBXFileSystemSynchronizedRootGroup;
                        exceptions = (
-                               3FFB77C62F17A11100EF9A60 /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" build phase */,
+                               3FFB77C62F17A11100EF9A60 /* Exceptions for "DeepChordsSdk" folder in "Embed Frameworks" phase from "DeepChordsSdk" target */,
                                3FFB77C82F17A14C00EF9A60 /* Exceptions for "DeepChordsSdk" folder in "playboy" target */,
                        );
                        path = DeepChordsSdk;
                        isa = PBXFileSystemSynchronizedRootGroup;
                        exceptions = (
                                3F887BAE2E38D8DD00C98658 /* Exceptions for "ShenYin" folder in "ShenYin" target */,
-                               3FCC8B152F1E0280004C2A13 /* Exceptions for "ShenYin" folder in "Embed Frameworks" build phase */,
+                               3FCC8B152F1E0280004C2A13 /* Exceptions for "ShenYin" folder in "Embed Frameworks" phase from "ShenYin" target */,
                                3FD1DFF52F0E00BF00A62733 /* Exceptions for "ShenYin" folder in "playboy" target */,
-                               3FCC8B1A2F1E030E004C2A13 /* Exceptions for "ShenYin" folder in "Embed Frameworks" build phase */,
+                               3FCC8B1A2F1E030E004C2A13 /* Exceptions for "ShenYin" folder in "Embed Frameworks" phase from "playboy" target */,
                                3F03696C2F2B604900F3CB95 /* Exceptions for "ShenYin" folder in "playboy copy" target */,
                        );
                        path = ShenYin;
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               F2E449CAD5874BE652A69B50 /* BuildFile in Frameworks */,
+                               F2E449CAD5874BE652A69B50 /* (null) in Frameworks */,
                                7A6613B4B617D6E71D34944C /* Pods_ShenYin.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        buildActionMask = 2147483647;
                        files = (
                                3FFB77C12F179F3100EF9A60 /* DeepChordsSdk.framework in Frameworks */,
-                               817510A595D00CAD05E3772C /* BuildFile in Frameworks */,
+                               817510A595D00CAD05E3772C /* (null) in Frameworks */,
                                30B13DEF1AA0E4C54D873276 /* Pods_playboy.framework in Frameworks */,
                                7666589AAA94A323B6090425 /* Pods_playboy.framework in Frameworks */,
                        );
                        inputFileListPaths = (
                                "${PODS_ROOT}/Target Support Files/Pods-playboy/Pods-playboy-frameworks-${CONFIGURATION}-input-files.xcfilelist",
                        );
+                       inputPaths = (
+                       );
                        name = "[CP] Embed Pods Frameworks";
                        outputFileListPaths = (
                                "${PODS_ROOT}/Target Support Files/Pods-playboy/Pods-playboy-frameworks-${CONFIGURATION}-output-files.xcfilelist",
                        );
+                       outputPaths = (
+                       );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
                        shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-playboy/Pods-playboy-frameworks.sh\"\n";
                        inputFileListPaths = (
                                "${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks-${CONFIGURATION}-input-files.xcfilelist",
                        );
+                       inputPaths = (
+                       );
                        name = "[CP] Embed Pods Frameworks";
                        outputFileListPaths = (
                                "${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks-${CONFIGURATION}-output-files.xcfilelist",
                        );
+                       outputPaths = (
+                       );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
                        shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks.sh\"\n";
                        inputFileListPaths = (
                                "${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-resources-${CONFIGURATION}-input-files.xcfilelist",
                        );
+                       inputPaths = (
+                       );
                        name = "[CP] Copy Pods Resources";
                        outputFileListPaths = (
                                "${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-resources-${CONFIGURATION}-output-files.xcfilelist",
                        );
+                       outputPaths = (
+                       );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
                        shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-resources.sh\"\n";
index c611c63..e976207 100644 (file)
@@ -133,6 +133,13 @@ enum CommomApi
     case getSportGroupList(param:[String:Any])
     /// 申请加入团队
     case applyJoinGroup(param:[String:Any])
+    /// 获取成员列表
+    case getGroupMembers(groupId:String)
+    /// 退出团队
+    case leaveGroup(groupId:String)
+    /// 退出团队
+    case removeMember(param:[String:Any])
+    
 }
 
 // 实现TargetType协议
@@ -298,8 +305,12 @@ extension CommomApi{
             return "/sp/sport-group/list"
         case .applyJoinGroup(let param):
             return "/sp/sport-group/\(param["id"]!)/apply"
-            
-            
+        case .getGroupMembers(let groupId):
+            return "/sp/sport-group/member/\(groupId)"
+        case .leaveGroup(let groupId):
+            return "/sp/sport-group/leave/\(groupId)"
+        case .removeMember(let param):
+            return "/sp/sport-group/member/\(param["groupId"]!)"
         }
     }
     
@@ -309,7 +320,7 @@ extension CommomApi{
             return .post
         case .updatePwd(_),.updateUserInfo(_),.updatePhone(_),.bindPhone(_),.updateEmail(_),.bindDevice(_),.otaUpdateVersion(_),.voiceRecordCollection(_),.updateVoiceRecord(_):
             return .put
-        case .deleteLoginRecord(_),.unbind(_),.deleteVoiceRecord(_):
+        case .deleteLoginRecord(_),.unbind(_),.deleteVoiceRecord(_),.leaveGroup(_),.removeMember(_):
             return .delete
         default:
             return .get
diff --git a/ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Contents.json b/ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Contents.json
new file mode 100644 (file)
index 0000000..07bd4d6
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "Slice 281@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "Slice 281@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Slice 281@2x.png b/ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Slice 281@2x.png
new file mode 100644 (file)
index 0000000..4b3257f
Binary files /dev/null and b/ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Slice 281@2x.png differ
diff --git a/ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Slice 281@3x.png b/ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Slice 281@3x.png
new file mode 100644 (file)
index 0000000..a1a1576
Binary files /dev/null and b/ShenYin/ShenYin/Assets.xcassets/sport/guchuandao_icon.imageset/Slice 281@3x.png differ
diff --git a/ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Contents.json b/ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Contents.json
new file mode 100644 (file)
index 0000000..a245818
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "Slice 282@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "Slice 282@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
diff --git a/ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Slice 282@2x.png b/ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Slice 282@2x.png
new file mode 100644 (file)
index 0000000..d36f251
Binary files /dev/null and b/ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Slice 282@2x.png differ
diff --git a/ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Slice 282@3x.png b/ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Slice 282@3x.png
new file mode 100644 (file)
index 0000000..0d474f9
Binary files /dev/null and b/ShenYin/ShenYin/Assets.xcassets/sport/more.imageset/Slice 282@3x.png differ
index e54c4c2..573c44c 100644 (file)
@@ -30,6 +30,8 @@ class UserInfoRoot:ResponseBaseModel {
 class UserInfo:ResponseBaseModel {
     /// 用户id
     var id = ""
+    /// 用户id
+    var userId = ""
     /// 头像
     var avatar = ""
     /// 昵称
index 00ae57b..b126b36 100644 (file)
@@ -7,7 +7,7 @@
 import JoyGemAI
 class CCDevice{
     static var isJoy = true
-    static var showRaisound = true
+    static var showRaisound = false
     static func initSdk(){
         if CCDevice.isJoy {
             JoySdkManager.shared.setupSdk()
diff --git a/ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberCell.swift b/ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberCell.swift
new file mode 100644 (file)
index 0000000..048f84e
--- /dev/null
@@ -0,0 +1,161 @@
+//
+//  GroupMemberCell.swift
+//  ShenYin
+//
+//  Created by liangshi on 2026/2/12.
+//
+
+class GroupMemberCell: BaseTableViewCell {
+    let bgView = UIView()
+    let icon = UIImageView()
+    let nameLabel = UILabel()
+    let roleType = UIImageView()
+    let roleLabel = UILabel()
+    let moreIcon = UIImageView()
+    let line = UIView()
+    var model:GroupMemberModel!{
+        didSet{
+            icon.kf.setImage(with: model.avatar.yc.asUrl)
+            nameLabel.text =  model.userName
+            roleLabel.text = model.role.name
+            roleType.backgroundColor = model.role.color
+//            moreIcon.isHidden = model.userId != CacheManager.shared.user.info.userId
+        }
+    }
+    
+    
+    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
+        super.init(style: style, reuseIdentifier: reuseIdentifier)
+    }
+    
+    required init?(coder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    override func setupViews() {
+        contentView.addSubview(bgView)
+        bgView.addSubviews([icon,nameLabel,roleLabel,roleType,moreIcon,line])
+        
+        backgroundColor = .color(.bgColor)
+        contentView.backgroundColor = .clear
+        selectionStyle = .none
+        bgView.do { v in
+            v.backgroundColor = .color(.cellBg)
+//            v.yc.setCornerRadius(18)
+        }
+        nameLabel.do { (v) in
+            v.textColor = .color(.first)
+            v.font = .medium(12)
+            v.textAlignment = .left
+            v.lineBreakMode = .byTruncatingTail
+        }
+        roleLabel.do { v in
+            v.textColor = .color(.secondary)
+            v.font = .regular(10)
+            v.textAlignment = .left
+            v.lineBreakMode = .byTruncatingTail
+        }
+        roleType.do { v in
+            v.yc.setCornerRadius(3)
+        }
+        icon.do { v in
+            v.yc.setCornerRadius(18)
+        }
+        moreIcon.do { v in
+            v.image = UIImage(named: "more")
+            v.contentMode = .center
+            v.yc.addTap(target: self, action: #selector(moreAction))
+        }
+        line.do { v in
+            v.backgroundColor = .color(.separateLine)
+        }
+    }
+    
+    override func setupLayout() {
+        bgView.snp.makeConstraints { (m) in
+            m.left.right.equalToSuperview().inset(18)
+            m.top.equalToSuperview()
+            m.bottom.equalToSuperview()
+        }
+        
+        icon.snp.makeConstraints { (m) in
+            m.size.equalTo(36)
+            m.left.equalToSuperview().inset(15)
+            m.top.equalToSuperview().inset(15)
+        }
+        nameLabel.snp.makeConstraints { (m) in
+            m.top.equalToSuperview().inset(16)
+            m.left.equalToSuperview().offset(60)
+            m.right.lessThanOrEqualToSuperview().inset(16)
+        }
+        roleType.snp.makeConstraints { make in
+            make.left.equalTo(nameLabel)
+            make.bottom.equalToSuperview().inset(16)
+            make.width.equalTo(6)
+            make.height.equalTo(10)
+        }
+        roleLabel.snp.makeConstraints { (m) in
+            m.bottom.equalToSuperview().inset(16)
+            m.left.equalToSuperview().offset(77)
+            m.right.lessThanOrEqualToSuperview().inset(16)
+        }
+        moreIcon.snp.makeConstraints { make in
+            make.right.equalToSuperview()
+            make.centerY.equalToSuperview()
+            make.width.equalTo(18+18+5)
+            make.height.equalToSuperview()
+        }
+        line.snp.makeConstraints { make in
+            make.left.right.equalToSuperview().inset(18)
+            make.bottom.equalToSuperview()
+            make.height.equalTo(0.4)
+        }
+    }
+    
+    @objc func moreAction(){
+        let vc = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
+        let action0 = UIAlertAction(title: "团长转让".l10n, style: .default) {[weak self] action in
+            self?.transferGroup()
+        }
+        let action1 = UIAlertAction(title: "移除团队".l10n, style: .default) {[weak self] action in
+            self?.removeFromGroup()
+        }
+        let action2 = UIAlertAction(title: "取消".l10n, style: .cancel) { action in
+            
+        }
+        vc.addAction(action0)
+        vc.addAction(action1)
+        vc.addAction(action2)
+        App.shared.topVC().present(vc, animated: true)
+    }
+    @objc func removeFromGroup(){
+        let vc = UIAlertController(title: "提示".l10n, message: "确认要把TA移出团队吗?".l10n, preferredStyle: .alert)
+        let action0 = UIAlertAction(title: "确定".l10n, style: .destructive) {[weak self] action in
+            self?.removeFromGroup2()
+        }
+        let action1 = UIAlertAction(title: "取消".l10n, style: .cancel) {[weak self] action in
+        }
+        
+        vc.addAction(action0)
+        vc.addAction(action1)
+        App.shared.topVC().present(vc, animated: true)
+    }
+    @objc func removeFromGroup2(){
+        
+    }
+    
+    @objc func transferGroup(){
+        let vc = UIAlertController(title: "提示".l10n, message: "确认要把团长转让给TA吗?".l10n, preferredStyle: .alert)
+        let action0 = UIAlertAction(title: "确定".l10n, style: .destructive) {[weak self] action in
+            self?.transferGroup2()
+        }
+        let action1 = UIAlertAction(title: "取消".l10n, style: .cancel) {[weak self] action in
+        }
+
+        vc.addAction(action0)
+        vc.addAction(action1)
+        App.shared.topVC().present(vc, animated: true)
+    }
+    @objc func transferGroup2(){
+
+    }
+}
diff --git a/ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberModel.swift b/ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberModel.swift
new file mode 100644 (file)
index 0000000..6552a48
--- /dev/null
@@ -0,0 +1,21 @@
+//
+//  GroupMemberModel.swift
+//  ShenYin
+//
+//  Created by liangshi on 2026/2/12.
+//
+
+import HandyJSON
+
+class GroupMemberModelRoot:ResponseBaseModel {
+    var data = [GroupMemberModel]()
+}
+
+class GroupMemberModel:HandyJSON {
+    var userId = ""/// 用户ID
+    var userName = "" /// 用户名
+    var role:GroupRoleType = .bjy /// 角色名
+    var avatar = "" /// 头像
+
+    required public init() { }
+}
diff --git a/ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberVC.swift b/ShenYin/ShenYin/UI/Sport/Sport/Group/Member/GroupMemberVC.swift
new file mode 100644 (file)
index 0000000..74b7740
--- /dev/null
@@ -0,0 +1,114 @@
+//
+//  GroupMemberVC.swift
+//  ShenYin
+//
+//  Created by liangshi on 2026/2/12.
+//
+
+import UIKit
+
+class GroupMemberVC: BaseVC{
+    let tableView = UITableView(frame: .zero, style: .plain)
+    var list:[GroupMemberModel] = []
+    var currentType = GroupRoleType.none
+    let btn = CustomButton()
+    var groupId = ""
+    
+    
+    init(groupId:String) {
+        self.groupId = groupId
+        super.init()
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do any additional setup after loading the view.
+    }
+    override func setupViews() {
+        navBar.do { v in
+            v.title = "成员管理".l10n
+//            v.rightView.setImage(UIImage(named: "help_icon"), for: .normal)
+//            v.rightView.isHidden = false
+        }
+        
+        tableView.do { v in
+            v.backgroundColor = .clear
+            v.delegate = self
+            v.dataSource = self
+            v.rowHeight = 68
+            v.separatorStyle = .none
+            v.contentInset = UIEdgeInsets(top: 10, left: 0, bottom: 0, right: 0)
+            v.register(GroupMemberCell.self, forCellReuseIdentifier: GroupMemberCell.reuseID)
+            
+            let header = UIView(frame: CGRect(x: 0, y: 0, width: kScreenWid, height: 40))
+            let label = UILabel(frame: CGRect(x: 18, y: 0, width: kScreenWid - 36, height: 40))
+            label.do { v in
+                v.text = "成员列表".l10n
+                v.font = .regular(14)
+                v.textColor = .color(.secondary)
+            }
+            header.addSubview(label)
+            v.tableHeaderView = header
+        }
+        view.addSubviews([tableView,btn])
+        
+        btn.set(title: "邀请".l10n, target: self, action: #selector(btnAction))
+    }
+    override func setupLayout() {
+        tableView.snp.makeConstraints { make in
+            make.left.right.bottom.equalToSuperview()
+            make.top.equalTo(kNavBtm)
+        }
+        btn.snp.makeConstraints { make in
+            make.width.equalTo(272)
+            make.height.equalTo(46)
+            make.centerX.equalToSuperview()
+            make.bottom.equalToSuperview().inset(82)
+        }
+    }
+    override func setupData() {
+        let api = CommomApi.getGroupMembers(groupId: self.groupId)
+        HttpClient.request(api) {[weak self] (model:GroupMemberModelRoot,res) in
+            guard let self = self else {return}
+            if model.isSuccess{
+                list = model.data
+            }
+            tableView.reloadData()
+            tableView.mj_header?.endRefreshing()
+        }
+    }
+    @objc func btnAction(){
+
+    }
+    override func navRightViewTapped() {
+
+    }
+}
+
+extension GroupMemberVC:UITableViewDelegate,UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return list.count
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        let cell = GroupMemberCell.cell(withTableView: tableView, indexPath: indexPath)
+        cell.model = list[indexPath.row]
+        let rect = CGRect(x: 0, y: 0, width: kScreenWid - 36, height: 68)
+        if indexPath.row == 0 {
+            cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 8, height: 8))
+        }
+        else if indexPath.row == list.count - 1{
+            cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.bottomLeft,.bottomRight], cornerRadii: CGSize(width: 8, height: 8))
+        }
+        else{
+            cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.allCorners], cornerRadii: CGSize(width: 0, height: 0))
+        }
+        if list.count == 1 {
+            cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.allCorners], cornerRadii: CGSize(width: 8, height: 8))
+        }
+        return cell
+    }
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+
+    }
+}
index 9cbc484..facf9cb 100644 (file)
@@ -71,6 +71,8 @@ class MyGroupView: BaseView,UITableViewDelegate,UITableViewDataSource {
             return cell
         }
         func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+            let vc = GroupMemberVC(groupId: list[indexPath.row].id)
+            App.shared.goToPage(vc)
         }
 
 }
index 7661102..613860a 100644 (file)
@@ -84,7 +84,7 @@ class GroupRoleVC: BaseVC{
     }
     override func setupViews() {
         navBar.do { v in
-            v.title = "团队类型".l10n
+            v.title = "我的团队角色".l10n
             v.rightView.setImage(UIImage(named: "help_icon"), for: .normal)
             v.rightView.isHidden = false
         }
@@ -97,6 +97,16 @@ class GroupRoleVC: BaseVC{
             v.separatorStyle = .none
             v.contentInset = UIEdgeInsets(top: 10, left: 0, bottom: 0, right: 0)
             v.register(RoleCell.self, forCellReuseIdentifier: RoleCell.reuseID)
+            
+            let header = UIView(frame: CGRect(x: 0, y: 0, width: kScreenWid, height: 40))
+            let label = UILabel(frame: CGRect(x: 18, y: 0, width: kScreenWid - 36, height: 40))
+            label.do { v in
+                v.text = "我的团队-团队设置-骑行团队角色".l10n
+                v.font = .regular(14)
+                v.textColor = .color(.secondary)
+            }
+            header.addSubview(label)
+            v.tableHeaderView = header
         }
         view.addSubviews([tableView,btn])
         
index 89046c7..162abd2 100644 (file)
@@ -22,7 +22,7 @@ class AddGroupVC: BaseVC{
         nameView.do { v in
             v.yc.setCornerRadius(12)
             v.titleLabel.text = "团队号".l10n
-            v.textField.text = "2019706199229804545"
+            v.textField.text = "2019681970232963074"
             v.textField.attributedPlaceholder = NSAttributedString(string: "请输入团队号".l10n, attributes: [NSAttributedString.Key.foregroundColor: UIColor.color(.placeholder)])
             
         }
@@ -90,7 +90,7 @@ class AddGroupVC: BaseVC{
                 YLprogressHUD.hidden()
             }
             else{
-                YLprogressHUD.showAutoHiden("请求失败".l10n)
+                YLprogressHUD.showAutoHiden(model.msg)
             }
         }
     }
index aa4eaee..2fb42fd 100644 (file)
@@ -27,7 +27,7 @@ class LightSetVC: BaseVC{
             v.title = "灯带设置".l10n
             v.titleLabel.textColor = .white
             v.backgroundColor = .clear
-            v.leftView.setImage(UIImage(named: "arrow_left_1"), for: .normal)
+            v.leftView.setImage(UIImage(named: "arrow_back_white"), for: .normal)
         }
         view.backgroundColor = .rgb(0x1F1F1F)
         view.addSubviews([bgView])
@@ -37,11 +37,11 @@ class LightSetVC: BaseVC{
             v.backgroundColor = .clear
         }
         icon.do { v in
-            v.backgroundColor = .lightGray
+            v.image = UIImage(named: "guchuandao_icon")
         }
         stateView.do { v in
             v.iSwitch.addTarget(self, action: #selector(stateAction), for: .valueChanged)
-
+            v.titleLabel.text = "灯带".l10n
         }
         modelView.do { v in
         }
@@ -50,7 +50,9 @@ class LightSetVC: BaseVC{
         }
         sysView.do { v in
             v.line.isHidden = true
+            v.titleLabel.text = "同步至队员".l10n
         }
+        stateAction()
     }
     override func setupLayout() {
 
@@ -61,14 +63,15 @@ class LightSetVC: BaseVC{
             make.height.equalTo(kScreenHei - kNavBtm)
         }
         icon.snp.makeConstraints { make in
-            make.height.equalTo(263.fitR)
-            make.width.equalTo(kScreenWid)
-            make.left.top.equalToSuperview()
+            make.height.equalTo(130.fitR)
+            make.width.equalTo(220.fitR)
+            make.centerX.equalToSuperview()
+            make.top.equalToSuperview().inset(40)
         }
         stateView.snp.makeConstraints { make in
             make.width.equalTo(kScreenWid)
             make.height.equalTo(60)
-            make.top.equalTo(icon.snp.bottom).offset(0)
+            make.top.equalTo(icon.snp.bottom).offset(35)
             make.left.equalToSuperview()
         }
         modelView.snp.makeConstraints { make in
index 81e393d..f6f5a06 100644 (file)
@@ -33,6 +33,18 @@ extension LightSetVC{
         var isOk:Bool{
             return normalItem.isSelected || breathItem.isSelected || flashItem.isSelected
         }
+        var mode:LightMode?{
+            if normalItem.isSelected {
+                return .normal
+            }
+            if breathItem.isSelected {
+                return .breath
+            }
+            if flashItem.isSelected {
+                return .flash
+            }
+            return nil
+        }
 
         
         override func setupViews() {
@@ -49,6 +61,7 @@ extension LightSetVC{
                 v.mode = .normal
                 v.yc.setCornerRadius(8)
                 v.yc.addTap(target: self, action: #selector(normalAction))
+                v.isSelected = true
             }
             breathItem.do { v in
                 v.mode = .breath
index fead556..66a1d90 100644 (file)
@@ -19,11 +19,11 @@ extension LightSetVC{
                 v.textColor = .white
                 v.font = .bold(14)
                 v.textAlignment = .left
-                v.text = "灯带".l10n
             }
            
             iSwitch.do { v in
                 //            v.backgroundColor = .red
+                v.isOn = true
             }
            
             line.do { v in
index 5b0aa0c..d076f38 100644 (file)
@@ -20,7 +20,7 @@ extension ReadyVC{
             backgroundColor = .color(.bgColor)
             addSubviews([backItem,icon,groupBtn,setBtn])
             backItem.do { v in
-                v.titleLabel.text = SportManager.shared.sortType.name
+                v.titleLabel.text = SportManager.shared.sportType.name
                 v.yc.addTap(target: self, action: #selector(backAction))
             }
             icon.do { v in
index 4b8fbbd..abbc129 100644 (file)
@@ -20,7 +20,7 @@ extension ReadyVC{
             typeLabel.do { v in
                 v.textColor = .color(.secondary)
                 v.font = .regular(12)
-                v.text = SportManager.shared.sortType.readyText
+                v.text = SportManager.shared.sportType.readyText
                 v.textAlignment = .left
             }
             totalLabel.do { v in
index 6c0434f..85710bc 100644 (file)
@@ -30,7 +30,7 @@ class ReadyVC: BaseVC {
             v.backgroundColor = .white
         }
         mapView.do { v in
-            v.backgroundColor = .green
+//            v.backgroundColor = .white
             
         }
         footerView.do { v in
index deef027..3ca5d5f 100644 (file)
@@ -87,15 +87,15 @@ class SportTypeView: BaseView {
         }
     }
     @objc func runAction(){
-        SportManager.shared.sortType = .run
+        SportManager.shared.sportType = .run
         App.shared.goToPage(ReadyVC())
     }
     @objc func rideAction(){
-        SportManager.shared.sortType = .ride
+        SportManager.shared.sportType = .ride
         App.shared.goToPage(ReadyVC())
     }
     @objc func walkAction(){
-        SportManager.shared.sortType = .walk
+        SportManager.shared.sportType = .walk
         App.shared.goToPage(ReadyVC())
     }
 }
index fc5eaa7..bf12602 100644 (file)
@@ -10,158 +10,300 @@ import UIKit
 extension SportDetailVC{
     class SportDetailBoard: BaseView {
         let topIcon = UIImageView()
-        let header = headerItem()
-        let distanceItem = LabelItem()
-        let durationItem = LabelItem()
-        let speedItem = LabelItem()
-        let calorieItem = LabelItem()
-        let stepItem = LabelItem()
-        
+        let header = UILabel()
+        let distanceItem = DistanceItem()
+        let item1 = LabelItem()
+        let item2 = LabelItem()
+        let item3 = LabelItem()
+        let item4 = LabelItem()
+        let item5 = LabelItem()
+        let item6 = LabelItem()
+        let item7 = LabelItem()
+        let item8 = LabelItem()
+        let item9 = LabelItem()
+        func updateUI(){
+            if SportManager.shared.sportType == .walk{
+                header.do { v in
+                    v.text = "健走".l10n
+                }
+                distanceItem.do { v in
+                    v.title = "1.2"
+                }
+                item1.do { v in
+                    v.title = "00:00:00"
+                    v.detail = "时长".l10n
+                }
+                item2.do { v in
+                    v.title = "8'26\""
+                    v.detail = "平均配速".l10n
+                }
+                item3.do { v in
+                    v.title = "300"
+                    v.detail = "运动消耗".l10n
+                }
+                item4.do { v in
+                    v.title = "1200"
+                    v.detail = "步数".l10n
+                }
+                item5.do { v in
+                    v.title = "00:00:00"
+                    v.detail = "平均步幅".l10n
+                }
+                item6.do { v in
+                    v.title = "8'26\""
+                    v.detail = "平均步频".l10n
+                }
+                item7.do { v in
+                    v.title = "300"
+                    v.detail = "积累爬升".l10n
+                }
+                item8.do { v in
+                    v.title = "1200"
+                    v.detail = "积累下降".l10n
+                }
+                item9.do { v in
+                    v.title = "1200"
+                    v.detail = "积累下降".l10n
+                }
+            }
+            else if  SportManager.shared.sportType == .run{
+                header.do { v in
+                    v.text = "户外跑步".l10n
+                }
+                distanceItem.do { v in
+                    v.title = "1.2"
+                }
+                item1.do { v in
+                    v.title = "00:00:00"
+                    v.detail = "时长".l10n
+                }
+                item2.do { v in
+                    v.title = "8'26\""
+                    v.detail = "平均配速".l10n
+                }
+                item3.do { v in
+                    v.title = "300"
+                    v.detail = "运动消耗".l10n
+                }
+                item4.do { v in
+                    v.title = "1200"
+                    v.detail = "步数".l10n
+                }
+                item5.do { v in
+                    v.title = "00:00:00"
+                    v.detail = "平均步幅".l10n
+                }
+                item6.do { v in
+                    v.title = "8'26\""
+                    v.detail = "平均步频".l10n
+                }
+                item7.do { v in
+                    v.title = "300"
+                    v.detail = "积累爬升".l10n
+                }
+                item8.do { v in
+                    v.title = "1200"
+                    v.detail = "积累下降".l10n
+                }
+                item9.do { v in
+                    v.title = "1200"
+                    v.detail = "积累下降".l10n
+                }
+            }
+            else if  SportManager.shared.sportType == .ride{
+                header.do { v in
+                    v.text = "户外骑行".l10n
+                }
+                distanceItem.do { v in
+                    v.title = "1.2"
+                }
+                item1.do { v in
+                    v.title = "00:00:00"
+                    v.detail = "时长".l10n
+                }
+                item2.do { v in
+                    v.title = "8'26\""
+                    v.detail = "平均配速".l10n
+                }
+                item3.do { v in
+                    v.title = "300"
+                    v.detail = "运动消耗".l10n
+                }
+                item4.do { v in
+                    v.title = "1200"
+                    v.detail = "步数".l10n
+                }
+                item5.do { v in
+                    v.title = "100"
+                    v.detail = "平均步幅".l10n
+                }
+                item6.do { v in
+                    v.title = "8'26\""
+                    v.detail = "平均步频".l10n
+                }
+                item7.do { v in
+                    v.title = "300"
+                    v.detail = "积累爬升".l10n
+                }
+                item8.do { v in
+                    v.title = "1200"
+                    v.detail = "积累下降".l10n
+                }
+                item9.do { v in
+                    v.title = "1200"
+                    v.detail = "积累下降".l10n
+                }
+            }
+        }
         override func setupViews() {
             backgroundColor = .white
-            addSubviews([topIcon,header,distanceItem,durationItem,speedItem,calorieItem,stepItem])
+            addSubviews([topIcon,header,distanceItem,item1,item2,item3,item4,item5,item6,item7,item8,item9])
             topIcon.do { v in
                 v.backgroundColor = .color(.secondary)
-                v.yc.setCornerRadius(2)
-            }
-            distanceItem.do { v in
-                v.titleLabel.text = "0"
-                v.detailLabel.text = "总距离".l10n
-            }
-            durationItem.do { v in
-                v.titleLabel.text = "00:00:00"
-                v.detailLabel.text = "总时长".l10n
-            }
-            speedItem.do { v in
-                v.titleLabel.text = "8'26\""
-                v.detailLabel.text = "配速".l10n
+                v.yc.setCornerRadius(12)
             }
-            calorieItem.do { v in
-                v.titleLabel.text = "300"
-                v.detailLabel.text = "卡路里".l10n
+            header.do { v in
+                v.font = .medium(16)
+                v.textColor = .color(.first)
             }
-            stepItem.do { v in
-                v.titleLabel.text = "1200"
-                v.detailLabel.text = "步数".l10n
-            }
-
+            updateUI()
         }
         
         override func setupLayout() {
             topIcon.snp.makeConstraints { make in
-                make.width.equalTo(50)
-                make.height.equalTo(4)
-                make.top.equalToSuperview().inset(6)
-                make.centerX.equalToSuperview()
+                make.width.equalTo(42)
+                make.height.equalTo(42)
+                make.top.equalToSuperview().inset(18)
+                make.right.equalToSuperview().inset(18)
             }
             header.snp.makeConstraints { make in
-                make.top.equalToSuperview().inset(28)
-                make.left.right.equalToSuperview()
-                make.height.equalTo(25)
+                make.top.leading.equalToSuperview().inset(18)
             }
             distanceItem.snp.makeConstraints { make in
                 make.left.equalToSuperview().inset(18)
-                make.top.equalToSuperview().inset(100)
-                make.height.equalTo(50)
+                make.top.equalToSuperview().inset(50)
+//                make.height.equalTo(64)
             }
-            durationItem.snp.makeConstraints { make in
+            item1.snp.makeConstraints { make in
                 make.left.equalToSuperview().inset(18)
-                make.top.equalToSuperview().inset(180)
+                make.top.equalToSuperview().inset(130)
                 make.height.equalTo(50)
+                make.width.equalTo(kScreenWid/3)
             }
-            speedItem.snp.makeConstraints { make in
-                make.left.equalToSuperview().inset(kScreenWid/2 + 18)
-                make.top.equalTo(durationItem.snp.top)
-                make.height.equalTo(50)
+            item2.snp.makeConstraints { make in
+                make.centerX.equalToSuperview().offset(20)
+                make.width.top.height.equalTo(item1)
             }
-            calorieItem.snp.makeConstraints { make in
-                make.left.equalToSuperview().inset(18)
-                make.top.equalToSuperview().inset(250)
-                make.height.equalTo(50)
+            item3.snp.makeConstraints { make in
+                make.right.equalToSuperview()
+                make.width.top.height.equalTo(item1)
             }
-            stepItem.snp.makeConstraints { make in
-                make.left.equalToSuperview().inset(kScreenWid/2 + 18)
-                make.top.equalTo(calorieItem.snp.top)
-                make.height.equalTo(50)
+            item4.snp.makeConstraints { make in
+                make.top.equalToSuperview().inset(200)
+                make.width.left.height.equalTo(item1)
+            }
+            item5.snp.makeConstraints { make in
+                make.centerX.equalTo(item2)
+                make.width.top.height.equalTo(item4)
+            }
+            item6.snp.makeConstraints { make in
+                make.right.equalToSuperview()
+                make.width.height.equalTo(item1)
+                make.top.equalTo(item4)
+            }
+            item7.snp.makeConstraints { make in
+                make.top.equalToSuperview().inset(270)
+                make.width.left.height.equalTo(item1)
+            }
+            item8.snp.makeConstraints { make in
+                make.centerX.equalTo(item2)
+                make.width.top.height.equalTo(item7)
+            }
+            item9.snp.makeConstraints { make in
+                make.right.equalToSuperview()
+                make.width.height.equalTo(item1)
+                make.top.equalTo(item7)
             }
         }
-        
-        @objc func okAction(){
-            App.shared.goToPage(SportDetailVC())
-        }
-        
-        
-        class headerItem: BaseView {
-            let deviceLabel = UILabel()
-            let deviceView = UIView()
+
+        class LabelItem: BaseView {
+            let detailLabel = UILabel()
             let titleLabel = UILabel()
             
+            var title:String = ""{
+                didSet{
+                    titleLabel.text = title
+                }
+            }
+            var detail:String = ""{
+                didSet{
+                    detailLabel.text = detail
+                }
+            }
+            
             override func setupViews() {
-                addSubviews([titleLabel,deviceView])
-                deviceView.addSubviews([deviceLabel])
+                addSubviews([titleLabel,detailLabel])
                 titleLabel.do { v in
                     v.textColor = .color(.first)
-                    v.font = .bold(16)
+                    v.font = .semiBold(24)
                     v.textAlignment = .left
-                    v.text = "户外跑步"
-                }
-                deviceView.do { v in
-                    v.backgroundColor = .rgb(0xF7F7F7 )
-                    v.yc.setCornerRadius(13)
                 }
-                deviceLabel.do { v in
+                detailLabel.do { v in
                     v.textColor = .color(.secondary)
-                    v.font = .regular(10)
-                    v.textAlignment = .center
-                    v.text = "Deep Lite2 Ultra"
+                    v.font = .regular(12)
+                    v.textAlignment = .left
                 }
             }
             
             override func setupLayout() {
                 titleLabel.snp.makeConstraints { make in
-                    make.centerY.equalToSuperview().inset(0)
-                    make.left.equalToSuperview().inset(18)
-                }
-                deviceView.snp.makeConstraints { make in
-                    make.width.equalTo(120)
-                    make.height.equalTo(26)
-                    make.left.equalToSuperview().inset(94)
-                    make.centerY.equalToSuperview()
+                    make.top.equalToSuperview().inset(0)
+                    make.left.right.equalToSuperview()
                 }
-                deviceLabel.snp.makeConstraints { make in
-                    make.centerY.right.equalToSuperview()
-                    make.left.equalToSuperview().inset(18)
+                detailLabel.snp.makeConstraints { make in
+                    make.bottom.equalToSuperview().inset(0)
+                    make.left.right.equalToSuperview()
                 }
             }
         }
-        
-        
-        class LabelItem: BaseView {
+        class DistanceItem: BaseView {
             let detailLabel = UILabel()
             let titleLabel = UILabel()
             
+            var title:String = ""{
+                didSet{
+                    titleLabel.text = title
+                }
+            }
+            var detail:String = ""{
+                didSet{
+                    detailLabel.text = detail
+                }
+            }
+            
             override func setupViews() {
                 addSubviews([titleLabel,detailLabel])
                 titleLabel.do { v in
                     v.textColor = .color(.first)
-                    v.font = .bold(24)
+                    v.font = .bold(48)
                     v.textAlignment = .left
                 }
                 detailLabel.do { v in
-                    v.textColor = .color(.secondary)
-                    v.font = .regular(12)
+                    v.textColor = .color(.first)
+                    v.font = .bold(20)
                     v.textAlignment = .left
+                    v.text = "公里".l10n
                 }
             }
             
             override func setupLayout() {
                 titleLabel.snp.makeConstraints { make in
                     make.top.equalToSuperview().inset(0)
-                    make.left.right.equalToSuperview()
+                    make.left.equalToSuperview()
                 }
                 detailLabel.snp.makeConstraints { make in
-                    make.bottom.equalToSuperview().inset(0)
-                    make.left.right.equalToSuperview()
+                    make.bottom.equalTo(titleLabel.snp.bottom).inset(8)
+                    make.left.equalTo(titleLabel.snp.right).offset(10)
                 }
             }
         }
@@ -170,3 +312,4 @@ extension SportDetailVC{
     
     
 }
+
index 19787df..3c758ef 100644 (file)
@@ -20,7 +20,9 @@ class SportDetailVC: BaseVC {
     
     override func setupViews() {
         MapManager.shared.setupSdk()
-        
+        navBar.do { v in
+            v.title = "运动数据".l10n
+        }
 
         
         mapView = MAMapView(frame: .zero)
@@ -56,7 +58,7 @@ class SportDetailVC: BaseVC {
             make.left.equalToSuperview()
             make.width.equalTo(kScreenWid)
             make.top.equalTo(mapView.snp.bottom)
-            make.height.equalTo(300)
+            make.height.equalTo(342)
         }
         pace.snp.makeConstraints { make in
             make.left.width.equalTo(detailView)
index 769b2e1..cf45024 100644 (file)
@@ -11,41 +11,96 @@ extension SportingVC{
     class DetailBoard: BaseView {
         let topIcon = UIImageView()
         let header = headerItem()
-        let distanceItem = LabelItem()
-        let durationItem = LabelItem()
-        let speedItem = LabelItem()
-        let calorieItem = LabelItem()
-        let stepItem = LabelItem()
+        let distanceItem = DistanceItem()
+        let item1 = LabelItem()
+        let item2 = LabelItem()
+        let item3 = LabelItem()
+        let item4 = LabelItem()
         let btnView = ButtonView()
-        
+        func updateUI(){
+            if SportManager.shared.sportType == .walk{
+                header.do { v in
+                    v.title = "健走".l10n
+                    v.value = "Deep Lite2 Ultra"
+                }
+                distanceItem.do { v in
+                    v.title = "1.2"
+                }
+                item1.do { v in
+                    v.title = "00:00:00"
+                    v.detail = "时长".l10n
+                }
+                item2.do { v in
+                    v.title = "8'26\""
+                    v.detail = "配速".l10n
+                }
+                item3.do { v in
+                    v.title = "300"
+                    v.detail = "卡路里".l10n
+                }
+                item4.do { v in
+                    v.title = "1200"
+                    v.detail = "步数".l10n
+                }
+            }
+            else if  SportManager.shared.sportType == .run{
+                header.do { v in
+                    v.title = "户外跑步".l10n
+                    v.value = "Deep Lite2 Ultra"
+                }
+                distanceItem.do { v in
+                    v.title = "1.2"
+                }
+                item1.do { v in
+                    v.title = "00:00:00"
+                    v.detail = "时长".l10n
+                }
+                item2.do { v in
+                    v.title = "8'26\""
+                    v.detail = "配速".l10n
+                }
+                item3.do { v in
+                    v.title = "300"
+                    v.detail = "卡路里".l10n
+                }
+                item4.do { v in
+                    v.title = "1200"
+                    v.detail = "步数".l10n
+                }
+            }
+            else if  SportManager.shared.sportType == .ride{
+                header.do { v in
+                    v.title = "户外骑行".l10n
+                    v.value = "Deep Lite2 Ultra"
+                }
+                distanceItem.do { v in
+                    v.title = "1.2"
+                }
+                item1.do { v in
+                    v.title = "00:00:00"
+                    v.detail = "时长".l10n
+                }
+                item2.do { v in
+                    v.title = "10.8"
+                    v.detail = "时速".l10n
+                }
+                item3.do { v in
+                    v.title = "300"
+                    v.detail = "卡路里".l10n
+                }
+                item4.do { v in
+
+                }
+            }
+        }
         override func setupViews() {
             backgroundColor = .white
-            addSubviews([topIcon,header,distanceItem,durationItem,speedItem,calorieItem,stepItem,btnView])
+            addSubviews([topIcon,header,distanceItem,item1,item2,item3,item4,btnView])
             topIcon.do { v in
                 v.backgroundColor = .color(.secondary)
                 v.yc.setCornerRadius(2)
             }
-            distanceItem.do { v in
-                v.titleLabel.text = "0"
-                v.detailLabel.text = "总距离".l10n
-            }
-            durationItem.do { v in
-                v.titleLabel.text = "00:00:00"
-                v.detailLabel.text = "总时长".l10n
-            }
-            speedItem.do { v in
-                v.titleLabel.text = "8'26\""
-                v.detailLabel.text = "配速".l10n
-            }
-            calorieItem.do { v in
-                v.titleLabel.text = "300"
-                v.detailLabel.text = "卡路里".l10n
-            }
-            stepItem.do { v in
-                v.titleLabel.text = "1200"
-                v.detailLabel.text = "步数".l10n
-            }
-
+            updateUI()
         }
         
         override func setupLayout() {
@@ -65,24 +120,24 @@ extension SportingVC{
                 make.top.equalToSuperview().inset(100)
                 make.height.equalTo(50)
             }
-            durationItem.snp.makeConstraints { make in
+            item1.snp.makeConstraints { make in
                 make.left.equalToSuperview().inset(18)
                 make.top.equalToSuperview().inset(180)
                 make.height.equalTo(50)
             }
-            speedItem.snp.makeConstraints { make in
+            item2.snp.makeConstraints { make in
                 make.left.equalToSuperview().inset(kScreenWid/2 + 18)
-                make.top.equalTo(durationItem.snp.top)
+                make.top.equalTo(item1.snp.top)
                 make.height.equalTo(50)
             }
-            calorieItem.snp.makeConstraints { make in
+            item3.snp.makeConstraints { make in
                 make.left.equalToSuperview().inset(18)
                 make.top.equalToSuperview().inset(250)
                 make.height.equalTo(50)
             }
-            stepItem.snp.makeConstraints { make in
+            item4.snp.makeConstraints { make in
                 make.left.equalToSuperview().inset(kScreenWid/2 + 18)
-                make.top.equalTo(calorieItem.snp.top)
+                make.top.equalTo(item3.snp.top)
                 make.height.equalTo(50)
             }
             btnView.snp.makeConstraints { make in
@@ -204,22 +259,37 @@ extension SportingVC{
         }
         class headerItem: BaseView {
             let deviceLabel = UILabel()
-            let deviceView = UIView()
+            let deviceBg = UIView()
+            let stateLabel = UIView()
             let titleLabel = UILabel()
             
+            var title:String = ""{
+                didSet{
+                    titleLabel.text = title
+                }
+            }
+            var value:String = ""{
+                didSet{
+                    deviceLabel.text = value
+                }
+            }
+            
             override func setupViews() {
-                addSubviews([titleLabel,deviceView])
-                deviceView.addSubviews([deviceLabel])
+                addSubviews([titleLabel,deviceBg])
+                deviceBg.addSubviews([stateLabel,deviceLabel])
                 titleLabel.do { v in
                     v.textColor = .color(.first)
                     v.font = .bold(16)
                     v.textAlignment = .left
-                    v.text = "户外跑步"
                 }
-                deviceView.do { v in
+                deviceBg.do { v in
                     v.backgroundColor = .rgb(0xF7F7F7 )
                     v.yc.setCornerRadius(13)
                 }
+                stateLabel.do { v in
+                    v.backgroundColor = .rgb(0x2BD84E )
+                    v.yc.setCornerRadius(2)
+                }
                 deviceLabel.do { v in
                     v.textColor = .color(.secondary)
                     v.font = .regular(10)
@@ -233,12 +303,17 @@ extension SportingVC{
                     make.centerY.equalToSuperview().inset(0)
                     make.left.equalToSuperview().inset(18)
                 }
-                deviceView.snp.makeConstraints { make in
+                deviceBg.snp.makeConstraints { make in
                     make.width.equalTo(120)
                     make.height.equalTo(26)
                     make.left.equalToSuperview().inset(94)
                     make.centerY.equalToSuperview()
                 }
+                stateLabel.snp.makeConstraints { make in
+                    make.size.equalTo(4)
+                    make.centerY.equalToSuperview()
+                    make.left.equalToSuperview().inset(9)
+                }
                 deviceLabel.snp.makeConstraints { make in
                     make.centerY.right.equalToSuperview()
                     make.left.equalToSuperview().inset(18)
@@ -251,6 +326,17 @@ extension SportingVC{
             let detailLabel = UILabel()
             let titleLabel = UILabel()
             
+            var title:String = ""{
+                didSet{
+                    titleLabel.text = title
+                }
+            }
+            var detail:String = ""{
+                didSet{
+                    detailLabel.text = detail
+                }
+            }
+            
             override func setupViews() {
                 addSubviews([titleLabel,detailLabel])
                 titleLabel.do { v in
@@ -276,6 +362,47 @@ extension SportingVC{
                 }
             }
         }
+        class DistanceItem: BaseView {
+            let detailLabel = UILabel()
+            let titleLabel = UILabel()
+            
+            var title:String = ""{
+                didSet{
+                    titleLabel.text = title
+                }
+            }
+            var detail:String = ""{
+                didSet{
+                    detailLabel.text = detail
+                }
+            }
+            
+            override func setupViews() {
+                addSubviews([titleLabel,detailLabel])
+                titleLabel.do { v in
+                    v.textColor = .color(.first)
+                    v.font = .bold(48)
+                    v.textAlignment = .left
+                }
+                detailLabel.do { v in
+                    v.textColor = .color(.first)
+                    v.font = .bold(20)
+                    v.textAlignment = .left
+                    v.text = "公里".l10n
+                }
+            }
+            
+            override func setupLayout() {
+                titleLabel.snp.makeConstraints { make in
+                    make.top.equalToSuperview().inset(0)
+                    make.left.equalToSuperview()
+                }
+                detailLabel.snp.makeConstraints { make in
+                    make.bottom.equalToSuperview().inset(0)
+                    make.left.equalTo(titleLabel.snp.right).offset(10)
+                }
+            }
+        }
     }
     
     
index ce06371..fe4dba3 100644 (file)
@@ -59,7 +59,7 @@ extension SportingVC{
             override func setupViews() {
                 addSubviews([titleLabel,detailLabel])
                 titleLabel.do { v in
-                    v.textColor = .color(.secondary)
+                    v.textColor = .color(.first)
                     v.font = .bold(24)
                     v.textAlignment = .left
                 }
index ae6d427..a94868d 100644 (file)
@@ -7,7 +7,7 @@
 
 class SportManager {
     static let shared = SportManager()
-    var sortType = SportType.ride
+    var sportType = SportType.ride
     
     
 }