刘千军 11 månader sedan
förälder
incheckning
e77d30043d

+ 36 - 0
Koala/Koala.xcodeproj/project.pbxproj

@@ -528,6 +528,13 @@
 		6C66AB802AE3ED85005C471D /* MDOptionsTimerCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6C66AB7E2AE3ED85005C471D /* MDOptionsTimerCell.xib */; };
 		6C66AB832AE3F15F005C471D /* MDOptionsOrderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C66AB812AE3F15F005C471D /* MDOptionsOrderCell.swift */; };
 		6C66AB842AE3F15F005C471D /* MDOptionsOrderCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6C66AB822AE3F15F005C471D /* MDOptionsOrderCell.xib */; };
+		6C66AB8E2AE50C29005C471D /* JCyclePictureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C66AB8B2AE50C29005C471D /* JCyclePictureView.swift */; };
+		6C66AB912AE54DDB005C471D /* HomeIndexCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C66AB8F2AE54DDB005C471D /* HomeIndexCell.swift */; };
+		6C66AB922AE54DDB005C471D /* HomeIndexCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6C66AB902AE54DDB005C471D /* HomeIndexCell.xib */; };
+		6C66AB992AE5507A005C471D /* HomeIndexListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C66AB972AE5507A005C471D /* HomeIndexListCell.swift */; };
+		6C66AB9A2AE5507A005C471D /* HomeIndexListCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6C66AB982AE5507A005C471D /* HomeIndexListCell.xib */; };
+		6C66AB9D2AE55F8B005C471D /* HomeOptionsListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C66AB9B2AE55F8B005C471D /* HomeOptionsListCell.swift */; };
+		6C66AB9E2AE55F8B005C471D /* HomeOptionsListCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6C66AB9C2AE55F8B005C471D /* HomeOptionsListCell.xib */; };
 		6C6B7DA3296AF77500067FA3 /* HomeHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6C6B7DA2296AF77500067FA3 /* HomeHeaderView.xib */; };
 		6C6B7DA7296B06BB00067FA3 /* HomeInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C6B7DA5296B06BB00067FA3 /* HomeInfoCell.swift */; };
 		6C6B7DA8296B06BB00067FA3 /* HomeInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6C6B7DA6296B06BB00067FA3 /* HomeInfoCell.xib */; };
@@ -1382,6 +1389,13 @@
 		6C66AB7E2AE3ED85005C471D /* MDOptionsTimerCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MDOptionsTimerCell.xib; sourceTree = "<group>"; };
 		6C66AB812AE3F15F005C471D /* MDOptionsOrderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MDOptionsOrderCell.swift; sourceTree = "<group>"; };
 		6C66AB822AE3F15F005C471D /* MDOptionsOrderCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MDOptionsOrderCell.xib; sourceTree = "<group>"; };
+		6C66AB8B2AE50C29005C471D /* JCyclePictureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JCyclePictureView.swift; sourceTree = "<group>"; };
+		6C66AB8F2AE54DDB005C471D /* HomeIndexCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeIndexCell.swift; sourceTree = "<group>"; };
+		6C66AB902AE54DDB005C471D /* HomeIndexCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeIndexCell.xib; sourceTree = "<group>"; };
+		6C66AB972AE5507A005C471D /* HomeIndexListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeIndexListCell.swift; sourceTree = "<group>"; };
+		6C66AB982AE5507A005C471D /* HomeIndexListCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeIndexListCell.xib; sourceTree = "<group>"; };
+		6C66AB9B2AE55F8B005C471D /* HomeOptionsListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeOptionsListCell.swift; sourceTree = "<group>"; };
+		6C66AB9C2AE55F8B005C471D /* HomeOptionsListCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeOptionsListCell.xib; sourceTree = "<group>"; };
 		6C6B7DA2296AF77500067FA3 /* HomeHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeHeaderView.xib; sourceTree = "<group>"; };
 		6C6B7DA5296B06BB00067FA3 /* HomeInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeInfoCell.swift; sourceTree = "<group>"; };
 		6C6B7DA6296B06BB00067FA3 /* HomeInfoCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeInfoCell.xib; sourceTree = "<group>"; };
@@ -2270,6 +2284,7 @@
 		6C00A8B7242D918C00CE9ADB /* OtherClass */ = {
 			isa = PBXGroup;
 			children = (
+				6C66AB8A2AE50C29005C471D /* JCyclePictureView */,
 				04D38E252A9EE8A10047EF9C /* JXSegmentedView */,
 				6CBDCBC3297C2E08003E068F /* Charts.xcodeproj */,
 				6C031D9F296315930043BECF /* PageFlow */,
@@ -2430,8 +2445,14 @@
 				6C6B7DA2296AF77500067FA3 /* HomeHeaderView.xib */,
 				6C6B7DA5296B06BB00067FA3 /* HomeInfoCell.swift */,
 				6C6B7DA6296B06BB00067FA3 /* HomeInfoCell.xib */,
+				6C66AB8F2AE54DDB005C471D /* HomeIndexCell.swift */,
+				6C66AB902AE54DDB005C471D /* HomeIndexCell.xib */,
+				6C66AB972AE5507A005C471D /* HomeIndexListCell.swift */,
+				6C66AB982AE5507A005C471D /* HomeIndexListCell.xib */,
 				6CBB631A2ADC112F0045A4C9 /* HomeOptionsCell.swift */,
 				6CBB631B2ADC112F0045A4C9 /* HomeOptionsCell.xib */,
+				6C66AB9B2AE55F8B005C471D /* HomeOptionsListCell.swift */,
+				6C66AB9C2AE55F8B005C471D /* HomeOptionsListCell.xib */,
 				6C7A1AE629F6D052004CFBE3 /* HomeMarketPopView.swift */,
 			);
 			path = V;
@@ -3283,6 +3304,14 @@
 			path = VC;
 			sourceTree = "<group>";
 		};
