diff --git a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj index 1d11c15..f5dda24 100644 --- a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj +++ b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 5989394B1ED3CFF4005DA462 /* AppSettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5989394A1ED3CFF4005DA462 /* AppSettingViewController.swift */; }; 5989394D1ED4016D005DA462 /* HistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5989394C1ED4016D005DA462 /* HistoryViewController.swift */; }; 598939501ED41C44005DA462 /* ChangePassWordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5989394F1ED41C44005DA462 /* ChangePassWordViewController.swift */; }; + 598939521ED818A7005DA462 /* AllMyResourceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 598939511ED818A7005DA462 /* AllMyResourceViewController.swift */; }; 598A0E531E51941300273AB8 /* libNIMSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 598A0E4D1E51941300273AB8 /* libNIMSDK.a */; }; 598A0E541E51941300273AB8 /* libaacplus.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 598A0E4F1E51941300273AB8 /* libaacplus.a */; }; 598A0E551E51941300273AB8 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 598A0E501E51941300273AB8 /* libcrypto.a */; }; @@ -254,6 +255,7 @@ 5989394A1ED3CFF4005DA462 /* AppSettingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppSettingViewController.swift; sourceTree = ""; }; 5989394C1ED4016D005DA462 /* HistoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoryViewController.swift; sourceTree = ""; }; 5989394F1ED41C44005DA462 /* ChangePassWordViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangePassWordViewController.swift; sourceTree = ""; }; + 598939511ED818A7005DA462 /* AllMyResourceViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllMyResourceViewController.swift; sourceTree = ""; }; 598A0E121E51941300273AB8 /* NIMChatroom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NIMChatroom.h; sourceTree = ""; }; 598A0E131E51941300273AB8 /* NIMChatroomEnterRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NIMChatroomEnterRequest.h; sourceTree = ""; }; 598A0E141E51941300273AB8 /* NIMChatroomMember.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NIMChatroomMember.h; sourceTree = ""; }; @@ -1225,6 +1227,7 @@ 598939481ED3CFD8005DA462 /* UserEditViewController.swift */, 5989394A1ED3CFF4005DA462 /* AppSettingViewController.swift */, 5989394C1ED4016D005DA462 /* HistoryViewController.swift */, + 598939511ED818A7005DA462 /* AllMyResourceViewController.swift */, 5989394E1ED41C31005DA462 /* Setting */, BFBB83DA1ECC445D008B404B /* UserCenter */, ); @@ -1598,6 +1601,7 @@ 59AE3DFD1ECED5B1003E2C62 /* MoivePlayerViewController.swift in Sources */, BF25DFF01DDAA36A003EC0C1 /* SessionDelegate.swift in Sources */, BF7723051ED5667500226D44 /* FilterListViewController.swift in Sources */, + 598939521ED818A7005DA462 /* AllMyResourceViewController.swift in Sources */, BF25DFE31DDAA36A003EC0C1 /* Alamofire.swift in Sources */, BF25DFEC1DDAA36A003EC0C1 /* Response.swift in Sources */, BF7B75961E305A6D0011D5C7 /* MJRefreshAutoFooter.m in Sources */, diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/AllMyResourceViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/AllMyResourceViewController.swift new file mode 100644 index 0000000..b8f593b --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/AllMyResourceViewController.swift @@ -0,0 +1,98 @@ +// +// AllMyResourceViewController.swift +// YouerLiveVideo +// +// Created by 左丞 on 2017/5/26. +// Copyright © 2017年 左丞. All rights reserved. +// + +import UIKit + +class AllMyResourceViewController: UIViewController { + var myDataSet:[TVStationSubject] = [] + var type:Int = 0// 资源类型 1-资源 0-微课 + @IBOutlet weak var collectionView: UICollectionView! + + override func viewDidLoad() { + super.viewDidLoad() + AppDelegate.instance().httpServer.getMyAllResources(parameters: ["f_ResourceType":type as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in + for item in json.contentData()["resultData"].arrayValue{ + self.myDataSet.append(TVStationSubject(json: item)) + } + self.collectionView.reloadData() + }, failHandler: { (error) in + + }) + } + + // Do any additional setup after loading the view. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tabBarController?.tabBar.isHidden = true + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.tabBarController?.hidesBottomBarWhenPushed = false + } + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} + + +extension AllMyResourceViewController:UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{ + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! MyResourceCell + let item = myDataSet[indexPath.row] + cell.model = item + return cell + } + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return myDataSet.count + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize(width: (getScreenWidth()-30)/2, height: 200) + } + + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsetsMake(10, 10, 10, 10) + } + +} + +class MyResourceCell: UICollectionViewCell { + + @IBOutlet weak var name: UILabel! + @IBOutlet weak var photo: UIImageView! + var model:TVStationSubject?{ + didSet{ + name.text = model!.f_Title + photo.sd_setImage(with: URL(string:model!.f_Img), placeholderImage: #imageLiteral(resourceName: "placeholder")) + } + } +} diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/HistoryViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/HistoryViewController.swift index 30eacbe..ca318f8 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/HistoryViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/HistoryViewController.swift @@ -13,36 +13,22 @@ class HistoryViewController: UIViewController { @IBOutlet weak var collectionView: UICollectionView! var datatSet:[HistoryView] = [] - var type:Int = 0// 资源类型 0-微课 1-资源 - var isHistory:Int = 0 + var type:Int = 0// 资源类型 1-资源 0-微课 override func viewDidLoad() { super.viewDidLoad() - if isHistory == 0{ - AppDelegate.instance().httpServer.getHistroyView(parameters: ["f_ViewType":type as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in - httpJsonResule(jsonString: str, error: error, successHandler: { (json) in - for item in json.contentData()["resultData"].arrayValue{ - self.datatSet.append(HistoryView(json: item)) - } - self.collectionView.reloadData() - }, failHandler: { (error) in - - }) - } - }else{ - AppDelegate.instance().httpServer.getHistroyView(parameters: ["f_ViewType":type as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in - httpJsonResule(jsonString: str, error: error, successHandler: { (json) in - for item in json.contentData()["resultData"].arrayValue{ - self.datatSet.append(HistoryView(json: item)) - } - self.collectionView.reloadData() - }, failHandler: { (error) in - - }) - } + AppDelegate.instance().httpServer.getHistroyView(parameters: ["f_ViewType":type as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in + for item in json.contentData()["resultData"].arrayValue{ + self.datatSet.append(HistoryView(json: item)) + } + self.collectionView.reloadData() + }, failHandler: { (error) in + + }) } // Do any additional setup after loading the view. } - + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard b/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard index dabc43b..6bab145 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard @@ -650,6 +650,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserEditViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserEditViewController.swift index ce4fb43..87f0508 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserEditViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserEditViewController.swift @@ -23,7 +23,7 @@ class UserEditViewController: UIViewController ,UIImagePickerControllerDelegate, } func setContentArr(){ - contentArr = [user.name(),user.phone(),getIdent(),user.schoolName()] + contentArr = [user.name(),user.id(),getIdent(),user.schoolName()] } func getIdent()->String{ diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift index b3de30d..9f15fd0 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift @@ -95,11 +95,19 @@ extension UserViewController:UITableViewDelegate,UITableViewDataSource{ AppDelegate.instance().window?.makeToast("请先登录") return } - let vc = Story.instantiateViewControllerWithIdentifier("HistoryViewControllerVC", storyName: "User") as! HistoryViewController - vc.type = indexPath.row - vc.isHistory = indexPath.section - vc.title = historyType[indexPath.row] - self.navigationController?.pushViewController(vc, animated: true) + let type = 0 == indexPath.row ? 1 : 0 + if indexPath.section == 0{ + let vc = Story.instantiateViewControllerWithIdentifier("HistoryViewControllerVC", storyName: "User") as! HistoryViewController + vc.type = type + vc.title = historyType[indexPath.row] + self.navigationController?.pushViewController(vc, animated: true) + }else{ + let vc = Story.instantiateViewControllerWithIdentifier("AllMyResourceViewControllerVC", storyName: "User") as! AllMyResourceViewController + vc.type = type + vc.title = historyType[indexPath.row] + self.navigationController?.pushViewController(vc, animated: true) + + } } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { -- libgit2 0.21.0