diff --git a/ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj b/ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj index 9e6867f..67f7dd9 100644 --- a/ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj +++ b/ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj @@ -250,6 +250,7 @@ AD64A2C4207F28EB00B25E80 /* ProgramVacateBodyTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProgramVacateBodyTableViewCell.xib; sourceTree = ""; }; AD65FB77206354220052415B /* MoralTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoralTableViewCell.swift; sourceTree = ""; }; AD65FB7920637F110052415B /* MoralViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoralViewController.swift; sourceTree = ""; }; + ADA398FD208EFBE600AD9296 /* ParentAssistant.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ParentAssistant.entitlements; sourceTree = ""; }; ADAEA3972064960300A47D2C /* SceneDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDetailViewController.swift; sourceTree = ""; }; ADAEA3992064C44900A47D2C /* LineChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartView.swift; sourceTree = ""; }; ADC9AB71207C55CE00348EF1 /* GrowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrowViewController.swift; sourceTree = ""; }; @@ -654,9 +655,9 @@ ADCDA074208B3FED004F1852 /* Controller */ = { isa = PBXGroup; children = ( - 599364DD204E62E700C8B371 /* ChannelViewController.swift */, 599364DE204E62E700C8B371 /* Information.storyboard */, 599364E1204E62E700C8B371 /* InformationViewController.swift */, + 599364DD204E62E700C8B371 /* ChannelViewController.swift */, ); path = Controller; sourceTree = ""; @@ -745,6 +746,7 @@ BF7A4C32204CD55300460463 /* ParentAssistant */ = { isa = PBXGroup; children = ( + ADA398FD208EFBE600AD9296 /* ParentAssistant.entitlements */, BF7A4C33204CD55300460463 /* AppDelegate.swift */, 5993652B20528D5700C8B371 /* MainViewController.swift */, BF7A4C6B204E320700460463 /* Classes */, @@ -970,6 +972,11 @@ CreatedOnToolsVersion = 9.2; LastSwiftMigration = 0920; ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Push = { + enabled = 1; + }; + }; }; BF7A4C46204CD55500460463 = { CreatedOnToolsVersion = 9.2; @@ -1391,6 +1398,8 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = ParentAssistant/ParentAssistant.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 8Q3BYL2H66; @@ -1421,6 +1430,8 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = ParentAssistant/ParentAssistant.entitlements; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 8Q3BYL2H66; diff --git a/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate b/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate index 9f211b2..911e7a9 100644 Binary files a/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate and b/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index e2573a5..c64041a 100644 --- a/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/ParentAssistant/ParentAssistant.xcworkspace/xcuserdata/caoyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -13,5 +13,21 @@ stopOnStyle = "0"> + + + + diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Information/Controller/InformationViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Information/Controller/InformationViewController.swift index 4e661d5..b43963e 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Information/Controller/InformationViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Information/Controller/InformationViewController.swift @@ -183,23 +183,50 @@ class InformationViewController: UIViewController,UISearchBarDelegate { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } - + //MARK: - 跳转Web页面 //点击资讯进入详情 func pushToInfoView(index:Int){ let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController - if data.channelContent[index].url != "" { - vcs.webURL = data.channelContent[index].url - }else{ - vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[index].id)"+"&areaname="+localAddress).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! + if data.channelContent.count > 0 { + let url = data.channelContent[index].url + if url.count>0 { + vcs.webURL = url + }else{ + vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[index].id)"+"&areaname="+localAddress).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) + } + } + } + //MARK:轮播图跳转 + func chickImage(index:Int){ + + let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController + + if self.topADs.count > 0 { + let model = self.topADs[index] + let url = model.url + //已登录 + if AccountManager.shared.isOnline() && url.contains(HOST_VIDEO){ + let phone = UserDefaults.standard.value(forKey: "user_phone") as! String + let password = UserDefaults.standard.value(forKey: "user_password") as! String + let params = ["username":phone,"password":password] + HTTPServer.shared.otherToken(parameters: params as [String : AnyObject]) { (backData, error) in + if let token = backData { + vcs.webURL = url + "&Token=" + token + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) + } + } + }else{ + vcs.webURL = url + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) + } } - self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) } - } - +// MARK: - XRCarouselViewDelegate extension InformationViewController:XRCarouselViewDelegate{ func carouselView(_ carouselView: XRCarouselView!, clickImageAt index: Int) { - pushToInfoView(index: index) + chickImage(index: index) } } @@ -250,6 +277,7 @@ extension InformationViewController:UICollectionViewDataSource,UICollectionViewD switch indexPath.section { case 0: let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "topCell", for: indexPath) as! InformationViewTopCell + cell.headerImageView.delegate = self if topADs.count > 0 { var arr:[String]=[] for item in topADs{ @@ -324,11 +352,12 @@ class InformationSectionHeader: UICollectionReusableView { } -//首页的轮播图所在的cell +//MARK: - 首页的轮播图所在的cell class InformationViewTopCell: UICollectionViewCell { @IBOutlet weak var headerImageView: XRCarouselView! + } //视频cell diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/LoginViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/LoginViewController.swift index 57c89fb..d6f16a3 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/LoginViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/LoginViewController.swift @@ -157,6 +157,10 @@ class LoginViewController: UITableViewController,UITextFieldDelegate { }, phone: phoneTextField.text!, password: passwordTextField.text!) } func loadUserInfo(){ + //保存手机号密码 + UserDefaults.standard.setValue(self.phoneTextField.text!, forKey: "user_phone") + UserDefaults.standard.setValue(self.passwordTextField.text!, forKey: "user_password") + //登录云信 let ID=AccountManager.shared.rawUserInfo!.contentData()["userid"].stringValue YXMessageManager.share.loginWithYX(account: ID, token: ID.md5()) { (success) in SVProgressHUD.dismiss() diff --git a/ParentAssistant/ParentAssistant/Classes/util/HTTPServer.swift b/ParentAssistant/ParentAssistant/Classes/util/HTTPServer.swift index 4c4fe19..3bdf3b9 100644 --- a/ParentAssistant/ParentAssistant/Classes/util/HTTPServer.swift +++ b/ParentAssistant/ParentAssistant/Classes/util/HTTPServer.swift @@ -36,7 +36,13 @@ final class KHttp{ // } // } - let requestUrl = HOST + url + var requestUrl = "" + //视频云 + if url.contains(HOST_VIDEO){ + requestUrl = url + }else{ + requestUrl = HOST + url + } request(requestUrl, method: method, parameters: parameters, encoding: encoding, headers: headers).responseString { (response) -> Void in let error=response.result.error let str=response.result.value @@ -91,7 +97,10 @@ final class HTTPServer{ var token:String?{ return AccountManager.shared.token } - + //MARK:视频云Token + func otherToken(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){ + KHttp.POST(url: HOST_VIDEO+"RoleLogin/GetToken", parameters: parameters, completionHandler: completionHandler) + } //上传图片 func uploadFile(file:NSURL,progress:((Int64, Int64, Int64) -> Void)? = nil,completionHandler: @escaping (String?, NSError?) -> Void){ upload(multipartFormData: { (multipartFormData) in diff --git a/ParentAssistant/ParentAssistant/Classes/util/Macro.swift b/ParentAssistant/ParentAssistant/Classes/util/Macro.swift index 6fee927..941b1a8 100644 --- a/ParentAssistant/ParentAssistant/Classes/util/Macro.swift +++ b/ParentAssistant/ParentAssistant/Classes/util/Macro.swift @@ -42,14 +42,17 @@ let appsecret="sincere:3a530f39f99411b454e667d69693c127" var HOST:String! = "http://60.190.202.57:1000" var HOSTWAP:String! = "http://60.190.202.57:8101" var HOSTImage:String! = "http://60.190.202.57:8196" +let HOST_VIDEO:String! = "http://60.190.202.57:8812/" #else //正式网址 var HOST:String! = "http://campus.myjxt.com" var HOSTWAP:String! = "http://parent.myjxt.com" var HOSTImage:String! = "http://manage.myjxt.com" +let HOST_VIDEO:String! = "http://www.sxspy.net/" #endif + let URL_UPLOAD_FILE=HOST+"/api/Class/UploadFile" //上传图片 var URL_GETHOSTURL:String! = "http://campus.myjxt.com/api/Common/GetListSchoolPrivate" diff --git a/ParentAssistant/ParentAssistant/Classes/util/NIM/YXMessageManager.swift b/ParentAssistant/ParentAssistant/Classes/util/NIM/YXMessageManager.swift index 3d0d92d..0aea7f6 100644 --- a/ParentAssistant/ParentAssistant/Classes/util/NIM/YXMessageManager.swift +++ b/ParentAssistant/ParentAssistant/Classes/util/NIM/YXMessageManager.swift @@ -89,7 +89,7 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa * @discussion 这个回调主要用于客户端UI的刷新 */ func onLogin(_ step: NIMLoginStep) { - + } /** * 自动登录失败回调 @@ -101,16 +101,19 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa func onAutoLoginFailed(_ error: Error) { AccountManager.shared.logOut() } + //MARK: - 接收自定义消息 func onReceive(_ notification: NIMCustomSystemNotification) { if let info=JSON.fromString(notification.content) { - if info["type"].stringValue=="attach"{//群发通知 + + switch info["type"].stringValue{ + case "attach": //群发通知 let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message attachItem.date=Date(timeIntervalSince1970: notification.timestamp) attachItem.content = info["content"].stringValue attachItem.ownId = AccountManager.shared.userid attachItem.save() NotificationCenter.default.post(name: Notification.Name(rawValue: MessageNotification.receiveMessage), object: nil, userInfo: nil) - }else if info["type"].stringValue=="ordermess"{//订购通知 + case "ordermess"://订购通知 let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message attachItem.date=Date(timeIntervalSince1970: notification.timestamp) attachItem.type = "ordermess" @@ -118,7 +121,18 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa attachItem.ownId = AccountManager.shared.userid attachItem.save() NotificationCenter.default.post(name: Notification.Name(rawValue: MessageNotification.receiveMessage), object: nil, userInfo: nil) + case "attend": //考勤通知 + let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message + attachItem.date=Date(timeIntervalSince1970: notification.timestamp) + attachItem.type = "attend" + attachItem.content = info["content"].stringValue + attachItem.ownId = AccountManager.shared.userid + attachItem.save() + NotificationCenter.default.post(name: Notification.Name(rawValue: MessageNotification.receiveMessage), object: nil, userInfo: nil) + default: + break } } } + } diff --git a/ParentAssistant/ParentAssistant/ParentAssistant.entitlements b/ParentAssistant/ParentAssistant/ParentAssistant.entitlements new file mode 100644 index 0000000..903def2 --- /dev/null +++ b/ParentAssistant/ParentAssistant/ParentAssistant.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + -- libgit2 0.21.0