+		6C66AB8A2AE50C29005C471D /* JCyclePictureView */ = {
+			isa = PBXGroup;
+			children = (
+				6C66AB8B2AE50C29005C471D /* JCyclePictureView.swift */,
+			);
+			path = JCyclePictureView;
+			sourceTree = "<group>";
+		};
 		6C7A1AEC29F80AEF004CFBE3 /* CreditsView */ = {
 			isa = PBXGroup;
 			children = (
@@ -4112,6 +4141,7 @@
 				6C10F0F329DB08D900B79491 /* updateAPP114.png in Resources */,
 				6C10F10129DB08D900B79491 /* updateAPP002.png in Resources */,
 				6C4AFAF7299FED3200508EA7 /* AFlashViewController.xib in Resources */,
+				6C66AB9E2AE55F8B005C471D /* HomeOptionsListCell.xib in Resources */,
 				6C10F0FD29DB08D900B79491 /* updateAPP098.png in Resources */,
 				6C4AFAEE299FE01600508EA7 /* APaymentMethodViewController.xib in Resources */,
 				6CD200B429E6FB2100F0966D /* ASavingsDetailsListCell.xib in Resources */,
@@ -4153,6 +4183,7 @@
 				6CDC5AF729CCA18100E60730 /* AFiatDepositsPayWayCell.xib in Resources */,
 				6C4AFB4A29A8FDFB00508EA7 /* DealTalentHeaderView.xib in Resources */,
 				6C86530429ACF3E400A2E7FB /* TDStatisticsRecordListCell.xib in Resources */,
+				6C66AB922AE54DDB005C471D /* HomeIndexCell.xib in Resources */,
 				6C10F0F629DB08D900B79491 /* updateAPP058.png in Resources */,
 				6CA71324295807B10047F450 /* BaseInputView.xib in Resources */,
 				6C10F0FB29DB08D900B79491 /* updateAPP112.png in Resources */,
@@ -4163,6 +4194,7 @@
 				6C66AB732AE3A3C4005C471D /* MDOptionsRateCell.xib in Resources */,
 				6CDC5AFB29CDFBFD00E60730 /* FlashHistoryRecordCell.xib in Resources */,
 				6C10F0D629DB08D900B79491 /* updateAPP042.png in Resources */,
+				6C66AB9A2AE5507A005C471D /* HomeIndexListCell.xib in Resources */,
 				6C00A9482432F1A500CE9ADB /* CodeScan.bundle in Resources */,
 				6CBB63002AD977AF0045A4C9 /* MDAuoteDepthCell.xib in Resources */,
 				6C10F0E529DB08D900B79491 /* updateAPP092.png in Resources */,
@@ -4316,6 +4348,7 @@
 				6CBDC8FF2974602A003E068F /* MarketModel.swift in Sources */,
 				6C35369329816129003BB632 /* DealNavView.swift in Sources */,
 				6CBDC918297AE49A003E068F /* KLineView.swift in Sources */,
+				6C66AB8E2AE50C29005C471D /* JCyclePictureView.swift in Sources */,
 				04D38EC32AB068F50047EF9C /* JDKLineAfterhoursCell.swift in Sources */,
 				6C3717E429AA5B23000DDD8B /* TalentDetailsHeaderView.swift in Sources */,
 				6CA7130F2957034B0047F450 /* PublicModel.swift in Sources */,
@@ -4615,6 +4648,7 @@
 				6CC37FEE298FF87D0079FA5C /* AssetsModel.swift in Sources */,
 				6CC37FD8298FAFD00079FA5C /* AssetsTotalView.swift in Sources */,
 				041D4EFF2AC3FD6F008ABDF7 /* JDWorkOrderModel.swift in Sources */,
+				6C66AB912AE54DDB005C471D /* HomeIndexCell.swift in Sources */,
 				6C66AB6E2AE187FE005C471D /* MDOptionsPeriodListCell.swift in Sources */,
 				6C00A90E242D918D00CE9ADB /* ProjectPrivateMacro.swift in Sources */,
 				6C00A91E242D918D00CE9ADB /* BaseTableView.swift in Sources */,
@@ -4656,6 +4690,7 @@
 				04D38E8E2AA1C0C80047EF9C /* MarketMainDetailViewController.swift in Sources */,
 				6C00A9922433313300CE9ADB /* HXImageClipScrollView.swift in Sources */,
 				6C00A92A242D969000CE9ADB /* HomeViewController.swift in Sources */,
+				6C66AB992AE5507A005C471D /* HomeIndexListCell.swift in Sources */,
 				04D38EC12AB054070047EF9C /* JDKLineUpsDownsCell.swift in Sources */,
 				6C00A9422431EF5900CE9ADB /* ShowBigImgView.swift in Sources */,
 				6C0C499B295DDD86000BFEEB /* ChangePasswordCell.swift in Sources */,
@@ -4683,6 +4718,7 @@
 				041D4F132AD0FDEB008ABDF7 /* JDAFiatAccountBalanceCell.swift in Sources */,
 				6C8652FF29ABB1A500A2E7FB /* TDStatisticsRecordCell.swift in Sources */,
 				04D38E7D2A9EE8A10047EF9C /* JXSegmentedNumberItemModel.swift in Sources */,
+				6C66AB9D2AE55F8B005C471D /* HomeOptionsListCell.swift in Sources */,
 				04D38E682A9EE8A10047EF9C /* JXSegmentedIndicatorGradientLineView.swift in Sources */,
 				041D4F262AD2CB9F008ABDF7 /* JDMineVIPViewController.swift in Sources */,
 				6CD200AE29E6E70400F0966D /* ASavingsDetailsHeaderView.swift in Sources */,

+ 83 - 1
Koala/Koala/FX/Classification/NSObject+CategoryClass.swift

@@ -10,7 +10,23 @@ import Foundation
 import UIKit
 extension NSObject
 {
-    
+    //MARK:- 视图渐变色范围
+    public enum MyLayerType
+    {
+        /**
+         宽度屏幕宽
+         */
+        case WIDTH_50
+        /**
+         宽度为一半
+         */
+        case WIDTH2_50
+        /**
+         No_TipView
+         */
+        case WIDTH_No_TipView_50
+        case normal(frame: CGRect)
+    }
     //MARK:- 在viewcontroller中需要初始化的事情
     
     func viewControllerNeedLoadOfInit() -> Void
@@ -215,6 +231,72 @@ extension NSObject
         }
         
     }
+    
+    //MARK:- 获取一个渐变layer
+    class  func getALayer(myType : MyLayerType , myColors : [CGColor]! , locationS: [NSNumber]! , startPoint : CGPoint , endPoint : CGPoint) ->CAGradientLayer
+    {
+        let layer = CAGradientLayer()
+        switch myType {
+        case .WIDTH_50:
+            layer.frame  = CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 50)
+        case .normal(let frame):
+            layer.frame = frame
+        case .WIDTH2_50:
+            layer.frame  = CGRect(x: 0, y: 0, width: SCREEN_WIDTH/2.0, height: 50)
+        case .WIDTH_No_TipView_50:
+            layer.frame  = CGRect(x: 0, y: 0, width: SCREEN_WIDTH-80, height: 50)
+        default:
+            layer.frame  = CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: SCREEN_HEIGHT)
+        }
+            
+        ///设置颜色
+        layer.colors = myColors
+        ///设置颜色渐变的位置 (我这里是横向 中间点开始变化)
+        layer.locations = locationS
+        ///开始的坐标点
+        layer.startPoint = startPoint
+        ///结束的坐标点
+        layer.endPoint = endPoint
+        return layer
+    }
+    
         
     
 }
+
+extension UIView {
+    func insertGradientLayer(myType: MyLayerType, mycolors: [CGColor]!, locations: [NSNumber]!, startPoint: CGPoint, endPoint: CGPoint) -> Void {
+        if self.layer.sublayers != nil {
+            for sublayer in self.layer.sublayers! where sublayer is CAGradientLayer {
+                sublayer.removeFromSuperlayer()
+            }
+        }
+        let layer = CAGradientLayer()
+        switch myType {
+        case .WIDTH_50:
+            layer.frame  = CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 50)
+        case .normal(let frame):
+            layer.frame = frame
+        case .WIDTH2_50:
+            layer.frame  = CGRect(x: 0, y: 0, width: SCREEN_WIDTH/2.0, height: 50)
+        case .WIDTH_No_TipView_50:
+            layer.frame  = CGRect(x: 0, y: 0, width: SCREEN_WIDTH-80, height: 50)
+        default:
+            layer.frame  = CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: SCREEN_HEIGHT)
+        }
+        
+        ///设置颜色
+        layer.colors = mycolors
+        ///设置颜色渐变的位置 (我这里是横向 中间点开始变化)
+        layer.locations = locations
+        ///开始的坐标点
+        layer.startPoint = startPoint
+        ///结束的坐标点
+        layer.endPoint = endPoint
+        
+        
+        self.layer.insertSublayer(layer, at: 0)
+                
+    }
+}
+

+ 560 - 0
Koala/Koala/FX/OtherClass/JCyclePictureView/JCyclePictureView.swift

