Commit da381d2f authored by Steven杜宇's avatar Steven杜宇

// 消息

parent 9709ff9d
...@@ -9,6 +9,49 @@ ...@@ -9,6 +9,49 @@
import UIKit import UIKit
import SafariServices import SafariServices
enum YHOrderStage: Int {
case apply = 1 // 申请阶段
case certificate = 2 // 办证阶段
case resign = 3 // 续签
}
enum YHRedirectPage: String {
// 通用
case serviceTab = "service_tab" // 服务tab
case lifeTab = "life_tab" // 首页-生活tab
case newsTab = "news_tab" // 首页-资讯tab
// stage = 1 (申请阶段) 可以进入的路由页面
case myInfo = "my_info" // 我的信息
case myCertificate = "my_certificate" // 我的证件
case myScore = "my_score" // 我的评分
case myPlan = "my_plan" // 我的方案
case myDocument = "my_document" // 我的文书
case mySignature = "my_signature" // 我的签字
// stage = 2 (办证阶段) 可以进入的路由页面
case approveResult = "approve_result" // 港府获批结果
case familyInfoConfirm = "family_info_confirm" // 家庭信息确认
case addDependent = "add_dependent" // 新增受养人
case appointForIdCard = "appoint_for_id_card" // 赴港办证预约
case payElectronicVisa = "pay_electronic_visa" // 电子签证缴费
case travelGuide = "travel_guide" // 赴港行程指引
case prepareTravelCertificate = "prepare_travel_certificate" // 旅行证件准备
case uploadPassCertificate = "upload_pass_certificate" // 上传过关证件
case principalApprovalSuccess = "principal_approval_success" // 原则批获批成功
// stage = 3 (续签阶段) 可以进入的路由页面 续签阶段可以进入 办证阶段能进入的路由界面
case renewalGuide = "renewal_guide" // 身份续签指引
case renewalPlan = "renewal_plan" // 我的续签方案
case stayInHKRecord = "stay_in_hk_record" // 添加在港记录
case renewalCertificate = "renewal_certificate" // 续签证件管理
case renewalMaterial = "renewal_material" // 续签资料管理
case renewalDocument = "renewal_document" // 续签文书管理
}
class YHMessageDetailListVC: YHBaseViewController { class YHMessageDetailListVC: YHBaseViewController {
var type:Int = -1 var type:Int = -1
...@@ -26,6 +69,53 @@ class YHMessageDetailListVC: YHBaseViewController { ...@@ -26,6 +69,53 @@ class YHMessageDetailListVC: YHBaseViewController {
let principleViewModel: YHPrincleViewModel = YHPrincleViewModel() let principleViewModel: YHPrincleViewModel = YHPrincleViewModel()
let serviceCenterViewModel = YHServiceCenterViewModel() let serviceCenterViewModel = YHServiceCenterViewModel()
func getRoutersForOrderStage(_ stage: Int) -> [YHRedirectPage] {
if stage == YHOrderStage.apply.rawValue {
return [.myInfo,
.myCertificate,
.myScore,
.myPlan,
.myDocument,
.mySignature,]
}
if stage == YHOrderStage.certificate.rawValue {
return [.approveResult,
.familyInfoConfirm,
.addDependent,
.appointForIdCard,
.payElectronicVisa,
.travelGuide,
.prepareTravelCertificate,
.uploadPassCertificate,
.principalApprovalSuccess,]
}
if stage == YHOrderStage.resign.rawValue {
return [.approveResult,
.familyInfoConfirm,
.addDependent,
.appointForIdCard,
.payElectronicVisa,
.travelGuide,
.prepareTravelCertificate,
.uploadPassCertificate,
.principalApprovalSuccess,
.renewalGuide,
.renewalPlan,
.stayInHKRecord,
.renewalCertificate,
.renewalMaterial,
.renewalDocument,]
}
return []
}
lazy var navBar: YHCustomNavigationBar = { lazy var navBar: YHCustomNavigationBar = {
...@@ -229,16 +319,16 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -229,16 +319,16 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
printLog("redirectPage:\(item.redirectPage)") printLog("redirectPage:\(item.redirectPage)")
if item.redirectPage == "service_tab" { // 服务tab页 if item.redirectPage == YHRedirectPage.serviceTab.rawValue { // 服务tab页
UIViewController.current?.navigationController?.popToRootViewController(animated: false) UIViewController.current?.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .service) goTabBarBy(tabType: .service)
} else if item.redirectPage == "life_tab" { // 首页-生活tab } else if item.redirectPage == YHRedirectPage.lifeTab.rawValue { // 首页-生活tab
UIViewController.current?.navigationController?.popToRootViewController(animated: false) UIViewController.current?.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .home) goTabBarBy(tabType: .home)
NotificationCenter.default.post(name: YhConstant.YhNotification.didJumpToHomePageLifeTabNotification, object: nil) NotificationCenter.default.post(name: YhConstant.YhNotification.didJumpToHomePageLifeTabNotification, object: nil)
} else if item.redirectPage == "news_tab" { // 首页-资讯tab } else if item.redirectPage == YHRedirectPage.newsTab.rawValue { // 首页-资讯tab
UIViewController.current?.navigationController?.popToRootViewController(animated: false) UIViewController.current?.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .home) goTabBarBy(tabType: .home)
NotificationCenter.default.post(name: YhConstant.YhNotification.didJumpToHomePageNewsTabNotification, object: nil) NotificationCenter.default.post(name: YhConstant.YhNotification.didJumpToHomePageNewsTabNotification, object: nil)
...@@ -250,7 +340,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -250,7 +340,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
self.requestOrderStatus(orderId: orderId) { self.requestOrderStatus(orderId: orderId) {
status in status in
// status 1 申请阶段 2办证阶段 3续期阶段 // status 1 申请阶段 2办证阶段 3续期阶段
self.handleRouter(msgDetailModel: item, status: status) { self.handleRouter(message: item, stage: status) {
// 没有满足相应跳转条件默认跳转到服务页 // 没有满足相应跳转条件默认跳转到服务页
goTabBarBy(tabType: .service) goTabBarBy(tabType: .service)
} }
...@@ -307,12 +397,12 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -307,12 +397,12 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
printLog("visiblemsgIdSet:/n \(visibleUnreadMsgIdSet)") printLog("visiblemsgIdSet:/n \(visibleUnreadMsgIdSet)")
} }
func handleRouter(msgDetailModel:YHDetailMessageModel, status: Int, defaultRouterBlock:(()->())?) { func handleRouter(message:YHDetailMessageModel, stage: Int, defaultRouterBlock:(()->())?) {
// status 1 申请阶段 2办证阶段 3续期阶段 // status 1 申请阶段 2办证阶段 3续期阶段
if status == 1 { // 申请阶段 if stage == YHOrderStage.apply.rawValue { // 申请阶段
if self.type == YHMessageType.infoSubmit.rawValue { // 资料递交 if self.type == YHMessageType.infoSubmit.rawValue { // 资料递交
if !msgDetailModel.url.isEmpty { if !message.url.isEmpty {
if let url = URL(string: msgDetailModel.url) { if let url = URL(string: message.url) {
let safariViewController = SFSafariViewController(url: url) let safariViewController = SFSafariViewController(url: url)
safariViewController.dismissButtonStyle = .close safariViewController.dismissButtonStyle = .close
safariViewController.modalPresentationStyle = .fullScreen safariViewController.modalPresentationStyle = .fullScreen
...@@ -323,156 +413,161 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -323,156 +413,161 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
return return
} }
} }
if msgDetailModel.redirectPage == "my_info" { // 我的信息
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHInformationPerfectListVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "my_certificate" { // 我的证件
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHMineCertificateEntryViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "my_score" { // 我的评分
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHScoreDetailViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "my_plan" { // 我的方案
let vc = YHMineSchemeViewController()
navigationController?.pushViewController(vc)
} else if msgDetailModel.redirectPage == "my_document" { // 我的文书
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHMyDocumentsListViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "my_signature" { // 我的签字
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHMySignatureListViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else {
defaultRouterBlock?()
}
return
} }
// 非申请阶段 // 根据订单状态获取其可以进入的路由数组
let routers = self.getRoutersForOrderStage(stage)
var routerStringArr = routers.map { page in
return page.rawValue
}
if routerStringArr.contains(message.redirectPage) {
self.routeToPage(message)
} else {
defaultRouterBlock?()
}
}
func routeToPage(_ msg:YHDetailMessageModel) {
if msgDetailModel.redirectPage == "approve_result" { // 港府获批结果(正式批) if msg.redirectPage == YHRedirectPage.myInfo.rawValue { // 我的信息
let vc = YHOfficialApprovalResultVC() if let orderId = Int(msg.orderId) {
navigationController?.pushViewController(vc) let vc = YHInformationPerfectListVC()
vc.orderId = orderId
} else if msgDetailModel.redirectPage == "family_info_confirm" { // 家庭信息确认 navigationController?.pushViewController(vc)
if let orderId = Int(msgDetailModel.orderId) { }
let vc = YHFamilyInfoConfirmViewController()
vc.orderId = orderId } else if msg.redirectPage == YHRedirectPage.myCertificate.rawValue { // 我的证件
navigationController?.pushViewController(vc) if let orderId = Int(msg.orderId) {
} let vc = YHMineCertificateEntryViewController()
vc.orderId = orderId
} else if msgDetailModel.redirectPage == "add_dependent" { // 新增受养人 navigationController?.pushViewController(vc)
if let orderId = Int(msgDetailModel.orderId) { }
let vc = YHAddAdoptersViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "appoint_for_id_card" { // 赴港办证预约
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHCertificateAppointViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "pay_electronic_visa" { // 电子签证缴费
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHVisaPaymentVC()
vc.orderID = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "travel_guide" { // 赴港行程指引
if let orderId = Int(msgDetailModel.orderId), var token = YHLoginManager.shared.userModel?.token {
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/tohkList"
let addtionString = String.randomAlphaNumericStringT(6)//随机6个字母或者数字
let indexToInsert = token.index(token.startIndex, offsetBy: 6) //插入位置,这里以第六个字符后面为例
token.insert(contentsOf: addtionString, at: indexToInsert)
url = url + "?paramO=\(orderId)" + "&param=" + token
url = url + "&app_platform=ios" + "&app_version=" + UIDevice.appVersion()
printLog("UURL: \(url)")
let vc = YHH5WebViewVC()
vc.url = url
vc.isFullScreenFlag = false
vc.navTitle = "赴港行程指引"
vc.isNeedRefreshDataFlag = true
UIViewController.current?.navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "prepare_travel_certificate" { // 旅行证件准备
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHTravelDocsPreparationListViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "upload_pass_certificate" { // 上传过关证件
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHUploadCertificateVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "principal_approval_success" { // 原则批获批成功
if let orderId = Int(msgDetailModel.orderId) {
let vc = YHPrincipleApprovedWaitSubmitVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "renewal_guide" { // 身份续签指引 H5
YHHUD.flash(message: "跳转至 身份续签指引")
} else if msgDetailModel.redirectPage == "renewal_plan" { // 我的续签方案 H5 } else if msg.redirectPage == YHRedirectPage.myScore.rawValue { // 我的评分
YHHUD.flash(message: "跳转至 我的续签方案") if let orderId = Int(msg.orderId) {
let vc = YHScoreDetailViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msg.redirectPage == YHRedirectPage.myPlan.rawValue { // 我的方案
let vc = YHMineSchemeViewController()
navigationController?.pushViewController(vc)
} else if msg.redirectPage == YHRedirectPage.myDocument.rawValue { // 我的文书
if let orderId = Int(msg.orderId) {
let vc = YHMyDocumentsListViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "stay_in_hk_record" { // 添加在港记录 } else if msg.redirectPage == YHRedirectPage.mySignature.rawValue { // 我的签字
let vc = YHHKImmigrationRecordsVC() if let orderId = Int(msg.orderId) {
navigationController?.pushViewController(vc) let vc = YHMySignatureListViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msg.redirectPage == YHRedirectPage.approveResult.rawValue { // 港府获批结果(正式批)
let vc = YHOfficialApprovalResultVC()
navigationController?.pushViewController(vc)
} else if msg.redirectPage == YHRedirectPage.familyInfoConfirm.rawValue { // 家庭信息确认
if let orderId = Int(msg.orderId) {
let vc = YHFamilyInfoConfirmViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msg.redirectPage == YHRedirectPage.addDependent.rawValue { // 新增受养人
if let orderId = Int(msg.orderId) {
let vc = YHAddAdoptersViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msgDetailModel.redirectPage == "renewal_certificate" { // 续签证件管理 } else if msg.redirectPage == YHRedirectPage.appointForIdCard.rawValue { // 赴港办证预约
if let orderId = Int(msgDetailModel.orderId) { if let orderId = Int(msg.orderId) {
let vc = YHResignCertificateListViewController() let vc = YHCertificateAppointViewController()
vc.orderId = orderId vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msg.redirectPage == YHRedirectPage.payElectronicVisa.rawValue { // 电子签证缴费
if let orderId = Int(msg.orderId) {
let vc = YHVisaPaymentVC()
vc.orderID = orderId
navigationController?.pushViewController(vc)
}
} else if msg.redirectPage == YHRedirectPage.travelGuide.rawValue { // 赴港行程指引
if let orderId = Int(msg.orderId), var token = YHLoginManager.shared.userModel?.token {
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/tohkList"
let addtionString = String.randomAlphaNumericStringT(6)//随机6个字母或者数字
let indexToInsert = token.index(token.startIndex, offsetBy: 6) //插入位置,这里以第六个字符后面为例
token.insert(contentsOf: addtionString, at: indexToInsert)
url = url + "?paramO=\(orderId)" + "&param=" + token
url = url + "&app_platform=ios" + "&app_version=" + UIDevice.appVersion()
printLog("UURL: \(url)")
let vc = YHH5WebViewVC()
vc.url = url
vc.isFullScreenFlag = false
vc.navTitle = "赴港行程指引"
vc.isNeedRefreshDataFlag = true
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
} }
} else if msgDetailModel.redirectPage == "renewal_material" { // 续签资料管理 } else if msg.redirectPage == YHRedirectPage.prepareTravelCertificate.rawValue { // 旅行证件准备
if let orderId = Int(msgDetailModel.orderId) { if let orderId = Int(msg.orderId) {
let vc = YHResinMaterialManageContainerVC() let vc = YHTravelDocsPreparationListViewController()
vc.orderId = orderId vc.orderId = orderId
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
} }
} else if msgDetailModel.redirectPage == "renewal_document" { // 续签文书管理 } else if msg.redirectPage == YHRedirectPage.uploadPassCertificate.rawValue { // 上传过关证件
let vc = YHResignDocumentManagementVC() if let orderId = Int(msg.orderId) {
navigationController?.pushViewController(vc) let vc = YHUploadCertificateVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else { } else if msg.redirectPage == YHRedirectPage.principalApprovalSuccess.rawValue { // 原则批获批成功
defaultRouterBlock?() if let orderId = Int(msg.orderId) {
} let vc = YHPrincipleApprovedWaitSubmitVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msg.redirectPage == YHRedirectPage.renewalGuide.rawValue { // 身份续签指引 H5
YHHUD.flash(message: "跳转至 身份续签指引")
} else if msg.redirectPage == YHRedirectPage.renewalPlan.rawValue { // 我的续签方案 H5
YHHUD.flash(message: "跳转至 我的续签方案")
} else if msg.redirectPage == YHRedirectPage.stayInHKRecord.rawValue { // 添加在港记录
let vc = YHHKImmigrationRecordsVC()
navigationController?.pushViewController(vc)
} else if msg.redirectPage == YHRedirectPage.renewalCertificate.rawValue { // 续签证件管理
if let orderId = Int(msg.orderId) {
let vc = YHResignCertificateListViewController()
vc.orderId = orderId
UIViewController.current?.navigationController?.pushViewController(vc)
}
} else if msg.redirectPage == YHRedirectPage.renewalMaterial.rawValue { // 续签资料管理
if let orderId = Int(msg.orderId) {
let vc = YHResinMaterialManageContainerVC()
vc.orderId = orderId
navigationController?.pushViewController(vc)
}
} else if msg.redirectPage == YHRedirectPage.renewalDocument.rawValue { // 续签文书管理
let vc = YHResignDocumentManagementVC()
navigationController?.pushViewController(vc)
}
} }
func requestOrderStatus(orderId:Int, callback:((_ status:Int)->())?) { func requestOrderStatus(orderId:Int, callback:((_ status:Int)->())?) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment