Commit fd6ee8b2 authored by 曹云霄's avatar 曹云霄

去掉无用框架、整理部分代码

parent 1980c2e1
This diff is collapsed.
......@@ -54,8 +54,8 @@ class BaseTableViewPullController: BaseViewController {
// MARK: - 添加上拉加载更多
func setupTableViewFooter() {
let footer = MJRefreshAutoNormalFooter.init(refreshingTarget: self, refreshingAction: #selector(BaseTableViewPullController.loadTableViewFooter))
footer?.setTitle("~ 加载更多 ~", for: .idle)
let footer = MJRefreshAutoNormalFooter(refreshingTarget: self, refreshingAction: #selector(BaseTableViewPullController.loadTableViewFooter))
footer?.setTitle("", for: .idle)
footer?.setTitle("~ 加载中 ~", for: .refreshing)
footer?.setTitle("~ end ~", for: .noMoreData)
footer?.stateLabel.textColor = kNavColor
......@@ -104,7 +104,6 @@ class BaseTableViewPullController: BaseViewController {
}
}
extension BaseTableViewPullController: DZNEmptyDataSetSource,DZNEmptyDataSetDelegate {
func image(forEmptyDataSet scrollView: UIScrollView!) -> UIImage! {
......
//
// UIDevice+Helper.h
// Patrol
//
// Created by 曹云霄 on 2017/7/19.
// Copyright © 2017年 上海勾芒科技信息有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIDevice (Helper)
/**
获取设备名称
*/
+ (NSString *)deviceModelName;
/**
app版本号
*/
+ (NSString *)appVersion;
/**
app名称
*/
+ (NSString *)appName;
/**
app图标
*/
+ (UIImage *)appIcon;
@end
//
// UIDevice+Helper.m
// Patrol
//
// Created by 曹云霄 on 2017/7/19.
// Copyright © 2017年 上海勾芒科技信息有限公司. All rights reserved.
//
#import "UIDevice+Helper.h"
#import <sys/utsname.h>
@implementation UIDevice (Helper)
//获取设备名称
+ (NSString*)deviceModelName
{
struct utsname systemInfo;
uname(&systemInfo);
NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
//iPhone 系列
if ([deviceModel isEqualToString:@"iPhone1,1"]) return @"iPhone 1G";
if ([deviceModel isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([deviceModel isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([deviceModel isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([deviceModel isEqualToString:@"iPhone3,2"]) return @"Verizon iPhone 4";
if ([deviceModel isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([deviceModel isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([deviceModel isEqualToString:@"iPhone5,2"]) return @"iPhone 5";
if ([deviceModel isEqualToString:@"iPhone5,3"]) return @"iPhone 5C";
if ([deviceModel isEqualToString:@"iPhone5,4"]) return @"iPhone 5C";
if ([deviceModel isEqualToString:@"iPhone6,1"]) return @"iPhone 5S";
if ([deviceModel isEqualToString:@"iPhone6,2"]) return @"iPhone 5S";
if ([deviceModel isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([deviceModel isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([deviceModel isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([deviceModel isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([deviceModel isEqualToString:@"iPhone9,1"]) return @"iPhone 7 (CDMA)";
if ([deviceModel isEqualToString:@"iPhone9,3"]) return @"iPhone 7 (GSM)";
if ([deviceModel isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus (CDMA)";
if ([deviceModel isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus (GSM)";
//iPod 系列
if ([deviceModel isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G";
if ([deviceModel isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G";
if ([deviceModel isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G";
if ([deviceModel isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G";
if ([deviceModel isEqualToString:@"iPod5,1"]) return @"iPod Touch 5G";
//iPad 系列
if ([deviceModel isEqualToString:@"iPad1,1"]) return @"iPad";
if ([deviceModel isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)";
if ([deviceModel isEqualToString:@"iPad2,2"]) return @"iPad 2 (GSM)";
if ([deviceModel isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
if ([deviceModel isEqualToString:@"iPad2,4"]) return @"iPad 2 (32nm)";
if ([deviceModel isEqualToString:@"iPad2,5"]) return @"iPad mini (WiFi)";
if ([deviceModel isEqualToString:@"iPad2,6"]) return @"iPad mini (GSM)";
if ([deviceModel isEqualToString:@"iPad2,7"]) return @"iPad mini (CDMA)";
if ([deviceModel isEqualToString:@"iPad3,1"]) return @"iPad 3(WiFi)";
if ([deviceModel isEqualToString:@"iPad3,2"]) return @"iPad 3(CDMA)";
if ([deviceModel isEqualToString:@"iPad3,3"]) return @"iPad 3(4G)";
if ([deviceModel isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)";
if ([deviceModel isEqualToString:@"iPad3,5"]) return @"iPad 4 (4G)";
if ([deviceModel isEqualToString:@"iPad3,6"]) return @"iPad 4 (CDMA)";
if ([deviceModel isEqualToString:@"iPad4,1"]) return @"iPad Air";
if ([deviceModel isEqualToString:@"iPad4,2"]) return @"iPad Air";
if ([deviceModel isEqualToString:@"iPad4,3"]) return @"iPad Air";
if ([deviceModel isEqualToString:@"iPad5,3"]) return @"iPad Air 2";
if ([deviceModel isEqualToString:@"iPad5,4"]) return @"iPad Air 2";
if ([deviceModel isEqualToString:@"i386"]) return @"Simulator";
if ([deviceModel isEqualToString:@"x86_64"]) return @"Simulator";
if ([deviceModel isEqualToString:@"iPad4,4"]
||[deviceModel isEqualToString:@"iPad4,5"]
||[deviceModel isEqualToString:@"iPad4,6"]) return @"iPad mini 2";
if ([deviceModel isEqualToString:@"iPad4,7"]
||[deviceModel isEqualToString:@"iPad4,8"]
||[deviceModel isEqualToString:@"iPad4,9"]) return @"iPad mini 3";
return deviceModel;
}
/**
app版本号
*/
+ (NSString *)appVersion
{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
return app_Version;
}
/**
app名称
*/
+ (NSString *)appName
{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
return app_Name;
}
/**
app图标
*/
+ (UIImage *)appIcon
{
NSDictionary *infoPlist = [[NSBundle mainBundle] infoDictionary];
NSString *icon = [[infoPlist valueForKeyPath:@"CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles"] lastObject];
UIImage *image = [UIImage imageNamed:icon];
return image;
}
@end
......@@ -11,3 +11,9 @@ import Foundation
//本地存储用户信息
public let accountPath: String = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! + "/userAccount.plist"
/// 添加图片
public let add_Photo: String = "add_photo"
/// 子订单完成界面,维修前、维修后
public let after: String = "after"
public let befor: String = "befor"
......@@ -72,10 +72,20 @@ public enum CHILD_BILL_EDIT_SECTION: Int {
case DESCRIBE
case AFTERATTACHMENT
case BEFORATTACHMENT
}
/// 待办事项状态
///
/// - INIT: 未开始
/// - DREW: 已领单
/// - ALL: 全部
public enum TODO_STATE: String {
case INIT = "init"
case DREW = "drew"
case ALL = "all"
}
......
......@@ -25,14 +25,19 @@ public let kTabBarHeight: CGFloat = 49
public let kROWS: Int = 15
public let kONE: Int = 1
public let kZERO: Int = 0
public let kPageSize: Int = 15
public let kSectionZero: CGFloat = 0.01
public let kSectionTen: CGFloat = 10
public let kEmptyHeight: CGFloat = 108
public let kWidth: CGFloat = UIScreen.main.bounds.size.width
public let kHeight: CGFloat = UIScreen.main.bounds.size.height
public let kWindow: UIWindow = ((UIApplication.shared.delegate?.window)!)!
/// 用户信息
public func kUser() -> UserModel {
return AppManager.shareInstance.userModel
}
......
......@@ -15,3 +15,6 @@ public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest"
/// 登录
public let loginUrl: String = "/user/login/%@"
/// 待办事项
public let todoUrl: String = "/message/query"
......@@ -22,6 +22,21 @@ extension UIViewController {
return searchBar
}
// MARK: - 创建UIBarbuttonItem
open func createButtonItem(_ title: String?, _ imageName: String?,_ target: Any,_ action: Selector) ->UIBarButtonItem {
let button = UIButton(type: .custom)
button.addTarget(target, action: action, for: .touchUpInside)
if title != nil {
button.setTitle(title, for: .normal)
}else if imageName != nil {
button.setImage(UIImage(named: imageName!), for: .normal)
}else {
button.setTitle("确认", for: .normal)
}
button.sizeToFit()
return UIBarButtonItem(customView: button)
}
///EZSE: Pushes a view controller onto the receiver’s stack and updates the display.
open func pushVC(_ vc: UIViewController) {
navigationController?.pushViewController(vc, animated: true)
......
......@@ -61,6 +61,15 @@ struct Network {
switch result {
/// 请求成功后先通过json解析数据,如果解析失败使用jsonString重试一次
case let .success(response):
//打印参数、返回
print("url = " + (response.request?.url?.absoluteString)!)
do {
let body = try JSON(data: (response.request?.httpBody)!)
print(body)
let result = try JSON(data: response.data)
print(result)
}catch {}
do {
guard response.statusCode == 200 else {
failure(MoyaError.statusCode(response))
......
......@@ -9,11 +9,14 @@
import Foundation
import Moya
import Alamofire
import SwiftyJSON
public enum Service {
// MARK: - 登录
case Login(String,String)
// MARK: - 待办事项查询
case QueryTodo(QueryTodoModel)
}
extension Service: TargetType {
......@@ -25,13 +28,17 @@ extension Service: TargetType {
switch self {
case .Login(let name, _):
return String(format: loginUrl, name)
case .QueryTodo(_):
return todoUrl
}
}
public var method: Moya.Method {
switch self {
case .Login(_, _):
case .Login(_, _),
.QueryTodo(_):
return .post
}
}
......@@ -45,6 +52,9 @@ extension Service: TargetType {
return .requestParameters(parameters: ["password": password,
"authenticode": "211534962"],
encoding: JSONEncoding.default)
case .QueryTodo(let model):
return .requestParameters(parameters: model.toDictionary(),
encoding: JSONEncoding.default)
}
}
......
......@@ -9,7 +9,6 @@
import UIKit
import ImagePicker
import SKPhotoBrowser
import Async
......
//
// AboutUsTableViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/1/9.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class AboutUsTableViewController: BaseTableViewController {
/// app图标
@IBOutlet weak var appIconImg: UIImageView!
/// app图标背景
@IBOutlet weak var appIconBgView: UIView!
/// app版本
@IBOutlet weak var appVersionLab: UILabel!
/// 联系方式
@IBOutlet weak var appMobileLab: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
uiConfigAction()
}
// MARK: - UI
fileprivate func uiConfigAction() {
view.layoutIfNeeded()
appIconBgView.seth(h: kWidth * 9 / 16)
appVersionLab.text = UIDevice.version()
// appIconImg.image = UIDevice.appIcon()
appMobileLab.text = "15121161964"
}
}
......@@ -8,6 +8,7 @@
import UIKit
import Kingfisher
import YXAlertController
class AccountTableViewController: BaseTableViewController {
......@@ -17,7 +18,11 @@ class AccountTableViewController: BaseTableViewController {
@IBOutlet weak var userNameLab: UILabel!
/// 账户背景
@IBOutlet weak var accountBgView: UIView!
/// 账户VieWModel
lazy final var accountViewModel: AccountViewModel = {
var accountViewModel = AccountViewModel()
return accountViewModel;
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -45,11 +50,18 @@ class AccountTableViewController: BaseTableViewController {
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 10
return kSectionTen
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return kSectionZero
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if indexPath.section == kONE && indexPath.row == kZERO {
accountViewModel.loginOutAction()
}
}
}
......
//
// ChangePasswordTableViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/1/9.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
import RxSwift
class ChangePasswordTableViewController: BaseTableViewController {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 旧密码
@IBOutlet weak var oldPasswordText: UITextField!
/// 新密码
@IBOutlet weak var newPasswordText: UITextField!
/// 确认新密码
@IBOutlet weak var new2PasswordText: UITextField!
/// 确认新密码
@IBOutlet weak var affirmButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
uiConfigAction()
bindingRxAction()
}
// MARK: - UI
fileprivate func uiConfigAction() {
affirmButton.addAngle(5.0)
}
// MARK: - UITextField绑定RxSwift事件
fileprivate func bindingRxAction() {
let oldPasswordValid = oldPasswordText.rx.text.map { (text) -> Bool in
if (text?.isEmpty)! {
return false
}
return true
}
let newPasswordValid = newPasswordText.rx.text.map { (text) -> Bool in
if (text?.isEmpty)! {
return false
}
return true
}
let new2PasswordValid = new2PasswordText.rx.text.map { (text) -> Bool in
if (text?.isEmpty)! {
return false
}
return true
}
Observable.combineLatest(oldPasswordValid,newPasswordValid,new2PasswordValid).map { (oldPasswordValid,newPasswordValid,new2PasswordValid) -> Bool in
return oldPasswordValid && newPasswordValid && new2PasswordValid
}.subscribe(onNext: {[weak self] (bool) in
self?.affirmButton.isEnabled = bool
self?.affirmButton.alpha = bool ? 1 : 0.5
}).disposed(by: disposeBag)
}
// MARK: - 确认新密码
@IBAction func affirmButtonClickAction(_ sender: UIButton) {
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return kSectionZero
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return kSectionTen
}
}
//
// AccountViewModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/9.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
import YXAlertController
class AccountViewModel: BaseViewModel {
// MARK: - 退出登录
func loginOutAction() {
ShowAlertView("提示", "请确认是否退出登录?", ["取消","确认"], .alert) { (index) in
if index == kZERO { return }
do {
try FileManager.default.removeItem(atPath: accountPath)
}catch {
ShowMessage("删除用户信息失败")
}
AppManager.shareInstance.openLoginVc()
}
}
}
......@@ -66,12 +66,19 @@ class RepairOrderAddTableViewController: BaseTableViewController {
fileprivate func uiConfigAction() {
describeTextView.placeholder = "工单描述"
tableView.register(UINib(nibName: RepairAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: RepairAttachmentTableViewCell.name())
describeTextView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0)
navigationItem.rightBarButtonItem = createButtonItem("提交", nil, self, #selector(RepairOrderAddTableViewController.submitButtonClickAction))
}
// MARK: - 提交工单
@objc fileprivate func submitButtonClickAction() {
}
// MARK: - 设置附件VC
fileprivate func setupPhotoAttachmentVc(){
addChildViewController(attachmentVc)
attachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel("add_photo", .ATTACHMENT_ADD))
attachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel(add_Photo, .ATTACHMENT_ADD))
attachmentHeight = attachmentVc.attachmentHeight(kONE,nil)
}
......
......@@ -21,9 +21,6 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
var beforAttachmentHeight: CGFloat! = 0
/// 维修后图片附件高度
var afterAttachmentHeight: CGFloat! = 0
/// key
let after: String = "after"
let befor: String = "befor"
/// 维修前图片附件
lazy final var beforAttachmentVc: PhotoAttachmentViewController = {
......@@ -50,8 +47,8 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
fileprivate func setupPhotoAttachmentVc(){
addChildViewController(afterAttachmentVc)
addChildViewController(beforAttachmentVc)
beforAttachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel("add_photo", .ATTACHMENT_ADD))
afterAttachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel("add_photo", .ATTACHMENT_ADD))
beforAttachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel(add_Photo, .ATTACHMENT_ADD))
afterAttachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel(add_Photo, .ATTACHMENT_ADD))
afterAttachmentHeight = afterAttachmentVc.attachmentHeight(kONE,after)
beforAttachmentHeight = beforAttachmentVc.attachmentHeight(kONE,befor)
}
......
//
// TodoResultModel.swift
//
// Create by 云霄 曹 on 9/1/2018
import Foundation
import SwiftyJSON
class TodoResultModel{
var data : TodoData!
var message : String!
var success : Bool!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
let dataJson = json["data"]
if !dataJson.isEmpty{
data = TodoData(fromJson: dataJson)
}
message = json["message"].stringValue
success = json["success"].boolValue
}
}
class Record{
var content : String!
var createTime : String!
var entityType : String!
var entityUuid : String!
var prompt : String!
var state : Bool!
var userid : String!
var uuid : String!
var version : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
content = json["content"].stringValue
createTime = json["createTime"].stringValue
entityType = json["entityType"].stringValue
entityUuid = json["entityUuid"].stringValue
prompt = json["prompt"].stringValue
state = json["state"].boolValue
userid = json["userid"].stringValue
uuid = json["uuid"].stringValue
version = json["version"].intValue
}
}
class Paging{
var page : Int!
var pageCount : Int!
var pageSize : Int!
var recordCount : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
page = json["page"].intValue
pageCount = json["pageCount"].intValue
pageSize = json["pageSize"].intValue
recordCount = json["recordCount"].intValue
}
}
class TodoData{
var paging : Paging!
var records : [Record]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
let pagingJson = json["paging"]
if !pagingJson.isEmpty{
paging = Paging(fromJson: pagingJson)
}
records = [Record]()
let recordsArray = json["records"].arrayValue
for recordsJson in recordsArray{
let value = Record(fromJson: recordsJson)
records.append(value)
}
}
}
......@@ -7,15 +7,73 @@
//
import UIKit
import RxSwift
class TodoViewModel: BaseViewModel {
}
/// 查询待办事项model
lazy final var queryModel: QueryTodoModel = {
var queryModel = QueryTodoModel()
queryModel.prompt = "未处理"
queryModel.receiver = kUser().userUuid
return queryModel
}()
/// 待办事项结果
lazy final var todoArray: Array<Record> = {
var todoArray = Array<Record>()
return todoArray
}()
/// 查询待办事项
///
/// - Parameters:
/// - page: 页数
/// - state: 状态
func queryTodoAction(_ page: Int,_ state: TODO_STATE) ->Observable<Int> {
queryModel.page = page
queryModel.pageSize = kPageSize
queryModel.state = state.rawValue
return Observable.create({ (observer) -> Disposable in
Network.request(target: .QueryTodo(self.queryModel), success: {[weak self] (json) in
let resultModel = TodoResultModel(fromJson: json)
if resultModel.success {
if page == kZERO {
self?.todoArray.removeAll()
}
for data in resultModel.data.records {
self?.todoArray.append(data)
}
observer.onNext(resultModel.data.paging.pageCount)
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
}
extension TodoViewModel {
/// 待办事项菜单调用
func dequeueReusableCell(_ identifier: String, _ indexPath: IndexPath, _ tableView: UITableView) -> UITableViewCell {
let todoCell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! TodoTableViewCell
return todoCell
}
/// 首页待办事项调用
func dequeueReusableHomeCell(_ identifier: String, _ indexPath: IndexPath, _ tableView: UITableView) -> UITableViewCell {
let todoCell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! HomeTableViewCell
return todoCell
}
}
......@@ -18,6 +18,10 @@ class HomeContentViewController: BaseViewController {
/// 当前子视图
var currentVc: BaseTableViewPullController!
/// 待办事项状态
// 未开始,已领单
let todoStates = [TODO_STATE.INIT,TODO_STATE.DREW]
override func viewDidLoad() {
super.viewDidLoad()
addChildContentVc()
......@@ -26,7 +30,8 @@ class HomeContentViewController: BaseViewController {
// MARK: - 添加子控制器到主控制器
fileprivate func addChildContentVc() {
for i in 0..<contentSegmented.numberOfSegments {
let homeTableVc = HomeTableViewController.instantiateViewController(.Home) as! BaseTableViewPullController
let homeTableVc = HomeTableViewController.instantiateViewController(.Home) as! HomeTableViewController
homeTableVc.todoState = todoStates[i]
addChildViewController(homeTableVc)
if i == kZERO {
currentVc = homeTableVc
......
......@@ -7,31 +7,64 @@
//
import UIKit
import RxSwift
import RxCocoa
class HomeTableViewController: BaseTableViewPullController {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 待办事项ViewModel
lazy final var todoViewModel: TodoViewModel = {
var todoViewModel = TodoViewModel()
return todoViewModel
}()
/// 待办状态
open var todoState: TODO_STATE!
override func viewDidLoad() {
super.viewDidLoad()
}
// MARK: - 获取数据
override func loadWebDataSource() {
endRefresh()
todoViewModel.queryTodoAction(pullPageIndex, todoState).subscribe(onNext: {[weak self] (pageCount) in
if (self?.pullPageIndex)! >= pageCount {
self?.endRefreshNomoreData()
}else {
self?.endRefresh()
}
self?.tableView.reloadData()
}).disposed(by: disposeBag)
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let homeCell = tableView.dequeueReusableCell(withIdentifier: HomeTableViewCell.name(), for: indexPath)
return homeCell
return todoViewModel.dequeueReusableHomeCell(HomeTableViewCell.name(), indexPath, tableView)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
return todoViewModel.todoArray.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 50
return 60
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
}
}
......@@ -11,7 +11,6 @@ import SnapKit
class HomeViewController: BaseViewController {
/// 子视图背景View
@IBOutlet weak var contentBgView: UIView!
......
//
// QueryTodoModel.swift
//
// Create by 云霄 曹 on 9/1/2018
// Copyright © 2018. All rights reserved.
import Foundation
import SwiftyJSON
public class QueryTodoModel {
var content : String!
var order : Order!
var overReceiver : String!
var overSpecifyRole : String!
var overtime : String!
var page : Int!
var pageSize : Int!
var prompt : String!
var receiver : String!
var remindTime : String!
var specifyRole : String!
var state : String!
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if content != nil{
dictionary["content"] = content
}
if order != nil{
dictionary["order"] = order.toDictionary()
}
if overReceiver != nil{
dictionary["overReceiver"] = overReceiver
}
if overSpecifyRole != nil{
dictionary["overSpecifyRole"] = overSpecifyRole
}
if overtime != nil{
dictionary["overtime"] = overtime
}
if page != nil{
dictionary["page"] = page
}
if pageSize != nil{
dictionary["pageSize"] = pageSize
}
if prompt != nil{
dictionary["prompt"] = prompt
}
if receiver != nil{
dictionary["receiver"] = receiver
}
if remindTime != nil{
dictionary["remindTime"] = remindTime
}
if specifyRole != nil{
dictionary["specifyRole"] = specifyRole
}
if state != nil{
dictionary["state"] = state
}
return dictionary
}
}
public class Order{
var direction : String!
var field : String!
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if direction != nil{
dictionary["direction"] = direction
}
if field != nil{
dictionary["field"] = field
}
return dictionary
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="oZa-IQ-b7k">
<device id="retina5_9" orientation="portrait">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
......@@ -15,11 +15,11 @@
<objects>
<viewController id="oZa-IQ-b7k" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Qv6-mi-Qhw">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="1470363197668_fact_1" translatesAutoresizingMaskIntoConstraints="NO" id="cwD-kG-8mE">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launchImage_bg" translatesAutoresizingMaskIntoConstraints="NO" id="cwD-kG-8mE">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......@@ -38,6 +38,6 @@
</scene>
</scenes>
<resources>
<image name="1470363197668_fact_1" width="360" height="640"/>
<image name="launchImage_bg" width="360" height="640"/>
</resources>
</document>
......@@ -19,7 +19,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo_bg" translatesAutoresizingMaskIntoConstraints="NO" id="vja-5Y-7mu">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo_bg" translatesAutoresizingMaskIntoConstraints="NO" id="vja-5Y-7mu">
<rect key="frame" x="0.0" y="0.0" width="414" height="240"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LbX-eW-pH9">
......@@ -61,7 +61,7 @@
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<textInputTraits key="textInputTraits" secureTextEntry="YES"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yPV-5e-fY6">
<rect key="frame" x="75" y="240.66666666666669" width="309" height="1"/>
......
This diff is collapsed.
......@@ -9,7 +9,7 @@ import Foundation
import SwiftyJSON
class UserModel : NSObject, NSCoding{
public class UserModel : NSObject, NSCoding{
var authenticode : String!
var belongOrgIsLeaf : Bool!
......@@ -109,7 +109,7 @@ class UserModel : NSObject, NSCoding{
* NSCoding required initializer.
* Fills the data from the passed decoder
*/
@objc required init(coder aDecoder: NSCoder)
@objc required public init(coder aDecoder: NSCoder)
{
authenticode = aDecoder.decodeObject(forKey: "authenticode") as? String
belongOrgIsLeaf = aDecoder.decodeObject(forKey: "belongOrgIsLeaf") as? Bool
......@@ -132,7 +132,7 @@ class UserModel : NSObject, NSCoding{
* NSCoding required method.
* Encodes mode properties into the decoder
*/
func encode(with aCoder: NSCoder)
public func encode(with aCoder: NSCoder)
{
if authenticode != nil{
aCoder.encode(authenticode, forKey: "authenticode")
......
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "图层1iPhoneNotification_20pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "图层1iPhoneNotification_20pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "图层1iPhoneSpootlight5_29pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "图层1iPhoneSpootlight5_29pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "图层1iPhoneSpootlight7_40pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "图层1iPhoneSpootlight7_40pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "图层1iPhoneApp_60pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "图层1iPhoneApp_60pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "图层1iPadNotifications_20pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "图层1iPadNotifications_20pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "图层1iPadSpootlight5_29pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "图层1iPadSpootlight5_29pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "图层1iPadSpootlight7_40pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "图层1iPadSpootlight7_40pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "图层1iPadApp_76pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "图层1iPadApp_76pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "图层1iPadProApp_83.5pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "图层1store_1024pt.png",
"scale" : "1x"
}
],
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "launchImage_bg@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "launchImage_bg@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -2,15 +2,16 @@
"images" : [
{
"idiom" : "universal",
"filename" : "1470363197668_fact_1.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "login_out@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "login_out@3x.png",
"scale" : "3x"
}
],
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "launchImage_bg@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "launchImage_bg@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -7,3 +7,4 @@
#import "YXKitHeader.h"
#import "YXPickerManager.h"
#import "IQTextView.h"
#import "UIDevice+Helper.h"
......@@ -2,11 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>zh_CN</string>
<key>CFBundleDisplayName</key>
......@@ -27,14 +22,19 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>LaunchScreen</string>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
......
......@@ -4,7 +4,6 @@ use_frameworks!
target IFS do
pod 'SnapKit'
pod 'SwiftyJSON'
pod 'IGListKit'
pod 'Moya'
pod 'DZNEmptyDataSet'
pod 'Kingfisher'
......@@ -14,8 +13,6 @@ target ‘IFS’ do
pod 'RxSwift'
pod 'RxCocoa'
pod 'HandyJSON', '~> 4.0.0-beta.1'
pod 'AsyncSwift'
pod 'YYText', '~> 1.0.7'
pod 'MJRefresh', '~> 3.1.15.1'
pod 'YXKit'
pod 'YXAlertController', '~> 1.0.8'
......
PODS:
- Alamofire (4.6.0)
- AsyncSwift (2.0.4)
- DeviceKit (1.4.0)
- DZNEmptyDataSet (1.8.1)
- FDFullscreenPopGesture (1.1)
- HandyJSON (4.0.0-beta.1)
- Hero (1.0.1)
- IGListKit (3.1.1):
- IGListKit/Default (= 3.1.1)
- IGListKit/Default (3.1.1):
- IGListKit/Diffing
- IGListKit/Diffing (3.1.1)
- ImagePicker (3.0.0)
- IQKeyboardManager (5.0.7)
- Kingfisher (4.6.1)
......@@ -31,16 +25,13 @@ PODS:
- YXAlertController (1.0.8)
- YXKit (0.0.8)
- YXPickerView (0.0.5)
- YYText (1.0.7)
DEPENDENCIES:
- AsyncSwift
- DeviceKit
- DZNEmptyDataSet
- FDFullscreenPopGesture (~> 1.1)
- HandyJSON (~> 4.0.0-beta.1)
- Hero
- IGListKit
- ImagePicker
- IQKeyboardManager (~> 5.0.6)
- Kingfisher
......@@ -55,17 +46,14 @@ DEPENDENCIES:
- YXAlertController (~> 1.0.8)
- YXKit
- YXPickerView (~> 0.0.4)
- YYText (~> 1.0.7)
SPEC CHECKSUMS:
Alamofire: f41a599bd63041760b26d393ec1069d9d7b917f4
AsyncSwift: 65775a7b32e740609b24969ece3de58723b9dc3e
DeviceKit: fa74d97499660e88081718b16688e19217595dba
DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7
FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
HandyJSON: 428bb18e2c34c2a77361accebf90cf64e4f74118
Hero: cee286821578e170d8c0c9c9cda7897357401112
IGListKit: cb97f405ae43e59fe1da74271e19427ec20d3c07
ImagePicker: 973953c25960fe04729a7082a56194321c6762d2
IQKeyboardManager: 0bfa4607d39924116b5c0c8b55b5d789288b5cba
Kingfisher: 1f9157d9c02b380cbd0b7cc890161195164eb634
......@@ -81,8 +69,7 @@ SPEC CHECKSUMS:
YXAlertController: 37a54642cb8e8b43b79004fe9148bb8ff2fab814
YXKit: 73d6ffbcf7530f1159e030460207286e9153b080
YXPickerView: 435b7b1362931fe63f2aab25d2810b1cf5ca2226
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
PODFILE CHECKSUM: 7d116579396cd862c5b27c1bfdfc97ea5045fa0f
PODFILE CHECKSUM: 36ab8d11dc09b068c8608b937c8558d98c298b69
COCOAPODS: 1.3.0
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