@@ -0,0 +1,560 @@
+//
+//  JCyclePictureView.swift
+//  JCyclePictureView
+//
+//  Created by Zebra on 2017/12/15.
+//  Copyright © 2017年 Zebra. All rights reserved.
+//
+
+import UIKit
+import Kingfisher
+
+internal let JCyclePictureCellIdentifier: String = "JCyclePictureViewCell"
+
+public typealias JCyclePictureViewCustomCellHandle = (_ collectionView: UICollectionView, _ indexPath: IndexPath) -> UICollectionViewCell
+
+/// 滚动方向
+public enum JCyclePictureViewRollingDirection : Int {
+    
+    case top
+    
+    case left
+    
+    case bottom
+    
+    case right
+}
+
+/// PageControl 的位置
+public enum JPageControlStyle : Int {
+    
+    case center
+    
+    case left
+    
+    case right
+}
+
+public class JCyclePictureView: UIView {
+
+    /// 图片数据源
+    open var pictures: [String] = [] {
+        
+        didSet {
+            
+            if self.pictures.count > 0 {
+                
+                self.collectionView.scrollToItem(at: IndexPath(item: 1, section: 0), at: self.scrollPosition, animated: false)
+
+                self.bringSubviewToFront(self.pageControl)
+
+                self.pageControl.numberOfPages = self.pictures.count
+
+                self.pageControl.currentPage = 0
+
+                self.startTimer()
+            }
+        }
+    }
+    
+    /// 默认图
+    open var placeholderImage: UIImage?
+    
+    /// 标题数据源
+    open var titles: [String?] = [] {
+        
+        didSet {
+            
+            if titles.count > 0 {
+                
+                self.pageControlStyle = .right
+                
+                self.titleLab.text = titles.count > self.index ? titles[self.index] : ""
+                
+                self.bringSubviewToFront(self.pageControl)
+            }
+        }
+    }
+    
+    /// 点击图片回调  从 0 开始
+    open var didTapAtIndexHandle: (( _: Int ) -> Void)?
+    
+    /// default is 2.0f, 如果小于0.5不自动播放
+    open var autoScrollDelay: TimeInterval = 2
+    
+    /// 滚动方向
+    open var direction: JCyclePictureViewRollingDirection = .left {
+        
+        willSet {
+            
+            switch newValue {
+            case .left, .top:
+                self.pageControl.currentPage = 0
+                self.index = 0
+                
+            case .right, .bottom:
+                self.pageControl.currentPage = self.pictures.count - 1
+                self.index = self.pictures.count - 1
+            }
+        }
+    }
+    
+    /// pageControl 的对齐方式
+    open var pageControlStyle: JPageControlStyle = .center {
+        
+        willSet {
+            
+            guard self.titles.count > 0 else { return }
+            
+            let pointSize: CGSize = self.pageControl.size(forNumberOfPages: self.titles.count)
+            
+            let page_x: CGFloat = (self.pageControl.bounds.size.width - pointSize.width) / 2
+            
+            switch newValue {
+            case .left:
+                self.pageControl.frame = CGRect(x: -page_x + 10, y: self.frame.size.height - 20, width: self.pageControl.bounds.size.width, height: self.pageControl.bounds.size.height)
+                
+            case .right:
+                self.pageControl.frame = CGRect(x: page_x - 10, y: self.frame.size.height - 20, width: self.pageControl.bounds.size.width, height: self.pageControl.bounds.size.height)
+                
+            case .center:
+                self.pageControl.frame = CGRect(x: 0, y: self.frame.size.height - 20, width: self.pageControl.bounds.size.width, height: self.pageControl.bounds.size.height)
+            }
+        }
+    }
+    
+    /// 设置图片的ContentMode
+    open var imageContentMode: UIView.ContentMode?
+    
+    /// 自定义 cell 的回调
+    open var customCellHandle: JCyclePictureViewCustomCellHandle?
+    
+    /// 如果需要自定义 AnyClass cell 需调用下面方法
+    ///
+    /// - Parameters:
+    ///   - cellClasss: [UICollectionViewCell.self]
+    ///   - identifiers: [identifier]
+    ///   - customCellHandle: cellForItemAt 回调
+    open func register(_ cellClasss: [Swift.AnyClass?], identifiers: [String], customCellHandle: @escaping JCyclePictureViewCustomCellHandle) {
+        
+        self.customCellHandle = customCellHandle
+
+        for (index, identifier) in identifiers.enumerated() {
+            
+            self.collectionView.register(cellClasss[index], forCellWithReuseIdentifier: identifier)
+        }
+    }
+    
+    /// 如果需要自定义 UINib cell 需调用下面方法
+    ///
+    /// - Parameters:
+    ///   - nibs: [UINib]
+    ///   - identifiers: [identifier]
+    ///   - customCellHandle: cellForItemAt 回调
+    open func register(_ nibs: [UINib?], identifiers: [String], customCellHandle: @escaping JCyclePictureViewCustomCellHandle) {
+        
+        self.customCellHandle = customCellHandle
+        
+        for (index, identifier) in identifiers.enumerated() {
+            
+            self.collectionView.register(nibs[index], forCellWithReuseIdentifier: identifier)
+        }
+    }
+    
+    internal var timer: Timer?
+    
+    lazy internal var titleBgView: UIView = {
+        
+        let titleBgView: UIView = UIView(frame: CGRect(x: 0, y: self.frame.height - 20, width: self.frame.width, height: 20))
+        
+        titleBgView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
+        
+        self.addSubview(titleBgView)
+        
+        return titleBgView
+    }()
+    
+    lazy internal var titleLab: UILabel = {
+        
+        let pointSize: CGSize = self.pageControl.size(forNumberOfPages: self.pictures.count)
+        
+        let titleLab: UILabel = UILabel(frame: CGRect(x: 5, y: 0, width: self.frame.width - 10 - pointSize.width, height: 20))
+        
+        titleLab.textColor = UIColor.white
+        
+        titleLab.font = UIFont.systemFont(ofSize: 13)
+        
+        self.titleBgView.addSubview(titleLab)
+        
+        return titleLab
+    }()
+    
+    var datas: [String]? {
+        
+        var firstIndex = 0
+        
+        var secondIndex = 0
+
+        var thirdIndex = 0
+
+        switch pictures.count {
+
+        case 0:
+            return []
+
+        case 1:
+            break
+
+        default:
+            firstIndex = (self.index - 1) < 0 ? pictures.count - 1 : self.index - 1
+            secondIndex = self.index
+            thirdIndex = (self.index + 1) > pictures.count - 1 ? 0 : self.index + 1
+        }
+        
+        return [pictures[firstIndex] ,pictures[secondIndex] ,pictures[thirdIndex]]
+    }
+    
+    internal var index: Int = 0 {
+        
+        willSet {
+            
+            if self.titles.count > 0 {
+                
+                self.titleLab.text = self.titles.count > newValue ? self.titles[newValue] : ""
+            }
+        }
+    }
+    
+    internal lazy var contentOffset: CGFloat = {
+        
+        switch self.direction {
+        case .left, .right:
+            return  self.collectionView.contentOffset.x
+            
+        case .top, .bottom:
+            return  self.collectionView.contentOffset.y
+        }
+    }()
+    
+    internal lazy var scrollPosition: UICollectionView.ScrollPosition = {
+        
+        switch self.direction {
+        case .left:
+            return UICollectionView.ScrollPosition.left
+            
+        case .right:
+            return UICollectionView.ScrollPosition.right
+            
+        case .top:
+            return UICollectionView.ScrollPosition.top
+            
+        case .bottom:
+            return  UICollectionView.ScrollPosition.bottom
+        }
+    }()
+    
+    /// PageControl
+    open lazy var pageControl: JPageControl = {
+        
+        let pageControl: JPageControl = JPageControl(frame: CGRect(x: 0, y: self.frame.size.height - 20, width: self.frame.size.width, height: 20))
+        
+        pageControl.numberOfPages = self.pictures.count
+        
+        pageControl.backgroundColor = UIColor.clear
+        
+        pageControl.currentPage = 0
+        
+        self.addSubview(pageControl)
+        
+        return pageControl
+    }()
+    
+    internal lazy var collectionView: UICollectionView = {
+        
+        let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
+        
+        layout.itemSize = self.frame.size
+        
+        layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        
+        layout.minimumLineSpacing = 0
+        
+        layout.minimumInteritemSpacing = 0
+        
+        switch self.direction {
+        case .left, .right:
+            layout.scrollDirection = .horizontal
+            
+        case .top, .bottom:
+            layout.scrollDirection = .vertical
+        }
+        
+        let collectionView: UICollectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.height), collectionViewLayout: layout)
+        
+        collectionView.showsHorizontalScrollIndicator = false
+        
+        collectionView.showsVerticalScrollIndicator = false
+        
+        collectionView.register(JCyclePictureViewCell.self, forCellWithReuseIdentifier: JCyclePictureCellIdentifier)
+        
+        collectionView.backgroundColor = UIColor.clear
+        
+        collectionView.isPagingEnabled = true
+        
+        collectionView.bounces = false
+        
+        collectionView.dataSource = self
+        
+        collectionView.delegate = self
+        
+        self.addSubview(collectionView)
+        
+        return collectionView
+    }()
+    
+    public convenience init(frame: CGRect, pictures: [String]?) {
+        
+        self.init(frame: frame)
+        
+        if let pictures = pictures {
+        
+            self.pictures = pictures
+        }
+        
+        self.collectionView.scrollToItem(at: IndexPath(item: 1, section: 0), at: self.scrollPosition, animated: false)
+        
+       // self.bringSubviewToFront(self.pageControl)
+        
+        self.startTimer()
+    }
+    
+    deinit {
+        
+        self.stopTimer()
+    }
+    
+}
+
+extension JCyclePictureView: UIScrollViewDelegate {
+    
+    public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+        
+        self.stopTimer()
+    }
+    
+    public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
+        
+        self.startTimer()
+    }
+    
+    public func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        
+        var offset: CGFloat = 0
+        
+        switch self.direction {
+        case .left, .right:
+            offset = scrollView.contentOffset.x
+            
+        case .top, .bottom:
+            offset = scrollView.contentOffset.y
+        }
+        
+        if offset >= self.contentOffset * 2 {
+            
+            if self.index == self.pictures.count - 1 {
+                
+                self.index = 0
+                
+            } else {
+                
+                self.index += 1
+            }
+            
+            self.collectionView.reloadData()
+
+            self.collectionView.scrollToItem(at: IndexPath(item: 1, section: 0), at: self.scrollPosition, animated: false)
+        }
+        
+        if offset <= 0 {
+            
+            if self.index == 0 {
+                
+                self.index = self.pictures.count - 1
+                
+            } else {
+                
+                self.index -= 1
+            }
+            
+            self.collectionView.reloadData()
+
+            self.collectionView.scrollToItem(at: IndexPath(item: 1, section: 0), at: self.scrollPosition, animated: false)
+        }
+        
+        UIView.animate(withDuration: 0.3) {
+            
+            self.pageControl.currentPage = self.index
+        }
+    }
+    
+    /// 添加定时器
+    internal func startTimer() {
+        
+        self.stopTimer()
+        
+        if self.autoScrollDelay >= 0.5 {
+            
+            self.timer = Timer.scheduledTimer(timeInterval: self.autoScrollDelay, target: self, selector: #selector(timerHandle), userInfo: nil, repeats: true)
+            
+            RunLoop.main.add(self.timer!, forMode: RunLoop.Mode.common)
+        }
+    }
+    
+    //关闭定时器
+    internal func stopTimer() {
+        
+        if let _ = timer?.isValid {
+            
+            timer?.invalidate()
+            
+            timer = nil
+        }
+    }
+    
+    @objc internal func timerHandle() {
+        
+        var item: Int = 0
+        
+        switch self.direction {
+        case .left, .bottom:
+            item = 2
+            
+        case .top, .right:
+            item = 0
+        }
+        
+        self.collectionView.scrollToItem(at: IndexPath(item: item, section: 0), at: self.scrollPosition, animated: true)
+    }
+}
+
+//MARK: - UICollectionViewDelegate, UICollectionViewDataSource
+extension JCyclePictureView: UICollectionViewDelegate, UICollectionViewDataSource {
+    
+    public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+        
+        return 3
+    }
+    
+    public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+        
+        if let customCellHandle = self.customCellHandle {
+            
+            return customCellHandle(collectionView, indexPath)
+            
+        } else {
+        
+            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: JCyclePictureCellIdentifier, for: indexPath) as! JCyclePictureViewCell
+
+            if let imageContentMode = self.imageContentMode {
+                
+                cell.imageView.contentMode = imageContentMode
+            }
+            
+            if self.datas![indexPath.item].hasPrefix("http") {
+                
+                cell.imageView.kf.setImage(with: URL(string: self.datas![indexPath.item]), placeholder: self.placeholderImage)
+                
+            } else {
+                
+                cell.imageView.image = UIImage(named: self.datas![indexPath.item])
+            }
+            
+            return cell
+            
+        }
+    }
+    
+    public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        
+        self.didTapAtIndexHandle?(self.index)
+    }
+}
+
+public class JPageControl: UIPageControl {
+    
+    /// 设置高亮显示图片
+    public var currentPageIndicatorImage: UIImage? {
+        
+        didSet {
+            
+             self.currentPageIndicatorTintColor = UIColor.clear
+        }
+    }
+    
+    /// 设置默认显示图片
+    public var pageIndicatorImage: UIImage? {
+        
+        didSet {
+            
+            self.pageIndicatorTintColor = UIColor.clear
+        }
+    }
+    
+    public override var currentPage: Int {
+        
+        willSet {
+            
+            self.updateDots()
+        }
+    }
+    
+    internal func updateDots() {
+        
+        if self.currentPageIndicatorImage != nil || self.pageIndicatorImage != nil {
+            
+            for (index, dot) in self.subviews.enumerated() {
+                
+                if dot.subviews.count == 0 {
+                    
+                    let imageView: UIImageView = UIImageView()
+                    
+                    imageView.frame = dot.bounds
+
+                    dot.addSubview(imageView)
+                }
+                    
+                if let imageView = dot.subviews[0] as? UIImageView {
+
+                    imageView.image = self.currentPage == index ? self.currentPageIndicatorImage ?? UIImage() : self.pageIndicatorImage ?? UIImage()
+                }
+            }
+        }
+    }
+    
+    public override init(frame: CGRect) {
+        
+        super.init(frame: frame)
+    }
+    
+    required public init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+}
+
+class JCyclePictureViewCell: UICollectionViewCell {
+    
+    let imageView: UIImageView = UIImageView()
+    
+    override init(frame: CGRect) {
+        
+        super.init(frame: frame)
+        
+        imageView.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
+        
+        self.addSubview(imageView)
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+}

+ 2 - 0
Koala/Koala/Modular/Assets/V/AssetsTotal/AssetsTotalCell.swift

@@ -163,6 +163,8 @@ extension AssetsTotalCell : UICollectionViewDelegateFlowLayout, UICollectionView
         return CGSize(width: (SCREEN_WIDTH-30 - 20)/3, height: (collectionView.frame.height-10)/2)
     }
     
