Commit bd57d55accf43fb885810edd606ccd3a50624ae8

Authored by 葛建军
1 parent 6f06ed3c
Exists in newLive

首页排行界面搭建及数据填充

YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj
... ... @@ -157,6 +157,7 @@
157 157 BF7B75A71E305A6D0011D5C7 /* UIScrollView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B75911E305A6D0011D5C7 /* UIScrollView+MJExtension.m */; };
158 158 BF7B75A81E305A6D0011D5C7 /* UIScrollView+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B75931E305A6D0011D5C7 /* UIScrollView+MJRefresh.m */; };
159 159 BF7B75A91E305A6D0011D5C7 /* UIView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = BF7B75951E305A6D0011D5C7 /* UIView+MJExtension.m */; };
  160 + BF8E52EE1ECFD16000E472E8 /* RankingTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8E52ED1ECFD16000E472E8 /* RankingTableViewController.swift */; };
160 161 BFBB83A91ECAE35E008B404B /* LeadViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBB83A81ECAE35E008B404B /* LeadViewController.swift */; };
161 162 BFBB83D11ECBEB4E008B404B /* JYScrollItem.m in Sources */ = {isa = PBXBuildFile; fileRef = BFBB83CC1ECBEB4E008B404B /* JYScrollItem.m */; };
162 163 BFBB83D21ECBEB4E008B404B /* JYScrollItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BFBB83CE1ECBEB4E008B404B /* JYScrollItemModel.m */; };
... ... @@ -493,6 +494,7 @@
493 494 BF7B75931E305A6D0011D5C7 /* UIScrollView+MJRefresh.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+MJRefresh.m"; sourceTree = "<group>"; };
494 495 BF7B75941E305A6D0011D5C7 /* UIView+MJExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MJExtension.h"; sourceTree = "<group>"; };
495 496 BF7B75951E305A6D0011D5C7 /* UIView+MJExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+MJExtension.m"; sourceTree = "<group>"; };
  497 + BF8E52ED1ECFD16000E472E8 /* RankingTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RankingTableViewController.swift; sourceTree = "<group>"; };
496 498 BFBB83A81ECAE35E008B404B /* LeadViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeadViewController.swift; sourceTree = "<group>"; };
497 499 BFBB83CB1ECBEB4E008B404B /* JYScrollItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JYScrollItem.h; sourceTree = "<group>"; };
498 500 BFBB83CC1ECBEB4E008B404B /* JYScrollItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JYScrollItem.m; sourceTree = "<group>"; };
... ... @@ -595,6 +597,7 @@
595 597 isa = PBXGroup;
596 598 children = (
597 599 BF682F1D1ECE8772007632CA /* MainHomeTableViewController.swift */,
  600 + BF8E52ED1ECFD16000E472E8 /* RankingTableViewController.swift */,
598 601 5904FC541ECA8BCB00E631FF /* HomePage.storyboard */,
599 602 );
600 603 path = HomePage;
... ... @@ -1545,6 +1548,7 @@
1545 1548 BF7B75A11E305A6D0011D5C7 /* MJRefreshGifHeader.m in Sources */,
1546 1549 599B2CE31DE52F7E00B4F7FD /* UMSocialUIManager.m in Sources */,
1547 1550 BF25DFF91DDAA36A003EC0C1 /* NSImage+WebCache.m in Sources */,
  1551 + BF8E52EE1ECFD16000E472E8 /* RankingTableViewController.swift in Sources */,
1548 1552 59F8014F1DD2C7AD000A78B0 /* AppDelegate.swift in Sources */,
1549 1553 BF25DFED1DDAA36A003EC0C1 /* ResponseSerialization.swift in Sources */,
1550 1554 BF25E0031DDAA36A003EC0C1 /* UIImage+GIF.m in Sources */,
... ...
YouerLiveVideo/YouerLiveVideo/controllers/HomePage/HomePage.storyboard
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3 3 <device id="retina4_7" orientation="portrait">
4 4 <adaptation id="fullscreen"/>
5 5 </device>
6 6 <dependencies>
7 7 <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
  8 + <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
8 9 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9 10 </dependencies>
10 11 <scenes>
11   - <!--View Controller-->
12   - <scene sceneID="eHj-Hl-wWx">
  12 + <!--排行-->
  13 + <scene sceneID="dY5-uz-H10">
