Commit 7329d3a014eb2bee560db59fd141de885b1b3539

Authored by Cao yang
1 parent bd4199db
Exists in parentassistant

添加轮播图跳转,补卡通知等

ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj
@@ -250,6 +250,7 @@ @@ -250,6 +250,7 @@
250 AD64A2C4207F28EB00B25E80 /* ProgramVacateBodyTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProgramVacateBodyTableViewCell.xib; sourceTree = "<group>"; }; 250 AD64A2C4207F28EB00B25E80 /* ProgramVacateBodyTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProgramVacateBodyTableViewCell.xib; sourceTree = "<group>"; };
251 AD65FB77206354220052415B /* MoralTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoralTableViewCell.swift; sourceTree = "<group>"; }; 251 AD65FB77206354220052415B /* MoralTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoralTableViewCell.swift; sourceTree = "<group>"; };
252 AD65FB7920637F110052415B /* MoralViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoralViewController.swift; sourceTree = "<group>"; }; 252 AD65FB7920637F110052415B /* MoralViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoralViewController.swift; sourceTree = "<group>"; };
  253 + ADA398FD208EFBE600AD9296 /* ParentAssistant.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ParentAssistant.entitlements; sourceTree = "<group>"; };
253 ADAEA3972064960300A47D2C /* SceneDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDetailViewController.swift; sourceTree = "<group>"; }; 254 ADAEA3972064960300A47D2C /* SceneDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDetailViewController.swift; sourceTree = "<group>"; };
254 ADAEA3992064C44900A47D2C /* LineChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartView.swift; sourceTree = "<group>"; }; 255 ADAEA3992064C44900A47D2C /* LineChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartView.swift; sourceTree = "<group>"; };
255 ADC9AB71207C55CE00348EF1 /* GrowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrowViewController.swift; sourceTree = "<group>"; }; 256 ADC9AB71207C55CE00348EF1 /* GrowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrowViewController.swift; sourceTree = "<group>"; };
@@ -654,9 +655,9 @@ @@ -654,9 +655,9 @@
654 ADCDA074208B3FED004F1852 /* Controller */ = { 655 ADCDA074208B3FED004F1852 /* Controller */ = {
655 isa = PBXGroup; 656 isa = PBXGroup;
656 children = ( 657 children = (
657 - 599364DD204E62E700C8B371 /* ChannelViewController.swift */,  
658 599364DE204E62E700C8B371 /* Information.storyboard */, 658 599364DE204E62E700C8B371 /* Information.storyboard */,
659 599364E1204E62E700C8B371 /* InformationViewController.swift */, 659 599364E1204E62E700C8B371 /* InformationViewController.swift */,
  660 + 599364DD204E62E700C8B371 /* ChannelViewController.swift */,
660 ); 661 );
661 path = Controller; 662 path = Controller;
662 sourceTree = "<group>"; 663 sourceTree = "<group>";
@@ -745,6 +746,7 @@ @@ -745,6 +746,7 @@
745 BF7A4C32204CD55300460463 /* ParentAssistant */ = { 746 BF7A4C32204CD55300460463 /* ParentAssistant */ = {
746 isa = PBXGroup; 747 isa = PBXGroup;
747 children = ( 748 children = (
  749 + ADA398FD208EFBE600AD9296 /* ParentAssistant.entitlements */,
748 BF7A4C33204CD55300460463 /* AppDelegate.swift */, 750 BF7A4C33204CD55300460463 /* AppDelegate.swift */,
749 5993652B20528D5700C8B371 /* MainViewController.swift */, 751 5993652B20528D5700C8B371 /* MainViewController.swift */,
750 BF7A4C6B204E320700460463 /* Classes */, 752 BF7A4C6B204E320700460463 /* Classes */,
@@ -970,6 +972,11 @@ @@ -970,6 +972,11 @@
970 CreatedOnToolsVersion = 9.2; 972 CreatedOnToolsVersion = 9.2;
971 LastSwiftMigration = 0920; 973 LastSwiftMigration = 0920;
972 ProvisioningStyle = Automatic; 974 ProvisioningStyle = Automatic;
  975 + SystemCapabilities = {
  976 + com.apple.Push = {
  977 + enabled = 1;
  978 + };
  979 + };
973 }; 980 };
974 BF7A4C46204CD55500460463 = { 981 BF7A4C46204CD55500460463 = {
975 CreatedOnToolsVersion = 9.2; 982 CreatedOnToolsVersion = 9.2;
@@ -1391,6 +1398,8 @@ @@ -1391,6 +1398,8 @@
1391 buildSettings = { 1398 buildSettings = {
1392 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 1399 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1393 CLANG_ENABLE_MODULES = YES; 1400 CLANG_ENABLE_MODULES = YES;
  1401 + CODE_SIGN_ENTITLEMENTS = ParentAssistant/ParentAssistant.entitlements;
  1402 + CODE_SIGN_IDENTITY = "iPhone Developer";
1394 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 1403 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1395 CODE_SIGN_STYLE = Automatic; 1404 CODE_SIGN_STYLE = Automatic;
1396 DEVELOPMENT_TEAM = 8Q3BYL2H66; 1405 DEVELOPMENT_TEAM = 8Q3BYL2H66;
@@ -1421,6 +1430,8 @@ @@ -1421,6 +1430,8 @@
1421 buildSettings = { 1430 buildSettings = {
1422 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 1431 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1423 CLANG_ENABLE_MODULES = YES; 1432 CLANG_ENABLE_MODULES = YES;
  1433 + CODE_SIGN_ENTITLEMENTS = ParentAssistant/ParentAssistant.entitlements;
  1434 + CODE_SIGN_IDENTITY = "iPhone Developer";
1424 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 1435 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1425 CODE_SIGN_STYLE = Automatic; 1436 CODE_SIGN_STYLE = Automatic;
1426 DEVELOPMENT_TEAM = 8Q3BYL2H66; 1437 DEVELOPMENT_TEAM = 8Q3BYL2H66;
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,5 +13,21 @@ @@ -13,5 +13,21 @@
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/util/NIM/YXMessageManager.swift"
  23 + timestampString = "546255709.753268"
  24 + startingColumnNumber = "9223372036854775807"
  25 + endingColumnNumber = "9223372036854775807"
  26 + startingLineNumber = "124"
  27 + endingLineNumber = "124"
  28 + landmarkName = "onReceive(_:)"
  29 + landmarkType = "7">
  30 + </BreakpointContent>
  31 + </BreakpointProxy>
16 </Breakpoints> 32 </Breakpoints>
17 </Bucket> 33 </Bucket>
ParentAssistant/ParentAssistant/Classes/controllers/Information/Controller/InformationViewController.swift
@@ -183,23 +183,50 @@ class InformationViewController: UIViewController,UISearchBarDelegate { @@ -183,23 +183,50 @@ class InformationViewController: UIViewController,UISearchBarDelegate {
183 super.didReceiveMemoryWarning() 183 super.didReceiveMemoryWarning()
184 // Dispose of any resources that can be recreated. 184 // Dispose of any resources that can be recreated.
185 } 185 }
186 - 186 + //MARK: - 跳转Web页面
187 //点击资讯进入详情 187 //点击资讯进入详情
188 func pushToInfoView(index:Int){ 188 func pushToInfoView(index:Int){
189 let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController 189 let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController
190 - if data.channelContent[index].url != "" {  
191 - vcs.webURL = data.channelContent[index].url  
192 - }else{  
193 - vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[index].id)"+"&areaname="+localAddress).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! 190 + if data.channelContent.count > 0 {
  191 + let url = data.channelContent[index].url
  192 + if url.count>0 {
  193 + vcs.webURL = url
  194 + }else{
  195 + vcs.webURL = (HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[index].id)"+"&areaname="+localAddress).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
  196 + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)
  197 + }
  198 + }
  199 + }
  200 + //MARK:轮播图跳转
  201 + func chickImage(index:Int){
  202 +
  203 + let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController
  204 +
  205 + if self.topADs.count > 0 {
  206 + let model = self.topADs[index]
  207 + let url = model.url
  208 + //已登录
  209 + if AccountManager.shared.isOnline() && url.contains(HOST_VIDEO){
  210 + let phone = UserDefaults.standard.value(forKey: "user_phone") as! String
  211 + let password = UserDefaults.standard.value(forKey: "user_password") as! String
  212 + let params = ["username":phone,"password":password]
  213 + HTTPServer.shared.otherToken(parameters: params as [String : AnyObject]) { (backData, error) in
  214 + if let token = backData {
  215 + vcs.webURL = url + "&Token=" + token
  216 + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)
  217 + }
  218 + }
  219 + }else{
  220 + vcs.webURL = url
  221 + self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)
  222 + }
194 } 223 }
195 - self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil)  
196 } 224 }
197 -  
198 } 225 }
199 - 226 +// MARK: - XRCarouselViewDelegate
200 extension InformationViewController:XRCarouselViewDelegate{ 227 extension InformationViewController:XRCarouselViewDelegate{
201 func carouselView(_ carouselView: XRCarouselView!, clickImageAt index: Int) { 228 func carouselView(_ carouselView: XRCarouselView!, clickImageAt index: Int) {
202 - pushToInfoView(index: index) 229 + chickImage(index: index)
203 } 230 }
204 } 231 }
205 232
@@ -250,6 +277,7 @@ extension InformationViewController:UICollectionViewDataSource,UICollectionViewD @@ -250,6 +277,7 @@ extension InformationViewController:UICollectionViewDataSource,UICollectionViewD
250 switch indexPath.section { 277 switch indexPath.section {
251 case 0: 278 case 0:
252 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "topCell", for: indexPath) as! InformationViewTopCell 279 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "topCell", for: indexPath) as! InformationViewTopCell
  280 + cell.headerImageView.delegate = self
253 if topADs.count > 0 { 281 if topADs.count > 0 {
254 var arr:[String]=[] 282 var arr:[String]=[]
255 for item in topADs{ 283 for item in topADs{
@@ -324,11 +352,12 @@ class InformationSectionHeader: UICollectionReusableView { @@ -324,11 +352,12 @@ class InformationSectionHeader: UICollectionReusableView {
324 352
325 } 353 }
326 354
327 -//首页的轮播图所在的cell 355 +//MARK: - 首页的轮播图所在的cell
328 class InformationViewTopCell: UICollectionViewCell { 356 class InformationViewTopCell: UICollectionViewCell {
329 357
330 @IBOutlet weak var headerImageView: XRCarouselView! 358 @IBOutlet weak var headerImageView: XRCarouselView!
331 359
  360 +
332 } 361 }
333 362
334 //视频cell 363 //视频cell
ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/LoginViewController.swift
@@ -157,6 +157,10 @@ class LoginViewController: UITableViewController,UITextFieldDelegate { @@ -157,6 +157,10 @@ class LoginViewController: UITableViewController,UITextFieldDelegate {
157 }, phone: phoneTextField.text!, password: passwordTextField.text!) 157 }, phone: phoneTextField.text!, password: passwordTextField.text!)
158 } 158 }
159 func loadUserInfo(){ 159 func loadUserInfo(){
  160 + //保存手机号密码
  161 + UserDefaults.standard.setValue(self.phoneTextField.text!, forKey: "user_phone")
  162 + UserDefaults.standard.setValue(self.passwordTextField.text!, forKey: "user_password")
  163 + //登录云信
160 let ID=AccountManager.shared.rawUserInfo!.contentData()["userid"].stringValue 164 let ID=AccountManager.shared.rawUserInfo!.contentData()["userid"].stringValue
161 YXMessageManager.share.loginWithYX(account: ID, token: ID.md5()) { (success) in 165 YXMessageManager.share.loginWithYX(account: ID, token: ID.md5()) { (success) in
162 SVProgressHUD.dismiss() 166 SVProgressHUD.dismiss()
ParentAssistant/ParentAssistant/Classes/util/HTTPServer.swift
@@ -36,7 +36,13 @@ final class KHttp{ @@ -36,7 +36,13 @@ final class KHttp{
36 // } 36 // }
37 // } 37 // }
38 38
39 - let requestUrl = HOST + url 39 + var requestUrl = ""
  40 + //视频云
  41 + if url.contains(HOST_VIDEO){
  42 + requestUrl = url
  43 + }else{
  44 + requestUrl = HOST + url
  45 + }
40 request(requestUrl, method: method, parameters: parameters, encoding: encoding, headers: headers).responseString { (response) -> Void in 46 request(requestUrl, method: method, parameters: parameters, encoding: encoding, headers: headers).responseString { (response) -> Void in
41 let error=response.result.error 47 let error=response.result.error
42 let str=response.result.value 48 let str=response.result.value
@@ -91,7 +97,10 @@ final class HTTPServer{ @@ -91,7 +97,10 @@ final class HTTPServer{
91 var token:String?{ 97 var token:String?{
92 return AccountManager.shared.token 98 return AccountManager.shared.token
93 } 99 }
94 - 100 + //MARK:视频云Token
  101 + func otherToken(parameters: [String : AnyObject]?,completionHandler:@escaping (String?, NSError?) -> ()){
  102 + KHttp.POST(url: HOST_VIDEO+"RoleLogin/GetToken", parameters: parameters, completionHandler: completionHandler)
  103 + }
95 //上传图片 104 //上传图片
96 func uploadFile(file:NSURL,progress:((Int64, Int64, Int64) -> Void)? = nil,completionHandler: @escaping (String?, NSError?) -> Void){ 105 func uploadFile(file:NSURL,progress:((Int64, Int64, Int64) -> Void)? = nil,completionHandler: @escaping (String?, NSError?) -> Void){
97 upload(multipartFormData: { (multipartFormData) in 106 upload(multipartFormData: { (multipartFormData) in
ParentAssistant/ParentAssistant/Classes/util/Macro.swift
@@ -42,14 +42,17 @@ let appsecret=&quot;sincere:3a530f39f99411b454e667d69693c127&quot; @@ -42,14 +42,17 @@ let appsecret=&quot;sincere:3a530f39f99411b454e667d69693c127&quot;
42 var HOST:String! = "http://60.190.202.57:1000" 42 var HOST:String! = "http://60.190.202.57:1000"
43 var HOSTWAP:String! = "http://60.190.202.57:8101" 43 var HOSTWAP:String! = "http://60.190.202.57:8101"
44 var HOSTImage:String! = "http://60.190.202.57:8196" 44 var HOSTImage:String! = "http://60.190.202.57:8196"
  45 +let HOST_VIDEO:String! = "http://60.190.202.57:8812/"
45 #else 46 #else
46 //正式网址 47 //正式网址
47 var HOST:String! = "http://campus.myjxt.com" 48 var HOST:String! = "http://campus.myjxt.com"
48 var HOSTWAP:String! = "http://parent.myjxt.com" 49 var HOSTWAP:String! = "http://parent.myjxt.com"
49 var HOSTImage:String! = "http://manage.myjxt.com" 50 var HOSTImage:String! = "http://manage.myjxt.com"
  51 +let HOST_VIDEO:String! = "http://www.sxspy.net/"
50 #endif 52 #endif
51 53
52 54
  55 +
53 let URL_UPLOAD_FILE=HOST+"/api/Class/UploadFile" //上传图片 56 let URL_UPLOAD_FILE=HOST+"/api/Class/UploadFile" //上传图片
54 57
55 var URL_GETHOSTURL:String! = "http://campus.myjxt.com/api/Common/GetListSchoolPrivate" 58 var URL_GETHOSTURL:String! = "http://campus.myjxt.com/api/Common/GetListSchoolPrivate"
ParentAssistant/ParentAssistant/Classes/util/NIM/YXMessageManager.swift
@@ -89,7 +89,7 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa @@ -89,7 +89,7 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa
89 * @discussion 这个回调主要用于客户端UI的刷新 89 * @discussion 这个回调主要用于客户端UI的刷新
90 */ 90 */
91 func onLogin(_ step: NIMLoginStep) { 91 func onLogin(_ step: NIMLoginStep) {
92 - 92 +
93 } 93 }
94 /** 94 /**
95 * 自动登录失败回调 95 * 自动登录失败回调
@@ -101,16 +101,19 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa @@ -101,16 +101,19 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa
101 func onAutoLoginFailed(_ error: Error) { 101 func onAutoLoginFailed(_ error: Error) {
102 AccountManager.shared.logOut() 102 AccountManager.shared.logOut()
103 } 103 }
  104 + //MARK: - 接收自定义消息
104 func onReceive(_ notification: NIMCustomSystemNotification) { 105 func onReceive(_ notification: NIMCustomSystemNotification) {
105 if let info=JSON.fromString(notification.content) { 106 if let info=JSON.fromString(notification.content) {
106 - if info["type"].stringValue=="attach"{//群发通知 107 +
  108 + switch info["type"].stringValue{
  109 + case "attach": //群发通知
107 let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message 110 let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message
108 attachItem.date=Date(timeIntervalSince1970: notification.timestamp) 111 attachItem.date=Date(timeIntervalSince1970: notification.timestamp)
109 attachItem.content = info["content"].stringValue 112 attachItem.content = info["content"].stringValue
110 attachItem.ownId = AccountManager.shared.userid 113 attachItem.ownId = AccountManager.shared.userid
111 attachItem.save() 114 attachItem.save()
112 NotificationCenter.default.post(name: Notification.Name(rawValue: MessageNotification.receiveMessage), object: nil, userInfo: nil) 115 NotificationCenter.default.post(name: Notification.Name(rawValue: MessageNotification.receiveMessage), object: nil, userInfo: nil)
113 - }else if info["type"].stringValue=="ordermess"{//订购通知 116 + case "ordermess"://订购通知
114 let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message 117 let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message
115 attachItem.date=Date(timeIntervalSince1970: notification.timestamp) 118 attachItem.date=Date(timeIntervalSince1970: notification.timestamp)
116 attachItem.type = "ordermess" 119 attachItem.type = "ordermess"
@@ -118,7 +121,18 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa @@ -118,7 +121,18 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa
118 attachItem.ownId = AccountManager.shared.userid 121 attachItem.ownId = AccountManager.shared.userid
119 attachItem.save() 122 attachItem.save()
120 NotificationCenter.default.post(name: Notification.Name(rawValue: MessageNotification.receiveMessage), object: nil, userInfo: nil) 123 NotificationCenter.default.post(name: Notification.Name(rawValue: MessageNotification.receiveMessage), object: nil, userInfo: nil)
  124 + case "attend": //考勤通知
  125 + let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message
  126 + attachItem.date=Date(timeIntervalSince1970: notification.timestamp)
  127 + attachItem.type = "attend"
  128 + attachItem.content = info["content"].stringValue
  129 + attachItem.ownId = AccountManager.shared.userid
  130 + attachItem.save()
  131 + NotificationCenter.default.post(name: Notification.Name(rawValue: MessageNotification.receiveMessage), object: nil, userInfo: nil)
  132 + default:
  133 + break
121 } 134 }
122 } 135 }
123 } 136 }
  137 +
124 } 138 }
ParentAssistant/ParentAssistant/ParentAssistant.entitlements 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>aps-environment</key>
  6 + <string>development</string>
  7 +</dict>
  8 +</plist>