+   
+    
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        
         if indexPath.row == 0 {

+ 164 - 0
Koala/Koala/Modular/Home/V/HomeIndexCell.swift

@@ -0,0 +1,164 @@
+//
+//  HomeIndexCell.swift
+//  Koala
+//
+//  Created by 刘千军 on 2023/10/22.
+//  Copyright © 2023 刘千军. All rights reserved.
+//
+
+import UIKit
+
+class HomeIndexCell: BaseTableViewCell {
+    @IBOutlet weak var collectionView: UICollectionView!
+    
+    lazy var listData:[KSymbolModel] = {
+        let arr:[KSymbolModel] = [KSymbolModel]()
+        return arr
+    }()
+    
+    /// 轮播时间
+    var time: TimeInterval = 2
+    {
+        didSet{
+            startTimer()
+        }
+    }
+    
+    var timer: Timer?
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        self.backgroundColor = .clear
+        
+        let layout = UICollectionViewFlowLayout.init()
+        layout.scrollDirection = UICollectionView.ScrollDirection.horizontal
+        layout.minimumInteritemSpacing = 0
+        layout.minimumLineSpacing = 10
+        collectionView.setCollectionViewLayout(layout, animated: true)
+        collectionView.delegate = self
+        collectionView.dataSource = self
+        collectionView.showsVerticalScrollIndicator = false
+        collectionView.showsHorizontalScrollIndicator = false
+        collectionView.backgroundColor = UIColor.clear
+        collectionView.register(UINib.init(nibName: "HomeIndexListCell", bundle: nil), forCellWithReuseIdentifier: "HomeIndexListCell")
+        
+        
+    }
+    
+    override func mySwitchColor() {
+        
+    }
+    
+    override func setSelected(_ selected: Bool, animated: Bool) {
+        super.setSelected(selected, animated: animated)
+        
+        // Configure the view for the selected state
+    }
+    
+    func updateCellDataWith(list:[KSymbolModel]) -> Void {
+        listData.removeAll()
+        self.listData = list
+        self.collectionView.reloadData()
+        startTimer()
+    }
+    
+}
+
+extension HomeIndexCell : UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource{
+    func numberOfSections(in collectionView: UICollectionView) -> Int {
+          return 100
+      }
+    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+        return self.listData.count
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+        
+        let cell:HomeIndexListCell = collectionView.dequeueReusableCell(withReuseIdentifier: "HomeIndexListCell", for: indexPath) as! HomeIndexListCell
+        cell.updateCellDataWith(model: self.listData[indexPath.row])
+        return cell
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
+        return CGSize(width: (SCREEN_WIDTH)/3, height: collectionView.frame.height)
+    }
+    
+    
+    
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        
+        
+    }
+    
+    //MARK: -UIScrollViewDelegate
+    // 停止拖拽的时候开始执行
+    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+        endTimer()
+    }
+    
+    // 停止拖拽的时候开始执行
+    func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
+        startTimer()
+    }
+    
+    // 手指离开减速停止的时候开始执行
+    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
+        //暂不做处理
+    }
+    
+    //在这个方法中算出当前页数
+    func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        let page = Int((scrollView.contentOffset.x + (collectionView.bounds.width) * 0.5) / (collectionView.bounds.width))
+        let currentPage = page % (self.listData.count)
+      
+        
+        //起始位置和最终位置的切换
+        if scrollView.contentOffset.x >= (CGFloat)((self.listData.count) * 100 - 3) * SCREEN_WIDTH || scrollView.contentOffset.x <= 2{
+            collectionView.scrollToItem(at: IndexPath(item: currentPage, section: 100/2), at: .left, animated: false)
+        }
+    }
+    
+}
+extension HomeIndexCell{
+    /// 开始定时器
+    func startTimer(){
+        
+//        //如果只有一张图片,则直接返回,不开启定时器
+//        if self.listData.count > 0 {
+//            return
+//        }
+//        //如果定时器已开启,先停止再重新开启
+//        if (timer != nil) {
+//            endTimer()
+//        }
+//
+//        timer = Timer.init(timeInterval: time, target: self, selector: #selector(nextPageView), userInfo: nil, repeats: true)
+//        RunLoop.current.add(timer!, forMode:.common)
+    }
+    
+    /// 停止定时器
+    func endTimer(){
+//        timer?.invalidate()
+//        timer = nil
+    }
+    
+    //MARK: -进入下一页
+    @objc func nextPageView()
+    {
+        //获取当前indexPath
+        let currentIndexPath = collectionView.indexPathsForVisibleItems.last!
+        //获取中间那一组的indexPath
+        let middleIndexPath = IndexPath(item: currentIndexPath.item, section: 100/2)
+        //滚动到中间那一组
+        collectionView.scrollToItem(at: middleIndexPath, at: .left, animated: false)
+        
+        var nextItem = middleIndexPath.item + 1
+        var nextSection = middleIndexPath.section
+        if nextItem == self.listData.count {
+            nextItem = 0
+            nextSection += 1
+        }
+        collectionView.scrollToItem(at: IndexPath(item: nextItem, section: nextSection), at: .left, animated: true)
+    }
+    
+}

