Преглед изворни кода

修改身份选择样式,修复一些bug

fancy пре 5 година
родитељ
комит
1deb982db2

+ 8 - 0
o2ios/O2Platform.xcodeproj/project.pbxproj

@@ -118,6 +118,7 @@
 		B13A011C2369315100025F3B /* CreateTables.swift in Sources */ = {isa = PBXBuildFile; fileRef = B13A011A2369315100025F3B /* CreateTables.swift */; };
 		B13A011E2369319300025F3B /* O2RunTrackFullData.swift in Sources */ = {isa = PBXBuildFile; fileRef = B13A011D2369319300025F3B /* O2RunTrackFullData.swift */; };
 		B13A0120236935BC00025F3B /* O2CloudFileInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = B13A011F236935BC00025F3B /* O2CloudFileInfo.swift */; };
+		B13F7EA924DA9C0C00733882 /* IdentitySelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B13F7EA824DA9C0C00733882 /* IdentitySelectView.swift */; };
 		B142B081230FB56400E7D127 /* MimeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B142B080230FB56400E7D127 /* MimeType.swift */; };
 		B142B083230FB58B00E7D127 /* Swime.swift in Sources */ = {isa = PBXBuildFile; fileRef = B142B082230FB58B00E7D127 /* Swime.swift */; };
 		B1489B1C248E0F4D009EE9FD /* IMChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1489B1A248E0F4D009EE9FD /* IMChatViewController.swift */; };
@@ -263,6 +264,7 @@
 		B1E95F4E2373DDC4004876B7 /* ZoomImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1E95F4D2373DDC4004876B7 /* ZoomImageView.swift */; };
 		B1E95F7B23750CC2004876B7 /* CloudFilePreviewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1E95F7A23750CC2004876B7 /* CloudFilePreviewController.swift */; };
 		B1E95FA72375155F004876B7 /* CloudFileBaseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1E95FA62375155F004876B7 /* CloudFileBaseVC.swift */; };
+		B1EA1A6724DA9BDD00EDCB3A /* IdentitySelectView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B1EA1A6624DA9BDD00EDCB3A /* IdentitySelectView.xib */; };
 		B1EE2CCE2281729400842F48 /* QDatePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1EE2CCD2281729400842F48 /* QDatePicker.swift */; };
 		B1EE2CD02281771600842F48 /* O2JsApiUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1EE2CCF2281771600842F48 /* O2JsApiUtil.swift */; };
 		B1F6CDBE24A88D26005CB1E0 /* BBSViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1F6CDBD24A88D26005CB1E0 /* BBSViewModel.swift */; };
@@ -1450,6 +1452,7 @@
 		B13A011A2369315100025F3B /* CreateTables.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateTables.swift; sourceTree = "<group>"; };
 		B13A011D2369319300025F3B /* O2RunTrackFullData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = O2RunTrackFullData.swift; sourceTree = "<group>"; };
 		B13A011F236935BC00025F3B /* O2CloudFileInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = O2CloudFileInfo.swift; sourceTree = "<group>"; };
+		B13F7EA824DA9C0C00733882 /* IdentitySelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdentitySelectView.swift; sourceTree = "<group>"; };
 		B142B080230FB56400E7D127 /* MimeType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MimeType.swift; sourceTree = "<group>"; };
 		B142B082230FB58B00E7D127 /* Swime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swime.swift; sourceTree = "<group>"; };
 		B1489B1A248E0F4D009EE9FD /* IMChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IMChatViewController.swift; sourceTree = "<group>"; };
@@ -1609,6 +1612,7 @@
 		B1E95F4D2373DDC4004876B7 /* ZoomImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZoomImageView.swift; sourceTree = "<group>"; };
 		B1E95F7A23750CC2004876B7 /* CloudFilePreviewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudFilePreviewController.swift; sourceTree = "<group>"; };
 		B1E95FA62375155F004876B7 /* CloudFileBaseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudFileBaseVC.swift; sourceTree = "<group>"; };
+		B1EA1A6624DA9BDD00EDCB3A /* IdentitySelectView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IdentitySelectView.xib; sourceTree = "<group>"; };
 		B1EE2CCD2281729400842F48 /* QDatePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QDatePicker.swift; sourceTree = "<group>"; };
 		B1EE2CCF2281771600842F48 /* O2JsApiUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = O2JsApiUtil.swift; sourceTree = "<group>"; };
 		B1F6CDBD24A88D26005CB1E0 /* BBSViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BBSViewModel.swift; sourceTree = "<group>"; };
@@ -4418,6 +4422,8 @@
 				E4BF45DC1E751399008B52F0 /* NewMainAppTableViewCell.swift */,
 				E4BF45DE1E7514A9008B52F0 /* NewMainItemTableViewCell.swift */,
 				E496E89D207314B100C68EEE /* NavView.swift */,
