Ver Fonte

市场添加 热门,指数轮播

刘千军 há 11 meses atrás
pai
commit
b94d6b24aa

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

@@ -771,6 +771,8 @@
 		6CC8023B29954D3500C36373 /* ADepositViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6CC8023929954D3500C36373 /* ADepositViewController.xib */; };
 		6CC8024329968A2300C36373 /* AWithdrawalsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CC8024129968A2300C36373 /* AWithdrawalsViewController.swift */; };
 		6CC8024429968A2300C36373 /* AWithdrawalsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6CC8024229968A2300C36373 /* AWithdrawalsViewController.xib */; };
+		6CCAA17D2AE6C5CD000510FB /* MarkertIndexCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CCAA17B2AE6C5CD000510FB /* MarkertIndexCell.swift */; };
+		6CCAA17E2AE6C5CD000510FB /* MarkertIndexCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6CCAA17C2AE6C5CD000510FB /* MarkertIndexCell.xib */; };
 		6CD200AA29E6E4B500F0966D /* ASavingsDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CD200A829E6E4B500F0966D /* ASavingsDetailsViewController.swift */; };
 		6CD200AB29E6E4B500F0966D /* ASavingsDetailsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6CD200A929E6E4B500F0966D /* ASavingsDetailsViewController.xib */; };
 		6CD200AE29E6E70400F0966D /* ASavingsDetailsHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CD200AD29E6E70400F0966D /* ASavingsDetailsHeaderView.swift */; };
@@ -1636,6 +1638,8 @@
 		6CC8023929954D3500C36373 /* ADepositViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ADepositViewController.xib; sourceTree = "<group>"; };
 		6CC8024129968A2300C36373 /* AWithdrawalsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AWithdrawalsViewController.swift; sourceTree = "<group>"; };
 		6CC8024229968A2300C36373 /* AWithdrawalsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AWithdrawalsViewController.xib; sourceTree = "<group>"; };
+		6CCAA17B2AE6C5CD000510FB /* MarkertIndexCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkertIndexCell.swift; sourceTree = "<group>"; };
+		6CCAA17C2AE6C5CD000510FB /* MarkertIndexCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MarkertIndexCell.xib; sourceTree = "<group>"; };
 		6CD200A829E6E4B500F0966D /* ASavingsDetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ASavingsDetailsViewController.swift; sourceTree = "<group>"; };
 		6CD200A929E6E4B500F0966D /* ASavingsDetailsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ASavingsDetailsViewController.xib; sourceTree = "<group>"; };
 		6CD200AD29E6E70400F0966D /* ASavingsDetailsHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ASavingsDetailsHeaderView.swift; sourceTree = "<group>"; };
@@ -3491,6 +3495,8 @@
 				04D38EAB2AAAE9B10047EF9C /* MarketNavView.swift */,
 				6CBB62C22AD588260045A4C9 /* MarketHeaderView.swift */,
 				6CBB62C62AD588380045A4C9 /* MarketHeaderView.xib */,
+				6CCAA17B2AE6C5CD000510FB /* MarkertIndexCell.swift */,
+				6CCAA17C2AE6C5CD000510FB /* MarkertIndexCell.xib */,
 				04D38EAF2AAB07B10047EF9C /* MarketListHeaderView.swift */,
 				6CBB62BD2AD4451D0045A4C9 /* MarketRecommendView.swift */,
 				6CBB62BF2AD445320045A4C9 /* MarketRecommendView.xib */,
@@ -4102,6 +4108,7 @@
 				6C10F11B29E1C02700B79491 /* AFinanceRedemptionViewController.xib in Resources */,
 				6CC380032992B8A80079FA5C /* AssetsDealCell.xib in Resources */,
 				6C7A1AEB29F80797004CFBE3 /* CreditsViewController.xib in Resources */,
+				6CCAA17E2AE6C5CD000510FB /* MarkertIndexCell.xib in Resources */,
 				6CBB63062AD982190045A4C9 /* MDAuoteDepthListCell.xib in Resources */,
 				6C10F0E729DB08D900B79491 /* updateAPP090.png in Resources */,
 				6CA7133E29587BE10047F450 /* CountrySelectCell.xib in Resources */,
@@ -4659,6 +4666,7 @@
 				6C00A9882433313300CE9ADB /* HXAlbumModel.swift in Sources */,
 				6CC37FEE298FF87D0079FA5C /* AssetsModel.swift in Sources */,
 				6CC37FD8298FAFD00079FA5C /* AssetsTotalView.swift in Sources */,