+ 51 - 0
Koala/Koala/Modular/Home/V/HomeIndexCell.xib

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_12" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="System colors in document resources" minToolsVersion="11.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="138" id="KGk-i7-Jjw" customClass="HomeIndexCell" customModule="Koala" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="395" height="138"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+            <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
+                <rect key="frame" x="0.0" y="0.0" width="395" height="138"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="GYf-GB-319">
+                        <rect key="frame" x="10" y="10" width="375" height="118"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                        <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="up3-aP-SZr">
+                            <size key="itemSize" width="128" height="128"/>
+                            <size key="headerReferenceSize" width="0.0" height="0.0"/>
+                            <size key="footerReferenceSize" width="0.0" height="0.0"/>
+                            <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
+                        </collectionViewFlowLayout>
+                    </collectionView>
+                </subviews>
+                <constraints>
+                    <constraint firstAttribute="trailing" secondItem="GYf-GB-319" secondAttribute="trailing" constant="10" id="9Th-Xn-t8D"/>
+                    <constraint firstItem="GYf-GB-319" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="9ui-ce-7P8"/>
+                    <constraint firstAttribute="bottom" secondItem="GYf-GB-319" secondAttribute="bottom" constant="10" id="D2D-dI-Zhe"/>
+                    <constraint firstItem="GYf-GB-319" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="mLb-P4-i22"/>
+                </constraints>
+            </tableViewCellContentView>
+            <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
+            <connections>
+                <outlet property="collectionView" destination="GYf-GB-319" id="zDm-tY-Y5Q"/>
+            </connections>
+            <point key="canvasLocation" x="149" y="54"/>
+        </tableViewCell>
+    </objects>
+    <resources>
+        <systemColor name="systemBackgroundColor">
+            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
+    </resources>
+</document>

+ 91 - 0
Koala/Koala/Modular/Home/V/HomeIndexListCell.swift

@@ -0,0 +1,91 @@
+//
+//  HomeIndexListCell.swift
+//  Koala
+//
+//  Created by 刘千军 on 2023/10/22.
+//  Copyright © 2023 刘千军. All rights reserved.
+//
+
+import UIKit
+
+class HomeIndexListCell: UICollectionViewCell {
+    @IBOutlet weak var bgView: UIView!
+    @IBOutlet weak var nameLab: UILabel!
+    @IBOutlet weak var priceLab: UILabel!
+    
+    @IBOutlet weak var differenceLab: UILabel!
+    
+    @IBOutlet weak var changeLab: UILabel!
+    
+    @IBOutlet weak var chartsBgView: UIView!
+    
+    lazy var lineView:JDChartLineView = {
+        let view:JDChartLineView = JDChartLineView()
+        view.lineChartView.minOffset = 0
+        view.shadowSize = CGSize(width: 0, height: 3)
+        view.isUserInteractionEnabled = false
+        view.lineChartView.isUserInteractionEnabled = false
+        return view
+    }()
+    
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        self.backgroundColor = .clear
+        
+        self.bgView.setViewLayerBorderColor(myColor: .clear, borderWidth: 0, maskBounds: 12)
+        self.nameLab.setTextFont(.PFSM, 12)
+        self.priceLab.setTextFont(.PFSM, 16)
+        
+        self.differenceLab.setTextFont(.PFSR, 10)
+        self.changeLab.setTextFont(.PFSR, 10)
+        
+        self.chartsBgView.addSubview(self.lineView)
+        self.lineView.snp.makeConstraints { make in
+            make.edges.equalToSuperview()
+        }
+    }
+    
+
+    func mySwitchColor() {
+        self.nameLab.textColor = TitleTextColor
+    
+    }
+    
+    
+    func updateCellDataWith(model:KSymbolModel) -> Void {
+        mySwitchColor()
+        
+    
+        self.nameLab.text = model.title
+        
+        self.priceLab.text = precisionString(with: model.newPrice, precision: model.digits)
+        
+        let difference:Double = conerData(model.newPrice, .MyDouble).2! - conerData(model.open, .MyDouble).2!
+        if difference > 0 {
+            self.differenceLab.text = String(format: "+%.2f", difference)
+        }else{
+            self.differenceLab.text = String(format: "%.2f", difference)
+        }
+        
+        let increase = conerData(model.increase as Any, .MyFloat).1!
+        if increase > 0 {
+            self.changeLab.text = "+" + precisionString(with: model.increase, precision: "2")  + "%"
+        }else{
+            self.changeLab.text = precisionString(with: model.increase, precision: "2")  + "%"
+        }
+        
+        let color = exchangeColorAndImage(increase: increase).0
+        self.priceLab.textColor = color
+        
+        self.differenceLab.textColor = color
+        self.changeLab.textColor = color
+        let color1 = exchangeColorAndImage(increase: increase).2
+        bgView.insertGradientLayer(myType: .normal(frame:bgView.frame), mycolors: [ALLBackGroundColor.cgColor, color1.cgColor], locations: [0, 1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 1, y: 1))
+        
+        self.lineView.updateHomeData(fillColor: color , gradientColor: ALLBackGroundColor , data: model.data)
+    }
+    
+    
+
+}

+ 98 - 0
Koala/Koala/Modular/Home/V/HomeIndexListCell.xib

@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_12" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="HomeIndexListCell" customModule="Koala" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="224" height="169"/>
+            <autoresizingMask key="autoresizingMask"/>
+            <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+                <rect key="frame" x="0.0" y="0.0" width="224" height="169"/>
+                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                <subviews>
+                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="g7f-nM-2QI">
+                        <rect key="frame" x="0.0" y="0.0" width="224" height="169"/>
+                        <subviews>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="vyU-Hh-JqD">
+                                <rect key="frame" x="5" y="9.9999999999999982" width="214" height="20.333333333333329"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AyW-kJ-FzC">
+                                <rect key="frame" x="5" y="35.333333333333336" width="215" height="20.333333333333336"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                            <stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aPM-hz-NCk">
+                                <rect key="frame" x="5" y="60.666666666666664" width="214" height="20.333333333333336"/>
+                                <subviews>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wrJ-bZ-GiI">
+                                        <rect key="frame" x="0.0" y="0.0" width="107" height="20.333333333333332"/>
+                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fgJ-3A-EXk">
+                                        <rect key="frame" x="107" y="0.0" width="107" height="20.333333333333332"/>
+                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="fgJ-3A-EXk" firstAttribute="width" secondItem="wrJ-bZ-GiI" secondAttribute="width" id="OZ7-5E-wDH"/>
+                                </constraints>
+                            </stackView>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="W05-8e-Bhc">
+                                <rect key="frame" x="5" y="81" width="214" height="88"/>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <constraints>
+                            <constraint firstAttribute="bottom" secondItem="W05-8e-Bhc" secondAttribute="bottom" id="0CW-Nz-oVD"/>
+                            <constraint firstAttribute="trailing" secondItem="aPM-hz-NCk" secondAttribute="trailing" constant="5" id="9iy-yr-Axd"/>
+                            <constraint firstItem="AyW-kJ-FzC" firstAttribute="leading" secondItem="g7f-nM-2QI" secondAttribute="leading" constant="5" id="Aky-gk-JJR"/>
+                            <constraint firstItem="AyW-kJ-FzC" firstAttribute="top" secondItem="vyU-Hh-JqD" secondAttribute="bottom" constant="5" id="JLJ-uA-YCL"/>
+                            <constraint firstAttribute="trailing" secondItem="AyW-kJ-FzC" secondAttribute="trailing" constant="4" id="MAF-4o-TZB"/>
+                            <constraint firstAttribute="trailing" secondItem="W05-8e-Bhc" secondAttribute="trailing" constant="5" id="O2J-cH-jBs"/>
+                            <constraint firstItem="aPM-hz-NCk" firstAttribute="leading" secondItem="g7f-nM-2QI" secondAttribute="leading" constant="5" id="Ova-Op-jAl"/>
+                            <constraint firstItem="W05-8e-Bhc" firstAttribute="top" secondItem="aPM-hz-NCk" secondAttribute="bottom" id="QS5-fh-fZh"/>
+                            <constraint firstItem="vyU-Hh-JqD" firstAttribute="top" secondItem="g7f-nM-2QI" secondAttribute="top" constant="10" id="TVQ-h2-LEE"/>
+                            <constraint firstItem="W05-8e-Bhc" firstAttribute="leading" secondItem="g7f-nM-2QI" secondAttribute="leading" constant="5" id="YT3-F5-9p3"/>
+                            <constraint firstItem="vyU-Hh-JqD" firstAttribute="leading" secondItem="g7f-nM-2QI" secondAttribute="leading" constant="5" id="bJv-ok-2rj"/>
+                            <constraint firstAttribute="trailing" secondItem="vyU-Hh-JqD" secondAttribute="trailing" constant="5" id="fDS-o2-JAW"/>
+                            <constraint firstItem="aPM-hz-NCk" firstAttribute="top" secondItem="AyW-kJ-FzC" secondAttribute="bottom" constant="5" id="xN4-3A-8qo"/>
+                        </constraints>
+                    </view>
+                </subviews>
+            </view>
+            <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
+            <constraints>
+                <constraint firstAttribute="bottom" secondItem="g7f-nM-2QI" secondAttribute="bottom" id="3ZP-6m-5B2"/>
+                <constraint firstAttribute="trailing" secondItem="g7f-nM-2QI" secondAttribute="trailing" id="RSk-HH-43N"/>
+                <constraint firstItem="g7f-nM-2QI" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="mYn-lg-jMo"/>
+                <constraint firstItem="g7f-nM-2QI" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="o2a-sf-g1v"/>
+            </constraints>
+            <size key="customSize" width="224" height="169"/>
+            <connections>
+                <outlet property="bgView" destination="g7f-nM-2QI" id="utV-kR-NqM"/>
+                <outlet property="changeLab" destination="fgJ-3A-EXk" id="tjK-Qn-rMF"/>
+                <outlet property="chartsBgView" destination="W05-8e-Bhc" id="dvE-M3-Ieo"/>
+                <outlet property="differenceLab" destination="wrJ-bZ-GiI" id="z6J-7E-gtK"/>
+                <outlet property="nameLab" destination="vyU-Hh-JqD" id="2OM-Dw-ODU"/>
+                <outlet property="priceLab" destination="AyW-kJ-FzC" id="drf-PZ-yiQ"/>
+            </connections>
+            <point key="canvasLocation" x="163.35877862595419" y="61.619718309859159"/>
+        </collectionViewCell>
+    </objects>
+</document>