13 14 <objects>
14   - <viewController id="LjZ-4M-CWC" sceneMemberID="viewController">
15   - <layoutGuides>
16   - <viewControllerLayoutGuide type="top" id="yeh-XP-HPd"/>
17   - <viewControllerLayoutGuide type="bottom" id="vkl-Ah-CiJ"/>
18   - </layoutGuides>
19   - <view key="view" contentMode="scaleToFill" id="Hyp-9a-Mci">
  15 + <tableViewController storyboardIdentifier="RankingTableViewController" automaticallyAdjustsScrollViewInsets="NO" hidesBottomBarWhenPushed="YES" id="xTw-6t-Upd" customClass="RankingTableViewController" customModule="YouerLiveVideo" customModuleProvider="target" sceneMemberID="viewController">
  16 + <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="339" sectionHeaderHeight="28" sectionFooterHeight="28" id="o1U-D1-qqQ">
20 17 <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
21 18 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
22   - <subviews>
23   - <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="157" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="YOa-J8-2UM">
24   - <rect key="frame" x="0.0" y="20" width="375" height="647"/>
25   - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
26   - <prototypes>
27   - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="157" id="SLW-Wm-iau">
28   - <rect key="frame" x="0.0" y="28" width="375" height="157"/>
29   - <autoresizingMask key="autoresizingMask"/>
30   - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="SLW-Wm-iau" id="QXN-J0-KgA">
31   - <rect key="frame" x="0.0" y="0.0" width="375" height="157"/>
32   - <autoresizingMask key="autoresizingMask"/>
  19 + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
  20 + <prototypes>
  21 + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ItemTableViewCell" rowHeight="339" id="cns-vb-pIQ" customClass="ItemTableViewCell" customModule="YouerLiveVideo" customModuleProvider="target">
  22 + <rect key="frame" x="0.0" y="28" width="375" height="339"/>
  23 + <autoresizingMask key="autoresizingMask"/>
  24 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="cns-vb-pIQ" id="88M-wr-UJ8">
  25 + <rect key="frame" x="0.0" y="0.0" width="375" height="339"/>
  26 + <autoresizingMask key="autoresizingMask"/>
  27 + <subviews>
  28 + <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="学校排行" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EZa-z2-arr">
  29 + <rect key="frame" x="8" y="15" width="65.5" height="19.5"/>
  30 + <fontDescription key="fontDescription" type="system" pointSize="16"/>
  31 + <nil key="textColor"/>
  32 + <nil key="highlightedColor"/>
  33 + </label>
  34 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ckB-W3-VJE">
  35 + <rect key="frame" x="0.0" y="44" width="375" height="44"/>
33 36 <subviews>
34   - <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="PAj-p1-GN4">
35   - <rect key="frame" x="8" y="4" width="359" height="148.5"/>
36   - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
37   - <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="Yxz-uf-KtO">
38   - <size key="itemSize" width="111" height="147"/>
39   - <size key="headerReferenceSize" width="0.0" height="0.0"/>
40   - <size key="footerReferenceSize" width="0.0" height="0.0"/>
41   - <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
42   - </collectionViewFlowLayout>
43   - <cells>
44   - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="Azu-vg-rrB">
45   - <rect key="frame" x="0.0" y="0.0" width="111" height="147"/>
46   - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
47   - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
48   - <rect key="frame" x="0.0" y="0.0" width="111" height="147"/>
49   - <autoresizingMask key="autoresizingMask"/>
50   - </view>
51   - </collectionViewCell>
52   - </cells>
53   - </collectionView>
  37 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="综合排名" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SaW-7O-OkT">
  38 + <rect key="frame" x="18" y="13" width="61.5" height="18"/>
  39 + <fontDescription key="fontDescription" type="system" pointSize="15"/>
  40 + <nil key="textColor"/>
  41 + <nil key="highlightedColor"/>
  42 + </label>
  43 + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="botoom_image" translatesAutoresizingMaskIntoConstraints="NO" id="NNQ-07-hic">
  44 + <rect key="frame" x="352" y="15" width="15" height="15"/>
  45 + <constraints>
  46 + <constraint firstAttribute="height" constant="15" id="J3l-xy-BQF"/>
  47 + <constraint firstAttribute="width" constant="15" id="uel-30-fcR"/>
  48 + </constraints>
  49 + </imageView>
  50 + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ss9-IN-p7o">
  51 + <rect key="frame" x="331" y="0.0" width="44" height="44"/>
  52 + <constraints>
  53 + <constraint firstAttribute="width" constant="44" id="i7f-rP-uMp"/>
  54 + </constraints>
  55 + <connections>
  56 + <action selector="openOrCloseAction:" destination="cns-vb-pIQ" eventType="touchUpInside" id="pnJ-fx-YyR"/>
  57 + </connections>
  58 + </button>