+				6CCAA17D2AE6C5CD000510FB /* MarkertIndexCell.swift in Sources */,
 				041D4EFF2AC3FD6F008ABDF7 /* JDWorkOrderModel.swift in Sources */,
 				6C66AB912AE54DDB005C471D /* HomeIndexCell.swift in Sources */,
 				6C66AB6E2AE187FE005C471D /* MDOptionsPeriodListCell.swift in Sources */,

+ 180 - 0
Koala/Koala/Modular/Market/V/MarketView/MarkertIndexCell.swift

@@ -0,0 +1,180 @@
+//
+//  MarkertIndexCell.swift
+//  Koala
+//
+//  Created by 刘千军 on 2023/10/23.
+//  Copyright © 2023 刘千军. All rights reserved.
+//
+
+import UIKit
+
+class MarkertIndexCell: UICollectionViewCell {
+    @IBOutlet weak var lineView: UIView!
+    @IBOutlet weak var titleLab: UILabel!
+    @IBOutlet weak var collectionView: UICollectionView!
+
+    var listData:[KSymbolModel] = [KSymbolModel]()
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        self.backgroundColor = .clear
+        self.titleLab.setTextFont(.PFSM, 14)
+        
+        let layout = UICollectionViewFlowLayout.init()
+        layout.scrollDirection = UICollectionView.ScrollDirection.vertical
+        layout.minimumInteritemSpacing = 5
+        layout.minimumLineSpacing = 0
+        collectionView.setCollectionViewLayout(layout, animated: true)
+        collectionView.delegate = self
+        collectionView.dataSource = self
+        collectionView.showsVerticalScrollIndicator = false
+        collectionView.showsHorizontalScrollIndicator = false
+        collectionView.backgroundColor = UIColor.clear
+        collectionView.base_registerCell(cellClass: MIndexListCell.self)
+        
+        // Initialization code
+    }
+    
+    func updagteCellWith(data:(String,[KSymbolModel])) -> Void {
+        self.lineView.backgroundColor = MainBackGroundColor
+        self.titleLab.textColor = TitleTextColor
+        self.titleLab.text = data.0
+        self.listData = data.1
+       
+        self.collectionView.reloadData()
+    }
+
+}
+
+extension MarkertIndexCell : UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource{
+    
+    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+        return self.listData.count
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+        let cell = collectionView.base_dequeueReusableCell(indexPath: indexPath) as MIndexListCell
+        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-40-11)/3, height: collectionView.frame.height)
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+    
+        let model = self.listData[indexPath.row]
+        let vc = MarketDetailViewController()
+        vc.symbolModel = model
+        currentVc()?.navigationController?.pushViewController(vc, animated: true)
+    }
+
+}
+
+class MIndexListCell: UICollectionViewCell {
+   
+    lazy var titleLab:UILabel = {
+        let lab:UILabel = UILabel.init()
+        lab.setTextFont(.PFSR, 12)
+        lab.textColor = TitleTextColor
+        lab.textAlignment = .center
+        return lab
+    }()
+    
+    lazy var priceLab:UILabel = {
+        let lab:UILabel = UILabel.init()
+        lab.setTextFont(.PFSM, 16)
+        lab.textColor = TitleTextColor
+        lab.textAlignment = .center
+        return lab
+    }()
+    
+    lazy var changeLab:UILabel = {
+        let lab:UILabel = UILabel.init()
+        lab.setTextFont(.PFSR, 10)
+        lab.textColor = TitleTextColor
+        lab.textAlignment = .center
+        return lab
+    }()
+    
+    lazy var stackView:UIStackView = {
+        let sView = UIStackView.init()
+        sView.axis = .vertical
+        sView.distribution = .fillEqually
+        sView.addArrangedSubview(titleLab)
+        sView.addArrangedSubview(priceLab)
+        sView.addArrangedSubview(changeLab)
+        return sView
+    }()
+    
+    lazy var bgView:UIView = {
+        let view:UIView = UIView()
+        view.addSubview(stackView)
+        stackView.snp.makeConstraints { make in
+            make.center.equalTo(view)
+            make.left.equalToSuperview()
+        }
+        
+        return view
+    }()
+    
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        contentView.addSubview(bgView)
+        self.backgroundColor = .clear
+        self.contentView.setViewLayerBorderColor(myColor: .clear, borderWidth: 0, maskBounds: 4)
+        self.contentView.layer.masksToBounds = true
+    }
+    
+    override func layoutSubviews() {
+        super.layoutSubviews()
+        self.bgView.snp.makeConstraints { (make) in
+            make.edges.equalToSuperview()
+        }
+        
+    }
+    
+    required init?(coder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+
+    func updateCellDataWith(model:KSymbolModel) -> Void {
+        self.titleLab.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!
+        var differenceStr = ""
+        if difference > 0 {
+            differenceStr = String(format: "+%.2f", difference)
+        }else{
+            differenceStr = String(format: "%.2f", difference)
+        }
+        
+        let increase = conerData(model.increase as Any, .MyFloat).1!
+        var increaseStr = ""
+        if increase > 0 {
+            increaseStr = "+" + precisionString(with: model.increase, precision: "2")  + "%"
+        }else{
+            increaseStr = precisionString(with: model.increase, precision: "2")  + "%"
+        }
+        self.changeLab.text = differenceStr + "  " + increaseStr
+        
+        let color = exchangeColorAndImage(increase: increase).0
+        self.priceLab.textColor = color
+        
+        self.changeLab.textColor = color
+        let color1 = exchangeColorAndImage(increase: increase).2
+        bgView.backgroundColor = color1
+       // bgView.insertGradientLayer(myType: .normal(frame:bgView.frame), mycolors: [color1.cgColor,ALLBackGroundColor.cgColor], locations: [1, 1], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1))
+        
+    }
+   
+  
+
+}
+
+
+