+ 145 - 42
Koala/Koala/Modular/Home/V/HomeOptionsCell.swift

@@ -21,12 +21,36 @@ class HomeOptionsCell: BaseTableViewCell {
     @IBOutlet weak var lab4: UILabel!
     
     @IBOutlet weak var lineView: UIView!
-    @IBOutlet weak var tableView: UITableView!
+   
     
+    @IBOutlet weak var listBgView: UIView!
+    @IBOutlet weak var collectionView: UICollectionView!
     @IBOutlet weak var more1Btn: UIButton!
     
-    var listData:[OptionsListModel] = [OptionsListModel]()
+    var listData:[[OptionsListModel]] = [[OptionsListModel]]()
+    /// 轮播时间
+    var time: TimeInterval = 4
+    {
+        didSet{
+            startTimer()
+        }
+    }
+    
+    var timer: Timer?
     
+    lazy var pictureView:JCyclePictureView = {
+        let pictureView: JCyclePictureView = JCyclePictureView(frame: CGRect(x: 0, y:0, width: self.frame.width, height:300), pictures: nil)
+        pictureView.direction = .right
+        pictureView.autoScrollDelay = 5
+        pictureView.didTapAtIndexHandle = { index in
+            
+        }
+        
+      
+        return pictureView
+    }()
+  
+
     override func awakeFromNib() {
         super.awakeFromNib()
        
@@ -47,19 +71,20 @@ class HomeOptionsCell: BaseTableViewCell {
         self.more1Btn.setTextFont(.PFSR, 14)
         self.moreBtn.addTarget(self, action: #selector(clickMoreBtnAction), for: .touchUpInside)
         self.more1Btn.addTarget(self, action: #selector(clickMoreBtnAction), for: .touchUpInside)
+
+        //self.listBgView.addSubview(self.pictureView)
         
-        self.tableView.delegate = self
-        self.tableView.dataSource = self
-        tableView.separatorStyle = .singleLine
-        tableView.separatorInset = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15)
-        tableView.separatorColor = ViewBorderColor
-        tableView.backgroundColor = .clear
-        tableView.tableFooterView = UIView()
-        tableView.tableHeaderView = UIView()
-        tableView.showsVerticalScrollIndicator = false
-        tableView.showsVerticalScrollIndicator = false
-        tableView.register(UINib.init(nibName: "MarketOptionsListCell", bundle: nil), forCellReuseIdentifier: "MarketOptionsListCell")
-       
+        let layout = UICollectionViewFlowLayout.init()
+        layout.scrollDirection = UICollectionView.ScrollDirection.horizontal
+        layout.minimumInteritemSpacing = 0
+        layout.minimumLineSpacing = 10
+        collectionView.setCollectionViewLayout(layout, animated: true)
+        collectionView.delegate = self
+        collectionView.dataSource = self
+        collectionView.showsVerticalScrollIndicator = false
+        collectionView.showsHorizontalScrollIndicator = false
+        collectionView.backgroundColor = UIColor.clear
+        collectionView.register(UINib.init(nibName: "HomeOptionsListCell", bundle: nil), forCellWithReuseIdentifier: "HomeOptionsListCell")
         
         mySwitchLanguage()
         mySwitchColor()
@@ -102,8 +127,11 @@ class HomeOptionsCell: BaseTableViewCell {
     }
     
     func updateCellWith(list:[OptionsListModel]) -> Void {
-        self.listData = list
-        self.tableView.reloadData()
+        self.listData = self.convertToTwoDArrayFrom(oneDArray: list, rawCount: 5)
+      
+        self.collectionView.reloadData()
+        self.startTimer()
+       // self.pictureView.collectionView.reloadData()
     }
     
     @objc func clickMoreBtnAction(){
@@ -111,50 +139,125 @@ class HomeOptionsCell: BaseTableViewCell {
         currentVc()?.tabBarController?.selectedIndex = TabbarMarketIndex
     }
     
+    /// 一维数组转二维数组
+       /// - Parameters:
+       ///   - oneDArray: 一维数组
+       ///   - rawCount: 被分割的个数
+       /// - Returns: 转换后的二维数组
+    private func convertToTwoDArrayFrom(oneDArray: [OptionsListModel], rawCount: Int) -> [[OptionsListModel]] {
+          let twoDArray = stride(from: 0, to: oneDArray.count, by: rawCount).map { (index) -> [OptionsListModel] in
+              if (index + rawCount) > oneDArray.count {
+                  return Array(oneDArray[index...])
+              } else {
+                  return Array(oneDArray[index..<index + rawCount])
+              }
+          }
+          print("转换后的二维数组\(twoDArray)")
+          return twoDArray
+      }
+    
 }
 
-//代理
-extension HomeOptionsCell: UITableViewDelegate,UITableViewDataSource{
-    func numberOfSections(in tableView: UITableView) -> Int {
-        return 1
-    }
-    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+extension HomeOptionsCell : UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource{
+    func numberOfSections(in collectionView: UICollectionView) -> Int {
+          return 100
+      }
+    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
         return self.listData.count
     }
     
-    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-        let cell:MarketOptionsListCell = tableView.dequeueReusableCell(withIdentifier: "MarketOptionsListCell") as! MarketOptionsListCell
-        let model = self.listData[indexPath.row]
-        cell.updateHomeCellWith(model: model)
+    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+        
+        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "HomeOptionsListCell", for: indexPath) as! HomeOptionsListCell
+        if self.listData.count == 0{
+            return cell
+        }
+        cell.updateCellWith(list:self.listData[indexPath.row])
         return cell
+        
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
+        return CGSize(width: (SCREEN_WIDTH-20), height: collectionView.frame.height)
+    }
+    
+    
+    
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        
+        
     }
     
-    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
-        return UIView()
+    //MARK: -UIScrollViewDelegate
+    // 停止拖拽的时候开始执行
+    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+        endTimer()
     }
     
-    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
-        return UIView()
+    // 停止拖拽的时候开始执行
+    func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
+        startTimer()
     }
     
-    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
-        return 60
+    // 手指离开减速停止的时候开始执行
+    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
+        //暂不做处理
     }
     
-    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
-        return 0
+    //在这个方法中算出当前页数
+    func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        let page = Int((scrollView.contentOffset.x + (collectionView.bounds.width) * 0.5) / (collectionView.bounds.width))
+        let currentPage = page % (self.listData.count)
+      
+        
+        //起始位置和最终位置的切换
+        if scrollView.contentOffset.x >= (CGFloat)((self.listData.count) * 100 - 3) * SCREEN_WIDTH || scrollView.contentOffset.x <= 2{
+            collectionView.scrollToItem(at: IndexPath(item: currentPage, section: 100/2), at: .left, animated: false)
+        }
     }
     
