Commit a8fe2388cc39fd1e940888eedb474913bc1d9533
1 parent
fd07bc26
Exists in
parentassistant
封装定位,优化代码
Showing
16 changed files
with
394 additions
and
87 deletions
 
Show diff stats
ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj
| @@ -59,6 +59,8 @@ | @@ -59,6 +59,8 @@ | ||
| 59 | AD5681CB208044860034A948 /* GrowCheckUpTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD5681C9208044860034A948 /* GrowCheckUpTableViewCell.xib */; }; | 59 | AD5681CB208044860034A948 /* GrowCheckUpTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD5681C9208044860034A948 /* GrowCheckUpTableViewCell.xib */; }; | 
| 60 | AD5681CE2080449A0034A948 /* GrowCheckDownTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD5681CC2080449A0034A948 /* GrowCheckDownTableViewCell.swift */; }; | 60 | AD5681CE2080449A0034A948 /* GrowCheckDownTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD5681CC2080449A0034A948 /* GrowCheckDownTableViewCell.swift */; }; | 
| 61 | AD5681CF2080449A0034A948 /* GrowCheckDownTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD5681CD2080449A0034A948 /* GrowCheckDownTableViewCell.xib */; }; | 61 | AD5681CF2080449A0034A948 /* GrowCheckDownTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD5681CD2080449A0034A948 /* GrowCheckDownTableViewCell.xib */; }; | 
| 62 | + AD639F0520897CBC0028BE73 /* AlertShowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD639F0420897CBC0028BE73 /* AlertShowView.swift */; }; | ||
| 63 | + AD639F072089C3950028BE73 /* LocationManger.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD639F062089C3950028BE73 /* LocationManger.swift */; }; | ||
| 62 | AD64A2C0207F289400B25E80 /* ProgramVacateTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD64A2BE207F289400B25E80 /* ProgramVacateTableViewCell.swift */; }; | 64 | AD64A2C0207F289400B25E80 /* ProgramVacateTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD64A2BE207F289400B25E80 /* ProgramVacateTableViewCell.swift */; }; | 
| 63 | AD64A2C1207F289400B25E80 /* ProgramVacateTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD64A2BF207F289400B25E80 /* ProgramVacateTableViewCell.xib */; }; | 65 | AD64A2C1207F289400B25E80 /* ProgramVacateTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD64A2BF207F289400B25E80 /* ProgramVacateTableViewCell.xib */; }; | 
| 64 | AD64A2C3207F28CF00B25E80 /* ProgramVacateBodyTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD64A2C2207F28CF00B25E80 /* ProgramVacateBodyTableViewCell.swift */; }; | 66 | AD64A2C3207F28CF00B25E80 /* ProgramVacateBodyTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD64A2C2207F28CF00B25E80 /* ProgramVacateBodyTableViewCell.swift */; }; | 
| @@ -237,6 +239,8 @@ | @@ -237,6 +239,8 @@ | ||
| 237 | AD5681C9208044860034A948 /* GrowCheckUpTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GrowCheckUpTableViewCell.xib; sourceTree = "<group>"; }; | 239 | AD5681C9208044860034A948 /* GrowCheckUpTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GrowCheckUpTableViewCell.xib; sourceTree = "<group>"; }; | 
| 238 | AD5681CC2080449A0034A948 /* GrowCheckDownTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrowCheckDownTableViewCell.swift; sourceTree = "<group>"; }; | 240 | AD5681CC2080449A0034A948 /* GrowCheckDownTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrowCheckDownTableViewCell.swift; sourceTree = "<group>"; }; | 
| 239 | AD5681CD2080449A0034A948 /* GrowCheckDownTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GrowCheckDownTableViewCell.xib; sourceTree = "<group>"; }; | 241 | AD5681CD2080449A0034A948 /* GrowCheckDownTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GrowCheckDownTableViewCell.xib; sourceTree = "<group>"; }; | 
| 242 | + AD639F0420897CBC0028BE73 /* AlertShowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertShowView.swift; sourceTree = "<group>"; }; | ||
| 243 | + AD639F062089C3950028BE73 /* LocationManger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationManger.swift; sourceTree = "<group>"; }; | ||
| 240 | AD64A2BE207F289400B25E80 /* ProgramVacateTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgramVacateTableViewCell.swift; sourceTree = "<group>"; }; | 244 | AD64A2BE207F289400B25E80 /* ProgramVacateTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgramVacateTableViewCell.swift; sourceTree = "<group>"; }; | 
| 241 | AD64A2BF207F289400B25E80 /* ProgramVacateTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProgramVacateTableViewCell.xib; sourceTree = "<group>"; }; | 245 | AD64A2BF207F289400B25E80 /* ProgramVacateTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProgramVacateTableViewCell.xib; sourceTree = "<group>"; }; | 
| 242 | AD64A2C2207F28CF00B25E80 /* ProgramVacateBodyTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgramVacateBodyTableViewCell.swift; sourceTree = "<group>"; }; | 246 | AD64A2C2207F28CF00B25E80 /* ProgramVacateBodyTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgramVacateBodyTableViewCell.swift; sourceTree = "<group>"; }; | 
| @@ -513,6 +517,7 @@ | @@ -513,6 +517,7 @@ | ||
| 513 | ADE33B302062202300BEA6E6 /* Macro.swift */, | 517 | ADE33B302062202300BEA6E6 /* Macro.swift */, | 
| 514 | BF5D1669204E675C00274489 /* account.swift */, | 518 | BF5D1669204E675C00274489 /* account.swift */, | 
| 515 | BF5D166B204E6A0300274489 /* network.swift */, | 519 | BF5D166B204E6A0300274489 /* network.swift */, | 
| 520 | + AD639F062089C3950028BE73 /* LocationManger.swift */, | ||
| 516 | BFA7446B208193D300845D30 /* MessageManager.swift */, | 521 | BFA7446B208193D300845D30 /* MessageManager.swift */, | 
| 517 | 599365282052553900C8B371 /* pinyin.c */, | 522 | 599365282052553900C8B371 /* pinyin.c */, | 
| 518 | 599365292052553900C8B371 /* pinyin.h */, | 523 | 599365292052553900C8B371 /* pinyin.h */, | 
| @@ -883,6 +888,7 @@ | @@ -883,6 +888,7 @@ | ||
| 883 | children = ( | 888 | children = ( | 
| 884 | BFF9B7F12057A28900F39B3E /* TableEmptyView.swift */, | 889 | BFF9B7F12057A28900F39B3E /* TableEmptyView.swift */, | 
| 885 | BFF9B7F32057A29D00F39B3E /* TableEmptyView.xib */, | 890 | BFF9B7F32057A29D00F39B3E /* TableEmptyView.xib */, | 
| 891 | + AD639F0420897CBC0028BE73 /* AlertShowView.swift */, | ||
| 886 | ); | 892 | ); | 
| 887 | path = view; | 893 | path = view; | 
| 888 | sourceTree = "<group>"; | 894 | sourceTree = "<group>"; | 
| @@ -1107,6 +1113,7 @@ | @@ -1107,6 +1113,7 @@ | ||
| 1107 | 5993652A2052553900C8B371 /* pinyin.c in Sources */, | 1113 | 5993652A2052553900C8B371 /* pinyin.c in Sources */, | 
| 1108 | AD122AB6208433BA00C7D0AD /* ProgramVacateDetailViewController.swift in Sources */, | 1114 | AD122AB6208433BA00C7D0AD /* ProgramVacateDetailViewController.swift in Sources */, | 
| 1109 | BFF9B7EF20577CD300F39B3E /* MyChildrenTableViewCell.swift in Sources */, | 1115 | BFF9B7EF20577CD300F39B3E /* MyChildrenTableViewCell.swift in Sources */, | 
| 1116 | + AD639F072089C3950028BE73 /* LocationManger.swift in Sources */, | ||
| 1110 | 590944E22057DA73004478B5 /* utils.swift in Sources */, | 1117 | 590944E22057DA73004478B5 /* utils.swift in Sources */, | 
| 1111 | BFEAAAC9205257460072FAAF /* NSDate+GFCalendar.m in Sources */, | 1118 | BFEAAAC9205257460072FAAF /* NSDate+GFCalendar.m in Sources */, | 
| 1112 | BF5D166A204E675C00274489 /* account.swift in Sources */, | 1119 | BF5D166A204E675C00274489 /* account.swift in Sources */, | 
| @@ -1156,6 +1163,7 @@ | @@ -1156,6 +1163,7 @@ | ||
| 1156 | ADF159612069E00000A9485D /* CalendarView.swift in Sources */, | 1163 | ADF159612069E00000A9485D /* CalendarView.swift in Sources */, | 
| 1157 | AD122ACA2084498F00C7D0AD /* ProgramVacateAddView.swift in Sources */, | 1164 | AD122ACA2084498F00C7D0AD /* ProgramVacateAddView.swift in Sources */, | 
| 1158 | BF406CD82057B529000A6681 /* MessageTableViewCell.swift in Sources */, | 1165 | BF406CD82057B529000A6681 /* MessageTableViewCell.swift in Sources */, | 
| 1166 | + AD639F0520897CBC0028BE73 /* AlertShowView.swift in Sources */, | ||
| 1159 | 599364EC204E62E700C8B371 /* EvaluationViewController.swift in Sources */, | 1167 | 599364EC204E62E700C8B371 /* EvaluationViewController.swift in Sources */, | 
| 1160 | AD122ABB20843AD700C7D0AD /* ProgramVacateDetailCell.swift in Sources */, | 1168 | AD122ABB20843AD700C7D0AD /* ProgramVacateDetailCell.swift in Sources */, | 
| 1161 | 599364F0204E62E700C8B371 /* ReportViewController.swift in Sources */, | 1169 | 599364F0204E62E700C8B371 /* ReportViewController.swift in Sources */, | 
ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
| @@ -13,21 +13,5 @@ | @@ -13,21 +13,5 @@ | ||
| 13 | stopOnStyle = "0"> | 13 | stopOnStyle = "0"> | 
| 14 | </BreakpointContent> | 14 | </BreakpointContent> | 
| 15 | </BreakpointProxy> | 15 | </BreakpointProxy> | 
| 16 | - <BreakpointProxy | ||
| 17 | - BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
| 18 | - <BreakpointContent | ||
| 19 | - shouldBeEnabled = "Yes" | ||
| 20 | - ignoreCount = "0" | ||
| 21 | - continueAfterRunningActions = "No" | ||
| 22 | - filePath = "ParentAssistant/Classes/controllers/Grow/GrowViewController.swift" | ||
| 23 | - timestampString = "545824470.67428" | ||
| 24 | - startingColumnNumber = "9223372036854775807" | ||
| 25 | - endingColumnNumber = "9223372036854775807" | ||
| 26 | - startingLineNumber = "72" | ||
| 27 | - endingLineNumber = "72" | ||
| 28 | - landmarkName = "viewWillAppear(_:)" | ||
| 29 | - landmarkType = "7"> | ||
| 30 | - </BreakpointContent> | ||
| 31 | - </BreakpointProxy> | ||
| 32 | </Breakpoints> | 16 | </Breakpoints> | 
| 33 | </Bucket> | 17 | </Bucket> | 
ParentAssistant/ParentAssistant/AppDelegate.swift
| @@ -37,12 +37,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | @@ -37,12 +37,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | ||
| 37 | } | 37 | } | 
| 38 | }) | 38 | }) | 
| 39 | } | 39 | } | 
| 40 | + | ||
| 41 | + //定位 | ||
| 42 | + LocationManger.shared.locationSelf() | ||
| 43 | + | ||
| 40 | setShareSDKSetting() | 44 | setShareSDKSetting() | 
| 41 | let tabbarVC = Story.instantiateViewControllerWithIdentifier("TabBarController", storyName: "Main") as! TabBarController | 45 | let tabbarVC = Story.instantiateViewControllerWithIdentifier("TabBarController", storyName: "Main") as! TabBarController | 
| 42 | self.window?.rootViewController = tabbarVC | 46 | self.window?.rootViewController = tabbarVC | 
| 43 | self.window?.makeKeyAndVisible() | 47 | self.window?.makeKeyAndVisible() | 
| 44 | // 加载广告 | 48 | // 加载广告 | 
| 45 | requestAD(vc: tabbarVC) | 49 | requestAD(vc: tabbarVC) | 
| 50 | + | ||
| 51 | + | ||
| 52 | + | ||
| 46 | return true | 53 | return true | 
| 47 | } | 54 | } | 
| 48 | //设置云信的appkey | 55 | //设置云信的appkey | 
| @@ -68,7 +75,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | @@ -68,7 +75,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | ||
| 68 | if Setting.getString("isFirst") == "\(AppDelegate.version())" {//是否是第一次下载 | 75 | if Setting.getString("isFirst") == "\(AppDelegate.version())" {//是否是第一次下载 | 
| 69 | position = 1 | 76 | position = 1 | 
| 70 | let adView = ZLaunchAd.create() | 77 | let adView = ZLaunchAd.create() | 
| 71 | - //position 广告位置0-首次广告位1-开屏广告位2-资讯首页3-频道首页4-频道内容5-文章内容页 AccountManager.shared.address | 78 | + //position 广告位置0-首次广告位1-开屏广告位2-资讯首页3-频道首页4-频道内容5-文章内容页 localAddress | 
| 72 | HTTPServer.shared.getAds(["position":position as AnyObject], completionHandler: { (str, error) in | 79 | HTTPServer.shared.getAds(["position":position as AnyObject], completionHandler: { (str, error) in | 
| 73 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 80 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 
| 74 | if json["status"] == 1 && error == nil{ | 81 | if json["status"] == 1 && error == nil{ | 
| @@ -93,7 +100,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | @@ -93,7 +100,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | ||
| 93 | vc.view.addSubview(view) | 100 | vc.view.addSubview(view) | 
| 94 | position = 0 | 101 | position = 0 | 
| 95 | let _ = Setting.save("\(AppDelegate.version())", forKey: "isFirst") | 102 | let _ = Setting.save("\(AppDelegate.version())", forKey: "isFirst") | 
| 96 | - //position 广告位置0-首次广告位1-开屏广告位2-资讯首页3-频道首页4-频道内容5-文章内容页 AccountManager.shared.address | 103 | + //position 广告位置0-首次广告位1-开屏广告位2-资讯首页3-频道首页4-频道内容5-文章内容页 localAddress | 
| 97 | HTTPServer.shared.getAds(["position":position as AnyObject], completionHandler: { (str, error) in | 104 | HTTPServer.shared.getAds(["position":position as AnyObject], completionHandler: { (str, error) in | 
| 98 | view.removeFromSuperview() | 105 | view.removeFromSuperview() | 
| 99 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 106 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 
ParentAssistant/ParentAssistant/Classes/controllers/Grow/GrowViewController.swift
| @@ -10,7 +10,6 @@ import UIKit | @@ -10,7 +10,6 @@ import UIKit | ||
| 10 | 10 | ||
| 11 | class GrowViewController: UIViewController,UIScrollViewDelegate { | 11 | class GrowViewController: UIViewController,UIScrollViewDelegate { | 
| 12 | 12 | ||
| 13 | - //MARK: - 标题数据 | ||
| 14 | //标题 | 13 | //标题 | 
| 15 | lazy var titleView = {() -> UIView in | 14 | lazy var titleView = {() -> UIView in | 
| 16 | let title = UIScrollView() | 15 | let title = UIScrollView() | 
| @@ -18,7 +17,6 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | @@ -18,7 +17,6 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | ||
| 18 | title.backgroundColor = Theme.topBarColor() | 17 | title.backgroundColor = Theme.topBarColor() | 
| 19 | return title | 18 | return title | 
| 20 | }() | 19 | }() | 
| 21 | - //MARK: - 内容数据 | ||
| 22 | //内容 | 20 | //内容 | 
| 23 | lazy var contentScrollView = {()->UIScrollView in | 21 | lazy var contentScrollView = {()->UIScrollView in | 
| 24 | let scrollView = UIScrollView.init(frame: self.view.bounds) | 22 | let scrollView = UIScrollView.init(frame: self.view.bounds) | 
| @@ -41,6 +39,19 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | @@ -41,6 +39,19 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | ||
| 41 | return lineLay | 39 | return lineLay | 
| 42 | }() | 40 | }() | 
| 43 | 41 | ||
| 42 | + /// 空数据页面 | ||
| 43 | + lazy var emptyView = {()-> UIView in | ||
| 44 | + let view = UIView.init(frame: self.view.bounds) | ||
| 45 | + view.backgroundColor = UIColor.white | ||
| 46 | + let imageView = UIImageView.init(frame: CGRect.init(x: 0, y: 0, width: 0.5*screenWidth, height: 0.5*screenWidth)) | ||
| 47 | + imageView.center = CGPoint.init(x: screenWidth/2, y: screenHeight*0.4) | ||
| 48 | + imageView.image = UIImage.init(named: "grow_empty_Image") | ||
| 49 | + imageView.contentMode = UIViewContentMode.scaleAspectFit | ||
| 50 | + | ||
| 51 | + view.addSubview(imageView) | ||
| 52 | + return view | ||
| 53 | + }() | ||
| 54 | + | ||
| 44 | var titleLeftLab = UILabel() | 55 | var titleLeftLab = UILabel() | 
| 45 | 56 | ||
| 46 | //是否显示右侧按钮 | 57 | //是否显示右侧按钮 | 
| @@ -68,22 +79,31 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | @@ -68,22 +79,31 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | ||
| 68 | 79 | ||
| 69 | override func viewWillAppear(_ animated: Bool) { | 80 | override func viewWillAppear(_ animated: Bool) { | 
| 70 | 81 | ||
| 71 | - | ||
| 72 | - let model = AccountManager.shared.getUserInfo() | ||
| 73 | - print(model.name) | 82 | + configUserStatus() | 
| 83 | + } | ||
| 84 | + | ||
| 85 | + //MARK: - 判断登录状态 | ||
| 86 | + func configUserStatus(){ | ||
| 74 | var title = String() | 87 | var title = String() | 
| 75 | if AccountManager.shared.isOnline() { | 88 | if AccountManager.shared.isOnline() { | 
| 76 | - if AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue.count == 0 { | 89 | + let array = AccountManager.shared.getChildClassInfo() | 
| 90 | + | ||
| 91 | + self.contentScrollView.isHidden = false | ||
| 92 | + self.emptyView.removeFromSuperview() | ||
| 93 | + | ||
| 94 | + if array.isEmpty { | ||
| 77 | title = "未绑定" | 95 | title = "未绑定" | 
| 78 | }else{ | 96 | }else{ | 
| 79 | - title = AccountManager.shared.rawUserInfo!.contentData()["studentClass"][0]["studentName"].stringValue | 97 | + title = array[0].studentName | 
| 80 | } | 98 | } | 
| 81 | }else{ | 99 | }else{ | 
| 82 | title = "未登录" | 100 | title = "未登录" | 
| 101 | + self.view.addSubview(self.emptyView) | ||
| 102 | + self.contentScrollView.isHidden = true | ||
| 83 | } | 103 | } | 
| 84 | self.titleLeftLab.text = title | 104 | self.titleLeftLab.text = title | 
| 85 | } | 105 | } | 
| 86 | - | 106 | + //MARK: 导航栏视图UI | 
| 87 | func drawHeadView () { | 107 | func drawHeadView () { | 
| 88 | //左按钮 | 108 | //左按钮 | 
| 89 | let leftView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 44)) | 109 | let leftView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 60, height: 44)) | 
| @@ -100,7 +120,7 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | @@ -100,7 +120,7 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | ||
| 100 | imageView.contentMode = .scaleAspectFit | 120 | imageView.contentMode = .scaleAspectFit | 
| 101 | leftView.addSubview(imageView) | 121 | leftView.addSubview(imageView) | 
| 102 | 122 | ||
| 103 | - // leftView.addTarget(self, action: #selector(showView), for: UIControlEvents.touchDown) | 123 | + leftView.addTarget(self, action: #selector(switchChildrenAction), for: UIControlEvents.touchDown) | 
| 104 | 124 | ||
| 105 | let leftBtn = UIBarButtonItem.init(customView: leftView) | 125 | let leftBtn = UIBarButtonItem.init(customView: leftView) | 
| 106 | self.navigationItem.leftBarButtonItem = leftBtn | 126 | self.navigationItem.leftBarButtonItem = leftBtn | 
| @@ -123,7 +143,46 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | @@ -123,7 +143,46 @@ class GrowViewController: UIViewController,UIScrollViewDelegate { | ||
| 123 | 143 | ||
| 124 | } | 144 | } | 
| 125 | 145 | ||
| 146 | + //MARK: 切换孩子按钮 | ||
| 147 | + @objc func switchChildrenAction(){ | ||
| 148 | + | ||
| 149 | + if AccountManager.shared.isOnline() { | ||
| 150 | + let arr = AccountManager.shared.getChildClassInfo() | ||
| 151 | + if arr.count > 0 { | ||
| 152 | + let view = AlertShowView.init(frame: CGRect.init(x: 10, y: Int((navigationBarHeight!+statusBarHeight)+5), width: Int(screenHeight*0.2), height: 50*arr.count)) | ||
| 153 | + view.setUpDataResource(arr:arr) | ||
| 154 | + view.showView() | ||
| 155 | + view.AlertBlock = { object in | ||
| 156 | + if object is StudentClassInfoModel { | ||
| 157 | + let model = object as! StudentClassInfoModel | ||
| 158 | + self.titleLeftLab.text = model.studentName | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + }else{ | ||
| 162 | + let alertView = UIAlertController.init(title: "提示", message: "您尚未绑定孩子信息,是否前往绑定?", preferredStyle: UIAlertControllerStyle.alert) | ||
| 163 | + let action = UIAlertAction.init(title: "确定", style: UIAlertActionStyle.default) { (action) in | ||
| 164 | + let vc = Story.instantiateViewControllerWithIdentifier("MyChildrenViewController", storyName: "My") as! MyChildrenViewController | ||
| 165 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 166 | + } | ||
| 167 | + let cancle = UIAlertAction.init(title: "取消", style: UIAlertActionStyle.cancel, handler: nil) | ||
| 168 | + alertView.addAction(action) | ||
| 169 | + alertView.addAction(cancle) | ||
| 170 | + self.present(alertView, animated: true, completion: nil) | ||
| 171 | + } | ||
| 172 | + }else{ | ||
| 173 | + let alertView = UIAlertController.init(title: "提示", message: "您尚未登录,是否前往登录?", preferredStyle: UIAlertControllerStyle.alert) | ||
| 174 | + let action = UIAlertAction.init(title: "确定", style: UIAlertActionStyle.default) { (action) in | ||
| 175 | + let vc = Story.instantiateViewControllerWithIdentifier("LoginViewController", storyName: "My") as! LoginViewController | ||
| 176 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 177 | + } | ||
| 178 | + let cancle = UIAlertAction.init(title: "取消", style: UIAlertActionStyle.cancel, handler: nil) | ||
| 179 | + alertView.addAction(action) | ||
| 180 | + alertView.addAction(cancle) | ||
| 181 | + self.present(alertView, animated: true, completion: nil) | ||
| 182 | + } | ||
| 183 | + } | ||
| 126 | 184 | ||
| 185 | + //MARK: - 设置控制器子视图 | ||
| 127 | private func setChildViewContent(){ | 186 | private func setChildViewContent(){ | 
| 128 | 187 | ||
| 129 | //添加子控制器 | 188 | //添加子控制器 | 
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramViewController.swift
| @@ -18,33 +18,8 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat | @@ -18,33 +18,8 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat | ||
| 18 | table.tableFooterView = UIView.init() | 18 | table.tableFooterView = UIView.init() | 
| 19 | return table | 19 | return table | 
| 20 | }() | 20 | }() | 
| 21 | - //Data | ||
| 22 | - var tableData = Array<String>() | ||
| 23 | - var titleImage = Array<String>() | ||
| 24 | - | ||
| 25 | - override func viewDidLoad() { | ||
| 26 | - super.viewDidLoad() | ||
| 27 | - self.view.backgroundColor = backGroundColor | ||
| 28 | - | ||
| 29 | - var isCheck = true | ||
| 30 | - if AccountManager.shared.isOnline() { | ||
| 31 | - if AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue.count == 0 { | ||
| 32 | - isCheck = false | ||
| 33 | - }else{ | ||
| 34 | - isCheck = true | ||
| 35 | - } | ||
| 36 | - } | ||
| 37 | - if isCheck { | ||
| 38 | - self.view.addSubview(self.tableView) | ||
| 39 | - }else{ | ||
| 40 | - drawEmptyView() | ||
| 41 | - } | ||
| 42 | - self.tableData = ["考勤","补卡","请假"] | ||
| 43 | - self.titleImage = ["program_check","program_card","program_leave"] | ||
| 44 | - // Do any additional setup after loading the view. | ||
| 45 | - } | ||
| 46 | 21 | ||
| 47 | - func drawEmptyView () { | 22 | + lazy var empty = {()->UIView in | 
| 48 | 23 | ||
| 49 | let emptyView = UIView.init(frame: self.view.bounds) | 24 | let emptyView = UIView.init(frame: self.view.bounds) | 
| 50 | emptyView.backgroundColor = backGroundColor | 25 | emptyView.backgroundColor = backGroundColor | 
| @@ -70,11 +45,42 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat | @@ -70,11 +45,42 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat | ||
| 70 | emptyView.addSubview(label2) | 45 | emptyView.addSubview(label2) | 
| 71 | emptyView.addSubview(label3) | 46 | emptyView.addSubview(label3) | 
| 72 | 47 | ||
| 73 | - self.view.addSubview(emptyView) | 48 | + return emptyView | 
| 49 | + }() | ||
| 50 | + | ||
| 51 | + //Data | ||
| 52 | + var tableData = Array<String>() | ||
| 53 | + var titleImage = Array<String>() | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + override func viewWillAppear(_ animated: Bool) { | ||
| 74 | 57 | ||
| 58 | + let array = AccountManager.shared.getChildClassInfo() | ||
| 59 | + if array.isEmpty { | ||
| 60 | + self.view.addSubview(self.empty) | ||
| 61 | + self.tableView.isHidden = true | ||
| 62 | + }else{ | ||
| 63 | + self.empty.removeFromSuperview() | ||
| 64 | + self.tableView.isHidden = false | ||
| 65 | + } | ||
| 75 | } | 66 | } | 
| 67 | + | ||
| 68 | + | ||
| 69 | + override func viewDidLoad() { | ||
| 70 | + super.viewDidLoad() | ||
| 71 | + self.view.backgroundColor = backGroundColor | ||
| 72 | + | ||
| 73 | + self.view.addSubview(self.tableView) | ||
| 74 | + | ||
| 75 | + self.tableData = ["考勤","补卡","请假"] | ||
| 76 | + self.titleImage = ["program_check","program_card","program_leave"] | ||
| 77 | + // Do any additional setup after loading the view. | ||
| 78 | + } | ||
| 79 | + | ||
| 76 | @objc func gotoChildView () { | 80 | @objc func gotoChildView () { | 
| 77 | print("去个人中心页面-我的孩子!") | 81 | print("去个人中心页面-我的孩子!") | 
| 82 | + let vc = Story.instantiateViewControllerWithIdentifier("MyChildrenViewController", storyName: "My") as! MyChildrenViewController | ||
| 83 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 78 | } | 84 | } | 
| 79 | 85 | ||
| 80 | 86 | 
ParentAssistant/ParentAssistant/Classes/controllers/Information/ChannelViewController.swift
| @@ -44,7 +44,7 @@ class ChannelViewController: UIViewController,UISearchBarDelegate { | @@ -44,7 +44,7 @@ class ChannelViewController: UIViewController,UISearchBarDelegate { | ||
| 44 | }) | 44 | }) | 
| 45 | } | 45 | } | 
| 46 | topADsQueue.async { | 46 | topADsQueue.async { | 
| 47 | - HTTPServer.shared.getChannelInfo([ "areaName": AccountManager.shared.address as AnyObject,"channel": self.channelId as AnyObject,"toFirstPage": 0 as AnyObject,"pageIndex": 1 as AnyObject,"pageSize": 20 as AnyObject], completionHandler: { (str, error) in | 47 | + HTTPServer.shared.getChannelInfo([ "areaName": localAddress as AnyObject,"channel": self.channelId as AnyObject,"toFirstPage": 0 as AnyObject,"pageIndex": 1 as AnyObject,"pageSize": 20 as AnyObject], completionHandler: { (str, error) in | 
| 48 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 48 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 
| 49 | if json["status"] == 1 && error == nil{ | 49 | if json["status"] == 1 && error == nil{ | 
| 50 | self.data = ChannelDemol(j: json.contentData()) | 50 | self.data = ChannelDemol(j: json.contentData()) | 
| @@ -61,7 +61,7 @@ class ChannelViewController: UIViewController,UISearchBarDelegate { | @@ -61,7 +61,7 @@ class ChannelViewController: UIViewController,UISearchBarDelegate { | ||
| 61 | if key == nil{ | 61 | if key == nil{ | 
| 62 | return | 62 | return | 
| 63 | } | 63 | } | 
| 64 | - HTTPServer.shared.getInformationTopic(["keyword":key as AnyObject, "areaName": AccountManager.shared.address as AnyObject,"channel": self.channelId as AnyObject,"toFirstPage": 0 as AnyObject,"pageIndex": 1 as AnyObject,"pageSize": 20 as AnyObject], completionHandler: { (str, error) in | 64 | + HTTPServer.shared.getInformationTopic(["keyword":key as AnyObject, "areaName": localAddress as AnyObject,"channel": self.channelId as AnyObject,"toFirstPage": 0 as AnyObject,"pageIndex": 1 as AnyObject,"pageSize": 20 as AnyObject], completionHandler: { (str, error) in | 
| 65 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 65 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 
| 66 | if json["status"] == 1 && error == nil{ | 66 | if json["status"] == 1 && error == nil{ | 
| 67 | self.data.channelContent.removeAll() | 67 | self.data.channelContent.removeAll() | 
ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift
| @@ -38,6 +38,45 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -38,6 +38,45 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 38 | self.navigationController?.navigationBar.tintColor=UIColor.white | 38 | self.navigationController?.navigationBar.tintColor=UIColor.white | 
| 39 | } | 39 | } | 
| 40 | 40 | ||
| 41 | + private func getDataFromNet(){ | ||
| 42 | + | ||
| 43 | + let group = DispatchGroup() | ||
| 44 | + var position:Int = 2 | ||
| 45 | + if !self.isFirstviewController { | ||
| 46 | + position = 3 | ||
| 47 | + } | ||
| 48 | + group.enter() | ||
| 49 | + HTTPServer.shared.getAds(["position":position as AnyObject,"areaName":localAddress as AnyObject], completionHandler: { (str, error) in//getPercentEncodingString(str: localAddress) | ||
| 50 | + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | ||
| 51 | + if json["status"] == 1 && error == nil{ | ||
| 52 | + self.topADs.removeAll() | ||
| 53 | + for item in json.contentData().arrayValue{ | ||
| 54 | + self.topADs.append(ADSModel(j: item)) | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + }, failHandler: { (error) in | ||
| 58 | + | ||
| 59 | + }) | ||
| 60 | + group.leave() | ||
| 61 | + }) | ||
| 62 | + group.enter() | ||
| 63 | + let dic = self.getListDic() | ||
| 64 | + HTTPServer.shared.getChannelInfo(dic, completionHandler: { (str, error) in | ||
| 65 | + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | ||
| 66 | + if json["status"] == 1 && error == nil{ | ||
| 67 | + self.data = ChannelDemol(j: json.contentData()) | ||
| 68 | + } | ||
| 69 | + }, failHandler: { (error) in | ||
| 70 | + | ||
| 71 | + }) | ||
| 72 | + group.leave() | ||
| 73 | + }) | ||
| 74 | + group.notify(queue: DispatchQueue.main) { | ||
| 75 | + self.collectView.reloadData() | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + | ||
| 41 | func getData(){ | 80 | func getData(){ | 
| 42 | let topADsQueue = DispatchQueue(label: "topADs") | 81 | let topADsQueue = DispatchQueue(label: "topADs") | 
| 43 | topADsQueue.async { | 82 | topADsQueue.async { | 
| @@ -46,7 +85,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -46,7 +85,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 46 | if !self.isFirstviewController { | 85 | if !self.isFirstviewController { | 
| 47 | position = 3 | 86 | position = 3 | 
| 48 | } | 87 | } | 
| 49 | - HTTPServer.shared.getAds(["position":position as AnyObject,"areaName":AccountManager.shared.address as AnyObject], completionHandler: { (str, error) in//getPercentEncodingString(str: AccountManager.shared.address) | 88 | + HTTPServer.shared.getAds(["position":position as AnyObject,"areaName":localAddress as AnyObject], completionHandler: { (str, error) in//getPercentEncodingString(str: localAddress) | 
| 50 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 89 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 
| 51 | if json["status"] == 1 && error == nil{ | 90 | if json["status"] == 1 && error == nil{ | 
| 52 | self.topADs.removeAll() | 91 | self.topADs.removeAll() | 
| @@ -99,7 +138,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -99,7 +138,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 99 | 138 | ||
| 100 | //获得请求参数 | 139 | //获得请求参数 | 
| 101 | func getListDic()->[String:AnyObject]{ | 140 | func getListDic()->[String:AnyObject]{ | 
| 102 | - var dic = [ "areaName": AccountManager.shared.address as AnyObject,"pageIndex": 1 as AnyObject,"pageSize": 20 as AnyObject] | 141 | + var dic = [ "areaName": localAddress as AnyObject,"pageIndex": 1 as AnyObject,"pageSize": 20 as AnyObject] | 
| 103 | var toFirstPage:Int = 1 | 142 | var toFirstPage:Int = 1 | 
| 104 | var ch:Int = 0 | 143 | var ch:Int = 0 | 
| 105 | if !isFirstviewController{ | 144 | if !isFirstviewController{ | 
| @@ -115,7 +154,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -115,7 +154,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 115 | func addLeftBarBtn(){ | 154 | func addLeftBarBtn(){ | 
| 116 | let leftbtn = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40)) | 155 | let leftbtn = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40)) | 
| 117 | leftLabel = UILabel(frame: CGRect(x: 0, y: 10, width: 60, height: 20)) | 156 | leftLabel = UILabel(frame: CGRect(x: 0, y: 10, width: 60, height: 20)) | 
| 118 | - leftLabel.text = AccountManager.shared.address | 157 | + leftLabel.text = localAddress | 
| 119 | leftLabel.textColor = UIColor.white | 158 | leftLabel.textColor = UIColor.white | 
| 120 | leftLabel.sizeToFit() | 159 | leftLabel.sizeToFit() | 
| 121 | let image = UIImageView(frame: CGRect(x: leftLabel.frame.maxX+4, y: 15, width: 16, height: 9)) | 160 | let image = UIImageView(frame: CGRect(x: leftLabel.frame.maxX+4, y: 15, width: 16, height: 9)) | 
| @@ -143,9 +182,11 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -143,9 +182,11 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 143 | 182 | ||
| 144 | //完成选择城市 | 183 | //完成选择城市 | 
| 145 | func selectCity(city: String) { | 184 | func selectCity(city: String) { | 
| 146 | - AccountManager.shared.address = city | 185 | + localAddress = city | 
| 147 | addLeftBarBtn() | 186 | addLeftBarBtn() | 
| 148 | - getData() | 187 | +// getData() | 
| 188 | + getDataFromNet() | ||
| 189 | + | ||
| 149 | } | 190 | } | 
| 150 | 191 | ||
| 151 | func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { | 192 | func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { | 
| @@ -174,7 +215,8 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -174,7 +215,8 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 174 | 215 | ||
| 175 | override func viewWillAppear(_ animated: Bool) { | 216 | override func viewWillAppear(_ animated: Bool) { | 
| 176 | super.viewWillAppear(animated) | 217 | super.viewWillAppear(animated) | 
| 177 | - getData() | 218 | +// getData() | 
| 219 | + getDataFromNet() | ||
| 178 | if isFirstviewController{ | 220 | if isFirstviewController{ | 
| 179 | addLeftBarBtn() | 221 | addLeftBarBtn() | 
| 180 | }else{ | 222 | }else{ | 
| @@ -193,7 +235,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | @@ -193,7 +235,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { | ||
| 193 | if data.channelContent[index].url != "" { | 235 | if data.channelContent[index].url != "" { | 
| 194 | vcs.webURL = data.channelContent[index].url | 236 | vcs.webURL = data.channelContent[index].url | 
| 195 | }else{ | 237 | }else{ | 
| 196 | - vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[index].id)"+"&areaname="+AccountManager.shared.address).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | 238 | + vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[index].id)"+"&areaname="+localAddress).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | 
| 197 | } | 239 | } | 
| 198 | self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) | 240 | self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) | 
| 199 | } | 241 | } | 
| @@ -297,7 +339,7 @@ extension InformationViewController:UICollectionViewDataSource,UICollectionViewD | @@ -297,7 +339,7 @@ extension InformationViewController:UICollectionViewDataSource,UICollectionViewD | ||
| 297 | if data.channelContent[indexPath.row].url != "" { | 339 | if data.channelContent[indexPath.row].url != "" { | 
| 298 | vcs.webURL = data.channelContent[indexPath.row].url | 340 | vcs.webURL = data.channelContent[indexPath.row].url | 
| 299 | }else{ | 341 | }else{ | 
| 300 | - vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[indexPath.row].id)"+"&areaname="+AccountManager.shared.address).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | 342 | + vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[indexPath.row].id)"+"&areaname="+localAddress).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | 
| 301 | } | 343 | } | 
| 302 | self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) | 344 | self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) | 
| 303 | 345 | 
ParentAssistant/ParentAssistant/Classes/controllers/evaluation/EvaluationViewController.swift
| @@ -40,7 +40,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | @@ -40,7 +40,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | ||
| 40 | } | 40 | } | 
| 41 | 41 | ||
| 42 | func getData(){ | 42 | func getData(){ | 
| 43 | - HTTPServer.shared.getActivityTool(["areaName":AccountManager.shared.address as AnyObject]) { (str, error) in | 43 | + HTTPServer.shared.getActivityTool(["areaName":localAddress as AnyObject]) { (str, error) in | 
| 44 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 44 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in | 
| 45 | if json["status"]==1{ | 45 | if json["status"]==1{ | 
| 46 | self.activityArr.removeAll() | 46 | self.activityArr.removeAll() | 
| @@ -120,7 +120,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | @@ -120,7 +120,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | ||
| 120 | self.navigationController?.navigationBar.setBackgroundImage(backImage, for: UIBarMetrics.default) | 120 | self.navigationController?.navigationBar.setBackgroundImage(backImage, for: UIBarMetrics.default) | 
| 121 | let leftbtn = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40)) | 121 | let leftbtn = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40)) | 
| 122 | leftLabel = UILabel(frame: CGRect(x: 0, y: 10, width: 60, height: 20)) | 122 | leftLabel = UILabel(frame: CGRect(x: 0, y: 10, width: 60, height: 20)) | 
| 123 | - leftLabel.text = AccountManager.shared.address | 123 | + leftLabel.text = localAddress | 
| 124 | leftLabel.textColor = UIColor.white | 124 | leftLabel.textColor = UIColor.white | 
| 125 | leftLabel.sizeToFit() | 125 | leftLabel.sizeToFit() | 
| 126 | let image = UIImageView(frame: CGRect(x: leftLabel.frame.maxX+4, y: 15, width: 16, height: 9)) | 126 | let image = UIImageView(frame: CGRect(x: leftLabel.frame.maxX+4, y: 15, width: 16, height: 9)) | 
| @@ -164,7 +164,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | @@ -164,7 +164,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | ||
| 164 | if city == nil{ | 164 | if city == nil{ | 
| 165 | city = placeMark!.administrativeArea | 165 | city = placeMark!.administrativeArea | 
| 166 | } | 166 | } | 
| 167 | - AccountManager.shared.address = city! | 167 | + localAddress = city! | 
| 168 | self.getData() | 168 | self.getData() | 
| 169 | self.addLeftBarBtn() | 169 | self.addLeftBarBtn() | 
| 170 | }else if error == nil && arr == nil{ | 170 | }else if error == nil && arr == nil{ | 
| @@ -194,7 +194,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | @@ -194,7 +194,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | ||
| 194 | } | 194 | } | 
| 195 | 195 | ||
| 196 | func selectCity(city: String) { | 196 | func selectCity(city: String) { | 
| 197 | - AccountManager.shared.address = city | 197 | + localAddress = city | 
| 198 | self.getData() | 198 | self.getData() | 
| 199 | addLeftBarBtn() | 199 | addLeftBarBtn() | 
| 200 | } | 200 | } | 
| @@ -234,7 +234,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | @@ -234,7 +234,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec | ||
| 234 | if activityArr[sender.tag-3000].toolUrl != "" { | 234 | if activityArr[sender.tag-3000].toolUrl != "" { | 
| 235 | vcs.webURL = activityArr[sender.tag-3000].toolUrl | 235 | vcs.webURL = activityArr[sender.tag-3000].toolUrl | 
| 236 | }else{ | 236 | }else{ | 
| 237 | - vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(activityArr[sender.tag-3000].toolId)"+"&areaname="+AccountManager.shared.address).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | 237 | + vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(activityArr[sender.tag-3000].toolId)"+"&areaname="+localAddress).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | 
| 238 | } | 238 | } | 
| 239 | self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) | 239 | self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) | 
| 240 | } | 240 | } | 
| @@ -276,7 +276,7 @@ extension EvaluationViewController:UICollectionViewDataSource,UICollectionViewDe | @@ -276,7 +276,7 @@ extension EvaluationViewController:UICollectionViewDataSource,UICollectionViewDe | ||
| 276 | if toolArr[indexPath.row].toolUrl != "" { | 276 | if toolArr[indexPath.row].toolUrl != "" { | 
| 277 | vcs.webURL = toolArr[indexPath.row].toolUrl | 277 | vcs.webURL = toolArr[indexPath.row].toolUrl | 
| 278 | }else{ | 278 | }else{ | 
| 279 | - vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(toolArr[indexPath.row].toolId)"+"&areaname="+AccountManager.shared.address).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | 279 | + vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(toolArr[indexPath.row].toolId)"+"&areaname="+localAddress).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | 
| 280 | } | 280 | } | 
| 281 | self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) | 281 | self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) | 
| 282 | } | 282 | } | 
ParentAssistant/ParentAssistant/Classes/controllers/userCenter/BaseCityChooseSchoolViewController.swift
| @@ -19,14 +19,14 @@ class BaseCityChooseSchoolViewController: UIViewController,UISearchBarDelegate { | @@ -19,14 +19,14 @@ class BaseCityChooseSchoolViewController: UIViewController,UISearchBarDelegate { | ||
| 19 | override func viewDidLoad() { | 19 | override func viewDidLoad() { | 
| 20 | super.viewDidLoad() | 20 | super.viewDidLoad() | 
| 21 | 21 | ||
| 22 | - citySelectbtn.text = AccountManager.shared.address | 22 | + citySelectbtn.text = localAddress | 
| 23 | getData() | 23 | getData() | 
| 24 | // Do any additional setup after loading the view. | 24 | // Do any additional setup after loading the view. | 
| 25 | } | 25 | } | 
| 26 | 26 | ||
| 27 | //根据关键字获取学校 | 27 | //根据关键字获取学校 | 
| 28 | func getData(_ keyword:String=""){ | 28 | func getData(_ keyword:String=""){ | 
| 29 | - var dic:[String:AnyObject] = ["areaName":AccountManager.shared.address as AnyObject,"keyword":keyword as AnyObject] | 29 | + var dic:[String:AnyObject] = ["areaName":localAddress as AnyObject,"keyword":keyword as AnyObject] | 
| 30 | if keyword == ""{ | 30 | if keyword == ""{ | 
| 31 | dic.removeValue(forKey: "keyword") | 31 | dic.removeValue(forKey: "keyword") | 
| 32 | } | 32 | } | 
| @@ -155,7 +155,7 @@ class BaseCityChooseSchoolViewController: UIViewController,UISearchBarDelegate { | @@ -155,7 +155,7 @@ class BaseCityChooseSchoolViewController: UIViewController,UISearchBarDelegate { | ||
| 155 | } | 155 | } | 
| 156 | 156 | ||
| 157 | func selectCity(city: String) { | 157 | func selectCity(city: String) { | 
| 158 | - AccountManager.shared.address = city | 158 | + localAddress = city | 
| 159 | 159 | ||
| 160 | citySelectbtn.text = city | 160 | citySelectbtn.text = city | 
| 161 | self.getData() | 161 | self.getData() | 
| @@ -163,7 +163,7 @@ class BaseCityChooseSchoolViewController: UIViewController,UISearchBarDelegate { | @@ -163,7 +163,7 @@ class BaseCityChooseSchoolViewController: UIViewController,UISearchBarDelegate { | ||
| 163 | 163 | ||
| 164 | override func viewWillAppear(_ animated: Bool) { | 164 | override func viewWillAppear(_ animated: Bool) { | 
| 165 | super.viewWillAppear(animated) | 165 | super.viewWillAppear(animated) | 
| 166 | - citySelectbtn.text = AccountManager.shared.address | 166 | + citySelectbtn.text = localAddress | 
| 167 | } | 167 | } | 
| 168 | /* | 168 | /* | 
| 169 | // MARK: - Navigation | 169 | // MARK: - Navigation | 
ParentAssistant/ParentAssistant/Classes/util/LocationManger.swift
0 → 100644
| @@ -0,0 +1,54 @@ | @@ -0,0 +1,54 @@ | ||
| 1 | +// | ||
| 2 | +// LocationManger.swift | ||
| 3 | +// ParentAssistant | ||
| 4 | +// | ||
| 5 | +// Created by Cao yang on 2018/4/20. | ||
| 6 | +// Copyright © 2018年 HANGZHOUTEAM. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +import UIKit | ||
| 10 | +import CoreLocation | ||
| 11 | + | ||
| 12 | +class LocationManger: NSObject,CLLocationManagerDelegate { | ||
| 13 | + | ||
| 14 | + static let shared = LocationManger() | ||
| 15 | + required override init() {} | ||
| 16 | + | ||
| 17 | + var locationManger = CLLocationManager() | ||
| 18 | + | ||
| 19 | + func locationSelf(){ | ||
| 20 | + if TARGET_IPHONE_SIMULATOR==0{//判断是模拟器还是真机 | ||
| 21 | + if CLLocationManager.locationServicesEnabled() && (CLLocationManager.authorizationStatus() == .authorizedWhenInUse || CLLocationManager.authorizationStatus() == .notDetermined){ | ||
| 22 | + locationManger = CLLocationManager() | ||
| 23 | + locationManger.distanceFilter = 100 | ||
| 24 | + locationManger.desiredAccuracy = 10 | ||
| 25 | + locationManger.requestWhenInUseAuthorization() | ||
| 26 | + locationManger.delegate = self | ||
| 27 | + locationManger.allowsBackgroundLocationUpdates = false | ||
| 28 | + locationManger.startUpdatingLocation() | ||
| 29 | + }else{ | ||
| 30 | + appDelegate.window!.makeToast("请在设置中打开定位功能") | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { | ||
| 35 | + let curr = locations.last! | ||
| 36 | + let geocoder = CLGeocoder() | ||
| 37 | + geocoder.reverseGeocodeLocation(curr) { (arr, error) in | ||
| 38 | + if arr != nil{ | ||
| 39 | + let placeMark = arr!.first | ||
| 40 | + var city = placeMark!.subLocality | ||
| 41 | + if city == nil{ | ||
| 42 | + city = placeMark!.administrativeArea | ||
| 43 | + } | ||
| 44 | + localAddress = city! | ||
| 45 | + | ||
| 46 | + }else if error == nil && arr == nil{ | ||
| 47 | + | ||
| 48 | + }else if error == nil{ | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + manager.stopUpdatingLocation() | ||
| 53 | + } | ||
| 54 | +} | 
ParentAssistant/ParentAssistant/Classes/util/Macro.swift
| @@ -18,6 +18,11 @@ let screenWidth = UIScreen.main.bounds.size.width | @@ -18,6 +18,11 @@ let screenWidth = UIScreen.main.bounds.size.width | ||
| 18 | let screenHeight = UIScreen.main.bounds.size.height | 18 | let screenHeight = UIScreen.main.bounds.size.height | 
| 19 | let backGroundColor = UIColor.init(red: 239/255, green: 239/255, blue: 244/255, alpha: 1) | 19 | let backGroundColor = UIColor.init(red: 239/255, green: 239/255, blue: 244/255, alpha: 1) | 
| 20 | let navigationColor = UIColorWithRGB(R: 109, G: 155, B: 255) | 20 | let navigationColor = UIColorWithRGB(R: 109, G: 155, B: 255) | 
| 21 | + | ||
| 22 | +var localAddress = "未知" | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + | ||
| 21 | //MARK: -------------------------- 接口地址 ---------------------------- | 26 | //MARK: -------------------------- 接口地址 ---------------------------- | 
| 22 | let appsecret="sincere:3a530f39f99411b454e667d69693c127" | 27 | let appsecret="sincere:3a530f39f99411b454e667d69693c127" | 
| 23 | var ReleaseHOST:String!="http://campus.myjxt.com"//正式网址 | 28 | var ReleaseHOST:String!="http://campus.myjxt.com"//正式网址 | 
ParentAssistant/ParentAssistant/Classes/util/account.swift
| @@ -12,7 +12,7 @@ class AccountManager: NSObject { | @@ -12,7 +12,7 @@ class AccountManager: NSObject { | ||
| 12 | var userid:String="" | 12 | var userid:String="" | 
| 13 | var token:String? | 13 | var token:String? | 
| 14 | var refreshToken:String="" | 14 | var refreshToken:String="" | 
| 15 | - var address:String = "未知" | 15 | +// var address:String = "未知" | 
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | //单例 | 18 | //单例 | 
| @@ -32,10 +32,11 @@ class AccountManager: NSObject { | @@ -32,10 +32,11 @@ class AccountManager: NSObject { | ||
| 32 | func getUserInfo() -> UserInfoModel { | 32 | func getUserInfo() -> UserInfoModel { | 
| 33 | 33 | ||
| 34 | var model = UserInfoModel() | 34 | var model = UserInfoModel() | 
| 35 | - let dic = Setting.getUserInfo()?.dictionary | ||
| 36 | - let data = dic!["data"]?.dictionary | ||
| 37 | - if let value = data { | ||
| 38 | - model = UserInfoModel.deserialize(from: value)! | 35 | + if let dic = Setting.getUserInfo()?.dictionary { | 
| 36 | + let data = dic["data"]?.dictionary | ||
| 37 | + if let value = data { | ||
| 38 | + model = UserInfoModel.deserialize(from: value)! | ||
| 39 | + } | ||
| 39 | } | 40 | } | 
| 40 | return model | 41 | return model | 
| 41 | } | 42 | } | 
| @@ -45,14 +46,15 @@ class AccountManager: NSObject { | @@ -45,14 +46,15 @@ class AccountManager: NSObject { | ||
| 45 | /// - Returns: 返回 StudentClassInfoModel | 46 | /// - Returns: 返回 StudentClassInfoModel | 
| 46 | func getChildClassInfo()-> Array<StudentClassInfoModel> { | 47 | func getChildClassInfo()-> Array<StudentClassInfoModel> { | 
| 47 | var array = Array<StudentClassInfoModel>() | 48 | var array = Array<StudentClassInfoModel>() | 
| 48 | - let dic = Setting.getUserInfo()?.dictionary | ||
| 49 | - let data = dic!["data"]?.dictionary | ||
| 50 | - let studentArr = data!["studentClass"]?.arrayValue | ||
| 51 | - for i in 0..<studentArr!.count { | ||
| 52 | - let studentDic = studentArr![i].dictionary | ||
| 53 | - if let value = studentDic { | ||
| 54 | - let model = StudentClassInfoModel.deserialize(from: value) | ||
| 55 | - array.append(model!) | 49 | + if let dic = Setting.getUserInfo()?.dictionary { | 
| 50 | + let data = dic["data"]?.dictionary | ||
| 51 | + let studentArr = data!["studentClass"]?.arrayValue | ||
| 52 | + for i in 0..<studentArr!.count { | ||
| 53 | + let studentDic = studentArr![i].dictionary | ||
| 54 | + if let value = studentDic { | ||
| 55 | + let model = StudentClassInfoModel.deserialize(from: value) | ||
| 56 | + array.append(model!) | ||
| 57 | + } | ||
| 56 | } | 58 | } | 
| 57 | } | 59 | } | 
| 58 | return array | 60 | return array | 
ParentAssistant/ParentAssistant/Classes/util/view/AlertShowView.swift
0 → 100644
| @@ -0,0 +1,119 @@ | @@ -0,0 +1,119 @@ | ||
| 1 | +// | ||
| 2 | +// AlertShowView.swift | ||
| 3 | +// ParentAssistant | ||
| 4 | +// | ||
| 5 | +// Created by Cao yang on 2018/4/20. | ||
| 6 | +// Copyright © 2018年 HANGZHOUTEAM. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +import UIKit | ||
| 10 | + | ||
| 11 | +class AlertShowView: UIView,UITableViewDelegate,UITableViewDataSource { | ||
| 12 | + | ||
| 13 | + typealias AlertBackBlock = (AnyObject)->() | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + lazy var tableView = { ()-> UITableView in | ||
| 17 | + | ||
| 18 | + let table = UITableView.init(frame: self.bounds) | ||
| 19 | + table.delegate = self | ||
| 20 | + table.dataSource = self | ||
| 21 | + table.layer.cornerRadius = 5 | ||
| 22 | + table.clipsToBounds = true | ||
| 23 | + table.separatorStyle = .none | ||
| 24 | + table.backgroundColor = backGroundColor | ||
| 25 | + table.register(UITableViewCell.self, forCellReuseIdentifier: "showAlertCell") | ||
| 26 | + return table | ||
| 27 | + }() | ||
| 28 | + private var dataArr = Array<AnyObject>() | ||
| 29 | + private var keysWindow = UIWindow() | ||
| 30 | + private var navigateButton = UIButton() | ||
| 31 | + private var backButton = UIButton() | ||
| 32 | + | ||
| 33 | + var rect = CGRect() | ||
| 34 | + var AlertBlock : AlertBackBlock? | ||
| 35 | + | ||
| 36 | + override init(frame: CGRect) { | ||
| 37 | + super.init(frame: frame) | ||
| 38 | + if !frame.isEmpty { | ||
| 39 | + self.rect = frame | ||
| 40 | + self.addSubview(self.tableView) | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + func showView() { | ||
| 44 | + let window = UIApplication.shared.keyWindow | ||
| 45 | + let btn = UIButton.init(frame: CGRect.init(x: 0, y: navigationBarHeight!+statusBarHeight, width: screenWidth, height: screenHeight)) | ||
| 46 | + btn.backgroundColor = UIColor.black | ||
| 47 | + btn.alpha = 0.4 | ||
| 48 | + btn.addTarget(self, action: #selector(closeView), for: UIControlEvents.touchDown) | ||
| 49 | + | ||
| 50 | + let upBtn = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: screenWidth, height: navigationBarHeight!+statusBarHeight)) | ||
| 51 | + upBtn.backgroundColor = UIColor.clear | ||
| 52 | + upBtn.addTarget(self, action: #selector(closeView), for: UIControlEvents.touchDown) | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + self.keysWindow = window! | ||
| 57 | + self.backButton = btn | ||
| 58 | + self.navigateButton = upBtn | ||
| 59 | + | ||
| 60 | + self.keysWindow.addSubview(self.backButton) | ||
| 61 | + self.keysWindow.addSubview(self.navigateButton) | ||
| 62 | + self.keysWindow.addSubview(self) | ||
| 63 | + showAnimation() | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @objc private func closeView(){ | ||
| 67 | + | ||
| 68 | + self.backButton.removeFromSuperview() | ||
| 69 | + self.navigateButton.removeFromSuperview() | ||
| 70 | + self.removeFromSuperview() | ||
| 71 | + self.keysWindow = UIWindow.init() | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + private func showAnimation(){ | ||
| 75 | + | ||
| 76 | + self.alpha = 0 | ||
| 77 | + self.backButton.alpha = 0 | ||
| 78 | + UIView.animate(withDuration: 0.3) { | ||
| 79 | + self.alpha = 1 | ||
| 80 | + self.backButton.alpha = 0.4 | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + func setUpDataResource (arr:Array<AnyObject>) { | ||
| 85 | + if arr.count > 0 { | ||
| 86 | + self.dataArr = arr | ||
| 87 | + } | ||
| 88 | + self.tableView.reloadData() | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 92 | + return self.dataArr.count | ||
| 93 | + } | ||
| 94 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 95 | + return 50 | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 99 | + | ||
| 100 | + let cell = tableView.dequeueReusableCell(withIdentifier: "showAlertCell") | ||
| 101 | + let dic = self.dataArr[indexPath.row] | ||
| 102 | + | ||
| 103 | + if dic is StudentClassInfoModel { | ||
| 104 | + let dict = dic as! StudentClassInfoModel | ||
| 105 | + cell?.textLabel?.text = dict.studentName | ||
| 106 | + } | ||
| 107 | + return cell! | ||
| 108 | + } | ||
| 109 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 110 | + let selectData = self.dataArr[indexPath.row] | ||
| 111 | + self.AlertBlock!(selectData) | ||
| 112 | + closeView() | ||
| 113 | + } | ||
| 114 | + required init?(coder aDecoder: NSCoder) { | ||
| 115 | + fatalError("init(coder:) has not been implemented") | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + | ||
| 119 | +} | 
ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/report/grow_empty_Image.imageset/Contents.json
0 → 100644
| @@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "idiom" : "universal", | ||
| 9 | + "filename" : "grow_empty_Image@2x.png", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file | 
ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/report/grow_empty_Image.imageset/grow_empty_Image@2x.png
0 → 100644
14.1 KB