Commit fafdc5529e57748767a14b5dcd996c378cdbadbb
1 parent
eaf34b66
Exists in
parentassistant
封装searchbar ,优化咨询频道代码,适配UI等
Showing
28 changed files
with
367 additions
and
273 deletions
Show diff stats
ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj
| ... | ... | @@ -81,6 +81,8 @@ |
| 81 | 81 | ADC9AB82207C673300348EF1 /* SceneMiddleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADC9AB81207C673300348EF1 /* SceneMiddleCell.xib */; }; |
| 82 | 82 | ADC9AB84207C673C00348EF1 /* SceneDownCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADC9AB83207C673C00348EF1 /* SceneDownCell.xib */; }; |
| 83 | 83 | ADC9AB88207C940700348EF1 /* ProgramViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADC9AB87207C940700348EF1 /* ProgramViewController.swift */; }; |
| 84 | + ADCDA070208AE317004F1852 /* SearchBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADCDA06F208AE317004F1852 /* SearchBarView.swift */; }; | |
| 85 | + ADCDA072208B2982004F1852 /* InfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADCDA071208B2982004F1852 /* InfoModel.swift */; }; | |
| 84 | 86 | ADE33B312062202300BEA6E6 /* Macro.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADE33B302062202300BEA6E6 /* Macro.swift */; }; |
| 85 | 87 | ADF159612069E00000A9485D /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADF159602069E00000A9485D /* CalendarView.swift */; }; |
| 86 | 88 | ADF15E7620883D1B00381EE1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ADF15E7520883D1B00381EE1 /* Assets.xcassets */; }; |
| ... | ... | @@ -262,6 +264,8 @@ |
| 262 | 264 | ADC9AB81207C673300348EF1 /* SceneMiddleCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SceneMiddleCell.xib; sourceTree = "<group>"; }; |
| 263 | 265 | ADC9AB83207C673C00348EF1 /* SceneDownCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SceneDownCell.xib; sourceTree = "<group>"; }; |
| 264 | 266 | ADC9AB87207C940700348EF1 /* ProgramViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgramViewController.swift; sourceTree = "<group>"; }; |
| 267 | + ADCDA06F208AE317004F1852 /* SearchBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBarView.swift; sourceTree = "<group>"; }; | |
| 268 | + ADCDA071208B2982004F1852 /* InfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoModel.swift; sourceTree = "<group>"; }; | |
| 265 | 269 | ADE33B302062202300BEA6E6 /* Macro.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Macro.swift; sourceTree = "<group>"; }; |
| 266 | 270 | ADF159602069E00000A9485D /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = "<group>"; }; |
| 267 | 271 | ADF15E7520883D1B00381EE1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; |
| ... | ... | @@ -467,6 +471,7 @@ |
| 467 | 471 | 599364E0204E62E700C8B371 /* Information */ = { |
| 468 | 472 | isa = PBXGroup; |
| 469 | 473 | children = ( |
| 474 | + ADCDA073208B298D004F1852 /* Model */, | |
| 470 | 475 | 599364E1204E62E700C8B371 /* InformationViewController.swift */, |
| 471 | 476 | 599364DD204E62E700C8B371 /* ChannelViewController.swift */, |
| 472 | 477 | 599364DE204E62E700C8B371 /* Information.storyboard */, |
| ... | ... | @@ -642,6 +647,14 @@ |
| 642 | 647 | path = Program; |
| 643 | 648 | sourceTree = "<group>"; |
| 644 | 649 | }; |
| 650 | + ADCDA073208B298D004F1852 /* Model */ = { | |
| 651 | + isa = PBXGroup; | |
| 652 | + children = ( | |
| 653 | + ADCDA071208B2982004F1852 /* InfoModel.swift */, | |
| 654 | + ); | |
| 655 | + path = Model; | |
| 656 | + sourceTree = "<group>"; | |
| 657 | + }; | |
| 645 | 658 | B605235D289EDBCA5C5AF2C5 /* Frameworks */ = { |
| 646 | 659 | isa = PBXGroup; |
| 647 | 660 | children = ( |
| ... | ... | @@ -892,6 +905,7 @@ |
| 892 | 905 | BFF9B7F32057A29D00F39B3E /* TableEmptyView.xib */, |
| 893 | 906 | AD639F0420897CBC0028BE73 /* AlertShowView.swift */, |
| 894 | 907 | AD639F082089D8670028BE73 /* PickSelectView.swift */, |
| 908 | + ADCDA06F208AE317004F1852 /* SearchBarView.swift */, | |
| 895 | 909 | ); |
| 896 | 910 | path = view; |
| 897 | 911 | sourceTree = "<group>"; |
| ... | ... | @@ -1162,7 +1176,9 @@ |
| 1162 | 1176 | BFEAAAC4205257460072FAAF /* LXCalendarMonthModel.m in Sources */, |
| 1163 | 1177 | BFA7443A207DB6EE00845D30 /* ActivationSchoolCardViewController.swift in Sources */, |
| 1164 | 1178 | BF38847E205CDE2D00A240EF /* JSViewController.swift in Sources */, |
| 1179 | + ADCDA070208AE317004F1852 /* SearchBarView.swift in Sources */, | |
| 1165 | 1180 | ADE33B312062202300BEA6E6 /* Macro.swift in Sources */, |
| 1181 | + ADCDA072208B2982004F1852 /* InfoModel.swift in Sources */, | |
| 1166 | 1182 | ADF159612069E00000A9485D /* CalendarView.swift in Sources */, |
| 1167 | 1183 | AD122ACA2084498F00C7D0AD /* ProgramVacateAddView.swift in Sources */, |
| 1168 | 1184 | BF406CD82057B529000A6681 /* MessageTableViewCell.swift in Sources */, | ... | ... |
ParentAssistant/ParentAssistant.xcodeproj/xcuserdata/caoyang.xcuserdatad/xcschemes/xcschememanagement.plist
| ... | ... | @@ -10,5 +10,18 @@ |
| 10 | 10 | <integer>11</integer> |
| 11 | 11 | </dict> |
| 12 | 12 | </dict> |
| 13 | + <key>SuppressBuildableAutocreation</key> | |
| 14 | + <dict> | |
| 15 | + <key>BF7A4C2F204CD55300460463</key> | |
| 16 | + <dict> | |
| 17 | + <key>primary</key> | |
| 18 | + <true/> | |
| 19 | + </dict> | |
| 20 | + <key>BF7A4C46204CD55500460463</key> | |
| 21 | + <dict> | |
| 22 | + <key>primary</key> | |
| 23 | + <true/> | |
| 24 | + </dict> | |
| 25 | + </dict> | |
| 13 | 26 | </dict> |
| 14 | 27 | </plist> | ... | ... |
ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
| ... | ... | @@ -20,11 +20,11 @@ |
| 20 | 20 | ignoreCount = "0" |
| 21 | 21 | continueAfterRunningActions = "No" |
| 22 | 22 | filePath = "ParentAssistant/Classes/controllers/Grow/GrowViewController.swift" |
| 23 | - timestampString = "545907653.422401" | |
| 23 | + timestampString = "545996291.249851" | |
| 24 | 24 | startingColumnNumber = "9223372036854775807" |
| 25 | 25 | endingColumnNumber = "9223372036854775807" |
| 26 | - startingLineNumber = "161" | |
| 27 | - endingLineNumber = "161" | |
| 26 | + startingLineNumber = "162" | |
| 27 | + endingLineNumber = "162" | |
| 28 | 28 | landmarkName = "switchChildrenAction()" |
| 29 | 29 | landmarkType = "7"> |
| 30 | 30 | </BreakpointContent> | ... | ... |
ParentAssistant/ParentAssistant/AppDelegate.swift
| ... | ... | @@ -16,6 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { |
| 16 | 16 | var conn:Reachability! |
| 17 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { |
| 18 | 18 | setUpYXIM() |
| 19 | + | |
| 19 | 20 | //1.设置网络状态监听 |
| 20 | 21 | NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.networkStatusChange), name: NSNotification.Name.reachabilityChanged, object: nil) |
| 21 | 22 | // 2、获得网络Reachability对象 |
| ... | ... | @@ -56,13 +57,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate { |
| 56 | 57 | func setUpYXIM(){ |
| 57 | 58 | var appkey = "" |
| 58 | 59 | var cername = "" |
| 59 | - if Debug.isFormal{ | |
| 60 | - appkey = "a1ff0bc08fa0d6f95b480d131e55584b" | |
| 61 | - cername = "hxyproductpush" | |
| 62 | - }else{ | |
| 60 | + #if DEBUG | |
| 63 | 61 | appkey = "330158c080acdf4dc1092d6a74576c2c" |
| 64 | 62 | cername = "parentdevelop" |
| 65 | - } | |
| 63 | + #else | |
| 64 | + appkey = "a1ff0bc08fa0d6f95b480d131e55584b" | |
| 65 | + cername = "hxyproductpush" | |
| 66 | + #endif | |
| 67 | +// if Debug.isFormal{ | |
| 68 | +// appkey = "a1ff0bc08fa0d6f95b480d131e55584b" | |
| 69 | +// cername = "hxyproductpush" | |
| 70 | +// }else{ | |
| 71 | +// appkey = "330158c080acdf4dc1092d6a74576c2c" | |
| 72 | +// cername = "parentdevelop" | |
| 73 | +// } | |
| 66 | 74 | let option = NIMSDKOption(appKey: appkey) |
| 67 | 75 | option.apnsCername = cername |
| 68 | 76 | NIMSDK.shared().register(with: option) |
| ... | ... | @@ -298,6 +306,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate { |
| 298 | 306 | } |
| 299 | 307 | } |
| 300 | 308 | } |
| 301 | - | |
| 302 | 309 | } |
| 303 | 310 | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/GrowViewController.swift
| ... | ... | @@ -65,7 +65,6 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { |
| 65 | 65 | //设置导航栏标题 |
| 66 | 66 | self.navigationItem.titleView = self.titleView |
| 67 | 67 | self.navigationItem.titleView?.center.x = screenWidth/2 |
| 68 | - print(self.navigationItem.titleView!.frame) | |
| 69 | 68 | self.view.addSubview(contentScrollView) |
| 70 | 69 | |
| 71 | 70 | self.title = "成长" |
| ... | ... | @@ -110,16 +109,18 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { |
| 110 | 109 | //MARK: 导航栏视图UI |
| 111 | 110 | func drawHeadView () { |
| 112 | 111 | //左按钮 |
| 113 | - let leftView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 44)) | |
| 114 | - let titleLab = UILabel.init(frame: CGRect.init(x: 0, y: 0, width: 50, height: 44)) | |
| 112 | + let leftView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 70, height: 44)) | |
| 113 | + let titleLab = UILabel.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 44)) | |
| 115 | 114 | |
| 116 | 115 | titleLab.font = UIFont.systemFont(ofSize: 15) |
| 117 | 116 | titleLab.textAlignment = .center |
| 118 | 117 | titleLab.textColor = .white |
| 118 | + titleLab.numberOfLines = 0 | |
| 119 | + titleLab.adjustsFontSizeToFitWidth = true | |
| 119 | 120 | self.titleLeftLab = titleLab |
| 120 | 121 | leftView.addSubview(titleLab) |
| 121 | 122 | |
| 122 | - let imageView = UIImageView.init(frame: CGRect.init(x: 50, y: 11, width: 10, height: 22)) | |
| 123 | + let imageView = UIImageView.init(frame: CGRect.init(x: 60, y: 11, width: 10, height: 22)) | |
| 123 | 124 | imageView.image = UIImage.init(named: "report_white_pull") |
| 124 | 125 | imageView.contentMode = .scaleAspectFit |
| 125 | 126 | leftView.addSubview(imageView) | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCardViewController.swift
| ... | ... | @@ -33,7 +33,7 @@ class ProgramCardViewController: UIViewController,UITextFieldDelegate { |
| 33 | 33 | }() |
| 34 | 34 | |
| 35 | 35 | @objc func applyAction(){ |
| 36 | - print("补卡申请提交") | |
| 36 | + DebugLog( "补卡提交") | |
| 37 | 37 | let params = ["studentid":1,"onecard":"sss"] as [String : Any] |
| 38 | 38 | HTTPServer.shared.postStudentMendCard(parameters: params as [String : AnyObject]) { (backData, error) in |
| 39 | 39 | print(backData!) |
| ... | ... | @@ -66,7 +66,6 @@ class ProgramCardViewController: UIViewController,UITextFieldDelegate { |
| 66 | 66 | |
| 67 | 67 | @objc func handleTap(sender:UITapGestureRecognizer){ |
| 68 | 68 | if sender.state == .ended { |
| 69 | - print("收起键盘") | |
| 70 | 69 | self.cardInputTextField.resignFirstResponder() |
| 71 | 70 | } |
| 72 | 71 | sender.cancelsTouchesInView = false | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramCheckViewController.swift
| ... | ... | @@ -56,7 +56,7 @@ class ProgramCheckViewController: UIViewController,UITableViewDelegate,UITableVi |
| 56 | 56 | SVProgressHUD.dismiss() |
| 57 | 57 | if error == nil && JSON.fromString(backData)!["status"].intValue == 1 { |
| 58 | 58 | let data = JSON.fromString(backData)!["data"].arrayValue |
| 59 | - print(backData!) | |
| 59 | + DebugLog(backData!) | |
| 60 | 60 | for i in 0..<data.count { |
| 61 | 61 | let dic = data[i].dictionary |
| 62 | 62 | if let model = StudentCardModel.deserialize(from: dic){ |
| ... | ... | @@ -91,7 +91,6 @@ class ProgramCheckViewController: UIViewController,UITableViewDelegate,UITableVi |
| 91 | 91 | cell.timeSelectBtn.setTitle(timeSelectString, for: UIControlState.normal) |
| 92 | 92 | cell.checkName.text = studentModel.studentName |
| 93 | 93 | cell.backBlock = { |
| 94 | - print("选择日期") | |
| 95 | 94 | self.selectTimeAction() |
| 96 | 95 | } |
| 97 | 96 | return cell |
| ... | ... | @@ -109,7 +108,6 @@ class ProgramCheckViewController: UIViewController,UITableViewDelegate,UITableVi |
| 109 | 108 | self.addAlertView.setRowAndTitle(title: [], type: PickSelectView.AlertType.TimeDateType) |
| 110 | 109 | self.addAlertView.showView() |
| 111 | 110 | self.addAlertView.alertTimeBlock = {str in |
| 112 | - print("backdata= \(str)") | |
| 113 | 111 | self.timeSelectString = str |
| 114 | 112 | self.downLoadDataFromNet(time: str) |
| 115 | 113 | } | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramVacateViewController.swift
| ... | ... | @@ -23,9 +23,9 @@ class ProgramVacateViewController: UIViewController,UITableViewDelegate,UITableV |
| 23 | 23 | }() |
| 24 | 24 | |
| 25 | 25 | lazy var bottomBtn = {()-> UIButton in |
| 26 | - let btn = UIButton.init(frame: CGRect.init(x: screenWidth/2-100, y: screenHeight-66-50, width: 200, height: 40)) | |
| 26 | + let btn = UIButton.init(frame: CGRect.init(x: 50, y: screenHeight-66-50, width: screenWidth-100, height: 40)) | |
| 27 | 27 | btn.setTitle("请假", for: UIControlState.normal) |
| 28 | - btn.setTitleColor(UIColor.black, for: UIControlState.normal) | |
| 28 | + btn.setTitleColor(UIColor.white, for: UIControlState.normal) | |
| 29 | 29 | btn.backgroundColor = Theme.topBarColor() |
| 30 | 30 | btn.layer.cornerRadius = 5 |
| 31 | 31 | btn.clipsToBounds = true |
| ... | ... | @@ -42,7 +42,7 @@ class ProgramVacateViewController: UIViewController,UITableViewDelegate,UITableV |
| 42 | 42 | |
| 43 | 43 | /// 请假页面 |
| 44 | 44 | @objc func addVacateAction(){ |
| 45 | - print("申请请假!") | |
| 45 | + | |
| 46 | 46 | let vc = ProgramVacateAddViewController() |
| 47 | 47 | vc.title = "申请请假" |
| 48 | 48 | vc.view.backgroundColor = backGroundColor |
| ... | ... | @@ -140,8 +140,6 @@ class ProgramVacateViewController: UIViewController,UITableViewDelegate,UITableV |
| 140 | 140 | |
| 141 | 141 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 142 | 142 | if indexPath.section == 1 && indexPath.row != 0 && vacateRecodeArray.count>0 { |
| 143 | - | |
| 144 | - print(indexPath.row) | |
| 145 | 143 | let vc = ProgramVacateDetailViewController() |
| 146 | 144 | vc.view.backgroundColor = UIColor.white |
| 147 | 145 | vc.title = "请假详情" | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramViewController.swift
| ... | ... | @@ -79,7 +79,6 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | @objc func gotoChildView () { |
| 82 | - print("去个人中心页面-我的孩子!") | |
| 83 | 82 | let vc = Story.instantiateViewControllerWithIdentifier("MyChildrenViewController", storyName: "My") as! MyChildrenViewController |
| 84 | 83 | self.navigationController?.pushViewController(vc, animated: true) |
| 85 | 84 | } | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Report/MoralViewController.swift
ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/CalendarView.swift
| ... | ... | @@ -81,7 +81,8 @@ class CalendarView: UIView,UICollectionViewDelegate,UICollectionViewDataSource { |
| 81 | 81 | } |
| 82 | 82 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| 83 | 83 | if indexPath.row >= firstDay-1+7 && indexPath.row < todayDay+7+firstDay-1 { |
| 84 | - print("点击了 ...\(indexPath.row+1-7-firstDay+1)号") | |
| 84 | + | |
| 85 | + DebugLog( "点击了 ...\(indexPath.row+1-7-firstDay+1)号") | |
| 85 | 86 | } |
| 86 | 87 | } |
| 87 | 88 | required init?(coder aDecoder: NSCoder) { | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/EducationDetailCell.swift
| ... | ... | @@ -18,7 +18,6 @@ class EducationDetailCell: UITableViewCell { |
| 18 | 18 | |
| 19 | 19 | let rect = CGRect.init(x: 10, y: 60, width: screenWidth-20, height: screenWidth*0.62-60) |
| 20 | 20 | customLineChart = LineChartView.init(frame: rect) |
| 21 | - print("linechart frame = \(customLineChart.frame)") | |
| 22 | 21 | customLineChart.drawUI(xLableArr: nil) |
| 23 | 22 | let arr1 = [4,4,2,1,3] |
| 24 | 23 | let arr2 = [2,1,4,4,5] | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/LineChartView.swift
ParentAssistant/ParentAssistant/Classes/controllers/Grow/View/ReportView/ReportHeaderView.swift
| ... | ... | @@ -85,7 +85,8 @@ class ReportHeaderView: UIView,UICollectionViewDelegate,UICollectionViewDataSour |
| 85 | 85 | } |
| 86 | 86 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| 87 | 87 | if indexPath.row >= firstDay-1 && indexPath.row < todayDate+firstDay-1 { |
| 88 | - print("点击了 ...\(indexPath.row+1-firstDay+1)号") | |
| 88 | + | |
| 89 | + DebugLog( "点击了 ...\(indexPath.row+1-firstDay+1)号") | |
| 89 | 90 | } |
| 90 | 91 | } |
| 91 | 92 | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift
| ... | ... | @@ -14,32 +14,81 @@ class InformationViewController: UIViewController,UISearchBarDelegate { |
| 14 | 14 | var topADs:[ADSModel]=[] |
| 15 | 15 | var isFirstviewController:Bool=true |
| 16 | 16 | var channel:Int=0 |
| 17 | + | |
| 18 | + //导航栏左侧按钮 | |
| 19 | + lazy var leftCityView = {()-> UIView in | |
| 20 | + //左按钮 | |
| 21 | + let leftView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 70, height: 44)) | |
| 22 | + let titleLab = UILabel.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 44)) | |
| 23 | + | |
| 24 | + titleLab.font = UIFont.systemFont(ofSize: 15) | |
| 25 | + titleLab.numberOfLines = 0 | |
| 26 | + titleLab.adjustsFontSizeToFitWidth = true | |
| 27 | + titleLab.textAlignment = .center | |
| 28 | + titleLab.textColor = .white | |
| 29 | + titleLab.text = localAddress | |
| 30 | + self.leftLabel = titleLab | |
| 31 | + leftView.addSubview(titleLab) | |
| 32 | + | |
| 33 | + let imageView = UIImageView.init(frame: CGRect.init(x: 60, y: 11, width: 10, height: 22)) | |
| 34 | + imageView.image = UIImage.init(named: "report_white_pull") | |
| 35 | + imageView.contentMode = .scaleAspectFit | |
| 36 | + leftView.addSubview(imageView) | |
| 37 | + | |
| 38 | + leftView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(EvaluationViewController.getAddreess(tap:)))) | |
| 39 | + return leftView | |
| 40 | + }() | |
| 41 | + | |
| 17 | 42 | override func viewDidLoad() { |
| 18 | 43 | super.viewDidLoad() |
| 19 | - | |
| 20 | - self.configTheme() | |
| 21 | - | |
| 22 | - // Do any additional setup after loading the view. | |
| 23 | - var searchViewFrame = CGRect(x: 0, y: 0, width: getScreenWidth()-100, height: 30) | |
| 24 | - | |
| 44 | + | |
| 45 | + let item = UIBarButtonItem.init(title: "返回", style: .plain, target: self, action: nil) | |
| 46 | + self.navigationItem.backBarButtonItem = item | |
| 47 | + | |
| 48 | + drawTopUI() | |
| 49 | + | |
| 50 | + } | |
| 51 | + override func viewWillAppear(_ animated: Bool) { | |
| 52 | + super.viewWillAppear(animated) | |
| 53 | + | |
| 25 | 54 | if isFirstviewController{ |
| 26 | - self.navigationItem.title = "" | |
| 27 | - addLeftBarBtn() | |
| 28 | - }else{ | |
| 29 | - searchViewFrame.size.width = getScreenWidth()-60 | |
| 55 | + let leftBtn = UIBarButtonItem.init(customView: self.leftCityView) | |
| 56 | + self.navigationItem.leftBarButtonItem = leftBtn | |
| 57 | + if localAddress == "未知" { | |
| 58 | + LocationManger.shared.block = { str in | |
| 59 | + localAddress = str | |
| 60 | + self.leftLabel.text = localAddress | |
| 61 | + self.getDataFromNet() | |
| 62 | + } | |
| 63 | + } | |
| 30 | 64 | } |
| 31 | - let searchView = UISearchBar(frame: searchViewFrame) | |
| 32 | - let view = UIView(frame: CGRect(x: 0, y: 7, width: searchViewFrame.size.width, height: 30)) | |
| 33 | - searchView.delegate = self | |
| 34 | - searchView.placeholder = "请输入搜索内容" | |
| 35 | - searchView.showsCancelButton = false | |
| 36 | - view.addSubview(searchView) | |
| 37 | - self.navigationItem.titleView = view | |
| 38 | - self.navigationController?.navigationBar.tintColor=UIColor.white | |
| 65 | + self.getDataFromNet() | |
| 39 | 66 | } |
| 40 | - | |
| 41 | - private func getDataFromNet(){ | |
| 67 | + func drawTopUI(){ | |
| 42 | 68 | |
| 69 | + self.configTheme() | |
| 70 | + //搜索框 | |
| 71 | + let searchView = SearchBarView.init(frame: CGRect.init(x: 0, y: 0, width: screenWidth-100, height: navigationBarHeight!)) | |
| 72 | + //MARK:搜索框搜索回调 | |
| 73 | + searchView.block = { str,type in | |
| 74 | + DebugLog(str) | |
| 75 | + switch type { | |
| 76 | + case .SearchType: | |
| 77 | + self.getList(key: str) | |
| 78 | + case .CancelType: | |
| 79 | + self.getDataFromNet() | |
| 80 | + } | |
| 81 | + } | |
| 82 | + self.navigationItem.titleView = searchView | |
| 83 | + } | |
| 84 | + override func viewWillDisappear(_ animated: Bool) { | |
| 85 | + super.viewWillDisappear(animated) | |
| 86 | + SVProgressHUD.dismiss() | |
| 87 | + } | |
| 88 | + //MARK: - 获取该城市下的数据 | |
| 89 | + private func getDataFromNet(){ | |
| 90 | + //position 广告位置0-首次广告位1-开屏广告位2-资讯首页3-频道首页4-频道内容5-文章内容页 | |
| 91 | + SVProgressHUD.show() | |
| 43 | 92 | let group = DispatchGroup() |
| 44 | 93 | var position:Int = 2 |
| 45 | 94 | if !self.isFirstviewController { |
| ... | ... | @@ -72,48 +121,27 @@ class InformationViewController: UIViewController,UISearchBarDelegate { |
| 72 | 121 | group.leave() |
| 73 | 122 | }) |
| 74 | 123 | group.notify(queue: DispatchQueue.main) { |
| 124 | + SVProgressHUD.dismiss() | |
| 75 | 125 | self.collectView.reloadData() |
| 76 | 126 | } |
| 77 | 127 | } |
| 78 | - | |
| 79 | - | |
| 80 | - func getData(){ | |
| 81 | - let topADsQueue = DispatchQueue(label: "topADs") | |
| 82 | - topADsQueue.async { | |
| 83 | - //position 广告位置0-首次广告位1-开屏广告位2-资讯首页3-频道首页4-频道内容5-文章内容页 | |
| 84 | - var position:Int = 2 | |
| 85 | - if !self.isFirstviewController { | |
| 86 | - position = 3 | |
| 87 | - } | |
| 88 | - HTTPServer.shared.getAds(["position":position as AnyObject,"areaName":localAddress as AnyObject], completionHandler: { (str, error) in//getPercentEncodingString(str: localAddress) | |
| 89 | - httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | |
| 90 | - if json["status"] == 1 && error == nil{ | |
| 91 | - self.topADs.removeAll() | |
| 92 | - for item in json.contentData().arrayValue{ | |
| 93 | - self.topADs.append(ADSModel(j: item)) | |
| 94 | - } | |
| 95 | - self.collectView.reloadData() | |
| 96 | - } | |
| 97 | - }, failHandler: { (error) in | |
| 98 | - | |
| 99 | - }) | |
| 100 | - }) | |
| 101 | - } | |
| 102 | - topADsQueue.async { | |
| 103 | - let dic = self.getListDic() | |
| 104 | - HTTPServer.shared.getChannelInfo(dic, completionHandler: { (str, error) in | |
| 105 | - httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | |
| 106 | - if json["status"] == 1 && error == nil{ | |
| 107 | - self.data = ChannelDemol(j: json.contentData()) | |
| 108 | - self.collectView.reloadData() | |
| 109 | - } | |
| 110 | - }, failHandler: { (error) in | |
| 111 | - | |
| 112 | - }) | |
| 113 | - }) | |
| 128 | + //MARK: - 地址选择回调 | |
| 129 | + @objc func getAddreess(tap:UITapGestureRecognizer){ | |
| 130 | + tap.view?.isUserInteractionEnabled = false | |
| 131 | + LZCityPickerController.showPicker(in: self | |
| 132 | + , select: { (address, province, city, area, isSelect) in | |
| 133 | + if isSelect{ | |
| 134 | + tap.view?.isUserInteractionEnabled = true | |
| 135 | + self.leftLabel.text = area! | |
| 136 | + localAddress = area! | |
| 137 | + self.getDataFromNet() | |
| 138 | + } | |
| 139 | + }) { | |
| 140 | + tap.view?.isUserInteractionEnabled = true | |
| 114 | 141 | } |
| 115 | 142 | } |
| 116 | 143 | |
| 144 | + //MARK: - 搜索框搜索咨询 | |
| 117 | 145 | func getList(key:String?) { |
| 118 | 146 | if key == nil{ |
| 119 | 147 | return |
| ... | ... | @@ -149,81 +177,8 @@ class InformationViewController: UIViewController,UISearchBarDelegate { |
| 149 | 177 | dic.updateValue(toFirstPage as AnyObject, forKey: "toFirstPage") |
| 150 | 178 | return dic |
| 151 | 179 | } |
| 152 | - | |
| 153 | - //左上交城市选择按钮添加 | |
| 154 | - func addLeftBarBtn(){ | |
| 155 | - let leftbtn = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40)) | |
| 156 | - leftLabel = UILabel(frame: CGRect(x: 0, y: 10, width: 60, height: 20)) | |
| 157 | - leftLabel.text = localAddress | |
| 158 | - leftLabel.textColor = UIColor.white | |
| 159 | - leftLabel.sizeToFit() | |
| 160 | - let image = UIImageView(frame: CGRect(x: leftLabel.frame.maxX+4, y: 15, width: 16, height: 9)) | |
| 161 | - image.image = #imageLiteral(resourceName: "evaluation_icon_pushDown") | |
| 162 | - leftbtn.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(EvaluationViewController.getAddreess(tap:)))) | |
| 163 | - leftbtn.addSubview(leftLabel) | |
| 164 | - leftbtn.addSubview(image) | |
| 165 | - leftbtn.frame.size = CGSize(width: image.frame.maxX+4, height: 40) | |
| 166 | - self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: leftbtn) | |
| 167 | - } | |
| 168 | - | |
| 169 | - //地址选择 | |
| 170 | - @objc func getAddreess(tap:UITapGestureRecognizer){ | |
| 171 | - tap.view?.isUserInteractionEnabled = false | |
| 172 | - LZCityPickerController.showPicker(in: self | |
| 173 | - , select: { (address, province, city, area, isSelect) in | |
| 174 | - if isSelect{ | |
| 175 | - tap.view?.isUserInteractionEnabled = true | |
| 176 | - self.selectCity(city: area!) | |
| 177 | - } | |
| 178 | - }) { | |
| 179 | - tap.view?.isUserInteractionEnabled = true | |
| 180 | - } | |
| 181 | - } | |
| 182 | 180 | |
| 183 | - //完成选择城市 | |
| 184 | - func selectCity(city: String) { | |
| 185 | - localAddress = city | |
| 186 | - addLeftBarBtn() | |
| 187 | -// getData() | |
| 188 | - getDataFromNet() | |
| 189 | - | |
| 190 | - } | |
| 191 | - | |
| 192 | - func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { | |
| 193 | - searchBar.showsCancelButton = true | |
| 194 | - } | |
| 195 | - | |
| 196 | - func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { | |
| 197 | - searchData(searchBar) | |
| 198 | - } | |
| 199 | - | |
| 200 | - func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { | |
| 201 | - searchData(searchBar) | |
| 202 | - } | |
| 203 | - | |
| 204 | - //搜索资讯 | |
| 205 | - func searchData(_ searchBar: UISearchBar){ | |
| 206 | - getList(key: searchBar.text) | |
| 207 | - searchBar.resignFirstResponder() | |
| 208 | - searchBar.showsCancelButton = false | |
| 209 | - | |
| 210 | - } | |
| 211 | - | |
| 212 | - override func viewWillDisappear(_ animated: Bool) { | |
| 213 | - super.viewWillDisappear(animated) | |
| 214 | - } | |
| 215 | - | |
| 216 | - override func viewWillAppear(_ animated: Bool) { | |
| 217 | - super.viewWillAppear(animated) | |
| 218 | -// getData() | |
| 219 | - getDataFromNet() | |
| 220 | - if isFirstviewController{ | |
| 221 | - addLeftBarBtn() | |
| 222 | - }else{ | |
| 223 | - | |
| 224 | - } | |
| 225 | 181 | |
| 226 | - } | |
| 227 | 182 | override func didReceiveMemoryWarning() { |
| 228 | 183 | super.didReceiveMemoryWarning() |
| 229 | 184 | // Dispose of any resources that can be recreated. |
| ... | ... | @@ -419,83 +374,4 @@ extension ChannelSelectView:UICollectionViewDataSource,UICollectionViewDelegateF |
| 419 | 374 | } |
| 420 | 375 | } |
| 421 | 376 | |
| 422 | -class ChannelDemol:NSObject{ | |
| 423 | - var id:Int=0 // 频道ID , | |
| 424 | - var channelName:String=""// 频道名称 , | |
| 425 | - var channelImage:String=""// 频道图片 , | |
| 426 | - var orderById:Int=0 // 频道排序 , | |
| 427 | - var subchannel:[SubchannelDemol] = []// 二级频道 , | |
| 428 | - var channelContent:[ChannelContentDemol] = []// 频道信息 | |
| 429 | - init(j:JSON){ | |
| 430 | - id = j["id"].intValue | |
| 431 | - channelName = j["channelName"].stringValue | |
| 432 | - channelName = j["channelName"].stringValue | |
| 433 | - orderById = j["orderById"].intValue | |
| 434 | - for item in j["subchannel"].arrayValue { | |
| 435 | - subchannel.append(SubchannelDemol(j: item)) | |
| 436 | - } | |
| 437 | - for item in j["channelContent"].arrayValue { | |
| 438 | - channelContent.append(ChannelContentDemol(j: item)) | |
| 439 | - } | |
| 440 | - } | |
| 441 | -} | |
| 442 | - | |
| 443 | -class SubchannelDemol: NSObject { | |
| 444 | - var id:Int=0 // 二级频道ID , | |
| 445 | - var channelName:String=""// 二级频道名称 , | |
| 446 | - var channelImage:String=""// 二级频道图片 , | |
| 447 | - var orderById:Int=0// 二级工具排序, | |
| 448 | - var url:String=""// 二级工具链接 | |
| 449 | - init(j:JSON){ | |
| 450 | - id = j["id"].intValue | |
| 451 | - channelName = j["channelName"].stringValue | |
| 452 | - channelImage = j["channelImage"].stringValue | |
| 453 | - orderById = j["orderById"].intValue | |
| 454 | - url = j["url"].stringValue | |
| 455 | - } | |
| 456 | - | |
| 457 | -} | |
| 458 | - | |
| 459 | -class ChannelContentDemol: NSObject { | |
| 460 | - var id:Int=0// 资讯ID , | |
| 461 | - var image:String=""// 资讯标题图片 , | |
| 462 | - var title:String=""// 资讯标题 , | |
| 463 | - var url:String=""// 资讯链接 , | |
| 464 | - var content:String=""// 资讯内容 , | |
| 465 | - var forwardingNum:Int=0// 资讯转发数 , | |
| 466 | - var talkNum:Int=0 // 评论数 , | |
| 467 | - var lookNum:Int = 0 //浏览数 | |
| 468 | - var orderById:Int=0// 资讯排序 | |
| 469 | - var isAds:Int=0// 是否为广告 1是广告 | |
| 470 | - init(j:JSON){ | |
| 471 | - id = j["id"].intValue | |
| 472 | - image = j["image"].stringValue | |
| 473 | - title = j["title"].stringValue | |
| 474 | - url = j["url"].stringValue | |
| 475 | - content = j["content"].stringValue | |
| 476 | - forwardingNum = j["forwardingNum"].intValue | |
| 477 | - talkNum = j["talkNum"].intValue | |
| 478 | - lookNum = j["lookNum"].intValue | |
| 479 | - orderById = j["orderById"].intValue | |
| 480 | - isAds = j["isAds"].intValue | |
| 481 | - } | |
| 482 | - | |
| 483 | -} | |
| 484 | - | |
| 485 | -class ADSModel: NSObject { | |
| 486 | - var id:Int=0// 广告ID , | |
| 487 | - var location:Int=0// 广告位 , | |
| 488 | - var describe:String=""// 广告内容 , | |
| 489 | - var fileSrc:String=""// 广告内容 , | |
| 490 | - var url:String=""// 广告跳转链接 , | |
| 491 | - var orderById:Int=0// 广告排序 | |
| 492 | - init(j:JSON){ | |
| 493 | - id = j["id"].intValue | |
| 494 | - location = j["location"].intValue | |
| 495 | - describe = j["describe"].stringValue | |
| 496 | - fileSrc = j["fileSrc"].stringValue | |
| 497 | - url = j["url"].stringValue | |
| 498 | - orderById = j["orderById"].intValue | |
| 499 | - } | |
| 500 | 377 | |
| 501 | -} | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Information/Model/InfoModel.swift
0 → 100644
| ... | ... | @@ -0,0 +1,93 @@ |
| 1 | +// | |
| 2 | +// InfoModel.swift | |
| 3 | +// ParentAssistant | |
| 4 | +// | |
| 5 | +// Created by Cao yang on 2018/4/21. | |
| 6 | +// Copyright © 2018年 HANGZHOUTEAM. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +import UIKit | |
| 10 | + | |
| 11 | +class InfoModel: NSObject { | |
| 12 | + | |
| 13 | +} | |
| 14 | +class ChannelDemol:NSObject{ | |
| 15 | + var id:Int=0 // 频道ID , | |
| 16 | + var channelName:String=""// 频道名称 , | |
| 17 | + var channelImage:String=""// 频道图片 , | |
| 18 | + var orderById:Int=0 // 频道排序 , | |
| 19 | + var subchannel:[SubchannelDemol] = []// 二级频道 , | |
| 20 | + var channelContent:[ChannelContentDemol] = []// 频道信息 | |
| 21 | + init(j:JSON){ | |
| 22 | + id = j["id"].intValue | |
| 23 | + channelName = j["channelName"].stringValue | |
| 24 | + channelName = j["channelName"].stringValue | |
| 25 | + orderById = j["orderById"].intValue | |
| 26 | + for item in j["subchannel"].arrayValue { | |
| 27 | + subchannel.append(SubchannelDemol(j: item)) | |
| 28 | + } | |
| 29 | + for item in j["channelContent"].arrayValue { | |
| 30 | + channelContent.append(ChannelContentDemol(j: item)) | |
| 31 | + } | |
| 32 | + } | |
| 33 | +} | |
| 34 | + | |
| 35 | +class SubchannelDemol: NSObject { | |
| 36 | + var id:Int=0 // 二级频道ID , | |
| 37 | + var channelName:String=""// 二级频道名称 , | |
| 38 | + var channelImage:String=""// 二级频道图片 , | |
| 39 | + var orderById:Int=0// 二级工具排序, | |
| 40 | + var url:String=""// 二级工具链接 | |
| 41 | + init(j:JSON){ | |
| 42 | + id = j["id"].intValue | |
| 43 | + channelName = j["channelName"].stringValue | |
| 44 | + channelImage = j["channelImage"].stringValue | |
| 45 | + orderById = j["orderById"].intValue | |
| 46 | + url = j["url"].stringValue | |
| 47 | + } | |
| 48 | + | |
| 49 | +} | |
| 50 | + | |
| 51 | +class ChannelContentDemol: NSObject { | |
| 52 | + var id:Int=0// 资讯ID , | |
| 53 | + var image:String=""// 资讯标题图片 , | |
| 54 | + var title:String=""// 资讯标题 , | |
| 55 | + var url:String=""// 资讯链接 , | |
| 56 | + var content:String=""// 资讯内容 , | |
| 57 | + var forwardingNum:Int=0// 资讯转发数 , | |
| 58 | + var talkNum:Int=0 // 评论数 , | |
| 59 | + var lookNum:Int = 0 //浏览数 | |
| 60 | + var orderById:Int=0// 资讯排序 | |
| 61 | + var isAds:Int=0// 是否为广告 1是广告 | |
| 62 | + init(j:JSON){ | |
| 63 | + id = j["id"].intValue | |
| 64 | + image = j["image"].stringValue | |
| 65 | + title = j["title"].stringValue | |
| 66 | + url = j["url"].stringValue | |
| 67 | + content = j["content"].stringValue | |
| 68 | + forwardingNum = j["forwardingNum"].intValue | |
| 69 | + talkNum = j["talkNum"].intValue | |
| 70 | + lookNum = j["lookNum"].intValue | |
| 71 | + orderById = j["orderById"].intValue | |
| 72 | + isAds = j["isAds"].intValue | |
| 73 | + } | |
| 74 | + | |
| 75 | +} | |
| 76 | + | |
| 77 | +class ADSModel: NSObject { | |
| 78 | + var id:Int=0// 广告ID , | |
| 79 | + var location:Int=0// 广告位 , | |
| 80 | + var describe:String=""// 广告内容 , | |
| 81 | + var fileSrc:String=""// 广告内容 , | |
| 82 | + var url:String=""// 广告跳转链接 , | |
| 83 | + var orderById:Int=0// 广告排序 | |
| 84 | + init(j:JSON){ | |
| 85 | + id = j["id"].intValue | |
| 86 | + location = j["location"].intValue | |
| 87 | + describe = j["describe"].stringValue | |
| 88 | + fileSrc = j["fileSrc"].stringValue | |
| 89 | + url = j["url"].stringValue | |
| 90 | + orderById = j["orderById"].intValue | |
| 91 | + } | |
| 92 | + | |
| 93 | +} | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/main/JSViewController.swift
| ... | ... | @@ -76,7 +76,8 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA |
| 76 | 76 | self.view.insertSubview(loadingView, aboveSubview: progressView) |
| 77 | 77 | } |
| 78 | 78 | func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { |
| 79 | - Debug.log("方法名:\(message.name),参数:\(message.body)") | |
| 79 | + | |
| 80 | + DebugLog( "方法名:\(message.name),参数:\(message.body)") | |
| 80 | 81 | // 调用方法 |
| 81 | 82 | if message.name == "setMenu" { |
| 82 | 83 | ary=[] |
| ... | ... | @@ -114,7 +115,7 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA |
| 114 | 115 | if buttonIndex==i { |
| 115 | 116 | self.wkWebView.evaluateJavaScript(jsAry[i-1], completionHandler: { (data, error) in |
| 116 | 117 | if error != nil { |
| 117 | - print("错误:\(String(describing: error?.localizedDescription)))") | |
| 118 | + DebugLog( "错误:\(String(describing: error?.localizedDescription)))") | |
| 118 | 119 | } |
| 119 | 120 | }) |
| 120 | 121 | } |
| ... | ... | @@ -125,7 +126,7 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA |
| 125 | 126 | if object as! WKWebView == self.wkWebView { |
| 126 | 127 | self.progressView.alpha=1.0 |
| 127 | 128 | self.progressView.setProgress(Float(wkWebView.estimatedProgress), animated: true) |
| 128 | - Debug.log("+++++++++++++++++\(Float(wkWebView.estimatedProgress))") | |
| 129 | + DebugLog( "+++++++++++++++++\(Float(wkWebView.estimatedProgress))") | |
| 129 | 130 | if wkWebView.estimatedProgress >= 1.0 { |
| 130 | 131 | UIView.animate(withDuration: 0.3, delay: 0.3, options: UIViewAnimationOptions.curveEaseIn, animations: { |
| 131 | 132 | self.progressView.alpha=0.0 | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/main/TabBarController.swift
| ... | ... | @@ -78,14 +78,14 @@ extension TabBarController: URLSessionDelegate { |
| 78 | 78 | //认证服务器证书 |
| 79 | 79 | if challenge.protectionSpace.authenticationMethod |
| 80 | 80 | == (NSURLAuthenticationMethodServerTrust) { |
| 81 | - print("服务端证书认证!") | |
| 81 | + DebugLog("服务器证书认证!") | |
| 82 | 82 | completionHandler(.performDefaultHandling, nil) |
| 83 | 83 | } |
| 84 | 84 | //认证客户端证书 |
| 85 | 85 | else if challenge.protectionSpace.authenticationMethod |
| 86 | 86 | == NSURLAuthenticationMethodClientCertificate |
| 87 | 87 | { |
| 88 | - print("客户端证书认证!") | |
| 88 | + DebugLog( "客户端证书认证!") | |
| 89 | 89 | //获取客户端证书相关信息 |
| 90 | 90 | let identityAndTrust:IdentityAndTrust = self.extractIdentity(); |
| 91 | 91 | |
| ... | ... | @@ -96,10 +96,9 @@ extension TabBarController: URLSessionDelegate { |
| 96 | 96 | |
| 97 | 97 | completionHandler(.useCredential, urlCredential); |
| 98 | 98 | } |
| 99 | - | |
| 100 | - // 其它情况(不接受认证) | |
| 99 | + // 其它情况(不接受认证) | |
| 101 | 100 | else { |
| 102 | - print("其它情况(不接受认证)") | |
| 101 | + DebugLog( "其他情况,不接受认证") | |
| 103 | 102 | completionHandler(.cancelAuthenticationChallenge, nil); |
| 104 | 103 | } |
| 105 | 104 | } | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/CurrentInfoViewController.swift
| ... | ... | @@ -91,7 +91,7 @@ class CurrentInfoViewController: UIViewController,UIImagePickerControllerDelegat |
| 91 | 91 | } |
| 92 | 92 | func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { |
| 93 | 93 | picker.dismiss(animated: true, completion: { () -> Void in |
| 94 | - Debug.log("\(info)") | |
| 94 | + DebugLog( "\(info)") | |
| 95 | 95 | let image=info[UIImagePickerControllerEditedImage] as! UIImage |
| 96 | 96 | let smallimage=scaleImage(image, toSize: CGSize(width: 256, height: 256)) |
| 97 | 97 | let filePath=imageFilePath(String(format:"%f.jpg",Date().timeIntervalSince1970)) | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/RegisterViewController.swift
| ... | ... | @@ -60,7 +60,6 @@ class RegisterViewController: UITableViewController,UITextFieldDelegate { |
| 60 | 60 | let userInfo:NSDictionary=noti.userInfo! as NSDictionary |
| 61 | 61 | let endFrame=(userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue |
| 62 | 62 | |
| 63 | - print(self.rootTableView.frame) | |
| 64 | 63 | let y = navigationBarHeight! + statusBarHeight |
| 65 | 64 | if endFrame?.origin.y == getScreenHeight() { |
| 66 | 65 | UIView.animate(withDuration: 0.5) { | ... | ... |
ParentAssistant/ParentAssistant/Classes/util/LocationManger.swift
| ... | ... | @@ -11,8 +11,15 @@ import CoreLocation |
| 11 | 11 | |
| 12 | 12 | class LocationManger: NSObject,CLLocationManagerDelegate { |
| 13 | 13 | |
| 14 | + typealias BackCityBlock = (String)->() | |
| 15 | + | |
| 14 | 16 | static let shared = LocationManger() |
| 15 | - required override init() {} | |
| 17 | + required override init() { | |
| 18 | + | |
| 19 | + } | |
| 20 | + | |
| 21 | + var block : BackCityBlock? | |
| 22 | + | |
| 16 | 23 | |
| 17 | 24 | var locationManger = CLLocationManager() |
| 18 | 25 | |
| ... | ... | @@ -41,8 +48,13 @@ class LocationManger: NSObject,CLLocationManagerDelegate { |
| 41 | 48 | if city == nil{ |
| 42 | 49 | city = placeMark!.administrativeArea |
| 43 | 50 | } |
| 51 | + if localAddress == "未知" { | |
| 52 | + if let add = city { | |
| 53 | + self.block!(add) | |
| 54 | + } | |
| 55 | + } | |
| 44 | 56 | localAddress = city! |
| 45 | - | |
| 57 | + | |
| 46 | 58 | }else if error == nil && arr == nil{ |
| 47 | 59 | |
| 48 | 60 | }else if error == nil{ | ... | ... |
ParentAssistant/ParentAssistant/Classes/util/Macro.swift
| ... | ... | @@ -24,16 +24,31 @@ var localAddress = "未知" |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | //MARK: -------------------------- 接口地址 ---------------------------- |
| 27 | + | |
| 28 | +//var ReleaseHOST:String!="http://campus.myjxt.com"//正式网址 | |
| 29 | +//var ReleaseHOSTWap:String!="http://parent.myjxt.com" | |
| 30 | +//var ReleaseHOSTImage:String!="http://manage.myjxt.com" | |
| 31 | +//var DebugHOST:String!="http://60.190.202.57:1000"//测试网址 | |
| 32 | +//var DebugHOSTWap:String!="http://60.190.202.57:8101" | |
| 33 | +//var DebugHOSTImage:String!="http://60.190.202.57:8196" | |
| 34 | +//var HOST:String! = Debug.isFormal ? ReleaseHOST : DebugHOST | |
| 35 | +//var HOSTWAP:String! = Debug.isFormal ? ReleaseHOSTWap : DebugHOSTWap | |
| 36 | +//var HOSTImage:String! = Debug.isFormal ? ReleaseHOSTImage : DebugHOSTImage | |
| 37 | + | |
| 27 | 38 | let appsecret="sincere:3a530f39f99411b454e667d69693c127" |
| 28 | -var ReleaseHOST:String!="http://campus.myjxt.com"//正式网址 | |
| 29 | -var ReleaseHOSTWap:String!="http://parent.myjxt.com" | |
| 30 | -var ReleaseHOSTImage:String!="http://manage.myjxt.com" | |
| 31 | -var DebugHOST:String!="http://60.190.202.57:1000"//测试网址 | |
| 32 | -var DebugHOSTWap:String!="http://60.190.202.57:8101" | |
| 33 | -var DebugHOSTImage:String!="http://60.190.202.57:8196" | |
| 34 | -var HOST:String! = Debug.isFormal ? ReleaseHOST : DebugHOST | |
| 35 | -var HOSTWAP:String! = Debug.isFormal ? ReleaseHOSTWap : DebugHOSTWap | |
| 36 | -var HOSTImage:String! = Debug.isFormal ? ReleaseHOSTImage : DebugHOSTImage | |
| 39 | + | |
| 40 | +#if DEBUG | |
| 41 | +//测试网址 | |
| 42 | +var HOST:String! = "http://60.190.202.57:1000" | |
| 43 | +var HOSTWAP:String! = "http://60.190.202.57:8101" | |
| 44 | +var HOSTImage:String! = "http://60.190.202.57:8196" | |
| 45 | +#else | |
| 46 | +//正式网址 | |
| 47 | +var HOST:String! = "http://campus.myjxt.com" | |
| 48 | +var HOSTWAP:String! = "http://parent.myjxt.com" | |
| 49 | +var HOSTImage:String! = "http://manage.myjxt.com" | |
| 50 | +#endif | |
| 51 | + | |
| 37 | 52 | |
| 38 | 53 | let URL_UPLOAD_FILE=HOST+"/api/Class/UploadFile" //上传图片 |
| 39 | 54 | ... | ... |
ParentAssistant/ParentAssistant/Classes/util/MessageManager.swift
ParentAssistant/ParentAssistant/Classes/util/utils.swift
| ... | ... | @@ -11,17 +11,21 @@ import QuickLook |
| 11 | 11 | import Photos |
| 12 | 12 | |
| 13 | 13 | //MARK: - 服务器和log打印设置 |
| 14 | -class Debug{ | |
| 15 | - static let enable=false//是否打印log | |
| 16 | - static let isFormal=false//是否是正式服务器 | |
| 17 | - class func log(_ msg:String){ | |
| 18 | - if(!Debug.enable){ | |
| 19 | - return | |
| 20 | - } | |
| 21 | - NSLog(msg) | |
| 22 | - } | |
| 14 | +//class Debug{ | |
| 15 | +// static let enable=false//是否打印log | |
| 16 | +// static let isFormal=false//是否是正式服务器 | |
| 17 | +// class func log(_ msg:String){ | |
| 18 | +// if(!Debug.enable){ | |
| 19 | +// return | |
| 20 | +// } | |
| 21 | +// NSLog(msg) | |
| 22 | +// } | |
| 23 | +//} | |
| 24 | +func DebugLog<M>( _ message:M,file:String = #file,method:String = #function,line: Int = #line){ | |
| 25 | + #if DEBUG | |
| 26 | + print("// DEBUG Log = \(method)[\(line)]:\(message)") | |
| 27 | + #endif | |
| 23 | 28 | } |
| 24 | - | |
| 25 | 29 | class Story{ |
| 26 | 30 | static func getStory(_ name:String)->UIStoryboard?{ |
| 27 | 31 | return UIStoryboard(name: name, bundle: nil); |
| ... | ... | @@ -488,7 +492,8 @@ func cleanImageCache(){ |
| 488 | 492 | for item in files{ |
| 489 | 493 | do { |
| 490 | 494 | try fm.removeItem(atPath: (imagePath as NSString).appendingPathComponent(item)) |
| 491 | - Debug.log("delete***************") | |
| 495 | + | |
| 496 | + DebugLog("delete***********") | |
| 492 | 497 | } catch _ { |
| 493 | 498 | } |
| 494 | 499 | } | ... | ... |
ParentAssistant/ParentAssistant/Classes/util/view/SearchBarView.swift
0 → 100644
| ... | ... | @@ -0,0 +1,63 @@ |
| 1 | +// | |
| 2 | +// SearchBarView.swift | |
| 3 | +// ParentAssistant | |
| 4 | +// | |
| 5 | +// Created by Cao yang on 2018/4/21. | |
| 6 | +// Copyright © 2018年 HANGZHOUTEAM. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +import UIKit | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | +class SearchBarView: UIView,UISearchBarDelegate { | |
| 14 | + | |
| 15 | + enum SearchActionType { | |
| 16 | + case SearchType | |
| 17 | + case CancelType | |
| 18 | + } | |
| 19 | + | |
| 20 | + typealias SearchBarBlock = (String,SearchActionType)->() | |
| 21 | + | |
| 22 | + lazy var searchBar = {()->UISearchBar in | |
| 23 | + let search = UISearchBar.init(frame: CGRect.init(x: 0, y: 0, width: self.bounds.size.width, height: 36)) | |
| 24 | + search.delegate = self | |
| 25 | + search.center = self.center | |
| 26 | + search.placeholder = "请输入搜索内容" | |
| 27 | + search.barStyle = .default | |
| 28 | + search.barTintColor = navigationColor | |
| 29 | + | |
| 30 | + return search | |
| 31 | + }() | |
| 32 | + | |
| 33 | + var block : SearchBarBlock? | |
| 34 | + | |
| 35 | + override init(frame: CGRect) { | |
| 36 | + super.init(frame: frame) | |
| 37 | + if !frame.isEmpty { | |
| 38 | + self.addSubview(self.searchBar) | |
| 39 | + } | |
| 40 | + } | |
| 41 | + //MARK: - SearchBarDelegate | |
| 42 | + func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { | |
| 43 | + searchBar.showsCancelButton = false | |
| 44 | + } | |
| 45 | + func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { | |
| 46 | + searchBar.showsCancelButton = true | |
| 47 | + } | |
| 48 | + func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { | |
| 49 | + self.block!( "", .CancelType) | |
| 50 | + searchBar.resignFirstResponder() | |
| 51 | + } | |
| 52 | + func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { | |
| 53 | + | |
| 54 | + if let str = searchBar.text { | |
| 55 | + self.block!(str,.SearchType) | |
| 56 | + } | |
| 57 | + searchBar.resignFirstResponder() | |
| 58 | + } | |
| 59 | + | |
| 60 | + required init?(coder aDecoder: NSCoder) { | |
| 61 | + fatalError("init(coder:) has not been implemented") | |
| 62 | + } | |
| 63 | +} | ... | ... |
ParentAssistant/ParentAssistant/Supporting Files/Base.lproj/Main.storyboard
| ... | ... | @@ -502,7 +502,7 @@ |
| 502 | 502 | </viewController> |
| 503 | 503 | <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> |
| 504 | 504 | </objects> |
| 505 | - <point key="canvasLocation" x="1487" y="-1078"/> | |
| 505 | + <point key="canvasLocation" x="1785" y="-1072"/> | |
| 506 | 506 | </scene> |
| 507 | 507 | <!--Tab Bar Controller--> |
| 508 | 508 | <scene sceneID="6yA-8W-l0b"> | ... | ... |
ParentAssistant/ParentAssistant/ViewController.swift
| ... | ... | @@ -12,7 +12,6 @@ class ViewController: UIViewController { |
| 12 | 12 | |
| 13 | 13 | override func viewDidLoad() { |
| 14 | 14 | super.viewDidLoad() |
| 15 | - print("123456") | |
| 16 | 15 | self.view.makeToast("test") |
| 17 | 16 | self.view.makeToast("testParentAssistant", duration: 5, position: CSToastPositionCenter) |
| 18 | 17 | // Do any additional setup after loading the view, typically from a nib. | ... | ... |