-    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
-        return  0
+}
+
+extension HomeOptionsCell{
+    /// 开始定时器
+    func startTimer(){
+        
+        //如果只有一张图片,则直接返回,不开启定时器
+        if self.listData.count < 3 {
+            return
+        }
+        //如果定时器已开启,先停止再重新开启
+        if (timer != nil) {
+            endTimer()
+        }
+        
+        timer = Timer.init(timeInterval: time, target: self, selector: #selector(nextPageView), userInfo: nil, repeats: true)
+        RunLoop.current.add(timer!, forMode:.common)
     }
     
-    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-        let vc:MarketDetailViewController = MarketDetailViewController()
-        let model = self.listData[indexPath.row]
-        vc.symbolCode = model.code
-        vc.index = 4
-        currentVc()?.navigationController?.pushViewController(vc, animated: true)
+    /// 停止定时器
+    func endTimer(){
+        timer?.invalidate()
+        timer = nil
+    }
+    
+    //MARK: -进入下一页
+    @objc func nextPageView()
+    {
+        //获取当前indexPath
+        let currentIndexPath = collectionView.indexPathsForVisibleItems.last!
+        //获取中间那一组的indexPath
+        let middleIndexPath = IndexPath(item: currentIndexPath.item, section: 100/2)
+        //滚动到中间那一组
+        collectionView.scrollToItem(at: middleIndexPath, at: .left, animated: false)
+        
+        var nextItem = middleIndexPath.item + 1
+        var nextSection = middleIndexPath.section
+        if nextItem == self.listData.count {
+            nextItem = 0
+            nextSection += 1
+        }
+        collectionView.scrollToItem(at: IndexPath(item: nextItem, section: nextSection), at: .left, animated: true)
     }
     
 }

+ 35 - 30
Koala/Koala/Modular/Home/V/HomeOptionsCell.xib

@@ -10,21 +10,21 @@
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="329" id="KGk-i7-Jjw" customClass="HomeOptionsCell" customModule="Koala" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="429" height="329"/>
+        <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="444" id="KGk-i7-Jjw" customClass="HomeOptionsCell" customModule="Koala" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="457" height="444"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
             <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
-                <rect key="frame" x="0.0" y="0.0" width="429" height="329"/>
+                <rect key="frame" x="0.0" y="0.0" width="457" height="444"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="y6Y-Bs-egr">
-                        <rect key="frame" x="10" y="5" width="409" height="268"/>
+                        <rect key="frame" x="10" y="5" width="437" height="434"/>
                         <subviews>
                             <stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="U8M-mN-bcr">
-                                <rect key="frame" x="0.0" y="0.0" width="409" height="268"/>
+                                <rect key="frame" x="0.0" y="0.0" width="437" height="434"/>
                                 <subviews>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EM4-6i-rgZ">
-                                        <rect key="frame" x="0.0" y="0.0" width="409" height="40"/>
+                                        <rect key="frame" x="0.0" y="0.0" width="437" height="40"/>
                                         <subviews>
                                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8TI-X1-ndH">
                                                 <rect key="frame" x="15.000000000000004" y="0.0" width="41.333333333333343" height="40"/>
@@ -33,7 +33,7 @@
                                                 <nil key="highlightedColor"/>
                                             </label>
                                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8KF-Ke-Z7i">
-                                                <rect key="frame" x="364" y="0.0" width="30" height="40"/>
+                                                <rect key="frame" x="392" y="0.0" width="30" height="40"/>
                                                 <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                             </button>
                                         </subviews>
@@ -49,19 +49,19 @@
                                         </constraints>
                                     </view>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DLh-Il-BFu">
-                                        <rect key="frame" x="0.0" y="40" width="409" height="30"/>
+                                        <rect key="frame" x="0.0" y="40" width="437" height="30"/>
                                         <subviews>
                                             <stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="J6f-PN-eU5">
-                                                <rect key="frame" x="15" y="0.0" width="379" height="30"/>
+                                                <rect key="frame" x="15" y="0.0" width="407" height="30"/>
                                                 <subviews>
                                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Cm-f4-gQ9">
-                                                        <rect key="frame" x="0.0" y="0.0" width="139" height="30"/>
+                                                        <rect key="frame" x="0.0" y="0.0" width="167" height="30"/>
                                                         <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                         <nil key="textColor"/>
                                                         <nil key="highlightedColor"/>
                                                     </label>
                                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rav-Cu-2z8">
-                                                        <rect key="frame" x="139" y="0.0" width="80" height="30"/>
+                                                        <rect key="frame" x="167" y="0.0" width="80" height="30"/>
                                                         <constraints>
                                                             <constraint firstAttribute="width" constant="80" id="28h-tG-3OX"/>
                                                         </constraints>
@@ -70,7 +70,7 @@
                                                         <nil key="highlightedColor"/>
                                                     </label>
                                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jCg-CN-bPF">
-                                                        <rect key="frame" x="219" y="0.0" width="80" height="30"/>
+                                                        <rect key="frame" x="247" y="0.0" width="80" height="30"/>
                                                         <constraints>
                                                             <constraint firstAttribute="width" constant="80" id="PDq-rt-4Ap"/>
                                                         </constraints>
@@ -79,7 +79,7 @@
                                                         <nil key="highlightedColor"/>
                                                     </label>
                                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u8D-5v-2bR">
-                                                        <rect key="frame" x="299" y="0.0" width="80" height="30"/>
+                                                        <rect key="frame" x="327" y="0.0" width="80" height="30"/>
                                                         <constraints>
                                                             <constraint firstAttribute="width" constant="80" id="WML-W8-IdW"/>
                                                         </constraints>
@@ -90,7 +90,7 @@
                                                 </subviews>
                                             </stackView>
                                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tpo-9y-1q7">
-                                                <rect key="frame" x="15" y="29" width="379" height="1"/>
+                                                <rect key="frame" x="15" y="29" width="407" height="1"/>
                                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="1" id="3om-O1-o3J"/>
@@ -110,29 +110,33 @@
                                         </constraints>
                                     </view>
                                     <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DBq-oa-PpC">
-                                        <rect key="frame" x="0.0" y="70" width="409" height="158"/>
+                                        <rect key="frame" x="0.0" y="70" width="437" height="324"/>
                                         <subviews>
-                                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="mxy-RH-Ojg">
-                                                <rect key="frame" x="0.0" y="0.0" width="409" height="180"/>
+                                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="DIx-64-QeQ">
+                                                <rect key="frame" x="0.0" y="98" width="437" height="128"/>
                                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
-                                                <constraints>
-                                                    <constraint firstAttribute="height" constant="180" id="9Jg-a6-M9a"/>
-                                                </constraints>
-                                            </tableView>
+                                                <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="sft-6l-0oK">
+                                                    <size key="itemSize" width="128" height="128"/>
+                                                    <size key="headerReferenceSize" width="0.0" height="0.0"/>
+                                                    <size key="footerReferenceSize" width="0.0" height="0.0"/>
+                                                    <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
+                                                </collectionViewFlowLayout>
+                                            </collectionView>
                                         </subviews>
                                         <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         <constraints>
-                                            <constraint firstAttribute="trailing" secondItem="mxy-RH-Ojg" secondAttribute="trailing" id="2tL-Th-6J8"/>
-                                            <constraint firstAttribute="bottom" secondItem="mxy-RH-Ojg" secondAttribute="bottom" id="8Yi-lJ-bML"/>
-                                            <constraint firstItem="mxy-RH-Ojg" firstAttribute="top" secondItem="DBq-oa-PpC" secondAttribute="top" id="KYl-Dp-z2W"/>
-                                            <constraint firstItem="mxy-RH-Ojg" firstAttribute="leading" secondItem="DBq-oa-PpC" secondAttribute="leading" id="eES-Qp-AyH"/>
+                                            <constraint firstAttribute="trailing" secondItem="DIx-64-QeQ" secondAttribute="trailing" id="5GE-56-riv"/>
+                                            <constraint firstAttribute="bottom" secondItem="DIx-64-QeQ" secondAttribute="bottom" id="6nh-p7-JQm"/>
+                                            <constraint firstAttribute="height" constant="300" id="F5J-my-kf7"/>
+                                            <constraint firstItem="DIx-64-QeQ" firstAttribute="leading" secondItem="DBq-oa-PpC" secondAttribute="leading" id="FZJ-Eh-lxx"/>
+                                            <constraint firstItem="DIx-64-QeQ" firstAttribute="top" secondItem="DBq-oa-PpC" secondAttribute="top" id="z1d-H9-WWk"/>
                                         </constraints>
                                     </view>
                                     <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zFb-3J-ZRx">
-                                        <rect key="frame" x="0.0" y="228" width="409" height="40"/>
+                                        <rect key="frame" x="0.0" y="394" width="437" height="40"/>
                                         <subviews>
                                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Sab-fs-7op">
-                                                <rect key="frame" x="189.66666666666666" y="0.0" width="30" height="40"/>
+                                                <rect key="frame" x="203.66666666666666" y="0.0" width="30" height="40"/>
                                                 <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                             </button>
                                         </subviews>
@@ -156,7 +160,7 @@
                         </constraints>
                     </view>
                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="M1O-cz-4Nq">
-                        <rect key="frame" x="379" y="0.0" width="40" height="40"/>
+                        <rect key="frame" x="407" y="0.0" width="40" height="40"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="40" id="Ga2-uW-joA"/>
                             <constraint firstAttribute="width" constant="40" id="gF9-iw-AcR"/>
@@ -174,18 +178,19 @@
             </tableViewCellContentView>
             <connections>
                 <outlet property="bgView" destination="y6Y-Bs-egr" id="uy1-Bs-xse"/>
+                <outlet property="collectionView" destination="DIx-64-QeQ" id="bYL-da-OfY"/>
                 <outlet property="imgView" destination="M1O-cz-4Nq" id="ByR-aI-ug5"/>
                 <outlet property="lab1" destination="0Cm-f4-gQ9" id="Vj1-zC-wWj"/>
                 <outlet property="lab2" destination="rav-Cu-2z8" id="xsR-HB-i49"/>
                 <outlet property="lab3" destination="jCg-CN-bPF" id="Q3b-Y0-ovL"/>
                 <outlet property="lab4" destination="u8D-5v-2bR" id="uVg-bb-Ut0"/>
                 <outlet property="lineView" destination="Tpo-9y-1q7" id="wz0-0U-sPv"/>
+                <outlet property="listBgView" destination="DBq-oa-PpC" id="QEg-ZU-NAQ"/>
                 <outlet property="more1Btn" destination="Sab-fs-7op" id="Kkg-le-fD1"/>
                 <outlet property="moreBtn" destination="8KF-Ke-Z7i" id="46j-eI-Ohw"/>
-                <outlet property="tableView" destination="mxy-RH-Ojg" id="gAh-ZR-CZi"/>
                 <outlet property="titleLab" destination="8TI-X1-ndH" id="Fvz-3C-k6c"/>
             </connections>
-            <point key="canvasLocation" x="179.38931297709922" y="105.28169014084507"/>
+            <point key="canvasLocation" x="200.76335877862596" y="145.77464788732394"/>
         </tableViewCell>
     </objects>
     <resources>

+ 82 - 0
Koala/Koala/Modular/Home/V/HomeOptionsListCell.swift

@@ -0,0 +1,82 @@
+//
+//  HomeOptionsListCell.swift
+//  Koala
+//
+//  Created by 刘千军 on 2023/10/22.
+//  Copyright © 2023 刘千军. All rights reserved.
+//
+
+import UIKit
+
+class HomeOptionsListCell: UICollectionViewCell {
+    @IBOutlet weak var tableView: UITableView!
+    var listData:[OptionsListModel] = [OptionsListModel]()
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        self.tableView.delegate = self
+        self.tableView.dataSource = self
+        tableView.separatorStyle = .singleLine
+        tableView.separatorInset = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15)
+        tableView.separatorColor = ViewBorderColor
+        tableView.backgroundColor = .clear
+        tableView.tableFooterView = UIView()
+        tableView.tableHeaderView = UIView()
+        tableView.showsVerticalScrollIndicator = false
+        tableView.showsVerticalScrollIndicator = false
+        tableView.register(UINib.init(nibName: "MarketOptionsListCell", bundle: nil), forCellReuseIdentifier: "MarketOptionsListCell")
+    }
+    
+    func updateCellWith(list:[OptionsListModel]) -> Void {
+        self.listData = list
+        self.tableView.reloadData()
+    }
+
+}
+
+//代理
+extension HomeOptionsListCell: UITableViewDelegate,UITableViewDataSource{
+    func numberOfSections(in tableView: UITableView) -> Int {
+        return 1
+    }
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return self.listData.count
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        let cell:MarketOptionsListCell = tableView.dequeueReusableCell(withIdentifier: "MarketOptionsListCell") as! MarketOptionsListCell
+        let model = self.listData[indexPath.row]
+        cell.updateHomeCellWith(model: model)
+        return cell
+    }
+    
+    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+        return UIView()
+    }
+    
+    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
+        return UIView()
+    }
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        return 60
+    }
+    
+    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
+        return 0
+    }
+    
+    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
+        return  0
+    }
+    
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        let vc:MarketDetailViewController = MarketDetailViewController()
+        let model = self.listData[indexPath.row]
+        vc.symbolCode = model.code
+        vc.index = 4
+        currentVc()?.navigationController?.pushViewController(vc, animated: true)
+    }
+    
+}
+