+ 80 - 0
Koala/Koala/Modular/Market/V/MarketView/MarkertIndexCell.xib

@@ -0,0 +1,80 @@
+<?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="MarkertIndexCell" customModule="Koala" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="373" height="181"/>
+            <autoresizingMask key="autoresizingMask"/>
+            <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+                <rect key="frame" x="0.0" y="0.0" width="373" height="181"/>
+                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                <subviews>
+                    <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Zhc-pr-pvB">
+                        <rect key="frame" x="0.0" y="0.0" width="373" height="181"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ARB-Z5-3AH">
+                                <rect key="frame" x="0.0" y="0.0" width="373" height="40"/>
+                                <subviews>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vxl-AI-hEM">
+                                        <rect key="frame" x="0.0" y="15" width="4" height="10"/>
+                                        <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="4" id="kdh-Gv-VZt"/>
+                                            <constraint firstAttribute="height" constant="10" id="zgf-Ub-3qO"/>
+                                        </constraints>
+                                    </view>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Cvz-Yv-pN4">
+                                        <rect key="frame" x="14.000000000000004" y="9.9999999999999982" width="41.333333333333343" height="20.333333333333329"/>
+                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstItem="Cvz-Yv-pN4" firstAttribute="leading" secondItem="vxl-AI-hEM" secondAttribute="trailing" constant="10" id="LXZ-ol-9gp"/>
+                                    <constraint firstAttribute="height" constant="40" id="VQt-gf-kwe"/>
+                                    <constraint firstItem="Cvz-Yv-pN4" firstAttribute="centerY" secondItem="ARB-Z5-3AH" secondAttribute="centerY" id="a89-KZ-0Nc"/>
+                                    <constraint firstItem="vxl-AI-hEM" firstAttribute="leading" secondItem="ARB-Z5-3AH" secondAttribute="leading" id="ghR-dm-JHe"/>
+                                    <constraint firstItem="vxl-AI-hEM" firstAttribute="centerY" secondItem="ARB-Z5-3AH" secondAttribute="centerY" id="sTb-b9-g5a"/>
+                                </constraints>
+                            </view>
+                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="5We-Hx-Mxi">
+                                <rect key="frame" x="0.0" y="40" width="373" height="141"/>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="yuR-Zu-fSQ">
+                                    <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>
+                    </stackView>
+                </subviews>
+            </view>
+            <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
+            <constraints>
+                <constraint firstAttribute="bottom" secondItem="Zhc-pr-pvB" secondAttribute="bottom" id="cGt-VV-Zam"/>
+                <constraint firstItem="Zhc-pr-pvB" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="dwQ-Bm-K6z"/>
+                <constraint firstItem="Zhc-pr-pvB" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="mmD-Ky-hf1"/>
+                <constraint firstAttribute="trailing" secondItem="Zhc-pr-pvB" secondAttribute="trailing" id="niX-uQ-oXJ"/>
+            </constraints>
+            <size key="customSize" width="373" height="181"/>
+            <connections>
+                <outlet property="collectionView" destination="5We-Hx-Mxi" id="HGI-6b-LFT"/>
+                <outlet property="lineView" destination="vxl-AI-hEM" id="RlH-M4-QdE"/>
+                <outlet property="titleLab" destination="Cvz-Yv-pN4" id="mTm-7z-VXD"/>
+            </connections>
+            <point key="canvasLocation" x="202.29007633587784" y="54.577464788732399"/>
+        </collectionViewCell>
+    </objects>
+</document>

