Commit 03b982681e6caffb6efe2673fdd760e770f00c09
1 parent
2843d18b
Exists in
newLive
no message
Showing
9 changed files
with
9 additions
and
111 deletions
Show diff stats
YouerLiveVideo/YouerLiveVideo/controllers/HomePage/MainHomeTableViewController.swift
| ... | ... | @@ -60,13 +60,8 @@ class MainHomeTableViewController: UITableViewController { |
| 60 | 60 | self.tableHeaderView.addSubview(jyScrollViews) |
| 61 | 61 | } |
| 62 | 62 | }, failHandler: { (error) in |
| 63 | - self.view.makeToast("获取轮播图失败:\(error.localizedDescription)") | |
| 64 | 63 | }) |
| 65 | - }else{ | |
| 66 | - self.view.makeToast("获取轮播图失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 67 | 64 | } |
| 68 | - }else{ | |
| 69 | - self.view.makeToast("获取轮播图失败:\(error!.description)") | |
| 70 | 65 | } |
| 71 | 66 | } |
| 72 | 67 | } |
| ... | ... | @@ -233,13 +228,8 @@ class HomeSecondTableViewCell: UITableViewCell,UICollectionViewDelegate,UICollec |
| 233 | 228 | } |
| 234 | 229 | (self.viewWithTag(1) as! UICollectionView).reloadData() |
| 235 | 230 | }, failHandler: { (error) in |
| 236 | - appRootViewController().view.makeToast("获取热门微课失败:\(error.localizedDescription)") | |
| 237 | 231 | }) |
| 238 | - }else{ | |
| 239 | - appRootViewController().view.makeToast("获取热门微课失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 240 | 232 | } |
| 241 | - }else{ | |
| 242 | - appRootViewController().view.makeToast("获取热门微课失败:\(error!.description)") | |
| 243 | 233 | } |
| 244 | 234 | } |
| 245 | 235 | } |
| ... | ... | @@ -371,13 +361,8 @@ class HomeThirdTableViewCell: UITableViewCell,UICollectionViewDelegate,UICollect |
| 371 | 361 | } |
| 372 | 362 | (self.viewWithTag(1) as! UICollectionView).reloadData() |
| 373 | 363 | }, failHandler: { (error) in |
| 374 | - appRootViewController().view.makeToast("获取资源失败:\(error.localizedDescription)") | |
| 375 | 364 | }) |
| 376 | - }else{ | |
| 377 | - appRootViewController().view.makeToast("获取资源失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 378 | 365 | } |
| 379 | - }else{ | |
| 380 | - appRootViewController().view.makeToast("获取资源失败:\(error!.description)") | |
| 381 | 366 | } |
| 382 | 367 | } |
| 383 | 368 | } |
| ... | ... | @@ -450,13 +435,8 @@ class HomeFourTableViewCell: UITableViewCell,UICollectionViewDelegate,UICollecti |
| 450 | 435 | } |
| 451 | 436 | (self.viewWithTag(1) as! UICollectionView).reloadData() |
| 452 | 437 | }, failHandler: { (error) in |
| 453 | - appRootViewController().view.makeToast("获取校园电视台失败:\(error.localizedDescription)") | |
| 454 | 438 | }) |
| 455 | - }else{ | |
| 456 | - appRootViewController().view.makeToast("获取校园电视台失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 457 | 439 | } |
| 458 | - }else{ | |
| 459 | - appRootViewController().view.makeToast("获取校园电视台失败:\(error!.description)") | |
| 460 | 440 | } |
| 461 | 441 | } |
| 462 | 442 | } | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/HomePage/RankingTableViewController.swift
| ... | ... | @@ -31,13 +31,8 @@ class RankingTableViewController: UITableViewController { |
| 31 | 31 | self.allDic.updateValue(lineAry, forKey: 0) |
| 32 | 32 | self.tableView.reloadData() |
| 33 | 33 | }, failHandler: { (error) in |
| 34 | - self.view.makeToast("排名失败:\(error.localizedDescription)") | |
| 35 | 34 | }) |
| 36 | - }else{ | |
| 37 | - self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 38 | 35 | } |
| 39 | - }else{ | |
| 40 | - self.view.makeToast("获取排名失败:\(error!.description)") | |
| 41 | 36 | } |
| 42 | 37 | } |
| 43 | 38 | AppDelegate.instance().httpServer.getSchoolUpload { (str, error) in |
| ... | ... | @@ -51,13 +46,8 @@ class RankingTableViewController: UITableViewController { |
| 51 | 46 | self.allDic.updateValue(lineAry, forKey: 1) |
| 52 | 47 | self.tableView.reloadData() |
| 53 | 48 | }, failHandler: { (error) in |
| 54 | - self.view.makeToast("排名失败:\(error.localizedDescription)") | |
| 55 | 49 | }) |
| 56 | - }else{ | |
| 57 | - self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 58 | 50 | } |
| 59 | - }else{ | |
| 60 | - self.view.makeToast("获取排名失败:\(error!.description)") | |
| 61 | 51 | } |
| 62 | 52 | } |
| 63 | 53 | AppDelegate.instance().httpServer.getSchoolDownloads { (str, error) in |
| ... | ... | @@ -71,13 +61,8 @@ class RankingTableViewController: UITableViewController { |
| 71 | 61 | self.allDic.updateValue(lineAry, forKey: 2) |
| 72 | 62 | self.tableView.reloadData() |
| 73 | 63 | }, failHandler: { (error) in |
| 74 | - self.view.makeToast("排名失败:\(error.localizedDescription)") | |
| 75 | 64 | }) |
| 76 | - }else{ | |
| 77 | - self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 78 | 65 | } |
| 79 | - }else{ | |
| 80 | - self.view.makeToast("获取排名失败:\(error!.description)") | |
| 81 | 66 | } |
| 82 | 67 | } |
| 83 | 68 | AppDelegate.instance().httpServer.getSchoolPv { (str, error) in |
| ... | ... | @@ -91,13 +76,8 @@ class RankingTableViewController: UITableViewController { |
| 91 | 76 | self.allDic.updateValue(lineAry, forKey: 3) |
| 92 | 77 | self.tableView.reloadData() |
| 93 | 78 | }, failHandler: { (error) in |
| 94 | - self.view.makeToast("排名失败:\(error.localizedDescription)") | |
| 95 | 79 | }) |
| 96 | - }else{ | |
| 97 | - self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 98 | 80 | } |
| 99 | - }else{ | |
| 100 | - self.view.makeToast("获取排名失败:\(error!.description)") | |
| 101 | 81 | } |
| 102 | 82 | } |
| 103 | 83 | AppDelegate.instance().httpServer.getTeacherGenerals { (str, error) in |
| ... | ... | @@ -111,13 +91,8 @@ class RankingTableViewController: UITableViewController { |
| 111 | 91 | self.allDic.updateValue(lineAry, forKey: 4) |
| 112 | 92 | self.tableView.reloadData() |
| 113 | 93 | }, failHandler: { (error) in |
| 114 | - self.view.makeToast("排名失败:\(error.localizedDescription)") | |
| 115 | 94 | }) |
| 116 | - }else{ | |
| 117 | - self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 118 | 95 | } |
| 119 | - }else{ | |
| 120 | - self.view.makeToast("获取排名失败:\(error!.description)") | |
| 121 | 96 | } |
| 122 | 97 | } |
| 123 | 98 | AppDelegate.instance().httpServer.getTeacherUpload { (str, error) in |
| ... | ... | @@ -131,13 +106,8 @@ class RankingTableViewController: UITableViewController { |
| 131 | 106 | self.allDic.updateValue(lineAry, forKey: 5) |
| 132 | 107 | self.tableView.reloadData() |
| 133 | 108 | }, failHandler: { (error) in |
| 134 | - self.view.makeToast("排名失败:\(error.localizedDescription)") | |
| 135 | 109 | }) |
| 136 | - }else{ | |
| 137 | - self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 138 | 110 | } |
| 139 | - }else{ | |
| 140 | - self.view.makeToast("获取排名失败:\(error!.description)") | |
| 141 | 111 | } |
| 142 | 112 | } |
| 143 | 113 | AppDelegate.instance().httpServer.getTeacherDownload { (str, error) in |
| ... | ... | @@ -151,13 +121,8 @@ class RankingTableViewController: UITableViewController { |
| 151 | 121 | self.allDic.updateValue(lineAry, forKey: 6) |
| 152 | 122 | self.tableView.reloadData() |
| 153 | 123 | }, failHandler: { (error) in |
| 154 | - self.view.makeToast("排名失败:\(error.localizedDescription)") | |
| 155 | 124 | }) |
| 156 | - }else{ | |
| 157 | - self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 158 | 125 | } |
| 159 | - }else{ | |
| 160 | - self.view.makeToast("获取排名失败:\(error!.description)") | |
| 161 | 126 | } |
| 162 | 127 | } |
| 163 | 128 | AppDelegate.instance().httpServer.getTeacherPvs { (str, error) in |
| ... | ... | @@ -171,13 +136,8 @@ class RankingTableViewController: UITableViewController { |
| 171 | 136 | self.allDic.updateValue(lineAry, forKey: 7) |
| 172 | 137 | self.tableView.reloadData() |
| 173 | 138 | }, failHandler: { (error) in |
| 174 | - self.view.makeToast("排名失败:\(error.localizedDescription)") | |
| 175 | 139 | }) |
| 176 | - }else{ | |
| 177 | - self.view.makeToast("获取排名失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 178 | 140 | } |
| 179 | - }else{ | |
| 180 | - self.view.makeToast("获取排名失败:\(error!.description)") | |
| 181 | 141 | } |
| 182 | 142 | } |
| 183 | 143 | } | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/MicroCourse/MicroCourseViewController.swift
| ... | ... | @@ -124,15 +124,12 @@ class MicroCourseViewController: UIViewController,UITableViewDelegate,UITableVie |
| 124 | 124 | success=true |
| 125 | 125 | }, failHandler: { (error) in |
| 126 | 126 | success=false |
| 127 | - appRootViewController().view.makeToast("获取资源失败:\(error.localizedDescription)") | |
| 128 | 127 | }) |
| 129 | 128 | }else{ |
| 130 | 129 | success=false |
| 131 | - appRootViewController().view.makeToast("获取资源失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 132 | 130 | } |
| 133 | 131 | }else{ |
| 134 | 132 | success=false |
| 135 | - appRootViewController().view.makeToast("获取资源失败:\(error!.description)") | |
| 136 | 133 | } |
| 137 | 134 | completionHandler(success) |
| 138 | 135 | } | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/Resource/FilterListViewController.swift
| ... | ... | @@ -32,13 +32,8 @@ class FilterListViewController: UIViewController,UITableViewDelegate,UITableView |
| 32 | 32 | self.currentItem=filterListModel(array: self.dataSet) |
| 33 | 33 | self.tableView.reloadData() |
| 34 | 34 | }, failHandler: { (error) in |
| 35 | - self.view.makeToast("获取教材目录失败:\(error.localizedDescription)") | |
| 36 | 35 | }) |
| 37 | - }else{ | |
| 38 | - self.view.makeToast("获取教材目录失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 39 | 36 | } |
| 40 | - }else{ | |
| 41 | - self.view.makeToast("获取教材目录失败:\(error!.description)") | |
| 42 | 37 | } |
| 43 | 38 | } |
| 44 | 39 | case 1: |
| ... | ... | @@ -52,13 +47,8 @@ class FilterListViewController: UIViewController,UITableViewDelegate,UITableView |
| 52 | 47 | self.currentItem=filterListModel(array: self.dataSet) |
| 53 | 48 | self.tableView.reloadData() |
| 54 | 49 | }, failHandler: { (error) in |
| 55 | - self.view.makeToast("获取知识点目录失败:\(error.localizedDescription)") | |
| 56 | 50 | }) |
| 57 | - }else{ | |
| 58 | - self.view.makeToast("获取知识点目录失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 59 | 51 | } |
| 60 | - }else{ | |
| 61 | - self.view.makeToast("获取知识点目录失败:\(error!.description)") | |
| 62 | 52 | } |
| 63 | 53 | } |
| 64 | 54 | case 2: |
| ... | ... | @@ -72,13 +62,8 @@ class FilterListViewController: UIViewController,UITableViewDelegate,UITableView |
| 72 | 62 | self.currentItem=filterListModel(array: self.dataSet) |
| 73 | 63 | self.tableView.reloadData() |
| 74 | 64 | }, failHandler: { (error) in |
| 75 | - self.view.makeToast("获取考点目录失败:\(error.localizedDescription)") | |
| 76 | 65 | }) |
| 77 | - }else{ | |
| 78 | - self.view.makeToast("获取考点目录失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 79 | 66 | } |
| 80 | - }else{ | |
| 81 | - self.view.makeToast("获取考点目录失败:\(error!.description)") | |
| 82 | 67 | } |
| 83 | 68 | } |
| 84 | 69 | default: | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/Resource/FilterViewController.swift
| ... | ... | @@ -77,13 +77,8 @@ class FilterViewController: UIViewController,FilterViewDelegate { |
| 77 | 77 | self.dataSchoolSection.append(SchoolSection(j: item)) |
| 78 | 78 | } |
| 79 | 79 | }, failHandler: { (error) in |
| 80 | - self.view.makeToast("获取学段失败:\(error.localizedDescription)") | |
| 81 | 80 | }) |
| 82 | - }else{ | |
| 83 | - self.view.makeToast("获取学段失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 84 | 81 | } |
| 85 | - }else{ | |
| 86 | - self.view.makeToast("获取学段失败:\(error!.description)") | |
| 87 | 82 | } |
| 88 | 83 | let filterView=Bundle.main.loadNibNamed("FilterView", owner: nil, options: nil)![0] as! FilterView |
| 89 | 84 | filterView.frame.size=CGSize(width: getScreenWidth(), height: 60+(getScreenWidth()-80)/12) |
| ... | ... | @@ -163,13 +158,8 @@ class FilterViewController: UIViewController,FilterViewDelegate { |
| 163 | 158 | self.dataGrade.append(Grade(j: item)) |
| 164 | 159 | } |
| 165 | 160 | }, failHandler: { (error) in |
| 166 | - self.view.makeToast("获取年级失败:\(error.localizedDescription)") | |
| 167 | 161 | }) |
| 168 | - }else{ | |
| 169 | - self.view.makeToast("获取年级失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 170 | 162 | } |
| 171 | - }else{ | |
| 172 | - self.view.makeToast("获取年级失败:\(error!.description)") | |
| 173 | 163 | } |
| 174 | 164 | self.setupFilterView(index: index, arry: self.dataGrade) |
| 175 | 165 | if self.type.schoolSection != nil && self.type.grade != nil && self.type.subject != nil{ |
| ... | ... | @@ -191,13 +181,8 @@ class FilterViewController: UIViewController,FilterViewDelegate { |
| 191 | 181 | self.dataSubject.append(Subject(j: item)) |
| 192 | 182 | } |
| 193 | 183 | }, failHandler: { (error) in |
| 194 | - self.view.makeToast("获取学科失败:\(error.localizedDescription)") | |
| 195 | 184 | }) |
| 196 | - }else{ | |
| 197 | - self.view.makeToast("获取学科失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 198 | 185 | } |
| 199 | - }else{ | |
| 200 | - self.view.makeToast("获取学科失败:\(error!.description)") | |
| 201 | 186 | } |
| 202 | 187 | self.setupFilterView(index: index, arry: self.dataSubject) |
| 203 | 188 | if self.type.schoolSection != nil && self.type.grade != nil && self.type.subject != nil{ |
| ... | ... | @@ -223,13 +208,8 @@ class FilterViewController: UIViewController,FilterViewDelegate { |
| 223 | 208 | self.dataMaterials.append(Material(j: item)) |
| 224 | 209 | } |
| 225 | 210 | }, failHandler: { (error) in |
| 226 | - self.view.makeToast("获取教材失败:\(error.localizedDescription)") | |
| 227 | 211 | }) |
| 228 | - }else{ | |
| 229 | - self.view.makeToast("获取教材失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 230 | 212 | } |
| 231 | - }else{ | |
| 232 | - self.view.makeToast("获取教材失败:\(error!.description)") | |
| 233 | 213 | } |
| 234 | 214 | self.setupFilterView(index: index, arry: self.dataMaterials) |
| 235 | 215 | } | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/Resource/ResourceViewController.swift
| ... | ... | @@ -124,15 +124,12 @@ class ResourceViewController: UIViewController,UITableViewDelegate,UITableViewDa |
| 124 | 124 | success=true |
| 125 | 125 | }, failHandler: { (error) in |
| 126 | 126 | success=false |
| 127 | - appRootViewController().view.makeToast("获取资源失败:\(error.localizedDescription)") | |
| 128 | 127 | }) |
| 129 | 128 | }else{ |
| 130 | 129 | success=false |
| 131 | - appRootViewController().view.makeToast("获取资源失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 132 | 130 | } |
| 133 | 131 | }else{ |
| 134 | 132 | success=false |
| 135 | - appRootViewController().view.makeToast("获取资源失败:\(error!.description)") | |
| 136 | 133 | } |
| 137 | 134 | completionHandler(success) |
| 138 | 135 | } | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift
| ... | ... | @@ -179,13 +179,8 @@ class ExcellentTVInforHeaderView:UICollectionReusableView{ |
| 179 | 179 | self.lunboView.addSubview(jyScrollViews) |
| 180 | 180 | } |
| 181 | 181 | }, failHandler: { (error) in |
| 182 | - self.superViewController.view.makeToast("获取轮播图失败:\(error.localizedDescription)") | |
| 183 | 182 | }) |
| 184 | - }else{ | |
| 185 | - self.superViewController.view.makeToast("获取轮播图失败:\(JSON.fromString(jsonString: str)!["message"].stringValue)") | |
| 186 | 183 | } |
| 187 | - }else{ | |
| 188 | - self.superViewController.view.makeToast("获取轮播图失败:\(error!.description)") | |
| 189 | 184 | } |
| 190 | 185 | } |
| 191 | 186 | } | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift
| ... | ... | @@ -91,10 +91,7 @@ class ChangePassWordViewController: UIViewController { |
| 91 | 91 | self.navigationController!.popViewController(animated: true) |
| 92 | 92 | AppDelegate.instance().window?.makeToast("修改成功") |
| 93 | 93 | }, failHandler: { (error) in |
| 94 | - self.view.makeToast("修改失败") | |
| 95 | 94 | }) |
| 96 | - }else{ | |
| 97 | - self.view.makeToast("修改失败") | |
| 98 | 95 | } |
| 99 | 96 | } |
| 100 | 97 | } |
| ... | ... | @@ -122,7 +119,7 @@ class ChangePassWordViewController: UIViewController { |
| 122 | 119 | self.view.makeToast("验证码发送成功") |
| 123 | 120 | self.timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ChangePassWordViewController.timerFire), userInfo: sender, repeats: true) |
| 124 | 121 | }, failHandler: { (error) in |
| 125 | - self.view.makeToast("验证码发送失败:\(error.localizedDescription)") | |
| 122 | + self.view.makeToast("验证码发送失败") | |
| 126 | 123 | }) |
| 127 | 124 | }else{ |
| 128 | 125 | self.view.makeToast("验证码发送失败") | ... | ... |
YouerLiveVideo/YouerLiveVideo/util/network.swift
| ... | ... | @@ -53,7 +53,14 @@ final class KHttp{ |
| 53 | 53 | let error=response.result.error |
| 54 | 54 | let str=response.result.value |
| 55 | 55 | if let er=error{ |
| 56 | - AppDelegate.instance().window?.makeToast("加载失败:\(er.localizedDescription)", duration: 1, position: CSToastPositionBottom) | |
| 56 | + if (er as NSError).code==NSURLErrorNotConnectedToInternet{ | |
| 57 | + AppDelegate.instance().window?.makeToast("网络连接不可用", duration: 1, position: CSToastPositionBottom) | |
| 58 | + }else if (er as NSError).code==NSURLErrorCannotConnectToHost{ | |
| 59 | + AppDelegate.instance().window?.makeToast("未能连接到服务器", duration: 1, position: CSToastPositionBottom) | |
| 60 | + }else{ | |
| 61 | + AppDelegate.instance().window?.makeToast("加载失败:\(er.localizedDescription)", duration: 1, position: CSToastPositionBottom) | |
| 62 | + } | |
| 63 | + NSLog("ERROR: url:\(url),error:\(er)") | |
| 57 | 64 | } |
| 58 | 65 | completionHandler(str,error as NSError?) |
| 59 | 66 | } | ... | ... |