+ 46 - 0
Koala/Koala/Modular/Home/V/HomeOptionsListCell.xib

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_12" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="System colors in document resources" minToolsVersion="11.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="HomeOptionsListCell" customModule="Koala" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="205" height="174"/>
+            <autoresizingMask key="autoresizingMask"/>
+            <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+                <rect key="frame" x="0.0" y="0.0" width="205" height="174"/>
+                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                <subviews>
+                    <tableView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="jHO-xr-GPn">
+                        <rect key="frame" x="0.0" y="0.0" width="205" height="174"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                    </tableView>
+                </subviews>
+            </view>
+            <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
+            <constraints>
+                <constraint firstItem="jHO-xr-GPn" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="R37-HY-QDx"/>
+                <constraint firstAttribute="bottom" secondItem="jHO-xr-GPn" secondAttribute="bottom" id="SAw-vZ-ymw"/>
+                <constraint firstAttribute="trailing" secondItem="jHO-xr-GPn" secondAttribute="trailing" id="WlH-o9-szV"/>
+                <constraint firstItem="jHO-xr-GPn" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="cah-0l-Rqe"/>
+            </constraints>
+            <size key="customSize" width="205" height="174"/>
+            <connections>
+                <outlet property="tableView" destination="jHO-xr-GPn" id="07j-nE-Vfw"/>
+            </connections>
+            <point key="canvasLocation" x="193.12977099236642" y="63.380281690140848"/>
+        </collectionViewCell>
+    </objects>
+    <resources>
+        <systemColor name="systemBackgroundColor">
+            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
+    </resources>
+</document>

+ 9 - 10
Koala/Koala/Modular/Home/V/HomeView.swift

@@ -47,7 +47,8 @@ class HomeView: BaseView {
         tableView.showsVerticalScrollIndicator = false
         
         
-        tableView.register(UINib.init(nibName: "HomeInfoCell", bundle: nil), forCellReuseIdentifier: "HomeInfoCell")
+        tableView.register(UINib.init(nibName: "HomeIndexCell", bundle: nil), forCellReuseIdentifier: "HomeIndexCell")
+        
         
         tableView.register(UINib.init(nibName: "HomeOptionsCell", bundle: nil), forCellReuseIdentifier: "HomeOptionsCell")
         
@@ -199,15 +200,13 @@ extension HomeView:UITableViewDelegate,UITableViewDataSource{
             
         }
         else if indexPath.section == 1{
-            //            let cell:BaseCurrencyListCell = tableView.dequeueReusableCell(withIdentifier: "BaseCurrencyListCell") as! BaseCurrencyListCell
-            //            let model:KSymbolModel = (self.VM?.symbolList[indexPath.row])!;
-            //            cell.updateHomeCellWith(model: model)
-            
-            //            return cell
-            
-            let cell = tableView.dequeueReusableCell(withIdentifier: JDHomeExponentCell.description()) as! JDHomeExponentCell
+            let cell:HomeIndexCell = tableView.dequeueReusableCell(withIdentifier: "HomeIndexCell") as! HomeIndexCell
             cell.updateCellDataWith(list: self.VM!.symbolList)
             return cell
+            
+//            let cell = tableView.dequeueReusableCell(withIdentifier: JDHomeExponentCell.description()) as! JDHomeExponentCell
+//            cell.updateCellDataWith(list: self.VM!.symbolList)
+  //          return cell
         }
         else if indexPath.section == 2{
             let cell:HomeOptionsCell = tableView.dequeueReusableCell(withIdentifier: "HomeOptionsCell") as! HomeOptionsCell
@@ -234,10 +233,10 @@ extension HomeView:UITableViewDelegate,UITableViewDataSource{
             return 98//220 - 70
         }
         else if indexPath.section == 1{
-            return 330
+            return 130
         }
         else if indexPath.section == 2{
-            return 180 + 110
+            return 300 + 110
         }
         else {
             return 100

+ 1 - 1
Koala/Koala/Modular/Home/V/JDChartLineView.swift

@@ -79,7 +79,7 @@ extension JDChartLineView {
         
         //设置折线
         let chartDataSet = LineChartDataSet(entries: dataEntries, label: "line")
-        chartDataSet.lineWidth = 1.5 //线条宽度
+        chartDataSet.lineWidth = 2 //线条宽度
         
         //chartDataSet.calcMinMaxY(entry: maxEntry)
         //chartDataSet.lineDashLengths = [3,1]

+ 1 - 2
Koala/Koala/Modular/Home/VM/HomeViewModel.swift

@@ -290,8 +290,7 @@ extension HomeViewModel {
 
         let param: [String : Any] = [
             "pageNum" : "1",
-            "pageSize" :"3",
-            "recommend" :"1",
+            "pageSize" :"25",
             "standard" :"100",
         ]
         

+ 3 - 3
Koala/Koala/Modular/Market/V/MarketView/MarketOptionsListCell.swift

@@ -115,13 +115,13 @@ class MarketOptionsListCell: BaseTableViewCell {
             self.markBtn.setTitleColor(_color("#EA4A45&#EA4A45"), for: .normal)
         }
         
-        self.changeLab.text = model.price_1m + "%"
+        self.changeLab.text = precisionString(with: model.price_1m, precision: "2")  + "%"
         self.changeLab.textColor = exchangeColorAndImage(increase: conerData( model.price_1m, .MyFloat).1!).0
         
-        self.meanLab.text = model.standard + switchLanguage("万")
+        self.meanLab.text = precisionString(with: model.standard, precision: "2") + switchLanguage("万")
         self.meanLab.textColor = TitleTextColor
         
-        self.virtualLab.text = model.price_1m + switchLanguage("万")
+        self.virtualLab.text = precisionString(with: model.price_1m, precision: "2") + switchLanguage("万")
         self.virtualLab.textColor = TitleTextColor
         
     }