Commit 7329d3a014eb2bee560db59fd141de885b1b3539
1 parent
bd4199db
Exists in
parentassistant
添加轮播图跳转,补卡通知等
Showing
9 changed files
with
110 additions
and
16 deletions
Show diff stats
ParentAssistant/ParentAssistant.xcodeproj/project.pbxproj
| ... | ... | @@ -250,6 +250,7 @@ |
| 250 | 250 | AD64A2C4207F28EB00B25E80 /* ProgramVacateBodyTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProgramVacateBodyTableViewCell.xib; sourceTree = "<group>"; }; |
| 251 | 251 | AD65FB77206354220052415B /* MoralTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoralTableViewCell.swift; sourceTree = "<group>"; }; |
| 252 | 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 | 254 | ADAEA3972064960300A47D2C /* SceneDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDetailViewController.swift; sourceTree = "<group>"; }; |
| 254 | 255 | ADAEA3992064C44900A47D2C /* LineChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartView.swift; sourceTree = "<group>"; }; |
| 255 | 256 | ADC9AB71207C55CE00348EF1 /* GrowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrowViewController.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -654,9 +655,9 @@ |
| 654 | 655 | ADCDA074208B3FED004F1852 /* Controller */ = { |
| 655 | 656 | isa = PBXGroup; |
| 656 | 657 | children = ( |
| 657 | - 599364DD204E62E700C8B371 /* ChannelViewController.swift */, | |
| 658 | 658 | 599364DE204E62E700C8B371 /* Information.storyboard */, |
| 659 | 659 | 599364E1204E62E700C8B371 /* InformationViewController.swift */, |
| 660 | + 599364DD204E62E700C8B371 /* ChannelViewController.swift */, | |
| 660 | 661 | ); |
| 661 | 662 | path = Controller; |
| 662 | 663 | sourceTree = "<group>"; |
| ... | ... | @@ -745,6 +746,7 @@ |
| 745 | 746 | BF7A4C32204CD55300460463 /* ParentAssistant */ = { |
| 746 | 747 | isa = PBXGroup; |
| 747 | 748 | children = ( |
| 749 | + ADA398FD208EFBE600AD9296 /* ParentAssistant.entitlements */, | |
| 748 | 750 | BF7A4C33204CD55300460463 /* AppDelegate.swift */, |
| 749 | 751 | 5993652B20528D5700C8B371 /* MainViewController.swift */, |
| 750 | 752 | BF7A4C6B204E320700460463 /* Classes */, |
| ... | ... | @@ -970,6 +972,11 @@ |
| 970 | 972 | CreatedOnToolsVersion = 9.2; |
| 971 | 973 | LastSwiftMigration = 0920; |
| 972 | 974 | ProvisioningStyle = Automatic; |
| 975 | + SystemCapabilities = { | |
| 976 | + com.apple.Push = { | |
| 977 | + enabled = 1; | |
| 978 | + }; | |
| 979 | + }; | |
| 973 | 980 | }; |
| 974 | 981 | BF7A4C46204CD55500460463 = { |
| 975 | 982 | CreatedOnToolsVersion = 9.2; |
| ... | ... | @@ -1391,6 +1398,8 @@ |
| 1391 | 1398 | buildSettings = { |
| 1392 | 1399 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 1393 | 1400 | CLANG_ENABLE_MODULES = YES; |
| 1401 | + CODE_SIGN_ENTITLEMENTS = ParentAssistant/ParentAssistant.entitlements; | |
| 1402 | + CODE_SIGN_IDENTITY = "iPhone Developer"; | |
| 1394 | 1403 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
| 1395 | 1404 | CODE_SIGN_STYLE = Automatic; |
| 1396 | 1405 | DEVELOPMENT_TEAM = 8Q3BYL2H66; |
| ... | ... | @@ -1421,6 +1430,8 @@ |
| 1421 | 1430 | buildSettings = { |
| 1422 | 1431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 1423 | 1432 | CLANG_ENABLE_MODULES = YES; |
| 1433 | + CODE_SIGN_ENTITLEMENTS = ParentAssistant/ParentAssistant.entitlements; | |
| 1434 | + CODE_SIGN_IDENTITY = "iPhone Developer"; | |
| 1424 | 1435 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
| 1425 | 1436 | CODE_SIGN_STYLE = Automatic; |
| 1426 | 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 | 13 | stopOnStyle = "0"> |
| 14 | 14 | </BreakpointContent> |
| 15 | 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 | 32 | </Breakpoints> |
| 17 | 33 | </Bucket> | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/Information/Controller/InformationViewController.swift
| ... | ... | @@ -183,23 +183,50 @@ class InformationViewController: UIViewController,UISearchBarDelegate { |
| 183 | 183 | super.didReceiveMemoryWarning() |
| 184 | 184 | // Dispose of any resources that can be recreated. |
| 185 | 185 | } |
| 186 | - | |
| 186 | + //MARK: - 跳转Web页面 | |
| 187 | 187 | //点击资讯进入详情 |
| 188 | 188 | func pushToInfoView(index:Int){ |
| 189 | 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 | 227 | extension InformationViewController:XRCarouselViewDelegate{ |
| 201 | 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 | 277 | switch indexPath.section { |
| 251 | 278 | case 0: |
| 252 | 279 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "topCell", for: indexPath) as! InformationViewTopCell |
| 280 | + cell.headerImageView.delegate = self | |
| 253 | 281 | if topADs.count > 0 { |
| 254 | 282 | var arr:[String]=[] |
| 255 | 283 | for item in topADs{ |
| ... | ... | @@ -324,11 +352,12 @@ class InformationSectionHeader: UICollectionReusableView { |
| 324 | 352 | |
| 325 | 353 | } |
| 326 | 354 | |
| 327 | -//首页的轮播图所在的cell | |
| 355 | +//MARK: - 首页的轮播图所在的cell | |
| 328 | 356 | class InformationViewTopCell: UICollectionViewCell { |
| 329 | 357 | |
| 330 | 358 | @IBOutlet weak var headerImageView: XRCarouselView! |
| 331 | 359 | |
| 360 | + | |
| 332 | 361 | } |
| 333 | 362 | |
| 334 | 363 | //视频cell | ... | ... |
ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/Login/LoginViewController.swift
| ... | ... | @@ -157,6 +157,10 @@ class LoginViewController: UITableViewController,UITextFieldDelegate { |
| 157 | 157 | }, phone: phoneTextField.text!, password: passwordTextField.text!) |
| 158 | 158 | } |
| 159 | 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 | 164 | let ID=AccountManager.shared.rawUserInfo!.contentData()["userid"].stringValue |
| 161 | 165 | YXMessageManager.share.loginWithYX(account: ID, token: ID.md5()) { (success) in |
| 162 | 166 | SVProgressHUD.dismiss() | ... | ... |
ParentAssistant/ParentAssistant/Classes/util/HTTPServer.swift
| ... | ... | @@ -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 | 46 | request(requestUrl, method: method, parameters: parameters, encoding: encoding, headers: headers).responseString { (response) -> Void in |
| 41 | 47 | let error=response.result.error |
| 42 | 48 | let str=response.result.value |
| ... | ... | @@ -91,7 +97,10 @@ final class HTTPServer{ |
| 91 | 97 | var token:String?{ |
| 92 | 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 | 105 | func uploadFile(file:NSURL,progress:((Int64, Int64, Int64) -> Void)? = nil,completionHandler: @escaping (String?, NSError?) -> Void){ |
| 97 | 106 | upload(multipartFormData: { (multipartFormData) in | ... | ... |
ParentAssistant/ParentAssistant/Classes/util/Macro.swift
| ... | ... | @@ -42,14 +42,17 @@ let appsecret="sincere:3a530f39f99411b454e667d69693c127" |
| 42 | 42 | var HOST:String! = "http://60.190.202.57:1000" |
| 43 | 43 | var HOSTWAP:String! = "http://60.190.202.57:8101" |
| 44 | 44 | var HOSTImage:String! = "http://60.190.202.57:8196" |
| 45 | +let HOST_VIDEO:String! = "http://60.190.202.57:8812/" | |
| 45 | 46 | #else |
| 46 | 47 | //正式网址 |
| 47 | 48 | var HOST:String! = "http://campus.myjxt.com" |
| 48 | 49 | var HOSTWAP:String! = "http://parent.myjxt.com" |
| 49 | 50 | var HOSTImage:String! = "http://manage.myjxt.com" |
| 51 | +let HOST_VIDEO:String! = "http://www.sxspy.net/" | |
| 50 | 52 | #endif |
| 51 | 53 | |
| 52 | 54 | |
| 55 | + | |
| 53 | 56 | let URL_UPLOAD_FILE=HOST+"/api/Class/UploadFile" //上传图片 |
| 54 | 57 | |
| 55 | 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 | 89 | * @discussion 这个回调主要用于客户端UI的刷新 |
| 90 | 90 | */ |
| 91 | 91 | func onLogin(_ step: NIMLoginStep) { |
| 92 | - | |
| 92 | + | |
| 93 | 93 | } |
| 94 | 94 | /** |
| 95 | 95 | * 自动登录失败回调 |
| ... | ... | @@ -101,16 +101,19 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa |
| 101 | 101 | func onAutoLoginFailed(_ error: Error) { |
| 102 | 102 | AccountManager.shared.logOut() |
| 103 | 103 | } |
| 104 | + //MARK: - 接收自定义消息 | |
| 104 | 105 | func onReceive(_ notification: NIMCustomSystemNotification) { |
| 105 | 106 | if let info=JSON.fromString(notification.content) { |
| 106 | - if info["type"].stringValue=="attach"{//群发通知 | |
| 107 | + | |
| 108 | + switch info["type"].stringValue{ | |
| 109 | + case "attach": //群发通知 | |
| 107 | 110 | let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message |
| 108 | 111 | attachItem.date=Date(timeIntervalSince1970: notification.timestamp) |
| 109 | 112 | attachItem.content = info["content"].stringValue |
| 110 | 113 | attachItem.ownId = AccountManager.shared.userid |
| 111 | 114 | attachItem.save() |
| 112 | 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 | 117 | let attachItem = NSManagedObject.creatWith(identifier: "Message") as! Message |
| 115 | 118 | attachItem.date=Date(timeIntervalSince1970: notification.timestamp) |
| 116 | 119 | attachItem.type = "ordermess" |
| ... | ... | @@ -118,7 +121,18 @@ class YXMessageManager: NSObject,NIMLoginManagerDelegate,NIMSystemNotificationMa |
| 118 | 121 | attachItem.ownId = AccountManager.shared.userid |
| 119 | 122 | attachItem.save() |
| 120 | 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 @@ |
| 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> | ... | ... |