54 59 </subviews>
  60 + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
55 61 <constraints>
56   - <constraint firstItem="PAj-p1-GN4" firstAttribute="top" secondItem="QXN-J0-KgA" secondAttribute="top" constant="4" id="5zz-bd-O6i"/>
57   - <constraint firstItem="PAj-p1-GN4" firstAttribute="leading" secondItem="QXN-J0-KgA" secondAttribute="leading" constant="8" id="8MC-Zz-u5f"/>
58   - <constraint firstAttribute="trailing" secondItem="PAj-p1-GN4" secondAttribute="trailing" constant="8" id="sTQ-kz-OzQ"/>
59   - <constraint firstAttribute="bottom" secondItem="PAj-p1-GN4" secondAttribute="bottom" constant="4" id="w43-em-me9"/>
  62 + <constraint firstItem="NNQ-07-hic" firstAttribute="centerY" secondItem="ckB-W3-VJE" secondAttribute="centerY" id="0Rf-nE-jAo"/>
  63 + <constraint firstAttribute="trailing" secondItem="NNQ-07-hic" secondAttribute="trailing" constant="8" id="6G8-VB-s2n"/>
  64 + <constraint firstAttribute="bottom" secondItem="ss9-IN-p7o" secondAttribute="bottom" id="PLC-c5-EFr"/>
  65 + <constraint firstAttribute="height" constant="44" id="Wyr-GU-aaT"/>
  66 + <constraint firstAttribute="trailing" secondItem="ss9-IN-p7o" secondAttribute="trailing" id="aAO-V3-sgD"/>
  67 + <constraint firstItem="ss9-IN-p7o" firstAttribute="top" secondItem="ckB-W3-VJE" secondAttribute="top" id="bxF-ra-1Fc"/>
  68 + <constraint firstItem="SaW-7O-OkT" firstAttribute="centerY" secondItem="ckB-W3-VJE" secondAttribute="centerY" id="ne0-jg-T5L"/>
  69 + <constraint firstItem="SaW-7O-OkT" firstAttribute="leading" secondItem="ckB-W3-VJE" secondAttribute="leading" constant="18" id="wS7-H2-6Hb"/>