+				B1EA1A6624DA9BDD00EDCB3A /* IdentitySelectView.xib */,
+				B13F7EA824DA9C0C00733882 /* IdentitySelectView.swift */,
 			);
 			path = v;
 			sourceTree = "<group>";
@@ -5780,6 +5786,7 @@
 				E46E6CB11DD41F5D00AB7561 /* ZSSunorderedlist.png in Resources */,
 				E40E246D20B68AF6009F8BE7 /* OOAttandanceTotalHeaderView.xib in Resources */,
 				B1489CB724935104009EE9FD /* IMInstantMessageViewController.xib in Resources */,
+				B1EA1A6724DA9BDD00EDCB3A /* IdentitySelectView.xib in Resources */,
 				E4C24C1720844F5200E426B0 /* yh_image_no_picked@3x.png in Resources */,
 				E46E6C7E1DD41F5D00AB7561 /* ZSSh5@2x.png in Resources */,
 				E46E6C871DD41F5D00AB7561 /* ZSSindent.png in Resources */,
@@ -6480,6 +6487,7 @@
 				B12FD1EB2283D62B00E636BA /* O2ThemeManager.swift in Sources */,
 				09E02E891F16319600579887 /* Fetch.swift in Sources */,
 				09E02E851F16319600579887 /* CryptoSwiftMD5.swift in Sources */,
+				B13F7EA924DA9C0C00733882 /* IdentitySelectView.swift in Sources */,
 				E4C24BAF20844F3C00E426B0 /* JCRemindListViewController.swift in Sources */,
 				E4CB27871E793AE6004A7ACB /* ZonePickerView.swift in Sources */,
 				E4B69728207602A40062F6E8 /* OOMoyaProvider.swift in Sources */,

+ 1 - 1
o2ios/O2Platform/App/IM-聊天/IMChatViewController.swift

@@ -241,7 +241,7 @@ class IMChatViewController: UIViewController {
         DispatchQueue.main.async {
             self.tableView.reloadData()
             if self.chatMessageList.count > 0 {
-                self.tableView.scrollToRow(at: IndexPath(row: self.chatMessageList.count - 1, section: 0), at: .bottom, animated: true)
+                self.tableView.scrollToRow(at: IndexPath(row: self.chatMessageList.count - 1, section: 0), at: .bottom, animated: false)
             }
         }
     }

+ 1 - 1
o2ios/O2Platform/App/IM-聊天/IMInstantMessageViewController.swift