+ 110 - 1
Koala/Koala/Modular/Market/V/MarketView/MarketHeaderView.swift

@@ -7,12 +7,13 @@
 //
 
 import UIKit
-
+import TYCyclePagerView
 class MarketHeaderView: BaseView {
 
     @IBOutlet weak var bg1View: UIView!
     @IBOutlet weak var menuBg1View: UIView!
     @IBOutlet weak var menu1Btn: UIButton!
+    @IBOutlet weak var indexBgView: UIView!
     
     @IBOutlet weak var btn1: UIButton!
     @IBOutlet weak var btn2: UIButton!
@@ -46,6 +47,10 @@ class MarketHeaderView: BaseView {
     
     var listData:[OptionsTimerModel] = [OptionsTimerModel]()
     
+    var indexData:[(String,[KSymbolModel])] = [(String,[KSymbolModel])]()
+    
+   
+    
     lazy var segmentedControl:HMSegmentedControl = {
         let segmentedControl:HMSegmentedControl = HMSegmentedControl.init(frame: CGRect(x: 10, y:0, width:SCREEN_WIDTH-74, height: 44))
         segmentedControl.selectedSegmentIndex = 0
@@ -78,6 +83,20 @@ class MarketHeaderView: BaseView {
         return segmentedControl
     }()
     
+    lazy var pagerView:TYCyclePagerView = {
+        let view:TYCyclePagerView = TYCyclePagerView()
+     
+        view.isInfiniteLoop = true
+        view.autoScrollInterval = 3
+        view.layout.layoutType = .normal
+        view.layout.itemSpacing = 0
+        view.setNeedsLayout()
+        view.dataSource = self
+        view.delegate = self
+        view.register(UINib.init(nibName: "MarkertIndexCell", bundle: nil), forCellWithReuseIdentifier: "MarkertIndexCell")
+        
+        return view
+    }()
     
     
     var headerView: UIView!
@@ -99,6 +118,13 @@ class MarketHeaderView: BaseView {
         
         self.menuBg2View.addSubview(self.segmented2Control)
         
+        self.indexBgView.addSubview(self.pagerView)
+        
+        self.pagerView.snp.makeConstraints { make in
+            make.left.equalTo(20)
+            make.right.equalTo(-20)
+            make.top.bottom.equalToSuperview()
+        }
         
         self.priceBtn.setTextFont(.PFSR, 12)
         self.changeBtn.setTextFont(.PFSR, 12)
@@ -202,10 +228,12 @@ class MarketHeaderView: BaseView {
         if index == 0 {
             self.bg1View.isHidden = false
             self.menuBg1View.isHidden = true
+            self.indexBgView.isHidden = true
         }
         else if index == 1{
             self.bg1View.isHidden = false
             self.menuBg1View.isHidden = false
+            self.indexBgView.isHidden = false
         }
         else{
             self.bg2View.isHidden = false
@@ -216,6 +244,52 @@ class MarketHeaderView: BaseView {
         self.listData = list
         self.collectionView.reloadData()
     }
+    
+    func updateIndexData(list:[KSymbolModel]) -> Void {
+       
+        var arr1 = [KSymbolModel]()
+        var arr2 = [KSymbolModel]()
+        var arr3 = [KSymbolModel]()
+        var arr4 = [KSymbolModel]()
+        var arr5 = [KSymbolModel]()
+        var arr6 = [KSymbolModel]()
+        
+        for model in list{
+            if model.symbol == "000001.SH"
+                || model.symbol == ".DJI.US"
+                || model.symbol == "HSI.HK"{
+                arr1.append(model)
+                arr6.append(model)
+            }
+            
+            if model.market == "HK"{
+                arr2.append(model)
+            }
+            
+            if model.market == "US"{
+                arr3.append(model)
+            }
+            
+            if model.market == "CN"{
+                arr4.append(model)
+            }
+            
+            if model.market == "CFD"{
+                arr5.append(model)
+            }
+        }
+        
+        self.indexData = [
+            (switchLanguage("热门"),arr1),
+            (switchLanguage("香港"),arr2),
+            (switchLanguage("美国"),arr3),
+            (switchLanguage("沪深"),arr4),
+            (switchLanguage("综合"),arr5),
+            (switchLanguage("全球"),arr6)
+        ]
+           
+        self.pagerView.reloadData()
+    }
 
 }
 
@@ -250,6 +324,39 @@ extension MarketHeaderView : UICollectionViewDelegateFlowLayout, UICollectionVie
 
 }
 
+extension MarketHeaderView :TYCyclePagerViewDataSource, TYCyclePagerViewDelegate{
+   
+    func numberOfItems(in pageView: TYCyclePagerView) -> Int {
+        return self.indexData.count
+    }
+    
+    func layout(for pageView: TYCyclePagerView) -> TYCyclePagerViewLayout {
+        let layout = TYCyclePagerViewLayout.init()
+        layout.itemSize = CGSize(width: SCREEN_WIDTH-40, height:140)
+        layout.itemSpacing = 0
+        layout.layoutType = .normal
+        layout.itemVerticalCenter = true
+        layout.itemHorizontalCenter = true
+        return layout;
+    }
+    
+    func pagerView(_ pagerView: TYCyclePagerView, cellForItemAt index: Int) -> UICollectionViewCell {
+        let cell:MarkertIndexCell = pagerView.dequeueReusableCell(withReuseIdentifier: "MarkertIndexCell", for: index) as! MarkertIndexCell
+        let data = self.indexData[index]
+        cell.updagteCellWith(data: data)
+        return cell
+    }
+    
+    func pagerView(_ pageView: TYCyclePagerView, didScrollFrom fromIndex: Int, to toIndex: Int) {
+        
+    }
+    
+    func pagerView(_ pageView: TYCyclePagerView, didSelectedItemCell cell: UICollectionViewCell, at index: Int) {
+    
+    }
+  
+}
+
 class MHTimerCell: UICollectionViewCell {
    
     lazy var titleLab:UILabel = {
@@ -296,3 +403,5 @@ class MHTimerCell: UICollectionViewCell {
 }
 
 
+
+

+ 34 - 26
Koala/Koala/Modular/Market/V/MarketView/MarketHeaderView.xib

@@ -19,6 +19,7 @@
                 <outlet property="btn4" destination="Ib7-dm-kXr" id="dyQ-i7-q1r"/>
                 <outlet property="changeBtn" destination="Sau-Ax-z7A" id="Rlh-gT-scu"/>
                 <outlet property="collectionView" destination="0dO-ui-Xej" id="tpp-zC-7ru"/>
+                <outlet property="indexBgView" destination="L9h-YS-OYb" id="az9-qX-NwI"/>
                 <outlet property="menu1Btn" destination="6sQ-sv-M6s" id="i2b-aN-yTY"/>
                 <outlet property="menu2Btn" destination="e3r-Jt-afI" id="NCN-pF-aZP"/>
                 <outlet property="menuBg1View" destination="qPY-Qn-rJ7" id="qwU-3b-gvA"/>
@@ -34,23 +35,23 @@
         </placeholder>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view contentMode="scaleToFill" id="iN0-l3-epB">
-            <rect key="frame" x="0.0" y="0.0" width="491" height="156"/>
+            <rect key="frame" x="0.0" y="0.0" width="506" height="215"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="QAl-3w-QIE">
-                    <rect key="frame" x="0.0" y="12" width="491" height="144"/>
+                    <rect key="frame" x="0.0" y="12" width="506" height="203"/>
                     <subviews>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dhn-Yo-3At">
-                            <rect key="frame" x="0.0" y="0.0" width="491" height="144"/>
+                            <rect key="frame" x="0.0" y="0.0" width="506" height="203"/>
                             <subviews>
                                 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="ZmW-bX-Dma">
-                                    <rect key="frame" x="0.0" y="0.0" width="491" height="144"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="506" height="203"/>
                                     <subviews>
                                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qPY-Qn-rJ7">
-                                            <rect key="frame" x="0.0" y="0.0" width="491" height="44"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="506" height="44"/>
                                             <subviews>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6sQ-sv-M6s">
-                                                    <rect key="frame" x="447" y="0.0" width="44" height="44"/>
+                                                    <rect key="frame" x="462" y="0.0" width="44" height="44"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" secondItem="6sQ-sv-M6s" secondAttribute="height" multiplier="1:1" id="zq2-XM-5Qf"/>
                                                     </constraints>
@@ -65,29 +66,36 @@
                                                 <constraint firstAttribute="height" constant="44" id="k9R-52-xJj"/>
                                             </constraints>
                                         </view>
+                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="L9h-YS-OYb">
+                                            <rect key="frame" x="0.0" y="44" width="506" height="140"/>
+                                            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="140" id="jo3-bc-SoA"/>
+                                            </constraints>
+                                        </view>
                                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DA8-n0-KD4">
-                                            <rect key="frame" x="0.0" y="44" width="491" height="100"/>
+                                            <rect key="frame" x="0.0" y="184" width="506" height="19"/>
                                             <subviews>
                                                 <stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qpU-vK-NwD">
-                                                    <rect key="frame" x="10" y="0.0" width="266.66666666666669" height="100"/>
+                                                    <rect key="frame" x="9.9999999999999964" y="0.0" width="50.666666666666657" height="19"/>
                                                     <subviews>
                                                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bjO-Ms-oDa">
-                                                            <rect key="frame" x="0.0" y="0.0" width="66.666666666666671" height="100"/>
+                                                            <rect key="frame" x="0.0" y="0.0" width="12.666666666666666" height="19"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="width" secondItem="bjO-Ms-oDa" secondAttribute="height" multiplier="1:1.5" id="B1z-2V-Hqi"/>
                                                             </constraints>
                                                             <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                         </button>
                                                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="X9m-PT-T4f">
-                                                            <rect key="frame" x="66.666666666666657" y="0.0" width="66.666666666666657" height="100"/>
+                                                            <rect key="frame" x="12.666666666666668" y="0.0" width="12.666666666666668" height="19"/>
                                                             <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                         </button>
                                                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vgq-N0-c5V">
-                                                            <rect key="frame" x="133.33333333333334" y="0.0" width="66.666666666666657" height="100"/>
+                                                            <rect key="frame" x="25.333333333333336" y="0.0" width="12.666666666666664" height="19"/>
                                                             <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                         </button>
                                                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ib7-dm-kXr">
-                                                            <rect key="frame" x="200" y="0.0" width="66.666666666666686" height="100"/>
+                                                            <rect key="frame" x="38" y="0.0" width="12.666666666666664" height="19"/>
                                                             <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                         </button>
                                                     </subviews>
@@ -98,14 +106,14 @@
                                                     </constraints>
                                                 </stackView>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="trailing" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WoH-d7-CQB">
-                                                    <rect key="frame" x="391" y="0.0" width="80" height="100"/>
+                                                    <rect key="frame" x="406" y="0.0" width="80" height="19"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" constant="80" id="3aJ-TO-KIM"/>
                                                     </constraints>
                                                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                 </button>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="trailing" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Sau-Ax-z7A">
-                                                    <rect key="frame" x="351" y="0.0" width="30" height="100"/>
+                                                    <rect key="frame" x="366" y="0.0" width="30" height="19"/>
                                                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                 </button>
                                             </subviews>
@@ -134,16 +142,16 @@
                             </constraints>
                         </view>
                         <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3Lf-8d-mW6">
-                            <rect key="frame" x="0.0" y="0.0" width="491" height="88"/>
+                            <rect key="frame" x="0.0" y="0.0" width="506" height="88"/>
                             <subviews>
                                 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="6Hg-H7-N36">
-                                    <rect key="frame" x="0.0" y="0.0" width="491" height="88"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="506" height="88"/>
                                     <subviews>
                                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wbH-Ad-VQF">
-                                            <rect key="frame" x="0.0" y="0.0" width="491" height="44"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="506" height="44"/>
                                             <subviews>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e3r-Jt-afI">
-                                                    <rect key="frame" x="447" y="0.0" width="44" height="44"/>
+                                                    <rect key="frame" x="462" y="0.0" width="44" height="44"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" secondItem="e3r-Jt-afI" secondAttribute="height" multiplier="1:1" id="Kl6-3z-fdB"/>
                                                     </constraints>
@@ -159,7 +167,7 @@
                                             </constraints>
                                         </view>
                                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Wni-0S-Tge">
-                                            <rect key="frame" x="0.0" y="44" width="491" height="44"/>
+                                            <rect key="frame" x="0.0" y="44" width="506" height="44"/>
                                             <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="IXb-az-D5L">
                                                     <rect key="frame" x="20.000000000000004" y="11.999999999999998" width="41.333333333333343" height="20.333333333333329"/>
@@ -168,7 +176,7 @@
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="0dO-ui-Xej">
-                                                    <rect key="frame" x="71.333333333333343" y="12" width="369.66666666666663" height="20"/>
+                                                    <rect key="frame" x="71.333333333333343" y="12" width="384.66666666666663" height="20"/>
                                                     <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                                     <constraints>
                                                         <constraint firstAttribute="height" constant="20" id="fUY-yN-sHU"/>
@@ -181,7 +189,7 @@
                                                     </collectionViewFlowLayout>
                                                 </collectionView>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dd7-Uq-DM3">
-                                                    <rect key="frame" x="451" y="0.0" width="30" height="44"/>
+                                                    <rect key="frame" x="466" y="0.0" width="30" height="44"/>
                                                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                 </button>
                                             </subviews>
@@ -199,7 +207,7 @@
                                             </constraints>
                                         </view>
                                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Fr8-Zb-coO">
-                                            <rect key="frame" x="0.0" y="88" width="491" height="0.0"/>
+                                            <rect key="frame" x="0.0" y="88" width="506" height="0.0"/>
                                             <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="RzD-CQ-O2w">
                                                     <rect key="frame" x="20.000000000000004" y="-10" width="41.333333333333343" height="20.333333333333332"/>
@@ -208,14 +216,14 @@
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="trailing" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4er-hb-wzS">
-                                                    <rect key="frame" x="391" y="0.0" width="80" height="0.0"/>
+                                                    <rect key="frame" x="406" y="0.0" width="80" height="0.0"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" constant="80" id="hJK-pI-Dbk"/>
                                                     </constraints>
                                                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                 </button>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="trailing" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YDn-eS-upl">
-                                                    <rect key="frame" x="311" y="0.0" width="80" height="0.0"/>
+                                                    <rect key="frame" x="326" y="0.0" width="80" height="0.0"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" constant="80" id="3KR-iV-pGh"/>
                                                         <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="80" id="hr3-wy-7ci"/>
@@ -223,7 +231,7 @@
                                                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                 </button>
                                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="trailing" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aqe-M7-dkg">
-                                                    <rect key="frame" x="281" y="0.0" width="30" height="0.0"/>
+                                                    <rect key="frame" x="296" y="0.0" width="30" height="0.0"/>
                                                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                                 </button>
                                             </subviews>
@@ -265,7 +273,7 @@
                 <constraint firstItem="QAl-3w-QIE" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="yAY-dD-C0w"/>
             </constraints>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
-            <point key="canvasLocation" x="-8.3969465648854964" y="123.94366197183099"/>
+            <point key="canvasLocation" x="3.0534351145038165" y="144.71830985915494"/>
         </view>
     </objects>
     <resources>

+ 9 - 2
Koala/Koala/Modular/Market/V/MarketView/MarketView.swift

@@ -77,7 +77,7 @@ class MarketView: BaseView {
     
     lazy var headerView:MarketHeaderView = {
         let view = MarketHeaderView.init(frame: CGRect(x: 0, y:TopHeight, width: SCREEN_WIDTH, height: 100))
-        
+      
         view.segmentedControl.indexChangeBlock = {[weak self](index) in
             self?.VM?.index = Int(index)
             
@@ -202,6 +202,8 @@ class MarketView: BaseView {
         
         self.addSubview(recommendView)
         
+        self.updateHeaderView(index: Int(self.navView.segmentedControl.selectedSegmentIndex))
+        
         mySwitchLanguage()
         mySwitchSkin()
     }
@@ -296,6 +298,11 @@ class MarketView: BaseView {
             
         })
         
+        VM?.indexSymbolListAction.values.observeValues({[weak self] (success) in
+            guard let self = self else{return}
+            self.headerView.updateIndexData(list: self.VM!.indexList)
+        })
+       
        
         VM?.symbolListAction.values.observeValues({[weak self] (success) in
             guard let self = self else{return}
@@ -376,7 +383,7 @@ class MarketView: BaseView {
         if (index == 0){
             self.headerView.frame = CGRect(x: 0, y:TopHeight, width: SCREEN_WIDTH, height: 100-44)
         }else if index == 1{
-            self.headerView.frame = CGRect(x: 0, y:TopHeight, width: SCREEN_WIDTH, height: 100)
+            self.headerView.frame = CGRect(x: 0, y:TopHeight, width: SCREEN_WIDTH, height: 100+140)
         }else{
             self.headerView.frame = CGRect(x: 0, y:TopHeight, width: SCREEN_WIDTH, height: 144)
         }

+ 1 - 1
Koala/Koala/Modular/Market/VC/MarketViewController.swift

@@ -43,7 +43,7 @@ class MarketViewController: BaseViewController {
         }
         
         self.viewModel.netRecommendSymbolList()
-        
+        self.viewModel.netIndexSymbolList()
         if OperationalUserInfoData.getLogin(){
             self.viewModel.netUserList()
         }

+ 72 - 2
Koala/Koala/Modular/Market/VM/MarketViewModel.swift

@@ -15,6 +15,11 @@ class MarketViewModel: BaseViewModel {
         return arr
     }()
     
+    lazy var netIndexList:[String] = {
+        let arr:[String] = ["000001.SH","399001.SZ","399006.SZ","XAUUSD","BTCUSD","UKOIL",".DJI.US",".IXIC.US","SPY.US","HSI.HK","HSCEI.HK","HSTECH.HK"];
+        return arr
+    }()
+    
     lazy var productGroupList:[MarketProductGroupModel] = {//交易对
         let arr:[MarketProductGroupModel] = [MarketProductGroupModel]()
         return arr
@@ -40,6 +45,12 @@ class MarketViewModel: BaseViewModel {
         return arr
     }()
     
+    lazy var indexList:[KSymbolModel] = {//交易对
+        let arr:[KSymbolModel] = [KSymbolModel]()
+        return arr
+    }()
+    
+    
     lazy var screenSymbolList:[KSymbolModel] = {//交易对
         let arr:[KSymbolModel] = [KSymbolModel]()
         return arr
@@ -152,6 +163,7 @@ class MarketViewModel: BaseViewModel {
     //netForInsertProductUser
     //netForGetOptionProductListGroup
     
+    var indexSymbolListAction: Action <(),(Bool),Never>!
     var recommendSymbolListAction: Action <(),(Bool),Never>!
     var groupListAction: Action <(),(Bool),Never>!
     var userListAction: Action <(),(Bool),Never>!
@@ -163,6 +175,12 @@ class MarketViewModel: BaseViewModel {
     var optionProductListGroupAction: Action <(Bool),(Bool),Never>!
     
     override func initialize() {
+        indexSymbolListAction = Action<(),(Bool),Never> {[weak self] _ in
+            return SignalProducer<(Bool),Never>{ observer, _ in
+                self?.requestIndexSymbolList(observer: observer)
+            }
+        }
+        
         recommendSymbolListAction = Action<(),(Bool),Never> {[weak self] _ in
             return SignalProducer<(Bool),Never>{ observer, _ in
                 self?.requestRecommendSymbolList(observer: observer)
@@ -219,6 +237,46 @@ class MarketViewModel: BaseViewModel {
 
 extension MarketViewModel {
     
+    //获取指数交易对
+    func netIndexSymbolList() {
+        indexSymbolListAction.apply().start()
+    }
+    //
+    func requestIndexSymbolList(observer: Signal< Bool, Never>.Observer) -> Void {
+       
+        let parame:[String:Any] = [
+            "symbol":getJSONStringFromArray(array: self.netIndexList as NSArray)
+        ]
+        NetWork.NetWorkInstance.requestData(requestType: .Post, URLString: netForHomeSymbolList,parameters: parame, success: { (code, result) in
+            if let list:[NSDictionary] = result?["list"] as? [NSDictionary] {
+                self.indexList.removeAll()
+                for dic in list {
+                    let model = KSymbolModel.deserialize(from: dic)
+                    if model!.visible == 1{
+                        var ask = model!.ask
+                        if conerData(ask, .MyDouble).2! == 0{
+                            ask = model!.open
+                        }
+                        model?.newPrice = precisionString(with: ask, precision: model!.digits)
+                        let np = decimalNumber(A: model!.newPrice, B: model!.open, type: .Subtract, scale:model!.digits)
+                        let increase = (conerData(np, .MyDouble).2!/conerData(model!.open, .MyDouble).2!)*100
+                        model?.increase = String(format: "%.2f",increase)
+                        self.indexList.append(model!)
+                    }
+                }
+                observer.send(value: true)
+            }else{
+                observer.send(value: false)
+                ProgressHUD.showError(status:DataTypeErrorPrompt)
+            }
+            observer.sendCompleted()
+        }) { (code, result) in
+            ProgressHUD.showError(status: result as! String)
+            observer.send(value: false)
+            observer.sendCompleted()
+        }
+    }
+    
     //获取推荐交易对
     func netRecommendSymbolList() {
         recommendSymbolListAction.apply().start()
@@ -374,12 +432,17 @@ extension MarketViewModel {
         if !isUp{
             self.pageNum = 1
         }
-        let param : [String : Any] = [
+        var param : [String : Any] = [
             
             "pageNum" : self.pageNum,
             "pageSize" : "30",
             "market" : self.marketText
         ]
+        
+        if self.index == 0{
+            param.add(["hot":1])
+        }
+        
         ProgressHUD.showLoading()
         NetWork.NetWorkInstance.requestData(requestType: .Post, URLString: netForHomeSymbolList, parameters: param, success: {[weak self](code, result) in
             
@@ -642,11 +705,18 @@ extension MarketViewModel {
     
     func resetProductGroup() -> Void {
      
+        let hotModel = MarketProductGroupModel()
+        hotModel.id = "-2"
+        hotModel.title = switchLanguage("热门")
+        hotModel.code = ""
+        self.productGroupList.insert(hotModel, at: 0)
+        
         let allModel = MarketProductGroupModel()
         allModel.id = "0"
         allModel.title = switchLanguage("全部")
         allModel.code = ""
-        self.productGroupList.insert(allModel, at: 0)
+        self.productGroupList.append(allModel)
+        
         self.screenSymbolListAction()
     }