60 70 </constraints>
61   - </tableViewCellContentView>
62   - </tableViewCell>
63   - </prototypes>
64   - </tableView>
65   - </subviews>
66   - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
67   - <constraints>
68   - <constraint firstItem="YOa-J8-2UM" firstAttribute="leading" secondItem="Hyp-9a-Mci" secondAttribute="leading" id="7D9-Dd-nwr"/>
69   - <constraint firstItem="vkl-Ah-CiJ" firstAttribute="top" secondItem="YOa-J8-2UM" secondAttribute="bottom" id="KeN-hy-x2G"/>
70   - <constraint firstItem="YOa-J8-2UM" firstAttribute="top" secondItem="yeh-XP-HPd" secondAttribute="bottom" id="d83-an-LAU"/>
71   - <constraint firstAttribute="trailing" secondItem="YOa-J8-2UM" secondAttribute="trailing" id="kit-ZG-l6n"/>
72   - </constraints>
73   - </view>
74   - </viewController>
75   - <placeholder placeholderIdentifier="IBFirstResponder" id="AHa-9V-Fv6" userLabel="First Responder" sceneMemberID="firstResponder"/>
  71 + </view>
  72 + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="M9F-0f-7Zj">
  73 + <rect key="frame" x="0.0" y="88" width="375" height="251"/>
  74 + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
  75 + <prototypes>
  76 + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" restorationIdentifier="cell" selectionStyle="default" indentationWidth="10" reuseIdentifier="cell" id="deq-A6-QAT">
  77 + <rect key="frame" x="0.0" y="28" width="375" height="44"/>
  78 + <autoresizingMask key="autoresizingMask"/>
  79 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="deq-A6-QAT" id="jel-9N-Twh">
  80 + <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
  81 + <autoresizingMask key="autoresizingMask"/>
  82 + </tableViewCellContentView>
  83 + </tableViewCell>
  84 + </prototypes>
  85 + <connections>
  86 + <outlet property="dataSource" destination="cns-vb-pIQ" id="UYa-xu-7SP"/>
  87 + <outlet property="delegate" destination="cns-vb-pIQ" id="XE2-JN-ndb"/>
  88 + </connections>
  89 + </tableView>
  90 + </subviews>
  91 + <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
  92 + <constraints>
  93 + <constraint firstItem="M9F-0f-7Zj" firstAttribute="leading" secondItem="88M-wr-UJ8" secondAttribute="leading" id="05H-J5-3ft"/>
  94 + <constraint firstItem="ckB-W3-VJE" firstAttribute="leading" secondItem="88M-wr-UJ8" secondAttribute="leading" id="Llv-Cj-qUv"/>
  95 + <constraint firstItem="EZa-z2-arr" firstAttribute="top" secondItem="88M-wr-UJ8" secondAttribute="topMargin" constant="7" id="Y6P-C4-Lnh"/>
  96 + <constraint firstItem="ckB-W3-VJE" firstAttribute="top" secondItem="88M-wr-UJ8" secondAttribute="top" constant="44" id="YYa-p3-V5Z"/>
  97 + <constraint firstAttribute="trailing" secondItem="M9F-0f-7Zj" secondAttribute="trailing" id="Zee-lj-9ac"/>
  98 + <constraint firstAttribute="bottom" secondItem="M9F-0f-7Zj" secondAttribute="bottom" id="gJP-sa-9DJ"/>
  99 + <constraint firstAttribute="trailing" secondItem="ckB-W3-VJE" secondAttribute="trailing" id="grJ-oO-BaR"/>
  100 + <constraint firstAttribute="leadingMargin" secondItem="EZa-z2-arr" secondAttribute="leading" id="pPi-1h-WTn"/>
  101 + <constraint firstItem="M9F-0f-7Zj" firstAttribute="top" secondItem="ckB-W3-VJE" secondAttribute="bottom" id="seG-Ge-GIf"/>
  102 + </constraints>
  103 + </tableViewCellContentView>
  104 + <connections>
  105 + <outlet property="sectionTitleLabel" destination="EZa-z2-arr" id="riK-aS-fgl"/>
  106 + <outlet property="subTableView" destination="M9F-0f-7Zj" id="TzF-ki-ccn"/>
  107 + <outlet property="tableViewButtom" destination="gJP-sa-9DJ" id="hjD-Q3-nGW"/>
  108 + <outlet property="titleImageView" destination="NNQ-07-hic" id="FDL-Do-NZC"/>
  109 + <outlet property="titleLabel" destination="SaW-7O-OkT" id="sqD-nr-S3a"/>
  110 + <outlet property="titleViewTop" destination="YYa-p3-V5Z" id="hok-Ka-n3E"/>
  111 + </connections>
  112 + </tableViewCell>
  113 + </prototypes>
  114 + <sections/>
  115 + <connections>
  116 + <outlet property="dataSource" destination="xTw-6t-Upd" id="k4J-Ub-G0Z"/>
  117 + <outlet property="delegate" destination="xTw-6t-Upd" id="9YG-mr-onA"/>
  118 + </connections>
  119 + </tableView>
  120 + <navigationItem key="navigationItem" title="排行" id="JPt-wk-Pdj"/>
  121 + <simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
  122 + </tableViewController>
  123 + <placeholder placeholderIdentifier="IBFirstResponder" id="mqx-56-Al8" userLabel="First Responder" sceneMemberID="firstResponder"/>
76 124 </objects>
77   - <point key="canvasLocation" x="164" y="253.2233883058471"/>
  125 + <point key="canvasLocation" x="196" y="260.41979010494754"/>
78 126 </scene>
79 127 </scenes>
  128 + <resources>
  129 + <image name="botoom_image" width="48" height="48"/>
  130 + </resources>