@@ -35,7 +35,7 @@ class IMInstantMessageViewController: UITableViewController {
     private func scrollMessageToBottom() {
         DispatchQueue.main.async {
             if self.instantMsgList.count > 0 {
-                self.tableView.scrollToRow(at: IndexPath(row: self.instantMsgList.count-1, section: 0), at: .bottom, animated: true)
+                self.tableView.scrollToRow(at: IndexPath(row: self.instantMsgList.count-1, section: 0), at: .bottom, animated: false)
             }
         }
     }

+ 8 - 1
o2ios/O2Platform/App/Work-工作/c/MainTaskSecondViewController.swift

@@ -74,7 +74,14 @@ class MainTaskSecondViewController: UIViewController {
         self.tableView.delegate = self
         loadHomeApps()
         loadPlayerList()
-        loadNewPublish(newPublishPageModel)
+        let sIndex = self.seguementControl.selectedIndex
+        if sIndex == 0 {
+            self.loadNewPublish(newPublishPageModel)
+        }else {
+            newTaskPageModel = CommonPageModel(MainTaskSecondViewController.PAGE_SIZE)
+            self.loadMainTodo(newTaskPageModel)
+        }
+        
         //self.initBarManager()
     }
     

+ 171 - 151
o2ios/O2Platform/App/Work-工作/c/TaskCreateViewController.swift

@@ -16,148 +16,168 @@ import ObjectMapper
 import Eureka
 import CocoaLumberjack
 
-class TaskCreateViewController: FormViewController {
-    
-    var process:AppProcess?{
-        didSet{
-            
-        }
-    }
-    
-    var identitys:[IdentityV2]? {
+class TaskCreateViewController: UIViewController {
+
+    var process: AppProcess? {
         didSet {
-            for identity in identitys! {
-                identityString.append("\(identity.name!)(\(identity.unitName!))")
-            }
+
         }
     }
-    
-    var task:TodoTask?
-    
-    var  identityString:[String] = []
-    
+
+    var identitys: [IdentityV2]?
+
+    var task: TodoTask?
+
+    var identityViews: [IdentitySelectView] = []
+
     override func viewDidLoad() {
         super.viewDidLoad()
-        TextRow.defaultCellUpdate = {
-            cell,row in
-            cell.textLabel?.font = setting_content_textFont
-            cell.textLabel?.textColor  = setting_content_textColor
-            //cell.textField.attributedPlaceholder = NSAttributedString(string: "",attributes: [NSFontAttributeName:setting_content_textFont,NSBackgroundColorAttributeName:setting_content_textColor])
-            //cell.accessoryType = .disclosureIndicator
-        }
-        ActionSheetRow<String>.defaultCellUpdate = {
-            cell,row in
-            cell.textLabel?.font = setting_content_textFont
-            cell.textLabel?.textColor  = setting_content_textColor
-            //cell.accessoryType = .disclosureIndicator
-        }
-        DateTimeRow.defaultCellUpdate = {
-            cell,row in
-            cell.textLabel?.font = setting_content_textFont
-            cell.textLabel?.textColor  = setting_content_textColor
-            //cell.accessoryType = .disclosureIndicator
+        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "创建", style: .plain, target: self, action: #selector(create))
+        title = process?.name
+//        showInputUI()
+
+        self.setupUI()
+
+    }
+
+    private func setupUI() {
+        let title = self.initTitleAndConstraint()
+        let height = title.frame.height + 20
+        if let ids = self.identitys {
+            var i = 0
+            ids.forEach { (identity) in
+                self.initIdentityView(id: identity, top: (height + i.toCGFloat * 94 + 20))
+                i += 1
+            }
+            self.identityViews.first?.selectedIdentity()
         }
+    }
+
+    private func initIdentityView(id: IdentityV2, top: CGFloat) {
+        let view = Bundle.main.loadNibNamed("IdentitySelectView", owner: self, options: nil)?.first as! IdentitySelectView
+        view.frame = CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 94)
+        view.setUp(identity: id)
+        self.identityViews.append(view)
+        view.translatesAutoresizingMaskIntoConstraints = false
+        self.view.addSubview(view)
+
+        let top = NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: view.superview!, attribute: .top, multiplier: 1, constant: top)
+        let left = NSLayoutConstraint(item: view, attribute: .leading, relatedBy: .equal, toItem: view.superview!, attribute: .leading, multiplier: 1, constant: 0)
+        let right = NSLayoutConstraint(item: view.superview!, attribute: .trailing, relatedBy: .equal, toItem: view, attribute: .trailing, multiplier: 1, constant: 0)
+        NSLayoutConstraint.activate([top, left, right])
         
-        ButtonRow.defaultCellUpdate = {
-            cell,row in
-            cell.textLabel?.font = setting_item_textFont
-            cell.textLabel?.theme_textColor = ThemeColorPicker(keyPath: "Base.base_color")
-            
+        view.addTapGesture { (tap) in
+            let id = view.id?.distinguishedName
+            self.identityViews.forEach { (i) in
+                if i.id?.distinguishedName == id {
+                    i.selectedIdentity()
+                } else {
+                    i.deSelectedIdentity()
+                }
+            }
         }
-        title = process?.name
-        showInputUI()
-        
-        
     }
-    
-//    func loadDepartAndIdentity(){
-//        let url = AppDelegate.o2Collect.generateURLWithAppContextKey(TaskContext.taskContextKey, query: TaskContext.todoCreateAvaiableIdentityByIdQuery, parameter: ["##processId##":process?.id as AnyObject])
-//        Alamofire.request(url!).responseArray(keyPath:"data") { (response:DataResponse<[IdentityV2]>) in
-//            switch response.result {
-//            case .success(let identitys):
-//                self.identitys = identitys
-//                DispatchQueue.main.async {
-//                    self.showInputUI()
-//                }
+
+
+    private func initTitleAndConstraint() -> UILabel {
+        //标题
+        let title = UILabel()
+        title.text = "请选择身份:"
+        title.font = setting_content_textFont
+        title.translatesAutoresizingMaskIntoConstraints = false
+        self.view.addSubview(title)
+        let top = NSLayoutConstraint(item: title, attribute: .top, relatedBy: .equal, toItem: title.superview!, attribute: .top, multiplier: 1, constant: 20)
+        let left = NSLayoutConstraint(item: title, attribute: .leading, relatedBy: .equal, toItem: title.superview!, attribute: .leading, multiplier: 1, constant: 10)
+        let right = NSLayoutConstraint(item: title.superview!, attribute: .trailing, relatedBy: .equal, toItem: title, attribute: .trailing, multiplier: 1, constant: 10)
+        NSLayoutConstraint.activate([top, left, right])
+
+        return title
+    }
 //
-//            case .failure(let err):
-//                DDLogError(err.localizedDescription)
-//                DispatchQueue.main.async {
-//                    self.showError(title: "读取身份列表失败")
-//                }
+//    func showInputUI() {
+//        form +++ Section("创建流程")
+//        //不需要标题
+////        <<< TextRow("title") {row in
+////            row.title = "标题"
+////            row.placeholder = "请输入标题"
+////        }.cellSetup({ (cell, row) in
+////            //cell.height = 50
+////        })
+//
+//        <<< ActionSheetRow<IdentityV2>("selectedIdentity") {
+//            $0.title = "用户身份"
+//            $0.selectorTitle = "请选择身份?"
+//            $0.options = self.identitys
+//            if(self.identitys != nil && self.identitys!.count > 0) {
+//                $0.value = self.identitys![0]
 //            }
-//        }
-//    }
-    
-    func showInputUI(){
-        form +++ Section("创建流程")
-            //不需要标题
-//        <<< TextRow("title") {row in
-//            row.title = "标题"
-//            row.placeholder = "请输入标题"
 //        }.cellSetup({ (cell, row) in
 //            //cell.height = 50
 //        })
-            
-        <<< ActionSheetRow<IdentityV2>("selectedIdentity") {
-                $0.title = "用户身份"
-                $0.selectorTitle = "请选择身份?"
-                $0.options = self.identitys
-                if(self.identitys != nil && self.identitys!.count>0){
-                    $0.value = self.identitys![0]
-                }
-        }.cellSetup({ (cell, row) in
-            //cell.height = 50
-        })
-        
-        <<< DateTimeRow("createTime") { row in
-            row.title = "创建时间"
-            row.value  = Date()
-            let formatter = DateFormatter()
-            formatter.locale = Locale.current
-            formatter.dateStyle = .long
-            row.dateFormatter = formatter
-        }.cellSetup({ (cell, row) in
-            //cell.height = 50
-        })
-            
-        +++ Section()
-            <<< ButtonRow("createButton") { (row:ButtonRow) in
-                row.title = "创建"
-            }.onCellSelection({ (cell, row) in
-//                let titleRow:TextRow = self.form.rowBy(tag:"title")!
-                let identityRow:ActionSheetRow<IdentityV2> = self.form.rowBy(tag:"selectedIdentity")!
-//                guard let title = titleRow.value else{
-//                    self.showError(title: "请输入标题")
-//                    return
-//                }
-                guard let id = identityRow.value  else {
-                    self.showError(title: "请选择身份")
-                    return
-                }
-                
-                if let mode = self.process?.defaultStartMode, mode == O2.O2_Word_draft_mode {
-                    self.createDraft(processId: self.process!.id!, identity: id.distinguishedName!)
-                }else {
-                    self.createProcess(processId: self.process!.id!, identity: id.distinguishedName!)
-                }
-            })
+//
+//
+//        <<< DateTimeRow("createTime") { row in
+//            row.title = "创建时间"
+//            row.value = Date()
+//            let formatter = DateFormatter()
+//            formatter.locale = Locale.current
+//            formatter.dateStyle = .long
+//            row.dateFormatter = formatter
+//        }.cellSetup({ (cell, row) in
+//            //cell.height = 50
+//        })
+//
+//            +++ Section()
+//        <<< ButtonRow("createButton") { (row: ButtonRow) in
+//            row.title = "创建"
+//        }.onCellSelection({ (cell, row) in
+////                let titleRow:TextRow = self.form.rowBy(tag:"title")!
+//            let identityRow: ActionSheetRow<IdentityV2> = self.form.rowBy(tag: "selectedIdentity")!
+////                guard let title = titleRow.value else{
+////                    self.showError(title: "请输入标题")
+////                    return
+////                }
+//            guard let id = identityRow.value else {
+//                self.showError(title: "请选择身份")
+//                return
+//            }
+//
+//            if let mode = self.process?.defaultStartMode, mode == O2.O2_Word_draft_mode {
+//                self.createDraft(processId: self.process!.id!, identity: id.distinguishedName!)
+//            } else {
+//                self.createProcess(processId: self.process!.id!, identity: id.distinguishedName!)
+//            }
+//        })
+//    }
+
+    @objc func create() {
+        guard let id = self.identityViews.first(where: { (view) -> Bool in
+            view.selected == true
+        }) else {
+            self.showError(title: "请选择身份")
+            return
+        }
+        if let mode = self.process?.defaultStartMode, mode == O2.O2_Word_draft_mode {
+            self.createDraft(processId: self.process?.id ?? "", identity: id.id?.distinguishedName ?? "")
+        } else {
+            self.createProcess(processId: self.process?.id ?? "", identity: id.id?.distinguishedName ?? "")
+        }
     }
-    
+
     //开启流程 创建工作
-    func createProcess(processId: String, identity:String){
+    func createProcess(processId: String, identity: String) {
         let bean = CreateProcessBean()
         bean.title = ""//不需要标题
         bean.identity = identity
-        let createURL = AppDelegate.o2Collect.generateURLWithAppContextKey(WorkContext.workContextKey, query: WorkContext.workCreateQuery, parameter: ["##id##":processId as AnyObject])
+        let createURL = AppDelegate.o2Collect.generateURLWithAppContextKey(WorkContext.workContextKey, query: WorkContext.workCreateQuery, parameter: ["##id##": processId as AnyObject])
         self.showLoading(title: "创建中,请稍候...")
-        Alamofire.request(createURL!,method:.post, parameters: bean.toJSON(), encoding: JSONEncoding.default, headers: nil).responseJSON { response in
+        Alamofire.request(createURL!, method: .post, parameters: bean.toJSON(), encoding: JSONEncoding.default, headers: nil).responseJSON { response in
             debugPrint(response.result)
             switch response.result {
             case .success(let val):
                 let taskList = JSON(val)["data"][0]
                 DDLogDebug(taskList.description)
-                if let tasks = Mapper<TodoTask>().mapArray(JSONString:taskList["taskList"].debugDescription) , tasks.count > 0 {
+                if let tasks = Mapper<TodoTask>().mapArray(JSONString: taskList["taskList"].debugDescription), tasks.count > 0 {
                     let taskStoryboard = UIStoryboard(name: "task", bundle: Bundle.main)
                     let todoTaskDetailVC = taskStoryboard.instantiateViewController(withIdentifier: "todoTaskDetailVC") as! TodoTaskDetailViewController
                     todoTaskDetailVC.todoTask = tasks[0]
@@ -173,41 +193,41 @@ class TaskCreateViewController: FormViewController {
                 DDLogError(err.localizedDescription)
                 self.showError(title: "创建失败")
             }
-           
+
         }
     }
-       
+
     //创建草稿
-   private func createDraft(processId: String, identity: String) {
-       let bean = CreateProcessBean()
-              bean.title = ""
-              bean.identity = identity
-       let draftCreateUrl = AppDelegate.o2Collect.generateURLWithAppContextKey(WorkContext.workContextKey, query: WorkContext.draftWorkCreateQuery, parameter: ["##processId##":processId as AnyObject])
-       self.showLoading(title: "创建中,请稍候...")
-       Alamofire.request(draftCreateUrl!,method:.post, parameters: bean.toJSON(), encoding: JSONEncoding.default, headers: nil).responseJSON { response in
-           
-           switch response.result {
-           case .success(let val):
-               let draftData = JSON(val)["data"]
-               DDLogDebug(draftData.description)
-               if let draft = Mapper<ProcessDraftBean>().map(JSONString:draftData["work"].debugDescription) {
-                   let taskStoryboard = UIStoryboard(name: "task", bundle: Bundle.main)
-                   let todoTaskDetailVC = taskStoryboard.instantiateViewController(withIdentifier: "todoTaskDetailVC") as! TodoTaskDetailViewController
-                   todoTaskDetailVC.draft = draft
-                   todoTaskDetailVC.backFlag = 1
-                   self.navigationController?.pushViewController(todoTaskDetailVC, animated: true)
-                   DispatchQueue.main.async {
-                       self.hideLoading()
-                   }
-               } else {
-                   self.showError(title: "创建失败")
-               }
-           case .failure(let err):
-               DDLogError(err.localizedDescription)
-               self.showError(title: "创建失败")
-           }
-       }
-   }
-
-    
+    private func createDraft(processId: String, identity: String) {
+        let bean = CreateProcessBean()
+        bean.title = ""
+        bean.identity = identity
+        let draftCreateUrl = AppDelegate.o2Collect.generateURLWithAppContextKey(WorkContext.workContextKey, query: WorkContext.draftWorkCreateQuery, parameter: ["##processId##": processId as AnyObject])
+        self.showLoading(title: "创建中,请稍候...")
+        Alamofire.request(draftCreateUrl!, method: .post, parameters: bean.toJSON(), encoding: JSONEncoding.default, headers: nil).responseJSON { response in
+
+            switch response.result {
+            case .success(let val):
+                let draftData = JSON(val)["data"]
+                DDLogDebug(draftData.description)
+                if let draft = Mapper<ProcessDraftBean>().map(JSONString: draftData["work"].debugDescription) {
+                    let taskStoryboard = UIStoryboard(name: "task", bundle: Bundle.main)
+                    let todoTaskDetailVC = taskStoryboard.instantiateViewController(withIdentifier: "todoTaskDetailVC") as! TodoTaskDetailViewController
+                    todoTaskDetailVC.draft = draft
+                    todoTaskDetailVC.backFlag = 1
+                    self.navigationController?.pushViewController(todoTaskDetailVC, animated: true)
+                    DispatchQueue.main.async {
+                        self.hideLoading()
+                    }
+                } else {
+                    self.showError(title: "创建失败")
+                }
+            case .failure(let err):
+                DDLogError(err.localizedDescription)
+                self.showError(title: "创建失败")
+            }
+        }
+    }
+
+
 }

+ 22 - 10
o2ios/O2Platform/App/Work-工作/c/TodoTaskDetailViewController.swift

@@ -229,9 +229,9 @@ class TodoTaskDetailViewController: BaseWebViewUIViewController {
         case 1:
             self.performSegue(withIdentifier: "backMainTask", sender: nil)
             break
-//        case 2:
-//            self.performSegue(withIdentifier: "backToTodoTask", sender: nil)
-//            break
+        case 2:
+            self.performSegue(withIdentifier: "backToTodoTask", sender: nil)
+            break
             //5是处理内容管理创建过来的流程 因为有一个创建页面 所以需要跳两层回去
         case 4, 5:
             if let index = self.navigationController?.viewControllers.firstIndex(of: self) {
@@ -831,8 +831,12 @@ extension TodoTaskDetailViewController: O2WKScriptMessageHandlerImplement {
         case "uploadAttachment":
             ZonePermissions.requestImagePickerAuthorization(callback: { (zoneStatus) in
                 if zoneStatus == ZoneAuthorizationStatus.zAuthorizationStatusAuthorized {
-                    let site = (message.body as! NSDictionary)["site"]
-                    self.uploadAttachment(site as! String)
+//                    let site = (message.body as! NSDictionary)["site"]
+                    if  let body = (message.body as?  NSDictionary), let site = body["site"] as? String {
+                        self.uploadAttachment(site)
+                    }else {
+                        self.showError(title: "参数传入错误,无法上传!")
+                    }
                 } else {
                     //显示
                     self.gotoApplicationSettings(alertMessage: "需要照片允许访问权限,是否跳转到手机设置页面开启相机权限?")
@@ -840,13 +844,21 @@ extension TodoTaskDetailViewController: O2WKScriptMessageHandlerImplement {
             })
             break
         case "downloadAttachment":
-            let attachmentId = (message.body as! NSDictionary)["id"]
-            self.downloadAttachment(attachmentId as! String)
+//            let attachmentId = (message.body as! NSDictionary)["id"]
+            if let body = (message.body as? NSDictionary), let attachmentId = body["id"] as? String {
+                self.downloadAttachment(attachmentId)
+            }else {
+                self.showError(title: "参数传入错误,无法下载!")
+            }
             break
         case "replaceAttachment":
-            let attachmentId = (message.body as! NSDictionary)["id"] as! String
-            let site = (message.body as! NSDictionary)["site"] as? String
-            self.replaceAttachment(attachmentId, site ?? "")
+//            let attachmentId = (message.body as! NSDictionary)["id"] as! String
+//            let site = (message.body as! NSDictionary)["site"] as? String
+            if let body = (message.body as? NSDictionary), let attachmentId = body["id"] as? String, let site = body["site"] as? String {
+                self.replaceAttachment(attachmentId, site)
+            }else {
+                self.showError(title: "参数传入错误,无法替换!")
+            }
             break
         case "openDocument":
             let url = (message.body as! NSString)

+ 15 - 18
o2ios/O2Platform/App/Work-工作/c/TodoTaskViewController.swift

@@ -90,10 +90,10 @@ class TodoTaskViewController: UITableViewController {
     
     override func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
-        if self.searchController.isActive {
-            self.searchController.isActive = false
-        }
-        self.searchController.searchBar.removeFromSuperview()
+//        if self.searchController.isActive {
+//            self.searchController.isActive = false
+//        }
+//        self.searchController.searchBar.removeFromSuperview()
     }
     
     override func viewDidLoad() {
@@ -113,11 +113,7 @@ class TodoTaskViewController: UITableViewController {
         if let searchField = self.searchController.searchBar.value(forKey: "searchField") as? UITextField {
             searchField.textColor = .white
         }
-        
-        
-        
-//        
-//        //设置搜索框是否显示
+        //设置搜索框是否显示
         self.setSearchBarIsShow()
         
         //分页刷新功能
@@ -481,16 +477,17 @@ class TodoTaskViewController: UITableViewController {
     //backWindtodoTask
     @IBAction func unWindForTodoTask(_ segue:UIStoryboardSegue){
         DDLogDebug(segue.identifier!)
-        if segue.identifier == "backToTodoTask" {
-            self.segmentedControl.setSelected(at: 0, animated: true)
-            AppConfigSettings.shared.taskIndex = 0
-            self.tableView.mj_header.beginRefreshing()
+        self.tableView.mj_header.beginRefreshing()
+//        if segue.identifier == "backToTodoTask" {
+//            self.segmentedControl.setSelected(at: 0, animated: true)
+//            AppConfigSettings.shared.taskIndex = 0
+//            self.tableView.mj_header.beginRefreshing()
             //self.segmentedSelected(self.taskSegmentedControl)
-        }else if segue.identifier == "backToReadTask" {
-            self.segmentedControl.setSelected(at: 1, animated: true)
-            AppConfigSettings.shared.taskIndex = 1
-            self.tableView.mj_header.beginRefreshing()
-        }
+//        }else if segue.identifier == "backToReadTask" {
+//            self.segmentedControl.setSelected(at: 1, animated: true)
+//            AppConfigSettings.shared.taskIndex = 1
+//            self.tableView.mj_header.beginRefreshing()
+//        }
     }
     
 }

+ 12 - 1
o2ios/O2Platform/App/Work-工作/c/category/ZoneMenuViewController.swift

@@ -292,7 +292,18 @@ class ZoneMenuViewController: UIViewController {
             if sender is TaskCreateData {
                 let data = sender as? TaskCreateData
                 destVc.process = data?.process
-                destVc.identitys = data?.identitys
+                //主身份排序
+                if let identitys = data?.identitys {
+                    var newArray = identitys
+                    newArray.sort { (first, second) -> Bool in
+                        if second.major == true {
+                            return false
+                        } else  {
+                            return true
+                        }
+                    }
+                    destVc.identitys = newArray
+                }
             }
         }
     }

+ 47 - 0
o2ios/O2Platform/App/Work-工作/v/IdentitySelectView.swift

@@ -0,0 +1,47 @@
+//
+//  IdentitySelectView.swift
+//  O2Platform
+//
+//  Created by FancyLou on 2020/8/5.
+//  Copyright © 2020 zoneland. All rights reserved.
+//
+
+import UIKit
+
+class IdentitySelectView: UIView {
+
+    @IBOutlet weak var identityLabel: UILabel!
+    
+    @IBOutlet weak var identityUnitLabel: UILabel!
+    
+    @IBOutlet weak var selectedImageView: UIImageView!
+    
+    var selected = false
+    var id : IdentityV2? = nil
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+    }
+    
+    
+    func setUp(identity: IdentityV2) {
+        self.id = identity
+        self.identityLabel.text = "\(identity.name ?? "")(\(identity.unitName ?? ""))"
+        self.identityLabel.textColor = text_primary_color
+        self.identityUnitLabel.text = "\(identity.unitLevelName ?? "")"
+        self.identityUnitLabel.textColor = text_normal_color
+        self.backgroundColor = .white
+    }
+    
+    func selectedIdentity() {
+        self.selected = true
+        self.identityLabel.textColor = base_color
+        self.selectedImageView.isHidden = false
+    }
+    
+    func deSelectedIdentity() {
+        self.selected = false
+        self.identityLabel.textColor = text_primary_color
+        self.selectedImageView.isHidden = true
+    }
+}

+ 71 - 0
o2ios/O2Platform/App/Work-工作/v/IdentitySelectView.xib

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="IdentitySelectView" customModule="O2Platform" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="414" height="94"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="身份(开发部)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Llb-2N-UP4">
+                    <rect key="frame" x="25" y="15" width="102" height="26"/>
+                    <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="18"/>
+                    <color key="textColor" red="0.98431372549999996" green="0.2784313725" blue="0.2784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="浙江兰德纵横网络技术股份有限公司/杭州基地/移动开发组" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DH6-jo-7YZ">
+                    <rect key="frame" x="25" y="51" width="364" height="17"/>
+                    <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
+                    <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EOl-2C-XKP">
+                    <rect key="frame" x="0.0" y="93" width="414" height="1"/>
+                    <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="1" id="CaV-wP-Ppk"/>
+                    </constraints>
+                </view>
+                <imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon__ok2_click" translatesAutoresizingMaskIntoConstraints="NO" id="1Wp-Cu-Qxc">
+                    <rect key="frame" x="385" y="35" width="24" height="24"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="24" id="cJl-oC-BwH"/>
+                        <constraint firstAttribute="height" constant="24" id="neo-Wd-Pgb"/>
+                    </constraints>
+                </imageView>
+            </subviews>
+            <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+            <constraints>
+                <constraint firstItem="Llb-2N-UP4" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="15" id="41B-Me-xnQ"/>
+                <constraint firstItem="1Wp-Cu-Qxc" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="7H5-QN-ZW8"/>
+                <constraint firstAttribute="trailing" secondItem="1Wp-Cu-Qxc" secondAttribute="trailing" constant="5" id="7SS-cE-Y7t"/>
+                <constraint firstItem="DH6-jo-7YZ" firstAttribute="top" secondItem="Llb-2N-UP4" secondAttribute="bottom" constant="10" id="E95-I7-Fxz"/>
+                <constraint firstItem="EOl-2C-XKP" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="93" id="STe-fA-Xeb"/>
+                <constraint firstAttribute="bottom" secondItem="EOl-2C-XKP" secondAttribute="bottom" id="SgA-cv-4D5"/>
+                <constraint firstItem="Llb-2N-UP4" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="25" id="Utf-v5-BGs"/>
+                <constraint firstItem="EOl-2C-XKP" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="b0g-jI-nxJ"/>
+                <constraint firstItem="DH6-jo-7YZ" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="25" id="rTy-PV-TXj"/>
+                <constraint firstAttribute="trailing" secondItem="DH6-jo-7YZ" secondAttribute="trailing" constant="25" id="w1y-Oc-ce8"/>
+                <constraint firstAttribute="trailing" secondItem="EOl-2C-XKP" secondAttribute="trailing" id="yyB-kq-KwU"/>
+            </constraints>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
+            <connections>
+                <outlet property="identityLabel" destination="Llb-2N-UP4" id="v7n-Qi-UXw"/>
+                <outlet property="identityUnitLabel" destination="DH6-jo-7YZ" id="3IR-su-ods"/>
+                <outlet property="selectedImageView" destination="1Wp-Cu-Qxc" id="R6V-Fi-hKy"/>
+            </connections>
+            <point key="canvasLocation" x="131.8840579710145" y="-88.392857142857139"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="icon__ok2_click" width="22" height="22"/>
+    </resources>
+</document>

+ 2 - 0
o2ios/O2Platform/App/contacts/m/IdentityV2.swift

@@ -22,6 +22,7 @@ class IdentityV2:NSObject,Mappable{
     var unit : String?
     var unitLevel : Int?
     var unitLevelName : String?
+    var major: Bool? //是否主身份
     var unitName : String?
     var updateTime : String?
     var orderNumber : Int?
@@ -46,6 +47,7 @@ class IdentityV2:NSObject,Mappable{
         unit <- map["unit"]
         unitLevel <- map["unitLevel"]
         unitLevelName <- map["unitLevelName"]
+        major <- map["major"]
         unitName <- map["unitName"]
         updateTime <- map["updateTime"]
         orderNumber <- map["orderNumber"]

+ 1 - 1
o2ios/O2Platform/Info.plist

@@ -167,7 +167,7 @@
 		<key>centerContext</key>
 		<string>/x_program_center</string>
 		<key>centerHost</key>
-		<string>wrdp3.zoneland.net</string>
+		<string>dd.o2oa.net</string>
 		<key>centerPort</key>
 		<integer>20030</integer>
 		<key>httpProtocol</key>

+ 3 - 0
o2ios/O2Platform/config/config.swift

@@ -73,6 +73,9 @@ let setting_content_textFont = UIFont(name: "PingFangSC-Light", size: 12.0)
 let setting_content_textColor = RGB(155, g: 155, b: 155)
 
 
+let text_primary_color = UIColor(hex: "#333333")
+let text_normal_color = UIColor(hex: "#666666")
+
 
 
 //基本颜色