diff --git a/ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj b/ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj index c7f2e4d..1ee8025 100644 --- a/ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj +++ b/ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj @@ -81,6 +81,8 @@ ADC9AB82207C673300348EF1 /* SceneMiddleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADC9AB81207C673300348EF1 /* SceneMiddleCell.xib */; }; ADC9AB84207C673C00348EF1 /* SceneDownCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADC9AB83207C673C00348EF1 /* SceneDownCell.xib */; }; ADC9AB88207C940700348EF1 /* ProgramViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADC9AB87207C940700348EF1 /* ProgramViewController.swift */; }; + ADCDA070208AE317004F1852 /* SearchBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADCDA06F208AE317004F1852 /* SearchBarView.swift */; }; + ADCDA072208B2982004F1852 /* InfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADCDA071208B2982004F1852 /* InfoModel.swift */; }; ADE33B312062202300BEA6E6 /* Macro.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADE33B302062202300BEA6E6 /* Macro.swift */; }; ADF159612069E00000A9485D /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADF159602069E00000A9485D /* CalendarView.swift */; }; ADF15E7620883D1B00381EE1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ADF15E7520883D1B00381EE1 /* Assets.xcassets */; }; @@ -262,6 +264,8 @@ ADC9AB81207C673300348EF1 /* SceneMiddleCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SceneMiddleCell.xib; sourceTree = ""; }; ADC9AB83207C673C00348EF1 /* SceneDownCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SceneDownCell.xib; sourceTree = ""; }; ADC9AB87207C940700348EF1 /* ProgramViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgramViewController.swift; sourceTree = ""; }; + ADCDA06F208AE317004F1852 /* SearchBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBarView.swift; sourceTree = ""; }; + ADCDA071208B2982004F1852 /* InfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoModel.swift; sourceTree = ""; }; ADE33B302062202300BEA6E6 /* Macro.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Macro.swift; sourceTree = ""; }; ADF159602069E00000A9485D /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = ""; }; ADF15E7520883D1B00381EE1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -467,6 +471,7 @@ 599364E0204E62E700C8B371 /* Information */ = { isa = PBXGroup; children = ( + ADCDA073208B298D004F1852 /* Model */, 599364E1204E62E700C8B371 /* InformationViewController.swift */, 599364DD204E62E700C8B371 /* ChannelViewController.swift */, 599364DE204E62E700C8B371 /* Information.storyboard */, @@ -642,6 +647,14 @@ path = Program; sourceTree = ""; }; + ADCDA073208B298D004F1852 /* Model */ = { + isa = PBXGroup; + children = ( + ADCDA071208B2982004F1852 /* InfoModel.swift */, + ); + path = Model; + sourceTree = ""; + }; B605235D289EDBCA5C5AF2C5 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -892,6 +905,7 @@ BFF9B7F32057A29D00F39B3E /* TableEmptyView.xib */, AD639F0420897CBC0028BE73 /* AlertShowView.swift */, AD639F082089D8670028BE73 /* PickSelectView.swift */, + ADCDA06F208AE317004F1852 /* SearchBarView.swift */, ); path = view; sourceTree = ""; @@ -1162,7 +1176,9 @@ BFEAAAC4205257460072FAAF /* LXCalendarMonthModel.m in Sources */, BFA7443A207DB6EE00845D30 /* ActivationSchoolCardViewController.swift in Sources */, BF38847E205CDE2D00A240EF /* JSViewController.swift in Sources */, + ADCDA070208AE317004F1852 /* SearchBarView.swift in Sources */, ADE33B312062202300BEA6E6 /* Macro.swift in Sources */, + ADCDA072208B2982004F1852 /* InfoModel.swift in Sources */, ADF159612069E00000A9485D /* CalendarView.swift in Sources */, AD122ACA2084498F00C7D0AD /* ProgramVacateAddView.swift in Sources */, BF406CD82057B529000A6681 /* MessageTableViewCell.swift in Sources */, diff --git a/ParentAssistant/ParentAssistant.xcodeproj/xcuserdata/caoyang.xcuserdatad/xcschemes/xcschememanagement.plist b/ParentAssistant/ParentAssistant.xcodeproj/xcuserdata/caoyang.xcuserdatad/xcschemes/xcschememanagement.plist index 3e94619..ee8ca0e 100644 --- a/ParentAssistant/ParentAssistant.xcodeproj/xcuserdata/caoyang.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/ParentAssistant/ParentAssistant.xcodeproj/xcuserdata/caoyang.xcuserdatad/xcschemes/xcschememanagement.plist @@ -10,5 +10,18 @@ 11 + SuppressBuildableAutocreation + + BF7A4C2F204CD55300460463 + + primary + + + BF7A4C46204CD55500460463 + + primary + + + diff --git a/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate b/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate index ad9faed..3f378d5 100644 Binary files a/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate and b/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 9d557ab..14a0487 100644 --- a/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -20,11 +20,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "ParentAssistant/Classes/controllers/Grow/GrowViewController.swift" - timestampString = "545907653.422401" + timestampString = "545996291.249851" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "161" - endingLineNumber = "161" + startingLineNumber = "162" + endingLineNumber = "162" landmarkName = "switchChildrenAction()" landmarkType = "7"> diff --git a/ParentAssistant/ParentAssistant/AppDelegate.swift b/ParentAssistant/ParentAssistant/AppDelegate.swift index 04f3957..1213858 100644 --- a/ParentAssistant/ParentAssistant/AppDelegate.swift +++ b/ParentAssistant/ParentAssistant/AppDelegate.swift @@ -16,6 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var conn:Reachability! func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { setUpYXIM() + //1.设置网络状态监听 NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.networkStatusChange), name: NSNotification.Name.reachabilityChanged, object: nil) // 2、获得网络Reachability对象 @@ -56,13 +57,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func setUpYXIM(){ var appkey = "" var cername = "" - if Debug.isFormal{ - appkey = "a1ff0bc08fa0d6f95b480d131e55584b" - cername = "hxyproductpush" - }else{ + #if DEBUG appkey = "330158c080acdf4dc1092d6a74576c2c" cername = "parentdevelop" - } + #else + appkey = "a1ff0bc08fa0d6f95b480d131e55584b" + cername = "hxyproductpush" + #endif +// if Debug.isFormal{ +// appkey = "a1ff0bc08fa0d6f95b480d131e55584b" +// cername = "hxyproductpush" +// }else{ +// appkey = "330158c080acdf4dc1092d6a74576c2c" +// cername = "parentdevelop" +// } let option = NIMSDKOption(appKey: appkey) option.apnsCername = cername NIMSDK.shared().register(with: option) @@ -298,6 +306,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } } } - } diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/GrowViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/GrowViewController.swift index 805733d..07801c3 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/GrowViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/GrowViewController.swift @@ -65,7 +65,6 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { //设置导航栏标题 self.navigationItem.titleView = self.titleView self.navigationItem.titleView?.center.x = screenWidth/2 - print(self.navigationItem.titleView!.frame) self.view.addSubview(contentScrollView) self.title = "成长" @@ -110,16 +109,18 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { //MARK: 导航栏视图UI func drawHeadView () { //左按钮 - let leftView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 44)) - let titleLab = UILabel.init(frame: CGRect.init(x: 0, y: 0, width: 50, height: 44)) + let leftView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 70, height: 44)) + let titleLab = UILabel.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 44)) titleLab.font = UIFont.systemFont(ofSize: 15) titleLab.textAlignment = .center titleLab.textColor = .white + titleLab.numberOfLines = 0 + titleLab.adjustsFontSizeToFitWidth = true self.titleLeftLab = titleLab leftView.addSubview(titleLab) - let imageView = UIImageView.init(frame: CGRect.init(x: 50, y: 11, width: 10, height: 22)) + let imageView = UIImageView.init(frame: CGRect.init(x: 60, y: 11, width: 10, height: 22)) imageView.image = UIImage.init(named: "report_white_pull") imageView.contentMode = .scaleAspectFit leftView.addSubview(imageView) diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCardViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCardViewController.swift index 6807063..856c255 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCardViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCardViewController.swift @@ -33,7 +33,7 @@ class ProgramCardViewController: UIViewController,UITextFieldDelegate { }() @objc func applyAction(){ - print("补卡申请提交") + DebugLog( "补卡提交") let params = ["studentid":1,"onecard":"sss"] as [String : Any] HTTPServer.shared.postStudentMendCard(parameters: params as [String : AnyObject]) { (backData, error) in print(backData!) @@ -66,7 +66,6 @@ class ProgramCardViewController: UIViewController,UITextFieldDelegate { @objc func handleTap(sender:UITapGestureRecognizer){ if sender.state == .ended { - print("收起键盘") self.cardInputTextField.resignFirstResponder() } sender.cancelsTouchesInView = false diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCheckViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCheckViewController.swift index 5aae8d5..78e65ba 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCheckViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCheckViewController.swift @@ -56,7 +56,7 @@ class ProgramCheckViewController: UIViewController,UITableViewDelegate,UITableVi SVProgressHUD.dismiss() if error == nil && JSON.fromString(backData)!["status"].intValue == 1 { let data = JSON.fromString(backData)!["data"].arrayValue - print(backData!) + DebugLog(backData!) for i in 0.. UIButton in - let btn = UIButton.init(frame: CGRect.init(x: screenWidth/2-100, y: screenHeight-66-50, width: 200, height: 40)) + let btn = UIButton.init(frame: CGRect.init(x: 50, y: screenHeight-66-50, width: screenWidth-100, height: 40)) btn.setTitle("请假", for: UIControlState.normal) - btn.setTitleColor(UIColor.black, for: UIControlState.normal) + btn.setTitleColor(UIColor.white, for: UIControlState.normal) btn.backgroundColor = Theme.topBarColor() btn.layer.cornerRadius = 5 btn.clipsToBounds = true @@ -42,7 +42,7 @@ class ProgramVacateViewController: UIViewController,UITableViewDelegate,UITableV /// 请假页面 @objc func addVacateAction(){ - print("申请请假!") + let vc = ProgramVacateAddViewController() vc.title = "申请请假" vc.view.backgroundColor = backGroundColor @@ -140,8 +140,6 @@ class ProgramVacateViewController: UIViewController,UITableViewDelegate,UITableV func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.section == 1 && indexPath.row != 0 && vacateRecodeArray.count>0 { - - print(indexPath.row) let vc = ProgramVacateDetailViewController() vc.view.backgroundColor = UIColor.white vc.title = "请假详情" diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramViewController.swift index b7dd1c9..3d7e918 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramViewController.swift @@ -79,7 +79,6 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat } @objc func gotoChildView () { - print("去个人中心页面-我的孩子!") let vc = Story.instantiateViewControllerWithIdentifier("MyChildrenViewController", storyName: "My") as! MyChildrenViewController self.navigationController?.pushViewController(vc, animated: true) } diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Report/MoralViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Report/MoralViewController.swift index ba48b1d..8813076 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Report/MoralViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/Report/MoralViewController.swift @@ -45,7 +45,8 @@ class MoralViewController: UIViewController,UITableViewDelegate,UITableViewDataS self.data = JSON.fromString(backData)!["data"].dictionaryValue if !self.data.isEmpty{ - print(self.data) + + DebugLog( self.data) } } } diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/CalendarView.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/CalendarView.swift index c8b1254..2b4e091 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/CalendarView.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/CalendarView.swift @@ -81,7 +81,8 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if indexPath.row >= firstDay-1+7 && indexPath.row < todayDay+7+firstDay-1 { - print("点击了 ...\(indexPath.row+1-7-firstDay+1)号") + + DebugLog( "点击了 ...\(indexPath.row+1-7-firstDay+1)号") } } required init?(coder aDecoder: NSCoder) { diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/EducationDetailCell.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/EducationDetailCell.swift index 87cf454..212a964 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/EducationDetailCell.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/EducationDetailCell.swift @@ -18,7 +18,6 @@ class EducationDetailCell: UITableViewCell { let rect = CGRect.init(x: 10, y: 60, width: screenWidth-20, height: screenWidth*0.62-60) customLineChart = LineChartView.init(frame: rect) - print("linechart frame = \(customLineChart.frame)") customLineChart.drawUI(xLableArr: nil) let arr1 = [4,4,2,1,3] let arr2 = [2,1,4,4,5] diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/LineChartView.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/LineChartView.swift index b5431f4..ed634d8 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/LineChartView.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/LineChartView.swift @@ -158,8 +158,6 @@ class LineChartView: UIView { self.addSubview(newLab) yLabArray.append(newLab) } - }else{ - print(yLabArray) } btnTouch = index diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/ReportHeaderView.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/ReportHeaderView.swift index 46fbd05..b529ff1 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/ReportHeaderView.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/ReportHeaderView.swift @@ -85,7 +85,8 @@ class ReportHeaderView: UIView,UICollectionViewDelegate,UICollectionViewDataSour } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if indexPath.row >= firstDay-1 && indexPath.row < todayDate+firstDay-1 { - print("点击了 ...\(indexPath.row+1-firstDay+1)号") + + DebugLog( "点击了 ...\(indexPath.row+1-firstDay+1)号") } } diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift index 82d3997..4e661d5 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift @@ -14,32 +14,81 @@ class InformationViewController: UIViewController,UISearchBarDelegate { var topADs:[ADSModel]=[] var isFirstviewController:Bool=true var channel:Int=0 + + //导航栏左侧按钮 + lazy var leftCityView = {()-> UIView in + //左按钮 + let leftView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 70, height: 44)) + let titleLab = UILabel.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 44)) + + titleLab.font = UIFont.systemFont(ofSize: 15) + titleLab.numberOfLines = 0 + titleLab.adjustsFontSizeToFitWidth = true + titleLab.textAlignment = .center + titleLab.textColor = .white + titleLab.text = localAddress + self.leftLabel = titleLab + leftView.addSubview(titleLab) + + let imageView = UIImageView.init(frame: CGRect.init(x: 60, y: 11, width: 10, height: 22)) + imageView.image = UIImage.init(named: "report_white_pull") + imageView.contentMode = .scaleAspectFit + leftView.addSubview(imageView) + + leftView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(EvaluationViewController.getAddreess(tap:)))) + return leftView + }() + override func viewDidLoad() { super.viewDidLoad() - - self.configTheme() - - // Do any additional setup after loading the view. - var searchViewFrame = CGRect(x: 0, y: 0, width: getScreenWidth()-100, height: 30) - + + let item = UIBarButtonItem.init(title: "返回", style: .plain, target: self, action: nil) + self.navigationItem.backBarButtonItem = item + + drawTopUI() + + } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + if isFirstviewController{ - self.navigationItem.title = "" - addLeftBarBtn() - }else{ - searchViewFrame.size.width = getScreenWidth()-60 + let leftBtn = UIBarButtonItem.init(customView: self.leftCityView) + self.navigationItem.leftBarButtonItem = leftBtn + if localAddress == "未知" { + LocationManger.shared.block = { str in + localAddress = str + self.leftLabel.text = localAddress + self.getDataFromNet() + } + } } - let searchView = UISearchBar(frame: searchViewFrame) - let view = UIView(frame: CGRect(x: 0, y: 7, width: searchViewFrame.size.width, height: 30)) - searchView.delegate = self - searchView.placeholder = "请输入搜索内容" - searchView.showsCancelButton = false - view.addSubview(searchView) - self.navigationItem.titleView = view - self.navigationController?.navigationBar.tintColor=UIColor.white + self.getDataFromNet() } - - private func getDataFromNet(){ + func drawTopUI(){ + self.configTheme() + //搜索框 + let searchView = SearchBarView.init(frame: CGRect.init(x: 0, y: 0, width: screenWidth-100, height: navigationBarHeight!)) + //MARK:搜索框搜索回调 + searchView.block = { str,type in + DebugLog(str) + switch type { + case .SearchType: + self.getList(key: str) + case .CancelType: + self.getDataFromNet() + } + } + self.navigationItem.titleView = searchView + } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + SVProgressHUD.dismiss() + } + //MARK: - 获取该城市下的数据 + private func getDataFromNet(){ + //position 广告位置0-首次广告位1-开屏广告位2-资讯首页3-频道首页4-频道内容5-文章内容页 + SVProgressHUD.show() let group = DispatchGroup() var position:Int = 2 if !self.isFirstviewController { @@ -72,48 +121,27 @@ class InformationViewController: UIViewController,UISearchBarDelegate { group.leave() }) group.notify(queue: DispatchQueue.main) { + SVProgressHUD.dismiss() self.collectView.reloadData() } } - - - func getData(){ - let topADsQueue = DispatchQueue(label: "topADs") - topADsQueue.async { - //position 广告位置0-首次广告位1-开屏广告位2-资讯首页3-频道首页4-频道内容5-文章内容页 - var position:Int = 2 - if !self.isFirstviewController { - position = 3 - } - HTTPServer.shared.getAds(["position":position as AnyObject,"areaName":localAddress as AnyObject], completionHandler: { (str, error) in//getPercentEncodingString(str: localAddress) - httpJsonResule(jsonString: str, error: error, successHandler: { (json) in - if json["status"] == 1 && error == nil{ - self.topADs.removeAll() - for item in json.contentData().arrayValue{ - self.topADs.append(ADSModel(j: item)) - } - self.collectView.reloadData() - } - }, failHandler: { (error) in - - }) - }) - } - topADsQueue.async { - let dic = self.getListDic() - HTTPServer.shared.getChannelInfo(dic, completionHandler: { (str, error) in - httpJsonResule(jsonString: str, error: error, successHandler: { (json) in - if json["status"] == 1 && error == nil{ - self.data = ChannelDemol(j: json.contentData()) - self.collectView.reloadData() - } - }, failHandler: { (error) in - - }) - }) + //MARK: - 地址选择回调 + @objc func getAddreess(tap:UITapGestureRecognizer){ + tap.view?.isUserInteractionEnabled = false + LZCityPickerController.showPicker(in: self + , select: { (address, province, city, area, isSelect) in + if isSelect{ + tap.view?.isUserInteractionEnabled = true + self.leftLabel.text = area! + localAddress = area! + self.getDataFromNet() + } + }) { + tap.view?.isUserInteractionEnabled = true } } + //MARK: - 搜索框搜索咨询 func getList(key:String?) { if key == nil{ return @@ -149,81 +177,8 @@ class InformationViewController: UIViewController,UISearchBarDelegate { dic.updateValue(toFirstPage as AnyObject, forKey: "toFirstPage") return dic } - - //左上交城市选择按钮添加 - func addLeftBarBtn(){ - let leftbtn = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40)) - leftLabel = UILabel(frame: CGRect(x: 0, y: 10, width: 60, height: 20)) - leftLabel.text = localAddress - leftLabel.textColor = UIColor.white - leftLabel.sizeToFit() - let image = UIImageView(frame: CGRect(x: leftLabel.frame.maxX+4, y: 15, width: 16, height: 9)) - image.image = #imageLiteral(resourceName: "evaluation_icon_pushDown") - leftbtn.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(EvaluationViewController.getAddreess(tap:)))) - leftbtn.addSubview(leftLabel) - leftbtn.addSubview(image) - leftbtn.frame.size = CGSize(width: image.frame.maxX+4, height: 40) - self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: leftbtn) - } - - //地址选择 - @objc func getAddreess(tap:UITapGestureRecognizer){ - tap.view?.isUserInteractionEnabled = false - LZCityPickerController.showPicker(in: self - , select: { (address, province, city, area, isSelect) in - if isSelect{ - tap.view?.isUserInteractionEnabled = true - self.selectCity(city: area!) - } - }) { - tap.view?.isUserInteractionEnabled = true - } - } - //完成选择城市 - func selectCity(city: String) { - localAddress = city - addLeftBarBtn() -// getData() - getDataFromNet() - - } - - func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { - searchBar.showsCancelButton = true - } - - func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { - searchData(searchBar) - } - - func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { - searchData(searchBar) - } - - //搜索资讯 - func searchData(_ searchBar: UISearchBar){ - getList(key: searchBar.text) - searchBar.resignFirstResponder() - searchBar.showsCancelButton = false - - } - - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) -// getData() - getDataFromNet() - if isFirstviewController{ - addLeftBarBtn() - }else{ - - } - } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. @@ -419,83 +374,4 @@ extension ChannelSelectView:UICollectionViewDataSource,UICollectionViewDelegateF } } -class ChannelDemol:NSObject{ - var id:Int=0 // 频道ID , - var channelName:String=""// 频道名称 , - var channelImage:String=""// 频道图片 , - var orderById:Int=0 // 频道排序 , - var subchannel:[SubchannelDemol] = []// 二级频道 , - var channelContent:[ChannelContentDemol] = []// 频道信息 - init(j:JSON){ - id = j["id"].intValue - channelName = j["channelName"].stringValue - channelName = j["channelName"].stringValue - orderById = j["orderById"].intValue - for item in j["subchannel"].arrayValue { - subchannel.append(SubchannelDemol(j: item)) - } - for item in j["channelContent"].arrayValue { - channelContent.append(ChannelContentDemol(j: item)) - } - } -} - -class SubchannelDemol: NSObject { - var id:Int=0 // 二级频道ID , - var channelName:String=""// 二级频道名称 , - var channelImage:String=""// 二级频道图片 , - var orderById:Int=0// 二级工具排序, - var url:String=""// 二级工具链接 - init(j:JSON){ - id = j["id"].intValue - channelName = j["channelName"].stringValue - channelImage = j["channelImage"].stringValue - orderById = j["orderById"].intValue - url = j["url"].stringValue - } - -} - -class ChannelContentDemol: NSObject { - var id:Int=0// 资讯ID , - var image:String=""// 资讯标题图片 , - var title:String=""// 资讯标题 , - var url:String=""// 资讯链接 , - var content:String=""// 资讯内容 , - var forwardingNum:Int=0// 资讯转发数 , - var talkNum:Int=0 // 评论数 , - var lookNum:Int = 0 //浏览数 - var orderById:Int=0// 资讯排序 - var isAds:Int=0// 是否为广告 1是广告 - init(j:JSON){ - id = j["id"].intValue - image = j["image"].stringValue - title = j["title"].stringValue - url = j["url"].stringValue - content = j["content"].stringValue - forwardingNum = j["forwardingNum"].intValue - talkNum = j["talkNum"].intValue - lookNum = j["lookNum"].intValue - orderById = j["orderById"].intValue - isAds = j["isAds"].intValue - } - -} - -class ADSModel: NSObject { - var id:Int=0// 广告ID , - var location:Int=0// 广告位 , - var describe:String=""// 广告内容 , - var fileSrc:String=""// 广告内容 , - var url:String=""// 广告跳转链接 , - var orderById:Int=0// 广告排序 - init(j:JSON){ - id = j["id"].intValue - location = j["location"].intValue - describe = j["describe"].stringValue - fileSrc = j["fileSrc"].stringValue - url = j["url"].stringValue - orderById = j["orderById"].intValue - } -} diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Information/Model/InfoModel.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Information/Model/InfoModel.swift new file mode 100644 index 0000000..437be92 --- /dev/null +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Information/Model/InfoModel.swift @@ -0,0 +1,93 @@ +// +// InfoModel.swift +// ParentAssistant +// +// Created by Cao yang on 2018/4/21. +// Copyright © 2018年 HANGZHOUTEAM. All rights reserved. +// + +import UIKit + +class InfoModel: NSObject { + +} +class ChannelDemol:NSObject{ + var id:Int=0 // 频道ID , + var channelName:String=""// 频道名称 , + var channelImage:String=""// 频道图片 , + var orderById:Int=0 // 频道排序 , + var subchannel:[SubchannelDemol] = []// 二级频道 , + var channelContent:[ChannelContentDemol] = []// 频道信息 + init(j:JSON){ + id = j["id"].intValue + channelName = j["channelName"].stringValue + channelName = j["channelName"].stringValue + orderById = j["orderById"].intValue + for item in j["subchannel"].arrayValue { + subchannel.append(SubchannelDemol(j: item)) + } + for item in j["channelContent"].arrayValue { + channelContent.append(ChannelContentDemol(j: item)) + } + } +} + +class SubchannelDemol: NSObject { + var id:Int=0 // 二级频道ID , + var channelName:String=""// 二级频道名称 , + var channelImage:String=""// 二级频道图片 , + var orderById:Int=0// 二级工具排序, + var url:String=""// 二级工具链接 + init(j:JSON){ + id = j["id"].intValue + channelName = j["channelName"].stringValue + channelImage = j["channelImage"].stringValue + orderById = j["orderById"].intValue + url = j["url"].stringValue + } + +} + +class ChannelContentDemol: NSObject { + var id:Int=0// 资讯ID , + var image:String=""// 资讯标题图片 , + var title:String=""// 资讯标题 , + var url:String=""// 资讯链接 , + var content:String=""// 资讯内容 , + var forwardingNum:Int=0// 资讯转发数 , + var talkNum:Int=0 // 评论数 , + var lookNum:Int = 0 //浏览数 + var orderById:Int=0// 资讯排序 + var isAds:Int=0// 是否为广告 1是广告 + init(j:JSON){ + id = j["id"].intValue + image = j["image"].stringValue + title = j["title"].stringValue + url = j["url"].stringValue + content = j["content"].stringValue + forwardingNum = j["forwardingNum"].intValue + talkNum = j["talkNum"].intValue + lookNum = j["lookNum"].intValue + orderById = j["orderById"].intValue + isAds = j["isAds"].intValue + } + +} + +class ADSModel: NSObject { + var id:Int=0// 广告ID , + var location:Int=0// 广告位 , + var describe:String=""// 广告内容 , + var fileSrc:String=""// 广告内容 , + var url:String=""// 广告跳转链接 , + var orderById:Int=0// 广告排序 + init(j:JSON){ + id = j["id"].intValue + location = j["location"].intValue + describe = j["describe"].stringValue + fileSrc = j["fileSrc"].stringValue + url = j["url"].stringValue + orderById = j["orderById"].intValue + } + +} diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/main/JSViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/main/JSViewController.swift index 3c971b9..2c19163 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/main/JSViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/main/JSViewController.swift @@ -76,7 +76,8 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA self.view.insertSubview(loadingView, aboveSubview: progressView) } func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { - Debug.log("方法名:\(message.name),参数:\(message.body)") + + DebugLog( "方法名:\(message.name),参数:\(message.body)") // 调用方法 if message.name == "setMenu" { ary=[] @@ -114,7 +115,7 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA if buttonIndex==i { self.wkWebView.evaluateJavaScript(jsAry[i-1], completionHandler: { (data, error) in if error != nil { - print("错误:\(String(describing: error?.localizedDescription)))") + DebugLog( "错误:\(String(describing: error?.localizedDescription)))") } }) } @@ -125,7 +126,7 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA if object as! WKWebView == self.wkWebView { self.progressView.alpha=1.0 self.progressView.setProgress(Float(wkWebView.estimatedProgress), animated: true) - Debug.log("+++++++++++++++++\(Float(wkWebView.estimatedProgress))") + DebugLog( "+++++++++++++++++\(Float(wkWebView.estimatedProgress))") if wkWebView.estimatedProgress >= 1.0 { UIView.animate(withDuration: 0.3, delay: 0.3, options: UIViewAnimationOptions.curveEaseIn, animations: { self.progressView.alpha=0.0 diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/main/TabBarController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/main/TabBarController.swift index 5f0f7c9..dc98205 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/main/TabBarController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/main/TabBarController.swift @@ -78,14 +78,14 @@ extension TabBarController: URLSessionDelegate { //认证服务器证书 if challenge.protectionSpace.authenticationMethod == (NSURLAuthenticationMethodServerTrust) { - print("服务端证书认证!") + DebugLog("服务器证书认证!") completionHandler(.performDefaultHandling, nil) } //认证客户端证书 else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodClientCertificate { - print("客户端证书认证!") + DebugLog( "客户端证书认证!") //获取客户端证书相关信息 let identityAndTrust:IdentityAndTrust = self.extractIdentity(); @@ -96,10 +96,9 @@ extension TabBarController: URLSessionDelegate { completionHandler(.useCredential, urlCredential); } - - // 其它情况(不接受认证) + // 其它情况(不接受认证) else { - print("其它情况(不接受认证)") + DebugLog( "其他情况,不接受认证") completionHandler(.cancelAuthenticationChallenge, nil); } } diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/CurrentInfoViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/CurrentInfoViewController.swift index 6dd2c21..446ef7f 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/CurrentInfoViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/CurrentInfoViewController.swift @@ -91,7 +91,7 @@ class CurrentInfoViewController: UIViewController,UIImagePickerControllerDelegat } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { picker.dismiss(animated: true, completion: { () -> Void in - Debug.log("\(info)") + DebugLog( "\(info)") let image=info[UIImagePickerControllerEditedImage] as! UIImage let smallimage=scaleImage(image, toSize: CGSize(width: 256, height: 256)) let filePath=imageFilePath(String(format:"%f.jpg",Date().timeIntervalSince1970)) diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/RegisterViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/RegisterViewController.swift index c453c84..240a2e3 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/RegisterViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/RegisterViewController.swift @@ -60,7 +60,6 @@ class RegisterViewController: UITableViewController,UITextFieldDelegate { let userInfo:NSDictionary=noti.userInfo! as NSDictionary let endFrame=(userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue - print(self.rootTableView.frame) let y = navigationBarHeight! + statusBarHeight if endFrame?.origin.y == getScreenHeight() { UIView.animate(withDuration: 0.5) { diff --git a/ParentAssistant/ParentAssistant/Classes/util/LocationManger.swift b/ParentAssistant/ParentAssistant/Classes/util/LocationManger.swift index bdb2fa4..22d4234 100644 --- a/ParentAssistant/ParentAssistant/Classes/util/LocationManger.swift +++ b/ParentAssistant/ParentAssistant/Classes/util/LocationManger.swift @@ -11,8 +11,15 @@ import CoreLocation class LocationManger: NSObject,CLLocationManagerDelegate { + typealias BackCityBlock = (String)->() + static let shared = LocationManger() - required override init() {} + required override init() { + + } + + var block : BackCityBlock? + var locationManger = CLLocationManager() @@ -41,8 +48,13 @@ class LocationManger: NSObject,CLLocationManagerDelegate { if city == nil{ city = placeMark!.administrativeArea } + if localAddress == "未知" { + if let add = city { + self.block!(add) + } + } localAddress = city! - + }else if error == nil && arr == nil{ }else if error == nil{ diff --git a/ParentAssistant/ParentAssistant/Classes/util/Macro.swift b/ParentAssistant/ParentAssistant/Classes/util/Macro.swift index 869154c..6fee927 100644 --- a/ParentAssistant/ParentAssistant/Classes/util/Macro.swift +++ b/ParentAssistant/ParentAssistant/Classes/util/Macro.swift @@ -24,16 +24,31 @@ var localAddress = "未知" //MARK: -------------------------- 接口地址 ---------------------------- + +//var ReleaseHOST:String!="http://campus.myjxt.com"//正式网址 +//var ReleaseHOSTWap:String!="http://parent.myjxt.com" +//var ReleaseHOSTImage:String!="http://manage.myjxt.com" +//var DebugHOST:String!="http://60.190.202.57:1000"//测试网址 +//var DebugHOSTWap:String!="http://60.190.202.57:8101" +//var DebugHOSTImage:String!="http://60.190.202.57:8196" +//var HOST:String! = Debug.isFormal ? ReleaseHOST : DebugHOST +//var HOSTWAP:String! = Debug.isFormal ? ReleaseHOSTWap : DebugHOSTWap +//var HOSTImage:String! = Debug.isFormal ? ReleaseHOSTImage : DebugHOSTImage + let appsecret="sincere:3a530f39f99411b454e667d69693c127" -var ReleaseHOST:String!="http://campus.myjxt.com"//正式网址 -var ReleaseHOSTWap:String!="http://parent.myjxt.com" -var ReleaseHOSTImage:String!="http://manage.myjxt.com" -var DebugHOST:String!="http://60.190.202.57:1000"//测试网址 -var DebugHOSTWap:String!="http://60.190.202.57:8101" -var DebugHOSTImage:String!="http://60.190.202.57:8196" -var HOST:String! = Debug.isFormal ? ReleaseHOST : DebugHOST -var HOSTWAP:String! = Debug.isFormal ? ReleaseHOSTWap : DebugHOSTWap -var HOSTImage:String! = Debug.isFormal ? ReleaseHOSTImage : DebugHOSTImage + +#if DEBUG +//测试网址 +var HOST:String! = "http://60.190.202.57:1000" +var HOSTWAP:String! = "http://60.190.202.57:8101" +var HOSTImage:String! = "http://60.190.202.57:8196" +#else +//正式网址 +var HOST:String! = "http://campus.myjxt.com" +var HOSTWAP:String! = "http://parent.myjxt.com" +var HOSTImage:String! = "http://manage.myjxt.com" +#endif + let URL_UPLOAD_FILE=HOST+"/api/Class/UploadFile" //上传图片 diff --git a/ParentAssistant/ParentAssistant/Classes/util/MessageManager.swift b/ParentAssistant/ParentAssistant/Classes/util/MessageManager.swift index 1e5ee2d..b0ae816 100644 --- a/ParentAssistant/ParentAssistant/Classes/util/MessageManager.swift +++ b/ParentAssistant/ParentAssistant/Classes/util/MessageManager.swift @@ -94,7 +94,8 @@ extension NSManagedObject { //保存 do { try context.save() - print("保存成功!") +// print("保存成功!") + DebugLog( "保存成功!") } catch { fatalError("不能保存:\(error)") } diff --git a/ParentAssistant/ParentAssistant/Classes/util/utils.swift b/ParentAssistant/ParentAssistant/Classes/util/utils.swift index aefeb32..9dfc573 100644 --- a/ParentAssistant/ParentAssistant/Classes/util/utils.swift +++ b/ParentAssistant/ParentAssistant/Classes/util/utils.swift @@ -11,17 +11,21 @@ import QuickLook import Photos //MARK: - 服务器和log打印设置 -class Debug{ - static let enable=false//是否打印log - static let isFormal=false//是否是正式服务器 - class func log(_ msg:String){ - if(!Debug.enable){ - return - } - NSLog(msg) - } +//class Debug{ +// static let enable=false//是否打印log +// static let isFormal=false//是否是正式服务器 +// class func log(_ msg:String){ +// if(!Debug.enable){ +// return +// } +// NSLog(msg) +// } +//} +func DebugLog( _ message:M,file:String = #file,method:String = #function,line: Int = #line){ + #if DEBUG + print("// DEBUG Log = \(method)[\(line)]:\(message)") + #endif } - class Story{ static func getStory(_ name:String)->UIStoryboard?{ return UIStoryboard(name: name, bundle: nil); @@ -488,7 +492,8 @@ func cleanImageCache(){ for item in files{ do { try fm.removeItem(atPath: (imagePath as NSString).appendingPathComponent(item)) - Debug.log("delete***************") + + DebugLog("delete***********") } catch _ { } } diff --git a/ParentAssistant/ParentAssistant/Classes/util/view/SearchBarView.swift b/ParentAssistant/ParentAssistant/Classes/util/view/SearchBarView.swift new file mode 100644 index 0000000..b9ace78 --- /dev/null +++ b/ParentAssistant/ParentAssistant/Classes/util/view/SearchBarView.swift @@ -0,0 +1,63 @@ +// +// SearchBarView.swift +// ParentAssistant +// +// Created by Cao yang on 2018/4/21. +// Copyright © 2018年 HANGZHOUTEAM. All rights reserved. +// + +import UIKit + + + +class SearchBarView: UIView,UISearchBarDelegate { + + enum SearchActionType { + case SearchType + case CancelType + } + + typealias SearchBarBlock = (String,SearchActionType)->() + + lazy var searchBar = {()->UISearchBar in + let search = UISearchBar.init(frame: CGRect.init(x: 0, y: 0, width: self.bounds.size.width, height: 36)) + search.delegate = self + search.center = self.center + search.placeholder = "请输入搜索内容" + search.barStyle = .default + search.barTintColor = navigationColor + + return search + }() + + var block : SearchBarBlock? + + override init(frame: CGRect) { + super.init(frame: frame) + if !frame.isEmpty { + self.addSubview(self.searchBar) + } + } + //MARK: - SearchBarDelegate + func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { + searchBar.showsCancelButton = false + } + func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { + searchBar.showsCancelButton = true + } + func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { + self.block!( "", .CancelType) + searchBar.resignFirstResponder() + } + func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { + + if let str = searchBar.text { + self.block!(str,.SearchType) + } + searchBar.resignFirstResponder() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/ParentAssistant/ParentAssistant/Supporting Files/Base.lproj/Main.storyboard b/ParentAssistant/ParentAssistant/Supporting Files/Base.lproj/Main.storyboard index e300dcd..db8c8ba 100644 --- a/ParentAssistant/ParentAssistant/Supporting Files/Base.lproj/Main.storyboard +++ b/ParentAssistant/ParentAssistant/Supporting Files/Base.lproj/Main.storyboard @@ -502,7 +502,7 @@ - + diff --git a/ParentAssistant/ParentAssistant/ViewController.swift b/ParentAssistant/ParentAssistant/ViewController.swift index 7796f02..04edb34 100644 --- a/ParentAssistant/ParentAssistant/ViewController.swift +++ b/ParentAssistant/ParentAssistant/ViewController.swift @@ -12,7 +12,6 @@ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - print("123456") self.view.makeToast("test") self.view.makeToast("testParentAssistant", duration: 5, position: CSToastPositionCenter) // Do any additional setup after loading the view, typically from a nib. -- libgit2 0.21.0