80 131 </document>
... ...
YouerLiveVideo/YouerLiveVideo/controllers/HomePage/MainHomeTableViewController.swift
... ... @@ -111,6 +111,11 @@ class MainHomeTableViewController: UITableViewController {
111 111 */
112 112 override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
113 113 NSLog("点击了第\(indexPath.row)个cell")
  114 + if indexPath.row==0{
  115 + //排行
  116 + let vc = UIStoryboard(name: "HomePage", bundle: nil).instantiateViewController(withIdentifier: "RankingTableViewController") as! RankingTableViewController
  117 + self.navigationController?.pushViewController(vc, animated: true)
  118 + }
114 119 }
115 120  
116 121  
... ...
YouerLiveVideo/YouerLiveVideo/controllers/HomePage/RankingTableViewController.swift 0 → 100644
... ... @@ -0,0 +1,279 @@
  1 +//
  2 +// RankingTableViewController.swift
  3 +// YouerLiveVideo
  4 +//
  5 +// Created by 葛建军 on 17/5/20.
  6 +// Copyright © 2017年 左丞. All rights reserved.
  7 +//
  8 +
  9 +import UIKit
  10 +
  11 +class RankingTableViewController: UITableViewController {
  12 + var openIndexAry:[Int]=[0,4] //记录那些是展开状态
  13 + var allDic:[Int:[String]]=Dictionary<Int,[String]>()
  14 + var ary:[String]=["综合排名","资源贡献","下载排名","阅读排名","综合排名","资源贡献","下载排名","阅读排名"]
  15 + override func viewDidLoad() {
  16 + super.viewDidLoad()
  17 + getAllSubRankings()
  18 + }
  19 + func getAllSubRankings(){
  20 + for i in 0..<8{
  21 + allDic.updateValue([], forKey: i)
  22 + }
  23 + AppDelegate.instance().httpServer.getSchoolGeneral { (str, error) in
  24 + if error==nil {
  25 + if JSON.fromString(jsonString: str)!["status"].intValue == 1{
  26 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  27 + var lineAry:[String]=[]
  28 + for item in JSON.fromString(jsonString: str)!["data"].arrayValue {
  29 + lineAry.append(item["f_SchoolName"].stringValue)
  30 + }
  31 + self.allDic.updateValue(lineAry, forKey: 0)
  32 + self.tableView.reloadData()
  33 + }, failHandler: { (error) in
  34 + self.view.makeToast("排名失败:\(error.localizedDescription)")
  35 + })
  36 + }else{
  37 + self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)")
  38 + }
  39 + }else{
  40 + self.view.makeToast("获取排名失败:\(error!.description)")
  41 + }
  42 + }
  43 + AppDelegate.instance().httpServer.getSchoolUpload { (str, error) in
  44 + if error==nil {
  45 + if JSON.fromString(jsonString: str)!["status"].intValue == 1{
  46 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  47 + var lineAry:[String]=[]
  48 + for item in JSON.fromString(jsonString: str)!["data"].arrayValue {
  49 + lineAry.append(item["f_SchoolName"].stringValue)
  50 + }
  51 + self.allDic.updateValue(lineAry, forKey: 1)
  52 + self.tableView.reloadData()
  53 + }, failHandler: { (error) in
  54 + self.view.makeToast("排名失败:\(error.localizedDescription)")
  55 + })
  56 + }else{
  57 + self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)")
  58 + }
  59 + }else{
  60 + self.view.makeToast("获取排名失败:\(error!.description)")
  61 + }
  62 + }
  63 + AppDelegate.instance().httpServer.getSchoolDownloads { (str, error) in
  64 + if error==nil {
  65 + if JSON.fromString(jsonString: str)!["status"].intValue == 1{
  66 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  67 + var lineAry:[String]=[]
  68 + for item in JSON.fromString(jsonString: str)!["data"].arrayValue {
  69 + lineAry.append(item["f_SchoolName"].stringValue)
  70 + }
  71 + self.allDic.updateValue(lineAry, forKey: 2)
  72 + self.tableView.reloadData()
  73 + }, failHandler: { (error) in
  74 + self.view.makeToast("排名失败:\(error.localizedDescription)")
  75 + })
  76 + }else{
  77 + self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)")
  78 + }
  79 + }else{
  80 + self.view.makeToast("获取排名失败:\(error!.description)")
  81 + }
  82 + }
  83 + AppDelegate.instance().httpServer.getSchoolPv { (str, error) in
  84 + if error==nil {
  85 + if JSON.fromString(jsonString: str)!["status"].intValue == 1{
  86 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  87 + var lineAry:[String]=[]
  88 + for item in JSON.fromString(jsonString: str)!["data"].arrayValue {
  89 + lineAry.append(item["f_SchoolName"].stringValue)
  90 + }
  91 + self.allDic.updateValue(lineAry, forKey: 3)
  92 + self.tableView.reloadData()
  93 + }, failHandler: { (error) in
  94 + self.view.makeToast("排名失败:\(error.localizedDescription)")
  95 + })
  96 + }else{
  97 + self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)")
  98 + }
  99 + }else{
  100 + self.view.makeToast("获取排名失败:\(error!.description)")
  101 + }
  102 + }
  103 + AppDelegate.instance().httpServer.getTeacherGenerals { (str, error) in
  104 + if error==nil {
  105 + if JSON.fromString(jsonString: str)!["status"].intValue == 1{
  106 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  107 + var lineAry:[String]=[]
  108 + for item in JSON.fromString(jsonString: str)!["data"].arrayValue {
  109 + lineAry.append(item["f_SchoolName"].stringValue)
  110 + }
  111 + self.allDic.updateValue(lineAry, forKey: 4)
  112 + self.tableView.reloadData()
  113 + }, failHandler: { (error) in
  114 + self.view.makeToast("排名失败:\(error.localizedDescription)")
  115 + })
  116 + }else{
  117 + self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)")
  118 + }
  119 + }else{
  120 + self.view.makeToast("获取排名失败:\(error!.description)")
  121 + }
  122 + }
  123 + AppDelegate.instance().httpServer.getTeacherUpload { (str, error) in
  124 + if error==nil {
  125 + if JSON.fromString(jsonString: str)!["status"].intValue == 1{
  126 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  127 + var lineAry:[String]=[]
  128 + for item in JSON.fromString(jsonString: str)!["data"].arrayValue {
  129 + lineAry.append(item["f_SchoolName"].stringValue)
  130 + }
  131 + self.allDic.updateValue(lineAry, forKey: 5)
  132 + self.tableView.reloadData()
  133 + }, failHandler: { (error) in
  134 + self.view.makeToast("排名失败:\(error.localizedDescription)")
  135 + })
  136 + }else{
  137 + self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)")
  138 + }
  139 + }else{
  140 + self.view.makeToast("获取排名失败:\(error!.description)")
  141 + }
  142 + }
  143 + AppDelegate.instance().httpServer.getTeacherDownload { (str, error) in
  144 + if error==nil {
  145 + if JSON.fromString(jsonString: str)!["status"].intValue == 1{
  146 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  147 + var lineAry:[String]=[]
  148 + for item in JSON.fromString(jsonString: str)!["data"].arrayValue {
  149 + lineAry.append(item["f_SchoolName"].stringValue)
  150 + }
  151 + self.allDic.updateValue(lineAry, forKey: 6)
  152 + self.tableView.reloadData()
  153 + }, failHandler: { (error) in
  154 + self.view.makeToast("排名失败:\(error.localizedDescription)")
  155 + })
  156 + }else{
  157 + self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)")
  158 + }
  159 + }else{
  160 + self.view.makeToast("获取排名失败:\(error!.description)")
  161 + }
  162 + }
  163 + AppDelegate.instance().httpServer.getTeacherPvs { (str, error) in
  164 + if error==nil {
  165 + if JSON.fromString(jsonString: str)!["status"].intValue == 1{
  166 + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
  167 + var lineAry:[String]=[]
  168 + for item in JSON.fromString(jsonString: str)!["data"].arrayValue {
  169 + lineAry.append(item["f_SchoolName"].stringValue)
  170 + }
  171 + self.allDic.updateValue(lineAry, forKey: 7)
  172 + self.tableView.reloadData()
  173 + }, failHandler: { (error) in
  174 + self.view.makeToast("排名失败:\(error.localizedDescription)")
  175 + })
  176 + }else{
  177 + self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)")
  178 + }
  179 + }else{
  180 + self.view.makeToast("获取排名失败:\(error!.description)")
  181 + }
  182 + }
  183 + }
  184 + override func didReceiveMemoryWarning() {
  185 + super.didReceiveMemoryWarning()
  186 + }
  187 + // MARK: - Table view data source
  188 + override func numberOfSections(in tableView: UITableView) -> Int {
  189 + return 1
  190 + }
  191 +
  192 + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  193 + return 8
  194 + }
  195 + override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  196 + var height:CGFloat=44
  197 + if indexPath.row==0 || indexPath.row==4{
  198 + height=height+44
  199 + }
  200 + if indexPath.row != 3{
  201 + height=height+20
  202 + }
  203 + if openIndexAry.contains(indexPath.row){
  204 + height=height+CGFloat(30*allDic[indexPath.row]!.count)
  205 + }
  206 + return height
  207 + }
  208 + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  209 + let cell=tableView.dequeueReusableCell(withIdentifier: "ItemTableViewCell", for: indexPath) as! ItemTableViewCell
  210 + cell.superVC=self
  211 + cell.indexPath=indexPath
  212 + if indexPath.row==0{
  213 + cell.sectionTitleLabel.text="学校排行"
  214 + cell.sectionTitleLabel.isHidden=false
  215 + }
  216 + if indexPath.row==4{
  217 + cell.sectionTitleLabel.text="教师排行"
  218 + cell.sectionTitleLabel.isHidden=false
  219 + }
  220 + if indexPath.row==0 || indexPath.row==4{
  221 + cell.titleViewTop.constant=44
  222 + }else{
  223 + cell.titleViewTop.constant=0
  224 + }
  225 + if indexPath.row==3{
  226 + cell.tableViewButtom.constant=0
  227 + }else{
  228 + cell.tableViewButtom.constant=20
  229 + }
  230 + cell.titleLabel.text=ary[indexPath.row]
  231 + if openIndexAry.contains(indexPath.row){
  232 + cell.titleImageView.image=UIImage(named: "botoom_image")
  233 + }else{
  234 + cell.titleImageView.image=UIImage(named: "top_image")
  235 + }
  236 + cell.subTableView.reloadData()
  237 + return cell
  238 + }
  239 +
  240 +}
  241 +class ItemTableViewCell: UITableViewCell,UITableViewDelegate,UITableViewDataSource {
  242 + var superVC:RankingTableViewController?
  243 + var indexPath:IndexPath!
  244 + @IBOutlet var sectionTitleLabel: UILabel!
  245 + @IBOutlet var titleViewTop: NSLayoutConstraint!
  246 + @IBOutlet var subTableView: UITableView!
  247 + @IBOutlet var tableViewButtom: NSLayoutConstraint!
  248 + @IBOutlet var titleLabel: UILabel!
  249 + @IBOutlet var titleImageView: UIImageView!
  250 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  251 + if superVC != nil {
  252 + if superVC!.openIndexAry.contains(indexPath.row){
  253 + return superVC!.allDic[indexPath.row]!.count
  254 + }else{
  255 + return 0
  256 + }
  257 + }else{
  258 + return 0
  259 + }
  260 + }
  261 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  262 + return 30
  263 + }
  264 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  265 + let cell=tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
  266 + if superVC != nil {
  267 + cell.textLabel?.text="\(superVC!.allDic[self.indexPath.row]![indexPath.row])"
  268 + }
  269 + return cell
  270 + }
  271 + @IBAction func openOrCloseAction(_ sender: UIButton) {
  272 + if superVC!.openIndexAry.contains(indexPath.row){
  273 + superVC!.openIndexAry.remove(at: getCurrentIndex(item: indexPath.row, arry: superVC!.openIndexAry))
  274 + }else{
  275 + superVC!.openIndexAry.append(indexPath.row)
  276 + }
  277 + superVC!.tableView.reloadData()
  278 + }
  279 +}
