Commit a313df9cdd5e7928b0ec432a07359aee5aa6334a

Authored by Cao yang
1 parent 4947c6d9
Exists in parentassistant

bug修改 视频云 接入

Showing 18 changed files with 197 additions and 132 deletions   Show diff stats
ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -2,32 +2,4 @@ @@ -2,32 +2,4 @@
2 <Bucket 2 <Bucket
3 type = "0" 3 type = "0"
4 version = "2.0"> 4 version = "2.0">
5 - <Breakpoints>  
6 - <BreakpointProxy  
7 - BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">  
8 - <BreakpointContent  
9 - shouldBeEnabled = "Yes"  
10 - ignoreCount = "0"  
11 - continueAfterRunningActions = "No"  
12 - scope = "0"  
13 - stopOnStyle = "0">  
14 - </BreakpointContent>  
15 - </BreakpointProxy>  
16 - <BreakpointProxy  
17 - BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">  
18 - <BreakpointContent  
19 - shouldBeEnabled = "Yes"  
20 - ignoreCount = "0"  
21 - continueAfterRunningActions = "No"  
22 - filePath = "ParentAssistant/Classes/util/NIM/YXMessageManager.swift"  
23 - timestampString = "546257540.733687"  
24 - startingColumnNumber = "9223372036854775807"  
25 - endingColumnNumber = "9223372036854775807"  
26 - startingLineNumber = "124"  
27 - endingLineNumber = "124"  
28 - landmarkName = "onReceive(_:)"  
29 - landmarkType = "7">  
30 - </BreakpointContent>  
31 - </BreakpointProxy>  
32 - </Breakpoints>  
33 </Bucket> 5 </Bucket>
ParentAssistant/ParentAssistant/AppDelegate.swift
@@ -55,22 +55,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { @@ -55,22 +55,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
55 } 55 }
56 //设置云信的appkey 56 //设置云信的appkey
57 func setUpYXIM(){ 57 func setUpYXIM(){
58 - var appkey = ""  
59 - var cername = ""  
60 - #if DEBUG  
61 - appkey = "330158c080acdf4dc1092d6a74576c2c"  
62 - cername = "parentdevelop"  
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 -// } 58 +
74 let option = NIMSDKOption(appKey: appkey) 59 let option = NIMSDKOption(appKey: appkey)
75 option.apnsCername = cername 60 option.apnsCername = cername
76 NIMSDK.shared().register(with: option) 61 NIMSDK.shared().register(with: option)
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Program/ProgramViewController.swift
@@ -55,14 +55,21 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat @@ -55,14 +55,21 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat
55 55
56 override func viewWillAppear(_ animated: Bool) { 56 override func viewWillAppear(_ animated: Bool) {
57 57
58 - let array = AccountManager.shared.getChildClassInfo()  
59 - if array.isEmpty { 58 +// let array = AccountManager.shared.getChildClassInfo()
  59 + if AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue.count == 0 {
60 self.view.addSubview(self.empty) 60 self.view.addSubview(self.empty)
61 self.tableView.isHidden = true 61 self.tableView.isHidden = true
62 }else{ 62 }else{
63 self.empty.removeFromSuperview() 63 self.empty.removeFromSuperview()
64 self.tableView.isHidden = false 64 self.tableView.isHidden = false
65 } 65 }
  66 +// if array.isEmpty {
  67 +// self.view.addSubview(self.empty)
  68 +// self.tableView.isHidden = true
  69 +// }else{
  70 +// self.empty.removeFromSuperview()
  71 +// self.tableView.isHidden = false
  72 +// }
66 } 73 }
67 74
68 75
@@ -126,9 +133,10 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat @@ -126,9 +133,10 @@ class ProgramViewController: UIViewController,UITableViewDelegate,UITableViewDat
126 vc.title = "补卡" 133 vc.title = "补卡"
127 self.navigationController?.pushViewController(vc, animated: true) 134 self.navigationController?.pushViewController(vc, animated: true)
128 case 2: 135 case 2:
129 - let vc = ProgramVacateViewController()  
130 - vc.title = "请假"  
131 - self.navigationController?.pushViewController(vc, animated: true) 136 + appDelegate.window?.makeToast("敬请期待!")
  137 +// let vc = ProgramVacateViewController()
  138 +// vc.title = "请假"
  139 +// self.navigationController?.pushViewController(vc, animated: true)
132 default: 140 default:
133 break 141 break
134 } 142 }
ParentAssistant/ParentAssistant/Classes/controllers/Grow/Report/ReportViewController.swift
@@ -34,25 +34,14 @@ class ReportViewController: UIViewController,UITableViewDelegate,UITableViewData @@ -34,25 +34,14 @@ class ReportViewController: UIViewController,UITableViewDelegate,UITableViewData
34 override func viewDidLoad() { 34 override func viewDidLoad() {
35 super.viewDidLoad() 35 super.viewDidLoad()
36 36
37 - setupDateView()  
38 -  
39 - self.view.addSubview(self.reportTable)  
40 - reportTable.snp.makeConstraints { (maker) in  
41 - maker.width.equalToSuperview()  
42 - maker.bottom.equalToSuperview()  
43 - maker.top.equalTo(60)  
44 - maker.centerX.equalToSuperview() 37 +// setupDateView()
  38 + ///功能暂未开放
  39 + let label = UILabel.init()
  40 + self.view.addSubview(label)
  41 + label.text = "敬请期待"
  42 + label.snp.makeConstraints { (maker) in
  43 + maker.center.equalToSuperview()
45 } 44 }
46 -  
47 - calendar = CalendarView.init(frame: CGRect.init(x: 0, y: 0, width: screenWidth, height: 245))  
48 - self.view.addSubview(calendar)  
49 - calendar.snp.makeConstraints { (maker) in  
50 - maker.width.equalToSuperview()  
51 - maker.height.equalTo(245)  
52 - maker.centerX.equalToSuperview()  
53 - maker.top.equalTo(headView)  
54 - }  
55 - calendar.isHidden = true  
56 } 45 }
57 override func viewDidLayoutSubviews() { 46 override func viewDidLayoutSubviews() {
58 DebugLog("横屏") 47 DebugLog("横屏")
@@ -75,6 +64,23 @@ class ReportViewController: UIViewController,UITableViewDelegate,UITableViewData @@ -75,6 +64,23 @@ class ReportViewController: UIViewController,UITableViewDelegate,UITableViewData
75 recognizer.direction = UISwipeGestureRecognizerDirection.down 64 recognizer.direction = UISwipeGestureRecognizerDirection.down
76 headView.addGestureRecognizer(recognizer) 65 headView.addGestureRecognizer(recognizer)
77 66
  67 + self.view.addSubview(self.reportTable)
  68 + reportTable.snp.makeConstraints { (maker) in
  69 + maker.width.equalToSuperview()
  70 + maker.bottom.equalToSuperview()
  71 + maker.top.equalTo(60)
  72 + maker.centerX.equalToSuperview()
  73 + }
  74 +
  75 + calendar = CalendarView.init(frame: CGRect.init(x: 0, y: 0, width: screenWidth, height: 245))
  76 + self.view.addSubview(calendar)
  77 + calendar.snp.makeConstraints { (maker) in
  78 + maker.width.equalToSuperview()
  79 + maker.height.equalTo(245)
  80 + maker.centerX.equalToSuperview()
  81 + maker.top.equalTo(headView)
  82 + }
  83 + calendar.isHidden = true
78 } 84 }
79 85
80 @objc func showView(){ 86 @objc func showView(){
ParentAssistant/ParentAssistant/Classes/controllers/Information/Controller/InformationViewController.swift
@@ -41,8 +41,8 @@ class InformationViewController: UIViewController,UISearchBarDelegate { @@ -41,8 +41,8 @@ class InformationViewController: UIViewController,UISearchBarDelegate {
41 41
42 override func viewDidLoad() { 42 override func viewDidLoad() {
43 super.viewDidLoad() 43 super.viewDidLoad()
44 -  
45 - let item = UIBarButtonItem.init(title: "返回", style: .plain, target: self, action: nil) 44 + localAddress = "越城区"
  45 + let item = UIBarButtonItem.init(title: "", style: .plain, target: self, action: nil)
46 self.navigationItem.backBarButtonItem = item 46 self.navigationItem.backBarButtonItem = item
47 47
48 drawTopUI() 48 drawTopUI()
@@ -54,13 +54,18 @@ class InformationViewController: UIViewController,UISearchBarDelegate { @@ -54,13 +54,18 @@ class InformationViewController: UIViewController,UISearchBarDelegate {
54 if isFirstviewController{ 54 if isFirstviewController{
55 let leftBtn = UIBarButtonItem.init(customView: self.leftCityView) 55 let leftBtn = UIBarButtonItem.init(customView: self.leftCityView)
56 self.navigationItem.leftBarButtonItem = leftBtn 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 - } 57 +
  58 +
  59 + self.leftLabel.text = "越城区"
  60 +
  61 + self.getDataFromNet()
  62 +// if localAddress == "未知" {
  63 +// LocationManger.shared.block = { str in
  64 +// localAddress = str
  65 +// self.leftLabel.text = localAddress
  66 +// self.getDataFromNet()
  67 +// }
  68 +// }
64 } 69 }
65 } 70 }
66 func drawTopUI(){ 71 func drawTopUI(){
@@ -94,7 +99,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { @@ -94,7 +99,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate {
94 position = 3 99 position = 3
95 } 100 }
96 group.enter() 101 group.enter()
97 - HTTPServer.shared.getAds(["position":position as AnyObject,"areaName":localAddress as AnyObject], completionHandler: { (str, error) in//getPercentEncodingString(str: localAddress) 102 + HTTPServer.shared.getAds(["position":position as AnyObject,"areaName":"越城区" as AnyObject], completionHandler: { (str, error) in//getPercentEncodingString(str: localAddress)
98 httpJsonResule(jsonString: str, error: error, successHandler: { (json) in 103 httpJsonResule(jsonString: str, error: error, successHandler: { (json) in
99 if json["status"] == 1 && error == nil{ 104 if json["status"] == 1 && error == nil{
100 self.topADs.removeAll() 105 self.topADs.removeAll()
@@ -199,27 +204,49 @@ class InformationViewController: UIViewController,UISearchBarDelegate { @@ -199,27 +204,49 @@ class InformationViewController: UIViewController,UISearchBarDelegate {
199 //MARK:轮播图跳转 204 //MARK:轮播图跳转
200 func chickImage(index:Int){ 205 func chickImage(index:Int){
201 206
202 - let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController  
203 -  
204 - if self.topADs.count > 0 {  
205 - let model = self.topADs[index]  
206 - let url = model.url  
207 - //已登录  
208 - if AccountManager.shared.isOnline() && url.contains(HOST_VIDEO){  
209 - let phone = UserDefaults.standard.value(forKey: "user_phone") as! String  
210 - let password = UserDefaults.standard.value(forKey: "user_password") as! String  
211 - let params = ["username":phone,"password":password]  
212 - HTTPServer.shared.otherToken(parameters: params as [String : AnyObject]) { (backData, error) in  
213 - if let token = backData {  
214 - vcs.webURL = url + "&Token=" + token  
215 - self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) 207 + if AccountManager.shared.isOnline(){
  208 +
  209 + if self.topADs.count > 0 {
  210 + let model = self.topADs[index]
  211 + if model.url.contains(HOST_VIDEO) {
  212 + let phone = UserDefaults.standard.value(forKey: "user_phone") as! String
  213 + let password = UserDefaults.standard.value(forKey: "user_password") as! String
  214 + let params = ["username":phone,"password":password,"type":"1"]
  215 + HTTPServer.shared.otherToken(parameters: params as [String : AnyObject]) { (backData, error) in
  216 + if let token = backData {
  217 + let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController
  218 + vcs.webURL = model.url + "&Token=" + token
  219 + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)
  220 + debugPrint(backData!)
  221 + }
216 } 222 }
  223 + }else{
  224 + let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController
  225 + vcs.webURL = model.url
  226 + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)
217 } 227 }
218 - }else{  
219 - vcs.webURL = url  
220 - self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)  
221 } 228 }
  229 + }else{
  230 + appDelegate.window?.makeToast("需要登录才能跳转!")
222 } 231 }
  232 +
  233 +
  234 +// if self.topADs.count > 0 {
  235 +// let model = self.topADs[index]
  236 +// let url = model.url
  237 +// //已登录
  238 +// if AccountManager.shared.isOnline() && url.contains(HOST_VIDEO){
  239 +// let phone = UserDefaults.standard.value(forKey: "user_phone") as! String
  240 +// let password = UserDefaults.standard.value(forKey: "user_password") as! String
  241 +// let params = ["username":phone,"password":password]
  242 +// HTTPServer.shared.otherToken(parameters: params as [String : AnyObject]) { (backData, error) in
  243 +// if let token = backData {
  244 +// vcs.webURL = url + "&Token=" + token
  245 +// self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)
  246 +// }
  247 +// }
  248 +
  249 +
223 } 250 }
224 } 251 }
225 // MARK: - XRCarouselViewDelegate 252 // MARK: - XRCarouselViewDelegate
@@ -333,7 +360,11 @@ extension InformationViewController:UICollectionViewDataSource,UICollectionViewD @@ -333,7 +360,11 @@ extension InformationViewController:UICollectionViewDataSource,UICollectionViewD
333 var reusableview:UICollectionReusableView? 360 var reusableview:UICollectionReusableView?
334 if kind == UICollectionElementKindSectionHeader{ 361 if kind == UICollectionElementKindSectionHeader{
335 let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "headerView", for: indexPath) as! InformationSectionHeader 362 let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "headerView", for: indexPath) as! InformationSectionHeader
336 - headerView.title.text = "咨讯话题" 363 + if isFirstviewController {
  364 + headerView.title.text = "资讯话题"
  365 + }else{
  366 + headerView.title.text = "热门资讯"
  367 + }
337 reusableview = headerView 368 reusableview = headerView
338 } 369 }
339 if indexPath.section == 2{ 370 if indexPath.section == 2{
ParentAssistant/ParentAssistant/Classes/controllers/main/JSViewController.swift
@@ -19,12 +19,15 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA @@ -19,12 +19,15 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA
19 var loadingView:UIView! 19 var loadingView:UIView!
20 var loadingImageWidth:CGFloat = 60 20 var loadingImageWidth:CGFloat = 60
21 var borderline:Bool = false//web页面有无边框 21 var borderline:Bool = false//web页面有无边框
  22 +
  23 + private var hasChildren:Bool!
22 override func viewDidLoad() { 24 override func viewDidLoad() {
23 super.viewDidLoad() 25 super.viewDidLoad()
24 - if let url = URL(string: webURL){  
25 - 26 + let childrenArr = AccountManager.shared.getChildClassInfo()
  27 + if childrenArr.count > 0 {
  28 + hasChildren = true
26 }else{ 29 }else{
27 - return 30 + hasChildren = false
28 } 31 }
29 // js配置 32 // js配置
30 // WKWebView的配置 33 // WKWebView的配置
@@ -46,7 +49,10 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA @@ -46,7 +49,10 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA
46 } 49 }
47 wkWebView.uiDelegate=self 50 wkWebView.uiDelegate=self
48 wkWebView.navigationDelegate=self 51 wkWebView.navigationDelegate=self
49 - self.wkWebView.load(Foundation.URLRequest(url: URL(string: webURL)!)) 52 +
  53 + if webURL.count > 0 {
  54 + self.wkWebView.load(URLRequest.init(url: URL.init(string: webURL)!))
  55 + }
50 wkWebView.addObserver(self, forKeyPath: "estimatedProgress", options: NSKeyValueObservingOptions.new, context: nil) 56 wkWebView.addObserver(self, forKeyPath: "estimatedProgress", options: NSKeyValueObservingOptions.new, context: nil)
51 wkWebView.addObserver(self, forKeyPath: "title", options: NSKeyValueObservingOptions.new, context: nil) 57 wkWebView.addObserver(self, forKeyPath: "title", options: NSKeyValueObservingOptions.new, context: nil)
52 if ary.count==0 { 58 if ary.count==0 {
@@ -122,8 +128,10 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA @@ -122,8 +128,10 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA
122 } 128 }
123 } 129 }
124 override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { 130 override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
  131 +
125 if keyPath=="estimatedProgress" { 132 if keyPath=="estimatedProgress" {
126 - if object as! WKWebView == self.wkWebView { 133 +
  134 + if object as? WKWebView == self.wkWebView {
127 self.progressView.alpha=1.0 135 self.progressView.alpha=1.0
128 self.progressView.setProgress(Float(wkWebView.estimatedProgress), animated: true) 136 self.progressView.setProgress(Float(wkWebView.estimatedProgress), animated: true)
129 DebugLog( "+++++++++++++++++\(Float(wkWebView.estimatedProgress))") 137 DebugLog( "+++++++++++++++++\(Float(wkWebView.estimatedProgress))")
@@ -136,9 +144,9 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA @@ -136,9 +144,9 @@ class JSViewController: UIViewController,WKUIDelegate,WKScriptMessageHandler,UIA
136 } 144 }
137 }else{ 145 }else{
138 super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) 146 super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
139 - } 147 + }
140 }else if keyPath=="title" { 148 }else if keyPath=="title" {
141 - if object as! WKWebView == self.wkWebView { 149 + if object as? WKWebView == self.wkWebView {
142 self.navigationItem.title=self.wkWebView.title 150 self.navigationItem.title=self.wkWebView.title
143 }else{ 151 }else{
144 super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) 152 super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/LoginViewController.swift
@@ -110,6 +110,28 @@ class LoginViewController: UITableViewController,UITextFieldDelegate { @@ -110,6 +110,28 @@ class LoginViewController: UITableViewController,UITextFieldDelegate {
110 // MARK: - 登录按钮 110 // MARK: - 登录按钮
111 @IBAction func loginAction(_ sender: UIButton) { 111 @IBAction func loginAction(_ sender: UIButton) {
112 self.view.endEditing(true) 112 self.view.endEditing(true)
  113 +
  114 + checkParent()
  115 + }
  116 + // MARK: - 判断是否为家长
  117 + func checkParent(){
  118 + SVProgressHUD.show()
  119 + HTTPServer.shared.checkParentType(phoneTextField.text!) { (backData, error) in
  120 + SVProgressHUD.dismiss()
  121 + if let isPatent = JSON.fromString(backData)!["data"].bool {
  122 + if isPatent {
  123 + self.gotoLoginAction()
  124 + }else{
  125 + appDelegate.window?.makeToast("账号未注册")
  126 +// if let message = JSON.fromString(backData)!["message"].string{
  127 +// appDelegate.window?.makeToast(message, duration: 1, position: nil)
  128 +// }
  129 + }
  130 + }
  131 + }
  132 + }
  133 + func gotoLoginAction(){
  134 +
113 SVProgressHUD.show(withStatus: "登录中...") 135 SVProgressHUD.show(withStatus: "登录中...")
114 HTTPServer.shared.login(completionHandler: { (str, error) in 136 HTTPServer.shared.login(completionHandler: { (str, error) in
115 SVProgressHUD.dismiss() 137 SVProgressHUD.dismiss()
@@ -173,7 +195,6 @@ class LoginViewController: UITableViewController,UITextFieldDelegate { @@ -173,7 +195,6 @@ class LoginViewController: UITableViewController,UITextFieldDelegate {
173 } 195 }
174 } 196 }
175 } 197 }
176 -  
177 // MARK: - 注册页面跳转 198 // MARK: - 注册页面跳转
178 @IBAction func registerAction(_ sender: UIButton) { 199 @IBAction func registerAction(_ sender: UIButton) {
179 let vc = Story.instantiateViewControllerWithIdentifier("RegisterViewController", storyName: "My") as! RegisterViewController 200 let vc = Story.instantiateViewControllerWithIdentifier("RegisterViewController", storyName: "My") as! RegisterViewController
ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/MyChildrenViewController.swift
@@ -31,10 +31,11 @@ class MyChildrenViewController: UIViewController{ @@ -31,10 +31,11 @@ class MyChildrenViewController: UIViewController{
31 emptyView.imageView.image=UIImage(named:"emptyset_1") 31 emptyView.imageView.image=UIImage(named:"emptyset_1")
32 emptyView.labelView.text="暂未关联孩子信息" 32 emptyView.labelView.text="暂未关联孩子信息"
33 emptyView.buttonView.isHidden=true 33 emptyView.buttonView.isHidden=true
34 - for j in AccountManager.shared.rawUserInfo!.contentData()["studentClass"].arrayValue {  
35 - myChildrens.append(StudentClassInfo(json: j)) 34 + if let j = AccountManager.shared.rawUserInfo?.contentData()["studentClass"].array{
  35 + for m in j {
  36 + myChildrens.append(StudentClassInfo(json: m))
  37 + }
36 } 38 }
37 -  
38 } 39 }
39 // MARK: - 添加绑定账号 40 // MARK: - 添加绑定账号
40 @IBAction func addChildrenAction(_ sender: UIButton) { 41 @IBAction func addChildrenAction(_ sender: UIButton) {
ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/MyViewController.swift
@@ -212,10 +212,15 @@ extension MyViewController: UITableViewDelegate,UITableViewDataSource{ @@ -212,10 +212,15 @@ extension MyViewController: UITableViewDelegate,UITableViewDataSource{
212 } 212 }
213 case 2://家校通订购 213 case 2://家校通订购
214 if AccountManager.shared.isOnline() { 214 if AccountManager.shared.isOnline() {
215 - let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController  
216 - vcs.borderline = true  
217 - vcs.webURL = "\(HOSTWAP!)/ParentOrderCenter.aspx?userid=\(AccountManager.shared.id())"  
218 - self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) 215 + let children = AccountManager.shared.getChildClassInfo()
  216 + if children.count > 0 {
  217 + let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController
  218 + vcs.borderline = true
  219 + vcs.webURL = "\(HOSTWAP!)/ParentOrderCenter.aspx?userid=\(AccountManager.shared.id())"
  220 + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)
  221 + }else{
  222 + appDelegate.window?.makeToast("绑定孩子后,才能订购!")
  223 + }
219 }else{ 224 }else{
220 appDelegate.window!.makeToast("请先登录", duration: 1, position: CSToastPositionCenter) 225 appDelegate.window!.makeToast("请先登录", duration: 1, position: CSToastPositionCenter)
221 } 226 }
ParentAssistant/ParentAssistant/Classes/controllers/my/userCenter/BindingViewController.swift
@@ -166,6 +166,7 @@ class BindingViewController: UIViewController { @@ -166,6 +166,7 @@ class BindingViewController: UIViewController {
166 if JSON.fromString(str)!["status"] == 1 && error == nil{ 166 if JSON.fromString(str)!["status"] == 1 && error == nil{
167 appDelegate.window!.makeToast("绑定成功") 167 appDelegate.window!.makeToast("绑定成功")
168 let vc = BindlingSuccessViewController() 168 let vc = BindlingSuccessViewController()
  169 + vc.bindlingSuccData = str!
169 self.navigationController?.pushViewController(vc, animated: true) 170 self.navigationController?.pushViewController(vc, animated: true)
170 }else{ 171 }else{
171 appDelegate.window!.makeToast("绑定失败") 172 appDelegate.window!.makeToast("绑定失败")
ParentAssistant/ParentAssistant/Classes/controllers/my/userCenter/BindlingSuccessViewController.swift
@@ -14,9 +14,15 @@ class BindlingSuccessViewController: UIViewController ,UIWebViewDelegate,UIScrol @@ -14,9 +14,15 @@ class BindlingSuccessViewController: UIViewController ,UIWebViewDelegate,UIScrol
14 var webBrowserView:UIView! 14 var webBrowserView:UIView!
15 var urlStr:String="http://60.190.202.57:8101/RecommendOrder.aspx?userid=" 15 var urlStr:String="http://60.190.202.57:8101/RecommendOrder.aspx?userid="
16 var bindlingType:Int = 1 16 var bindlingType:Int = 1
  17 +
  18 + var bindlingSuccData = String()
  19 +
17 override func viewDidLoad() { 20 override func viewDidLoad() {
18 super.viewDidLoad() 21 super.viewDidLoad()
19 self.view.backgroundColor = UIColor.white 22 self.view.backgroundColor = UIColor.white
  23 +
  24 +
  25 +
20 // Do any additional setup after loading the view. 26 // Do any additional setup after loading the view.
21 webView = UIWebView() 27 webView = UIWebView()
22 webView.frame = CGRect(x: 10, y: 0, width: getScreenWidth()-20, height: getScreenHeight()) 28 webView.frame = CGRect(x: 10, y: 0, width: getScreenWidth()-20, height: getScreenHeight())
@@ -51,7 +57,11 @@ class BindlingSuccessViewController: UIViewController ,UIWebViewDelegate,UIScrol @@ -51,7 +57,11 @@ class BindlingSuccessViewController: UIViewController ,UIWebViewDelegate,UIScrol
51 header.frame = CGRect(x: 10, y: 0, width: getScreenWidth()-20, height: 150) 57 header.frame = CGRect(x: 10, y: 0, width: getScreenWidth()-20, height: 150)
52 header.backgroundColor = UIColor.clear 58 header.backgroundColor = UIColor.clear
53 let label = UILabel(frame: CGRect(x: 10, y: 10, width: header.frame.width - 20, height: 100)) 59 let label = UILabel(frame: CGRect(x: 10, y: 10, width: header.frame.width - 20, height: 100))
54 - label.text = "生成孩子\"汇作业\"账号为:\(urlStr),\n初始密码为:\(urlStr)(与账号相同),\n孩子可以下载\"汇作业\"app进行使用,\n" 60 + if bindlingSuccData.count>0{
  61 + if let data = JSON.fromString(bindlingSuccData)?["data"].dictionary{
  62 + label.text = "生成孩子\"汇作业\"账号为:\(data["account"]?.stringValue ?? ""),\n初始密码为:\(data["passwprd"]?.stringValue ?? ""),\n孩子可以下载\"汇作业\"app进行使用,\n"
  63 + }
  64 + }
55 label.numberOfLines = 0 65 label.numberOfLines = 0
56 label.textColor = UIColor.darkGray 66 label.textColor = UIColor.darkGray
57 label.font = UIFont.systemFont(ofSize: 15) 67 label.font = UIFont.systemFont(ofSize: 15)
@@ -79,7 +89,7 @@ class BindlingSuccessViewController: UIViewController ,UIWebViewDelegate,UIScrol @@ -79,7 +89,7 @@ class BindlingSuccessViewController: UIViewController ,UIWebViewDelegate,UIScrol
79 backView.frame.size = CGSize(width: btn.frame.width+label2.frame.width+10, height: 30) 89 backView.frame.size = CGSize(width: btn.frame.width+label2.frame.width+10, height: 30)
80 backView.center = CGPoint(x: header.center.x-10, y: label.frame.maxY+10) 90 backView.center = CGPoint(x: header.center.x-10, y: label.frame.maxY+10)
81 header.frame.size.height = backView.frame.maxY + 10 91 header.frame.size.height = backView.frame.maxY + 10
82 - header.addSubview(backView) 92 +// header.addSubview(backView)
83 } 93 }
84 94
85 webBrowserView = webView.scrollView.subviews[0] 95 webBrowserView = webView.scrollView.subviews[0]
ParentAssistant/ParentAssistant/Classes/controllers/my/userCenter/UserCenter.storyboard
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> 2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3 <device id="retina4_7" orientation="portrait"> 3 <device id="retina4_7" orientation="portrait">
4 <adaptation id="fullscreen"/> 4 <adaptation id="fullscreen"/>
5 </device> 5 </device>
6 <dependencies> 6 <dependencies>
7 <deployment identifier="iOS"/> 7 <deployment identifier="iOS"/>
8 - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> 8 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
9 <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> 9 <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
10 <capability name="Safe area layout guides" minToolsVersion="9.0"/> 10 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
11 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 11 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -338,7 +338,7 @@ @@ -338,7 +338,7 @@
338 </connections> 338 </connections>
339 </tapGestureRecognizer> 339 </tapGestureRecognizer>
340 </objects> 340 </objects>
341 - <point key="canvasLocation" x="77.599999999999994" y="118.29085457271366"/> 341 + <point key="canvasLocation" x="-146" y="107"/>
342 </scene> 342 </scene>
343 <!--选择孩子学校--> 343 <!--选择孩子学校-->
344 <scene sceneID="jXC-xr-pan"> 344 <scene sceneID="jXC-xr-pan">
@@ -600,7 +600,7 @@ @@ -600,7 +600,7 @@
600 </scene> 600 </scene>
601 </scenes> 601 </scenes>
602 <resources> 602 <resources>
603 - <image name="evaluation_icon_pushDown" width="16" height="9"/> 603 + <image name="evaluation_icon_pushDown" width="178" height="100"/>
604 <image name="my_icon_confirmBtn" width="21" height="19"/> 604 <image name="my_icon_confirmBtn" width="21" height="19"/>
605 </resources> 605 </resources>
606 </document> 606 </document>
ParentAssistant/ParentAssistant/Classes/util/HTTPServer.swift
@@ -151,8 +151,10 @@ final class HTTPServer{ @@ -151,8 +151,10 @@ final class HTTPServer{
151 func updatePassword(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){ 151 func updatePassword(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
152 KHttp.POST(url: URL_USER_UPDATEPASSWORD, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler) 152 KHttp.POST(url: URL_USER_UPDATEPASSWORD, parameters: parameters,headers:["Authorization":token!], completionHandler: completionHandler)
153 } 153 }
154 -  
155 - 154 + //登录时判断是否是家长
  155 + func checkParentType(_ mobile:String,completionHandler:@escaping (String?, NSError?) -> Void){
  156 + KHttp.GET(url: URL_GET_PARENT_JUDGE,parameters:["mobile":mobile as AnyObject], completionHandler: completionHandler)
  157 + }
156 158
157 //家长注册 159 //家长注册
158 func parentRegister(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){ 160 func parentRegister(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
ParentAssistant/ParentAssistant/Classes/util/Macro.swift
@@ -39,16 +39,28 @@ let appsecret=&quot;sincere:3a530f39f99411b454e667d69693c127&quot; @@ -39,16 +39,28 @@ let appsecret=&quot;sincere:3a530f39f99411b454e667d69693c127&quot;
39 39
40 #if DEBUG 40 #if DEBUG
41 //测试网址 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 -let HOST_VIDEO:String! = "http://60.190.202.57:8812/" 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 +//let HOST_VIDEO:String! = "http://60.190.202.57:8812/"
  46 +var HOST:String! = "http://campus.myjxt.com"
  47 +var HOSTWAP:String! = "http://parent.myjxt.com"
  48 +var HOSTImage:String! = "http://manage.myjxt.com"
  49 +let HOST_VIDEO:String! = "http://www.sxspy.net/"
  50 +
  51 +//var appkey = "330158c080acdf4dc1092d6a74576c2c"
  52 +//var cername = "parentdevelop"
  53 +var appkey = "a1ff0bc08fa0d6f95b480d131e55584b"
  54 +var cername = "hxyproductpush"
46 #else 55 #else
47 //正式网址 56 //正式网址
48 var HOST:String! = "http://campus.myjxt.com" 57 var HOST:String! = "http://campus.myjxt.com"
49 var HOSTWAP:String! = "http://parent.myjxt.com" 58 var HOSTWAP:String! = "http://parent.myjxt.com"
50 var HOSTImage:String! = "http://manage.myjxt.com" 59 var HOSTImage:String! = "http://manage.myjxt.com"
51 let HOST_VIDEO:String! = "http://www.sxspy.net/" 60 let HOST_VIDEO:String! = "http://www.sxspy.net/"
  61 +//云信账号
  62 +var appkey = "a1ff0bc08fa0d6f95b480d131e55584b"
  63 +var cername = "hxyproductpush"
52 #endif 64 #endif
53 65
54 66
@@ -66,8 +78,9 @@ let URL_RESTPW=&quot;/api/Account/ReSetpass&quot; @@ -66,8 +78,9 @@ let URL_RESTPW=&quot;/api/Account/ReSetpass&quot;
66 let URL_SCANLOGINCODE = "/api/Account/ScanLogin" 78 let URL_SCANLOGINCODE = "/api/Account/ScanLogin"
67 let URL_IDENTITYLIST = "/api/Account/IdentityList" 79 let URL_IDENTITYLIST = "/api/Account/IdentityList"
68 let URL_IDENTITYCONFRIM = "/api/Account/IdentityConfrim" 80 let URL_IDENTITYCONFRIM = "/api/Account/IdentityConfrim"
69 - 81 +//MARK: ------ 登录 --------
70 let URL_PARENTREGISTER = "/api/ParentHelper/ParentRegister"//家长注册 82 let URL_PARENTREGISTER = "/api/ParentHelper/ParentRegister"//家长注册
  83 +let URL_GET_PARENT_JUDGE = "/api/ParentHelper/ParentJudge" //验证是否是家长账户
71 let URL_CAPTCHA="/api/Account/ChangePhoneCaptcha"//获取注册验证码 84 let URL_CAPTCHA="/api/Account/ChangePhoneCaptcha"//获取注册验证码
72 let URL_GETPARENTINFO = "/api/ParentHelper/GetParentInfo"//登录获取家长信息(包括关联的孩子信息区分绑定状态) 85 let URL_GETPARENTINFO = "/api/ParentHelper/GetParentInfo"//登录获取家长信息(包括关联的孩子信息区分绑定状态)
73 let URL_UPDATEPARENTINFO = "/api/ParentHelper/UpdateParentInfo"//更新姓名和性别 86 let URL_UPDATEPARENTINFO = "/api/ParentHelper/UpdateParentInfo"//更新姓名和性别
ParentAssistant/ParentAssistant/Classes/util/utils.swift
@@ -207,8 +207,8 @@ extension String{ @@ -207,8 +207,8 @@ extension String{
207 for i in 0 ..< digestLen { 207 for i in 0 ..< digestLen {
208 hash.appendFormat("%02x", result[i]) 208 hash.appendFormat("%02x", result[i])
209 } 209 }
210 -// result.deinitialize()  
211 - result.deinitialize(count: digestLen) 210 + result.deinitialize()
  211 +// result.deinitialize(count: digestLen)
212 return hash.uppercased 212 return hash.uppercased
213 } 213 }
214 } 214 }
ParentAssistant/ParentAssistant/Supporting Files/Base.lproj/Main.storyboard
@@ -1063,11 +1063,11 @@ @@ -1063,11 +1063,11 @@
1063 </objects> 1063 </objects>
1064 <point key="canvasLocation" x="913" y="-971"/> 1064 <point key="canvasLocation" x="913" y="-971"/>
1065 </scene> 1065 </scene>
1066 - <!--咨询频道--> 1066 + <!--资讯-->
1067 <scene sceneID="zMY-cK-guM"> 1067 <scene sceneID="zMY-cK-guM">
1068 <objects> 1068 <objects>
1069 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="40K-Kv-ipy" customClass="MainViewController" customModule="ParentAssistant" customModuleProvider="target" sceneMemberID="viewController"> 1069 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="40K-Kv-ipy" customClass="MainViewController" customModule="ParentAssistant" customModuleProvider="target" sceneMemberID="viewController">
1070 - <tabBarItem key="tabBarItem" title="咨询频道" image="Information_bar_icon" selectedImage="Information_bar_icon_select" id="0Ea-ls-Ren"/> 1070 + <tabBarItem key="tabBarItem" title="资讯" image="Information_bar_icon" selectedImage="Information_bar_icon_select" id="0Ea-ls-Ren"/>
1071 <toolbarItems/> 1071 <toolbarItems/>
1072 <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="bTJ-Ap-TDP"> 1072 <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="bTJ-Ap-TDP">
1073 <rect key="frame" x="0.0" y="20" width="375" height="44"/> 1073 <rect key="frame" x="0.0" y="20" width="375" height="44"/>
@@ -1104,11 +1104,11 @@ @@ -1104,11 +1104,11 @@
1104 </objects> 1104 </objects>
1105 <point key="canvasLocation" x="913" y="410"/> 1105 <point key="canvasLocation" x="913" y="410"/>
1106 </scene> 1106 </scene>
1107 - <!--个人中心--> 1107 + <!--我的-->
1108 <scene sceneID="k70-QL-d6T"> 1108 <scene sceneID="k70-QL-d6T">
1109 <objects> 1109 <objects>
1110 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="eER-h6-27H" customClass="MainViewController" customModule="ParentAssistant" customModuleProvider="target" sceneMemberID="viewController"> 1110 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="eER-h6-27H" customClass="MainViewController" customModule="ParentAssistant" customModuleProvider="target" sceneMemberID="viewController">
1111 - <tabBarItem key="tabBarItem" title="个人中心" image="my_bar_icon" selectedImage="my_bar_icon_select" id="Rn5-qq-H6e"> 1111 + <tabBarItem key="tabBarItem" title="我的" image="my_bar_icon" selectedImage="my_bar_icon_select" id="Rn5-qq-H6e">
1112 <color key="badgeColor" red="0.42745098039215684" green="0.54509803921568623" blue="0.99215686274509807" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> 1112 <color key="badgeColor" red="0.42745098039215684" green="0.54509803921568623" blue="0.99215686274509807" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
1113 </tabBarItem> 1113 </tabBarItem>
1114 <toolbarItems/> 1114 <toolbarItems/>
ParentAssistant/ParentAssistant/Supporting Files/Info.plist
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <plist version="1.0"> 3 <plist version="1.0">
4 <dict> 4 <dict>
5 <key>CFBundleDevelopmentRegion</key> 5 <key>CFBundleDevelopmentRegion</key>
6 - <string>$(DEVELOPMENT_LANGUAGE)</string> 6 + <string>zh_CN</string>
7 <key>CFBundleDisplayName</key> 7 <key>CFBundleDisplayName</key>
8 <string>家长慧</string> 8 <string>家长慧</string>
9 <key>CFBundleExecutable</key> 9 <key>CFBundleExecutable</key>
@@ -17,9 +17,9 @@ @@ -17,9 +17,9 @@
17 <key>CFBundlePackageType</key> 17 <key>CFBundlePackageType</key>
18 <string>APPL</string> 18 <string>APPL</string>
19 <key>CFBundleShortVersionString</key> 19 <key>CFBundleShortVersionString</key>
20 - <string>1.0.1</string> 20 + <string>1.0.2</string>
21 <key>CFBundleVersion</key> 21 <key>CFBundleVersion</key>
22 - <string>13</string> 22 + <string>15</string>
23 <key>ITSAppUsesNonExemptEncryption</key> 23 <key>ITSAppUsesNonExemptEncryption</key>
24 <false/> 24 <false/>
25 <key>LSRequiresIPhoneOS</key> 25 <key>LSRequiresIPhoneOS</key>
@@ -29,6 +29,8 @@ @@ -29,6 +29,8 @@
29 <key>NSAllowsArbitraryLoads</key> 29 <key>NSAllowsArbitraryLoads</key>
30 <true/> 30 <true/>
31 </dict> 31 </dict>
  32 + <key>NSLocationUsageDescription</key>
  33 + <string>家长慧将根据您的地理位置信息,获取与位置相匹配的学校和新闻信息</string>
32 <key>NSLocationWhenInUseUsageDescription</key> 34 <key>NSLocationWhenInUseUsageDescription</key>
33 <string>家长慧将根据您的地理位置信息,获取与位置相匹配的学校和新闻信息</string> 35 <string>家长慧将根据您的地理位置信息,获取与位置相匹配的学校和新闻信息</string>
34 <key>NSMicrophoneUsageDescription</key> 36 <key>NSMicrophoneUsageDescription</key>