... ...
YouerLiveVideo/YouerLiveVideo/controllers/MViewController.swift
... ... @@ -20,6 +20,7 @@ class MViewController: UITabBarController {
20 20 super.viewDidLoad()
21 21 self.tabBar.tintColor=Theme.topBarColor()
22 22 tabBar.barTintColor=UIColor.white
  23 + tabBarController?.tabBar.isHidden=true
23 24 }
24 25  
25 26 override func didReceiveMemoryWarning() {
... ...
YouerLiveVideo/YouerLiveVideo/util/network.swift
... ... @@ -308,43 +308,43 @@ final class HTTPServer{
308 308  
309 309 //MARK:-DataStatistics
310 310 //获取前十学校的综合排行
311   - func getSchoolGeneral(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
312   - KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETSCHOOLGENERAL, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
  311 + func getSchoolGeneral(completionHandler:@escaping (String?, NSError?) -> ()){
  312 + KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETSCHOOLGENERAL,headers:["Authorization":token!], completionHandler: completionHandler)
313 313 }
314 314  
315 315 //获取前十学校的阅读量排行
316   - func getSchoolPv(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
317   - KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETSCHOOLPV, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
  316 + func getSchoolPv(completionHandler:@escaping (String?, NSError?) -> ()){
  317 + KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETSCHOOLPV, headers:["Authorization":token!], completionHandler: completionHandler)
318 318 }
319 319  
320 320 //获取排行前十学校的下载量
321   - func getSchoolDownloads(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
322   - KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETSCHOOLDOWNLOADS, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
  321 + func getSchoolDownloads(completionHandler:@escaping (String?, NSError?) -> ()){
  322 + KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETSCHOOLDOWNLOADS,headers:["Authorization":token!], completionHandler: completionHandler)
323 323 }
324 324  
325 325 //获取排行前十学校的上传数
326   - func getSchoolUpload(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
327   - KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETSCHOOLUPLOAD, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
  326 + func getSchoolUpload(completionHandler:@escaping (String?, NSError?) -> ()){
  327 + KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETSCHOOLUPLOAD,headers:["Authorization":token!], completionHandler: completionHandler)
328 328 }
329 329  
330 330 //获取排行前十的教师的综合数
331   - func getTeacherGenerals(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
332   - KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETTEACHERGENERALS, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
  331 + func getTeacherGenerals(completionHandler:@escaping (String?, NSError?) -> ()){
  332 + KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETTEACHERGENERALS,headers:["Authorization":token!], completionHandler: completionHandler)
333 333 }
334 334  
335 335 //获取排名前十的教师发的资源的阅读量
336   - func getTeacherPvs(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
337   - KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETTEACHERPVS, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
  336 + func getTeacherPvs(completionHandler:@escaping (String?, NSError?) -> ()){
  337 + KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETTEACHERPVS, headers:["Authorization":token!], completionHandler: completionHandler)
338 338 }
339 339  
340 340 //获取排名前十的资源的下载量
341   - func getTeacherDownload(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
342   - KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETTEACHERDOWNLOAD, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
  341 + func getTeacherDownload(completionHandler:@escaping (String?, NSError?) -> ()){
  342 + KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETTEACHERDOWNLOAD, headers:["Authorization":token!], completionHandler: completionHandler)
343 343 }
344 344  
345 345 //获取排名前十的教师的上传量
346   - func getTeacherUpload(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
347   - KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETTEACHERUPLOAD, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
  346 + func getTeacherUpload(completionHandler:@escaping (String?, NSError?) -> ()){
  347 + KHttp.GET(url: HTTPServer.URL_DATASTATISTICGETTEACHERUPLOAD,headers:["Authorization":token!], completionHandler: completionHandler)
348 348 }
349 349  
350 350 //分页获取排行榜
... ...
YouerLiveVideo/YouerLiveVideo/util/utiles.swift
... ... @@ -187,7 +187,15 @@ class indexLongPressGesture: UILongPressGestureRecognizer {
187 187 class indexUIMenuItem: UIMenuItem {
188 188 var indexPath:IndexPath?
189 189 }
190   -
  190 +//获取元素在数组中的位置
  191 +func getCurrentIndex(item:Int,arry:[Int])->Int{
  192 + for i in 0..<arry.count {
  193 + if arry[i]==item{
  194 + return i
  195 + }
  196 + }
  197 + return 0
  198 +}
191 199 //图片缩放
192 200 extension UIImage{
193 201 func imageScaledToScale(_ scale:CGFloat)->UIImage{
... ...