Commit b881c2e8 authored by 刘俊宏's avatar 刘俊宏

工作中心(缺编辑完善)

parent 9e82d123
...@@ -306,6 +306,7 @@ ...@@ -306,6 +306,7 @@
F905A7D8246CF82400E3A74D /* SwipeCellKit in Frameworks */ = {isa = PBXBuildFile; productRef = F905A7D7246CF82400E3A74D /* SwipeCellKit */; }; F905A7D8246CF82400E3A74D /* SwipeCellKit in Frameworks */ = {isa = PBXBuildFile; productRef = F905A7D7246CF82400E3A74D /* SwipeCellKit */; };
F9171EFC245128B200359C2B /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171EFB245128B200359C2B /* Interface.swift */; }; F9171EFC245128B200359C2B /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171EFB245128B200359C2B /* Interface.swift */; };
F9171F0224513C5B00359C2B /* UpDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171F0124513C5B00359C2B /* UpDataModel.swift */; }; F9171F0224513C5B00359C2B /* UpDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171F0124513C5B00359C2B /* UpDataModel.swift */; };
F933C42E2484A66C0058940C /* WorkTestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933C42D2484A66C0058940C /* WorkTestModel.swift */; };
F933F6C02452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6AF2452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift */; }; F933F6C02452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6AF2452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift */; };
F933F6C12452C68B00189561 /* PKHUDAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6B02452C68B00189561 /* PKHUDAnimation.swift */; }; F933F6C12452C68B00189561 /* PKHUDAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6B02452C68B00189561 /* PKHUDAnimation.swift */; };
F933F6C22452C68B00189561 /* PKHUDAnimating.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6B12452C68B00189561 /* PKHUDAnimating.swift */; }; F933F6C22452C68B00189561 /* PKHUDAnimating.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6B12452C68B00189561 /* PKHUDAnimating.swift */; };
...@@ -323,6 +324,8 @@ ...@@ -323,6 +324,8 @@
F933F6CE2452C68B00189561 /* PKHUDSquareBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6BD2452C68B00189561 /* PKHUDSquareBaseView.swift */; }; F933F6CE2452C68B00189561 /* PKHUDSquareBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6BD2452C68B00189561 /* PKHUDSquareBaseView.swift */; };
F933F6CF2452C68B00189561 /* PKHUDErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6BE2452C68B00189561 /* PKHUDErrorView.swift */; }; F933F6CF2452C68B00189561 /* PKHUDErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6BE2452C68B00189561 /* PKHUDErrorView.swift */; };
F933F6D22452DAE100189561 /* TabBarContentClassView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6D12452DAE000189561 /* TabBarContentClassView.swift */; }; F933F6D22452DAE100189561 /* TabBarContentClassView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6D12452DAE000189561 /* TabBarContentClassView.swift */; };
F93615DB2480B421004187F9 /* WorkInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93615DA2480B421004187F9 /* WorkInterface.swift */; };
F93615DD2480B693004187F9 /* WorkcenterIndexModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93615DC2480B693004187F9 /* WorkcenterIndexModel.swift */; };
F93E31F724721C4200524DFC /* EditOGPAdModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93E31F624721C4200524DFC /* EditOGPAdModel.swift */; }; F93E31F724721C4200524DFC /* EditOGPAdModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93E31F624721C4200524DFC /* EditOGPAdModel.swift */; };
F93E31FD24727A2D00524DFC /* ShowTimeSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93E31FC24727A2D00524DFC /* ShowTimeSelectView.swift */; }; F93E31FD24727A2D00524DFC /* ShowTimeSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93E31FC24727A2D00524DFC /* ShowTimeSelectView.swift */; };
F93E32052473C9C200524DFC /* jpush-extension-ios-1.1.2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F93E32002473C9C200524DFC /* jpush-extension-ios-1.1.2.a */; }; F93E32052473C9C200524DFC /* jpush-extension-ios-1.1.2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F93E32002473C9C200524DFC /* jpush-extension-ios-1.1.2.a */; };
...@@ -805,6 +808,7 @@ ...@@ -805,6 +808,7 @@
F9023F702449ACA800DD5A63 /* TitleAndSwitchCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndSwitchCell.xib; sourceTree = "<group>"; }; F9023F702449ACA800DD5A63 /* TitleAndSwitchCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndSwitchCell.xib; sourceTree = "<group>"; };
F9171EFB245128B200359C2B /* Interface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Interface.swift; sourceTree = "<group>"; }; F9171EFB245128B200359C2B /* Interface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Interface.swift; sourceTree = "<group>"; };
F9171F0124513C5B00359C2B /* UpDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpDataModel.swift; sourceTree = "<group>"; }; F9171F0124513C5B00359C2B /* UpDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpDataModel.swift; sourceTree = "<group>"; };
F933C42D2484A66C0058940C /* WorkTestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkTestModel.swift; sourceTree = "<group>"; };
F933F6AF2452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDSystemActivityIndicatorView.swift; sourceTree = "<group>"; }; F933F6AF2452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDSystemActivityIndicatorView.swift; sourceTree = "<group>"; };
F933F6B02452C68B00189561 /* PKHUDAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDAnimation.swift; sourceTree = "<group>"; }; F933F6B02452C68B00189561 /* PKHUDAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDAnimation.swift; sourceTree = "<group>"; };
F933F6B12452C68B00189561 /* PKHUDAnimating.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDAnimating.swift; sourceTree = "<group>"; }; F933F6B12452C68B00189561 /* PKHUDAnimating.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDAnimating.swift; sourceTree = "<group>"; };
...@@ -823,6 +827,8 @@ ...@@ -823,6 +827,8 @@
F933F6BE2452C68B00189561 /* PKHUDErrorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDErrorView.swift; sourceTree = "<group>"; }; F933F6BE2452C68B00189561 /* PKHUDErrorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDErrorView.swift; sourceTree = "<group>"; };
F933F6BF2452C68B00189561 /* PKHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKHUD.h; sourceTree = "<group>"; }; F933F6BF2452C68B00189561 /* PKHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKHUD.h; sourceTree = "<group>"; };
F933F6D12452DAE000189561 /* TabBarContentClassView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarContentClassView.swift; sourceTree = "<group>"; }; F933F6D12452DAE000189561 /* TabBarContentClassView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarContentClassView.swift; sourceTree = "<group>"; };
F93615DA2480B421004187F9 /* WorkInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkInterface.swift; sourceTree = "<group>"; };
F93615DC2480B693004187F9 /* WorkcenterIndexModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkcenterIndexModel.swift; sourceTree = "<group>"; };
F93E31F624721C4200524DFC /* EditOGPAdModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditOGPAdModel.swift; sourceTree = "<group>"; }; F93E31F624721C4200524DFC /* EditOGPAdModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditOGPAdModel.swift; sourceTree = "<group>"; };
F93E31FC24727A2D00524DFC /* ShowTimeSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowTimeSelectView.swift; sourceTree = "<group>"; }; F93E31FC24727A2D00524DFC /* ShowTimeSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowTimeSelectView.swift; sourceTree = "<group>"; };
F93E32002473C9C200524DFC /* jpush-extension-ios-1.1.2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "jpush-extension-ios-1.1.2.a"; sourceTree = "<group>"; }; F93E32002473C9C200524DFC /* jpush-extension-ios-1.1.2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "jpush-extension-ios-1.1.2.a"; sourceTree = "<group>"; };
...@@ -1506,14 +1512,15 @@ ...@@ -1506,14 +1512,15 @@
E09B03A92445B09200211A51 /* Model */ = { E09B03A92445B09200211A51 /* Model */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
F95B8533247F47D800790719 /* Work */,
E00D85DC244561FD00F5F816 /* Products */, E00D85DC244561FD00F5F816 /* Products */,
F95B8533247F47D800790719 /* Work */,
E0B5308224728D5600FFCC15 /* WarehouseManageModel */, E0B5308224728D5600FFCC15 /* WarehouseManageModel */,
F956D5BE246A3649003FF510 /* OrderManageModel */, F956D5BE246A3649003FF510 /* OrderManageModel */,
F956D5BD246A3629003FF510 /* PersonCenterModel */, F956D5BD246A3629003FF510 /* PersonCenterModel */,
F956D5BC246A35DB003FF510 /* GoodsManageMoel */, F956D5BC246A35DB003FF510 /* GoodsManageMoel */,
F9171EFB245128B200359C2B /* Interface.swift */, F9171EFB245128B200359C2B /* Interface.swift */,
E0B5308524728FB600FFCC15 /* WarehouseInterface.swift */, E0B5308524728FB600FFCC15 /* WarehouseInterface.swift */,
F93615DA2480B421004187F9 /* WorkInterface.swift */,
F956D5BA246A359C003FF510 /* GoodsInterface.swift */, F956D5BA246A359C003FF510 /* GoodsInterface.swift */,
F956D5B8246A33E2003FF510 /* OrderInterface.swift */, F956D5B8246A33E2003FF510 /* OrderInterface.swift */,
E09B03AA2445B0A300211A51 /* LoginModel.swift */, E09B03AA2445B0A300211A51 /* LoginModel.swift */,
...@@ -1998,6 +2005,7 @@ ...@@ -1998,6 +2005,7 @@
F94A315A24628C7E00FEC38E /* WorkItemTableViewCell.xib */, F94A315A24628C7E00FEC38E /* WorkItemTableViewCell.xib */,
F94A315D24629DDD00FEC38E /* WorkBannerTableViewCell.swift */, F94A315D24629DDD00FEC38E /* WorkBannerTableViewCell.swift */,
F94A315E24629DDD00FEC38E /* WorkBannerTableViewCell.xib */, F94A315E24629DDD00FEC38E /* WorkBannerTableViewCell.xib */,
F933C42D2484A66C0058940C /* WorkTestModel.swift */,
); );
path = "工作中心"; path = "工作中心";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2261,6 +2269,7 @@ ...@@ -2261,6 +2269,7 @@
F95B8533247F47D800790719 /* Work */ = { F95B8533247F47D800790719 /* Work */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
F93615DC2480B693004187F9 /* WorkcenterIndexModel.swift */,
); );
path = Work; path = Work;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2780,8 +2789,10 @@ ...@@ -2780,8 +2789,10 @@
F956D5A6246A2D9C003FF510 /* LMNoteViewController.m in Sources */, F956D5A6246A2D9C003FF510 /* LMNoteViewController.m in Sources */,
E0CC848B24824291009B1FE9 /* CRKListVC.swift in Sources */, E0CC848B24824291009B1FE9 /* CRKListVC.swift in Sources */,
E03549AD24582828008BD021 /* KeHuGuanLiCell.swift in Sources */, E03549AD24582828008BD021 /* KeHuGuanLiCell.swift in Sources */,
F93615DD2480B693004187F9 /* WorkcenterIndexModel.swift in Sources */,
F95567A72453DA86009674AB /* WarehoseMangementListVC.swift in Sources */, F95567A72453DA86009674AB /* WarehoseMangementListVC.swift in Sources */,
F933F6CF2452C68B00189561 /* PKHUDErrorView.swift in Sources */, F933F6CF2452C68B00189561 /* PKHUDErrorView.swift in Sources */,
F933C42E2484A66C0058940C /* WorkTestModel.swift in Sources */,
E07B1E78245966E60055BA3C /* XinCaiGouViewController.swift in Sources */, E07B1E78245966E60055BA3C /* XinCaiGouViewController.swift in Sources */,
F933F6C42452C68B00189561 /* PKHUD.swift in Sources */, F933F6C42452C68B00189561 /* PKHUD.swift in Sources */,
E0F97B102451728D001BD600 /* AddGuiGeCell.swift in Sources */, E0F97B102451728D001BD600 /* AddGuiGeCell.swift in Sources */,
...@@ -2921,6 +2932,7 @@ ...@@ -2921,6 +2932,7 @@
F942A7FD247500C300FDFC47 /* TestClass.swift in Sources */, F942A7FD247500C300FDFC47 /* TestClass.swift in Sources */,
F950FDD824518B9500C40530 /* FSCalendarDelegationProxy.m in Sources */, F950FDD824518B9500C40530 /* FSCalendarDelegationProxy.m in Sources */,
E01EA1A0245A5D6B00F019D5 /* YunDanXiangQingViewController.swift in Sources */, E01EA1A0245A5D6B00F019D5 /* YunDanXiangQingViewController.swift in Sources */,
F93615DB2480B421004187F9 /* WorkInterface.swift in Sources */,
F956D5A0246A2D9C003FF510 /* LMNImageView.m in Sources */, F956D5A0246A2D9C003FF510 /* LMNImageView.m in Sources */,
E0E341EA246E95EE0060AC20 /* PingLunCell.swift in Sources */, E0E341EA246E95EE0060AC20 /* PingLunCell.swift in Sources */,
F950FDDF24518B9500C40530 /* FSCalendarSeparatorDecorationView.m in Sources */, F950FDDF24518B9500C40530 /* FSCalendarSeparatorDecorationView.m in Sources */,
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "work入库申请.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "work入库申请@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "work入库申请@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "work出库申请.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "work出库申请@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "work出库申请@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "work待确认订单.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "work待确认订单@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "work待确认订单@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "work未发货订单.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "work未发货订单@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "work未发货订单@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "work采购入库.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "work采购入库@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "work采购入库@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -27,10 +27,10 @@ let systemVersion = (UIDevice.current.systemVersion as String) ...@@ -27,10 +27,10 @@ let systemVersion = (UIDevice.current.systemVersion as String)
//接口地址 //接口地址
//test //test
//let SERVERCE_ImageHost = "https://z.gelifood.com/" let SERVERCE_ImageHost = "https://z.gelifood.com/"
//let SERVERCE_HOST = "https://z.gelifood.com/admin/" let SERVERCE_HOST = "https://z.gelifood.com/admin/"
let SERVERCE_ImageHost = "https://zx.gelifood.com/" //let SERVERCE_ImageHost = "https://zx.gelifood.com/"
let SERVERCE_HOST = "https://zx.gelifood.com/admin/" //let SERVERCE_HOST = "https://zx.gelifood.com/admin/"
//online //online
//let SERVERCE_ImageHost = "https://api.laigewan.com/upload/images/" //let SERVERCE_ImageHost = "https://api.laigewan.com/upload/images/"
//let SERVERCE_HOST = "http://a.gelifood.com/apia" //let SERVERCE_HOST = "http://a.gelifood.com/apia"
......
...@@ -94,6 +94,8 @@ ...@@ -94,6 +94,8 @@
<string>Workcenter/statistics</string> <string>Workcenter/statistics</string>
<key>获取权限</key> <key>获取权限</key>
<string>Workcenter/auths</string> <string>Workcenter/auths</string>
<key>获取统计+权限</key>
<string>Workcenter/index</string>
<key>填写/修改订单物流单号</key> <key>填写/修改订单物流单号</key>
<string>Order/editLwbno</string> <string>Order/editLwbno</string>
<key>获取入库的基本信息</key> <key>获取入库的基本信息</key>
......
//
// WorkManageModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/5/29.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//获取统计+权限
class WorkcenterIndexModel: Mappable {
var code:Int?
var message : String?
var data : WorkcenterIndexDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class WorkcenterIndexDataModel: Mappable {
var order_count : Int? //订单数量
var paid : Float? //已收款
var npaid : Float? //待付款
var qr_code : String? //商家小程序二维码
var shipping : Int? //未发货订单数
var confirm : Int? //待确认订单数
var apply_in : Int? //入库申请数
var apply_out : Int? //出库申请数
var auth_res : Array<WorkcenterIndexAuthResModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
order_count <- map["order_count"]
paid <- map["paid"]
npaid <- map["npaid"]
qr_code <- map["qr_code"]
shipping <- map["shipping"]
confirm <- map["confirm"]
apply_in <- map["apply_in"]
apply_out <- map["apply_out"]
auth_res <- map["auth_res"]
}
}
class WorkcenterIndexAuthResModel: Mappable {
var auth_id : Int? ////权限id
var auth_name : String? //权限名
var is_often : Int? //是否常用功能
var auth_controller_app : String?
var auth_action_app : String?
var ranges : Int?
var platforms : Int?
var auth_pid : Int? ////权限id父
var app_icon : String? //item缩略图
required init?( map: Map) {
}
func mapping(map: Map) {
auth_id <- map["auth_id"]
auth_name <- map["auth_name"]
is_often <- map["is_often"]
auth_controller_app <- map["auth_controller_app"]
auth_action_app <- map["auth_action_app"]
ranges <- map["ranges"]
platforms <- map["platforms"]
auth_pid <- map["auth_pid"]
}
}
//获取 权限
class WorkcenterAuthsModel: Mappable {
var code:Int?
var message : String?
var data : Array<WorkcenterIndexAuthResModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
//获取统计、店铺二维码、待办事项信息
class WorkcenterStatisticsModel: Mappable {
var code:Int?
var message : String?
var data : WorkcenterIndexDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
//
// WorkInterface.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/5/29.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import Alamofire
import SwiftyJSON
import ObjectMapper
//MARK: --获取统计+权限
/**
params-key:
user_token(验证token)
star_time(开始时间,时间戳)
end_time(当前时间戳)
*/
func WorkcenterIndex(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) { NetworkRequest.sharedInstance.postRequest("获取统计+权限", params, { (rep:DataResponse<WorkcenterIndexModel>) in
}, success: { (data) in
success(data)
}) { (error) in
}
}
//MARK: --获取 权限
/**
params-key:
user_token(验证token)
*/
func WorkcenterAuths(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) { NetworkRequest.sharedInstance.postRequest("获取权限", params, { (rep:DataResponse<WorkcenterAuthsModel>) in
}, success: { (data) in
success(data)
}) { (error) in
}
}
//MARK: --获取统计、店铺二维码、待办事项信息
/**
params-key:
user_token(验证token)
star_time(开始时间,时间戳)
end_time(当前时间戳)
*/
func WorkcenterStatistics(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) { NetworkRequest.sharedInstance.postRequest("获取统计、店铺二维码、待办事项信息", params, { (rep:DataResponse<WorkcenterStatisticsModel>) in
}, success: { (data) in
success(data)
}) { (error) in
}
}
...@@ -317,8 +317,8 @@ ...@@ -317,8 +317,8 @@
[self.imgIndexArr addObject:index]; [self.imgIndexArr addObject:index];
} }
// NSString *imgSrc = @"https://c.gelifood.com/"; NSString *imgSrc = @"https://c.gelifood.com/";
NSString *imgSrc = @"https://cms.gelifood.com/"; // NSString *imgSrc = @"https://cms.gelifood.com/";
NSString *imgurl = [src stringByReplacingOccurrencesOfString:imgSrc withString:@""]; NSString *imgurl = [src stringByReplacingOccurrencesOfString:imgSrc withString:@""];
[self.imgUrlArr addObject:imgurl]; [self.imgUrlArr addObject:imgurl];
} }
......
...@@ -81,8 +81,8 @@ static CGFloat const kVerticalMargin = kVerticalInset + kMargin; ...@@ -81,8 +81,8 @@ static CGFloat const kVerticalMargin = kVerticalInset + kMargin;
} }
- (void)setImageUrl:(NSString *)imageUrl { - (void)setImageUrl:(NSString *)imageUrl {
_imageUrl = imageUrl; _imageUrl = imageUrl;
// NSString *imgSrc = @"https://c.gelifood.com/"; NSString *imgSrc = @"https://c.gelifood.com/";
NSString *imgSrc = @"https://cms.gelifood.com/"; // NSString *imgSrc = @"https://cms.gelifood.com/";
[self.imageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",imgSrc,imageUrl]] [self.imageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",imgSrc,imageUrl]]
placeholderImage:[UIImage imageNamed:@"lmn_tool_image"] options:(SDWebImageRetryFailed) completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { placeholderImage:[UIImage imageNamed:@"lmn_tool_image"] options:(SDWebImageRetryFailed) completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
if ([line isKindOfMode:LMNLineModeModeImage]) { if ([line isKindOfMode:LMNLineModeModeImage]) {
// TODO: 图片部分逻辑未处理。 // TODO: 图片部分逻辑未处理。
// NSString *imgSrc = @"https://c.gelifood.com/"; NSString *imgSrc = @"https://c.gelifood.com/";
NSString *imgSrc = @"https://cms.gelifood.com/"; // NSString *imgSrc = @"https://cms.gelifood.com/";
NSString *imgUrl = self.imgArr[i]; NSString *imgUrl = self.imgArr[i];
i += 1; i += 1;
......
...@@ -69,6 +69,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg ...@@ -69,6 +69,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
} }
} }
//MARK:--tabbarVCs //MARK:--tabbarVCs
weak var tabBarC:ESTabBarController? = nil
func addTabBarVcs (isAgain:Bool) { func addTabBarVcs (isAgain:Bool) {
let tabBarController = ESTabBarController() let tabBarController = ESTabBarController()
tabBarController.delegate = self tabBarController.delegate = self
...@@ -77,26 +78,26 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg ...@@ -77,26 +78,26 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
let img = imageWithColor(UIColor.white) let img = imageWithColor(UIColor.white)
tabBarController.tabBar.backgroundImage = img tabBarController.tabBar.backgroundImage = img
NotificationCenter.default.addObserver(self, selector: #selector(popLogout), name: NSNotification.Name(rawValue: "logout"), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(popLogout), name: NSNotification.Name(rawValue: "logout"), object: nil)
tabBarC = tabBarController
let v1 = OrderListViewController() let v1 = OrderListViewController()
let v2 = CRKListVC() let v2 = CRKListVC()
// let v3 = WorkCViewController() let v3 = WorkCViewController()
let v4 = WarehoseMangementListVC() let v4 = WarehoseMangementListVC()
let v5 = PersonCenterViewController() let v5 = PersonCenterViewController()
v1.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "订单管理", image: UIImage(named: "tab_btn_dingdao_nor"), selectedImage: UIImage(named: "tab_btn_dingdan_hig")) v1.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "订单管理", image: UIImage(named: "tab_btn_dingdao_nor"), selectedImage: UIImage(named: "tab_btn_dingdan_hig"))
v2.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "商品管理", image: UIImage(named: "tab_btn_shangpin_nor"), selectedImage: UIImage(named: "tab_btn_shangpin_hig")) v2.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "商品管理", image: UIImage(named: "tab_btn_shangpin_nor"), selectedImage: UIImage(named: "tab_btn_shangpin_hig"))
// v3.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "工作中心", image: UIImage(named: "tab_btn_gongzuo_nor"), selectedImage: UIImage(named: "tab_btn_gongzuo_hig")) v3.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "工作中心", image: UIImage(named: "tab_btn_gongzuo_nor"), selectedImage: UIImage(named: "tab_btn_gongzuo_hig"))
v4.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "仓库管理", image: UIImage(named: "tab_btn_cangku_nor"), selectedImage: UIImage(named: "tab_btn_cangku_hig")) v4.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "仓库管理", image: UIImage(named: "tab_btn_cangku_nor"), selectedImage: UIImage(named: "tab_btn_cangku_hig"))
v5.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "个人中心", image: UIImage(named: "tab_btn_geren_nor"), selectedImage: UIImage(named: "tab_btn_geren_hig")) v5.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "个人中心", image: UIImage(named: "tab_btn_geren_nor"), selectedImage: UIImage(named: "tab_btn_geren_hig"))
// Create the SwiftUI view that provides the window contents. // Create the SwiftUI view that provides the window contents.
// tabBarController.viewControllers = [v1, v2, v3, v4, v5] tabBarController.viewControllers = [v1, v2, v3, v4, v5]
tabBarController.viewControllers = [v1, v2, v4, v5] // tabBarController.viewControllers = [v1, v2, v4, v5]
// tabBarController.selectedIndex = 2 tabBarController.selectedIndex = 2
...@@ -120,6 +121,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg ...@@ -120,6 +121,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
} }
NotificationCenter.default.addObserver(self, selector: #selector(changgeTabItem(notion:)), name: NSNotification.Name(rawValue: "changgeTabItem"), object: nil)
//测试代码 //测试代码
// if let tabBarItem = v2.tabBarItem as? ESTabBarItem { // if let tabBarItem = v2.tabBarItem as? ESTabBarItem {
// DispatchQueue.main.asyncAfter(deadline: .now() + 2 ) { // DispatchQueue.main.asyncAfter(deadline: .now() + 2 ) {
...@@ -127,6 +130,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg ...@@ -127,6 +130,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
// } // }
// } // }
} }
//MARK:--切换tab
@objc func changgeTabItem(notion:Notification) {
let dic = notion.userInfo
tabBarC?.selectedIndex = dic!["tag"] as Any as! Int
}
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) { func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
//添加通知,才加载数据 //添加通知,才加载数据
print(viewController) print(viewController)
......
...@@ -49,7 +49,7 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable ...@@ -49,7 +49,7 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable
make.left.right.equalTo(0) make.left.right.equalTo(0)
make.height.equalTo(60) make.height.equalTo(60)
} }
listView.delegate = self listView.delegate = self
listView.dataSource = self listView.dataSource = self
listView.isScrollEnabled = false listView.isScrollEnabled = false
......
...@@ -10,6 +10,10 @@ import UIKit ...@@ -10,6 +10,10 @@ import UIKit
class WorkBannerTableViewCell: UITableViewCell { class WorkBannerTableViewCell: UITableViewCell {
@IBOutlet weak var totalPriceLbl: UILabel!
@IBOutlet weak var npaidLbl: UILabel!
@IBOutlet weak var paidLbl: UILabel!
@IBOutlet weak var orderCountLbl: UILabel!
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
self.selectionStyle = .none self.selectionStyle = .none
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <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"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="171" id="KGk-i7-Jjw" customClass="WorkBannerTableViewCell" customModule="GeliBusinessPlatform" customModuleProvider="target"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="171" id="KGk-i7-Jjw" customClass="WorkBannerTableViewCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="353" height="223"/> <rect key="frame" x="0.0" y="0.0" width="353" height="223"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
...@@ -21,13 +21,13 @@ ...@@ -21,13 +21,13 @@
<rect key="frame" x="0.0" y="0.0" width="353" height="191"/> <rect key="frame" x="0.0" y="0.0" width="353" height="191"/>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="销售额统计:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pRd-lf-xl6"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="销售额统计:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pRd-lf-xl6">
<rect key="frame" x="144" y="20" width="65" height="15"/> <rect key="frame" x="139" y="20" width="75.5" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" name="白色背景色"/> <color key="textColor" name="白色背景色"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="16" translatesAutoresizingMaskIntoConstraints="NO" id="1WB-Jl-YGE"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="16" translatesAutoresizingMaskIntoConstraints="NO" id="1WB-Jl-YGE">
<rect key="frame" x="15" y="40" width="323" height="45"/> <rect key="frame" x="15" y="42" width="323" height="45"/>
<attributedString key="attributedText"> <attributedString key="attributedText">
<fragment content="132936.86"> <fragment content="132936.86">
<attributes> <attributes>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BZy-Sq-Vha"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BZy-Sq-Vha">
<rect key="frame" x="15" y="127" width="323" height="96"/> <rect key="frame" x="15" y="129" width="323" height="94"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5bk-NQ-8kk"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5bk-NQ-8kk">
<rect key="frame" x="135" y="20" width="53" height="19"/> <rect key="frame" x="135" y="20" width="53" height="19"/>
...@@ -56,12 +56,12 @@ ...@@ -56,12 +56,12 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="AWN-GF-A3K"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="AWN-GF-A3K">
<rect key="frame" x="113.5" y="52" width="96" height="24"/> <rect key="frame" x="113.5" y="50" width="96" height="24"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="96" id="NU6-YZ-bC0"/> <constraint firstAttribute="width" constant="96" id="NU6-YZ-bC0"/>
</constraints> </constraints>
<attributedString key="attributedText"> <attributedString key="attributedText">
<fragment content="2513212011"> <fragment content="0.0">
<attributes> <attributes>
<font key="NSFont" size="20" name="DINAlternate-Bold"/> <font key="NSFont" size="20" name="DINAlternate-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="truncatingTail" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="truncatingTail" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
...@@ -71,12 +71,12 @@ ...@@ -71,12 +71,12 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g61-9M-kva"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g61-9M-kva">
<rect key="frame" x="30" y="22.5" width="65" height="14.5"/> <rect key="frame" x="30" y="21.5" width="66.5" height="16"/>
<attributedString key="attributedText"> <attributedString key="attributedText">
<fragment content="订单数量:"> <fragment content="订单数量:">
<attributes> <attributes>
<color key="NSColor" name="灰色字体颜色"/> <color key="NSColor" name="灰色字体颜色"/>
<font key="NSFont" size="13" name=".PingFangSC-Regular"/> <font key="NSFont" metaFont="system"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes> </attributes>
</fragment> </fragment>
...@@ -84,12 +84,12 @@ ...@@ -84,12 +84,12 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="qC2-6T-Y8x"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="qC2-6T-Y8x">
<rect key="frame" x="24" y="52" width="77" height="24"/> <rect key="frame" x="25" y="50" width="77" height="24"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="77" id="aHR-yL-a2A"/> <constraint firstAttribute="width" constant="77" id="aHR-yL-a2A"/>
</constraints> </constraints>
<attributedString key="attributedText"> <attributedString key="attributedText">
<fragment content="2513212"> <fragment content="0">
<attributes> <attributes>
<font key="NSFont" size="20" name="DINAlternate-Bold"/> <font key="NSFont" size="20" name="DINAlternate-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="truncatingTail" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="truncatingTail" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
...@@ -99,12 +99,12 @@ ...@@ -99,12 +99,12 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TeE-zd-u5H"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TeE-zd-u5H">
<rect key="frame" x="241" y="22" width="52" height="15"/> <rect key="frame" x="239.5" y="21.5" width="53.5" height="16"/>
<attributedString key="attributedText"> <attributedString key="attributedText">
<fragment content="待收款:"> <fragment content="待收款:">
<attributes> <attributes>
<color key="NSColor" name="灰色字体颜色"/> <color key="NSColor" name="灰色字体颜色"/>
<font key="NSFont" size="13" name=".PingFangSC-Regular"/> <font key="NSFont" metaFont="system"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes> </attributes>
</fragment> </fragment>
...@@ -112,12 +112,12 @@ ...@@ -112,12 +112,12 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="dTv-Ho-7eq"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="dTv-Ho-7eq">
<rect key="frame" x="227" y="52" width="80" height="24"/> <rect key="frame" x="226.5" y="50" width="80" height="24"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="80" id="HOs-uN-tNy"/> <constraint firstAttribute="width" constant="80" id="HOs-uN-tNy"/>
</constraints> </constraints>
<attributedString key="attributedText"> <attributedString key="attributedText">
<fragment content="25132120"> <fragment content="0.0">
<attributes> <attributes>
<font key="NSFont" size="20" name="DINAlternate-Bold"/> <font key="NSFont" size="20" name="DINAlternate-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="truncatingTail" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="truncatingTail" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
...@@ -167,6 +167,12 @@ ...@@ -167,6 +167,12 @@
</constraints> </constraints>
</tableViewCellContentView> </tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/> <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="npaidLbl" destination="dTv-Ho-7eq" id="La0-9o-xLe"/>
<outlet property="orderCountLbl" destination="qC2-6T-Y8x" id="vfw-lN-qE2"/>
<outlet property="paidLbl" destination="AWN-GF-A3K" id="dKP-uq-0Aq"/>
<outlet property="totalPriceLbl" destination="1WB-Jl-YGE" id="pgU-Uy-BF6"/>
</connections>
<point key="canvasLocation" x="155.79710144927537" y="173.10267857142856"/> <point key="canvasLocation" x="155.79710144927537" y="173.10267857142856"/>
</tableViewCell> </tableViewCell>
</objects> </objects>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
import UIKit import UIKit
import RealmSwift
class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource ,WorkSelectTimeViewDelegate,WorkItemTableViewCellDelegate{ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource ,WorkSelectTimeViewDelegate,WorkItemTableViewCellDelegate{
...@@ -15,15 +16,6 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -15,15 +16,6 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setTabv() setTabv()
// let cover = UIView()
// self.view.addSubview(cover)
// cover.backgroundColor = UIColor.black
// cover.alpha = 0.3
// cover.snp.makeConstraints { (make) in
// make.top.right.bottom.left.equalTo(0)
// }
} }
//MARK:--二维码方法 //MARK:--二维码方法
@IBAction func codeAction(_ sender: UIButton) { @IBAction func codeAction(_ sender: UIButton) {
...@@ -74,9 +66,114 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -74,9 +66,114 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
tableV.estimatedRowHeight = 44 tableV.estimatedRowHeight = 44
//rowHeight属性设置为UITableViewAutomaticDimension //rowHeight属性设置为UITableViewAutomaticDimension
tableV.rowHeight = UITableView.automaticDimension tableV.rowHeight = UITableView.automaticDimension
//查询所有记录
let items = realm.objects(WorkDataModel.self)
// 已经有记录的话就不插入了
if items.count > 0 {
print("有数据哦--")
let workTestMd:WorkDataModel = items[0];
let dataModelStr = workTestMd.dataModelStr
self.dataModel = WorkcenterIndexDataModel(JSONString: dataModelStr)
//旧的常用功能
let oftenStr = workTestMd.oftenArrStr
if oftenStr.count > 0 {
self.oftenArr?.removeAll()
self.oftenArr = Array<WorkcenterIndexAuthResModel>(JSONString: oftenStr)
}
self.tableV.reloadData()
}else{
print("没有数据hehe--")
}
//下拉刷新相关设置
headerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadData))
self.tableV!.mj_header = headerMJ
// self.tableV.mj_header?.beginRefreshing()
}
//MARK:--使用默认的数据库
let realm = try! Realm()
var dataModel:WorkcenterIndexDataModel? = nil
var oftenArr:Array<WorkcenterIndexAuthResModel>? = []
//MARK:--加载数据
@objc func loadData() {
print("请求网络数据")
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let today = Date()
let endTime = Int(today.timeIntervalSince1970)
WorkcenterIndex(["user_token":UserToken as Any,"star_time":"","end_time":endTime as Any], success: { (data) in
let dataM = data as! WorkcenterIndexModel
if dataM.code == 1 {
self.dataModel = dataM.data
//查询常用的
let items = self.realm.objects(WorkDataModel.self)
if items.count > 0 {
print("有数据哦--")
let workTestMd:WorkDataModel = items[0];
let oftenStr = workTestMd.oftenArrStr
if oftenStr.count > 0 {
//经过对比需要删除剩哪一些
let oldOftenArr = Array<WorkcenterIndexAuthResModel>(JSONString: oftenStr)
self.oftenArr?.removeAll()
oldOftenArr?.forEach({ (md) in
var isAdd = false
self.dataModel?.auth_res?.forEach({ (pmd) in
if md.auth_id == pmd.auth_id && pmd.is_often == 1 {
//存在且还常用
isAdd = true
}
})
if isAdd {
self.oftenArr?.append(md)
}
})
}
}else{
//常用功能
self.oftenArr?.removeAll()
self.dataModel?.auth_res?.forEach({ (md) in
if self.oftenArr!.count < 10 && md.is_often == 1 && md.auth_pid != 0 {
self.oftenArr?.append(md)
}
})
}
let modelStr = dataM.data?.toJSONString()
let oftenStr = self.oftenArr?.toJSONString()
let saveModel = WorkDataModel()
saveModel.dataModelStr = modelStr!
saveModel.star_time = 0
saveModel.end_time = today
saveModel.oftenArrStr = oftenStr!
// 数据持久化操作--(退出登录的话,或者token异常那里,全部要删除)
try! self.realm.write {
self.realm.deleteAll()
}
//成功插入
try! self.realm.write {
self.realm.add(saveModel)
}
//打印出数据库地址
print(self.realm.configuration.fileURL ?? "")
self.tableV.reloadData()
}
self.tableV.mj_header?.endRefreshing()
}) { (data) in
self.tableV.mj_header?.endRefreshing()
}
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if dataModel == nil {
return 0
}
return 4 return 4
} }
...@@ -84,6 +181,12 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -84,6 +181,12 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
if indexPath.row == 0 { if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "WorkBannerTableViewCell") as! WorkBannerTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: "WorkBannerTableViewCell") as! WorkBannerTableViewCell
let total = (self.dataModel?.paid)! + (self.dataModel?.npaid)!
cell.totalPriceLbl.text = String(format: "%.2f", total)
cell.orderCountLbl.text = StringByInt(number: (self.dataModel?.order_count)!)
cell.paidLbl.text = String(format: "%.2f", (self.dataModel?.paid)!)
cell.npaidLbl.text = String(format: "%.2f", (self.dataModel?.npaid)!)
return cell return cell
}else{ }else{
let cell = tableView.dequeueReusableCell(withIdentifier: "WorkItemTableViewCell") as! WorkItemTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: "WorkItemTableViewCell") as! WorkItemTableViewCell
...@@ -92,23 +195,57 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -92,23 +195,57 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
cell.delegate = self cell.delegate = self
cell.layoutIfNeeded() cell.layoutIfNeeded()
let arr = ["常用功能","代办事项","功能列表"] let arr = ["常用功能","代办事项","功能列表"]
cell.reloadData(title: arr[indexPath.row - 1], items: [])
if indexPath.row == 1{ if indexPath.row == 1{
cell.gotoImgV.isHidden = false cell.gotoImgV.isHidden = false
}else{ }else{
cell.gotoImgV.isHidden = true cell.gotoImgV.isHidden = true
} }
cell.dataIndexSection = indexPath.row
switch indexPath.row {
case 1:
cell.itemDataArrs = self.oftenArr!
var tempArr:[String] = []
self.oftenArr?.forEach({ (md) in
tempArr.append(md.auth_name!)
})
cell.itemDataArrs = self.oftenArr!
cell.reloadData(title: arr[indexPath.row - 1], items: tempArr)
break
case 2:
let tempArr:[String] = ["未发货订单","待确认订单","入库申请","出库申请","采购入库"]
cell.reloadData(title: arr[indexPath.row - 1], items: tempArr)
break
case 3:
var tempArr:[String] = []
var itemDataArrs:[WorkcenterIndexAuthResModel] = []
self.dataModel?.auth_res?.forEach({ (md) in
if md.auth_pid != 0 {
tempArr.append(md.auth_name!)
itemDataArrs.append(md)
}
})
cell.itemDataArrs = itemDataArrs
cell.reloadData(title: arr[indexPath.row - 1], items: tempArr)
break
default:
break
}
return cell return cell
} }
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("点中cell--\(indexPath.row)") print("点中cell--\(indexPath.row)")
// if indexPath.row == 1 { if indexPath.row == 1 {
// let vc = EditWorkCViewController() let vc = EditWorkCViewController()
// self.navigationController?.pushViewController(vc, animated: true) vc.oftenArr = self.oftenArr
// } vc.dataModel = self.dataModel
let vc = DaiKeXiaDanGouWuViewController() self.navigationController?.pushViewController(vc, animated: true)
self.navigationController?.pushViewController(vc, animated: true) }
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
...@@ -118,23 +255,73 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -118,23 +255,73 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
return tableV.rowHeight return tableV.rowHeight
} }
//MARK:--
func getTheWorkVcByAuthId(auth_id:Int){
switch auth_id {
case 47: //订单列表
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "changgeTabItem"), object: nil, userInfo: ["tag":0])
return
case 48: //销售统计
HUD.flash(.label("敬请期待"),delay: 1.2)
return
case 50: //商品列表
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "changgeTabItem"), object: nil, userInfo: ["tag":1])
return
case 51: //品牌列表
let vc = PinPaiListViewController()
self.navigationController?.pushViewController(vc, animated: true)
return
case 53: //销售下单-代客下单
let vc = DaiKeXiaDanGouWuViewController()
self.navigationController?.pushViewController(vc, animated: true)
return
default:
break;
}
HUD.flash(.label("敬请期待"),delay: 1.2)
return
}
//MARK: - diy cell delegate //MARK: - diy cell delegate
func WorkItemTableViewCellAuthId(sender: WorkItemTableViewCell, auth_id: Int) {
print("跳转的id",auth_id)
getTheWorkVcByAuthId(auth_id: auth_id)
}
func WorkItemTableViewCellBtnClick(sender: WorkItemTableViewCell, idx: IndexPath) { func WorkItemTableViewCellBtnClick(sender: WorkItemTableViewCell, idx: IndexPath) {
print("选中item=\(idx.section)=\(idx.row)") print("选中item=\(idx.section)=\(idx.row)")
switch idx.row {
case 0:
//未发货订单
return
case 1:
//待确认订单
return
case 2:
//入库申请
return
case 3:
//出库申请
return
case 4:
//采购入库
return
default:
break
}
let target = "" let target = ""
switch target { switch target {
case "代客下单":
let vc = DaiKeXiaDanGouWuViewController()
self.navigationController?.pushViewController(vc, animated: true)
break
case "地址管理": case "地址管理":
let vc = DZGLViewController() let vc = DZGLViewController()
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
break break
case "品牌列表":
let vc = PinPaiListViewController()
self.navigationController?.pushViewController(vc, animated: true)
break
case "新增采购单": case "新增采购单":
let vc = XinCaiGouViewController() let vc = XinCaiGouViewController()
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <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="retina4_7" orientation="portrait" appearance="light"/> <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WorkCViewController" customModule="GeliBusinessPlatform" customModuleProvider="target"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WorkCViewController" customModule="TestClass" customModuleProvider="target">
<connections> <connections>
<outlet property="contentView" destination="Ljz-8E-4Zf" id="KmD-fN-LkV"/> <outlet property="contentView" destination="Ljz-8E-4Zf" id="KmD-fN-LkV"/>
<outlet property="topNavBtn" destination="1ie-Ew-Tp5" id="xH1-fJ-48Y"/> <outlet property="topNavBtn" destination="1ie-Ew-Tp5" id="xH1-fJ-48Y"/>
......
...@@ -10,6 +10,7 @@ import UIKit ...@@ -10,6 +10,7 @@ import UIKit
class WorkItemCollectionViewCell: UICollectionViewCell { class WorkItemCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var countLbl: UILabel!
@IBOutlet weak var itemNameLbl: UILabel! @IBOutlet weak var itemNameLbl: UILabel!
@IBOutlet weak var itemImgV: UIImageView! @IBOutlet weak var itemImgV: UIImageView!
@IBOutlet weak var bgImV: UIImageView! @IBOutlet weak var bgImV: UIImageView!
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <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"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="WorkItemCollectionViewCell" customModule="GeliBusinessPlatform" customModuleProvider="target"> <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="WorkItemCollectionViewCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="100" height="69"/> <rect key="frame" x="0.0" y="0.0" width="100" height="69"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="pg3-lh-kp9"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="pg3-lh-kp9">
<rect key="frame" x="0.0" y="0.0" width="100" height="69"/> <rect key="frame" x="0.0" y="0.0" width="100" height="69"/>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="item名称" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nZJ-9s-cJg"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="item名称" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nZJ-9s-cJg">
<rect key="frame" x="3" y="48" width="94" height="14"/> <rect key="frame" x="0.0" y="48.5" width="100" height="13.5"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/> <fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" name="标题字颜色"/> <color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
...@@ -29,17 +29,35 @@ ...@@ -29,17 +29,35 @@
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bianji" translatesAutoresizingMaskIntoConstraints="NO" id="qfI-0k-kQG"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bianji" translatesAutoresizingMaskIntoConstraints="NO" id="qfI-0k-kQG">
<rect key="frame" x="41.5" y="18" width="17" height="16.5"/> <rect key="frame" x="41.5" y="18" width="17" height="16.5"/>
</imageView> </imageView>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ajc-oX-hvc">
<rect key="frame" x="74" y="0.0" width="16" height="16"/>
<color key="backgroundColor" name="密码错误字体颜色"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="02u-H7-wuT"/>
<constraint firstAttribute="height" constant="16" id="GmL-IM-B6e"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" name="白色背景色"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="7.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
</subviews> </subviews>
</view> </view>
<gestureRecognizers/> <gestureRecognizers/>
<constraints> <constraints>
<constraint firstAttribute="trailing" secondItem="pg3-lh-kp9" secondAttribute="trailing" id="74N-EK-MFS"/> <constraint firstAttribute="trailing" secondItem="pg3-lh-kp9" secondAttribute="trailing" id="74N-EK-MFS"/>
<constraint firstItem="nZJ-9s-cJg" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="3" id="8vJ-pB-TcE"/> <constraint firstItem="nZJ-9s-cJg" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="8vJ-pB-TcE"/>
<constraint firstAttribute="trailing" secondItem="nZJ-9s-cJg" secondAttribute="trailing" constant="3" id="Adg-76-avT"/> <constraint firstAttribute="trailing" secondItem="nZJ-9s-cJg" secondAttribute="trailing" id="Adg-76-avT"/>
<constraint firstItem="qfI-0k-kQG" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="GAg-aT-ARc"/> <constraint firstItem="qfI-0k-kQG" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="GAg-aT-ARc"/>
<constraint firstItem="pg3-lh-kp9" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="KBD-1B-1gJ"/> <constraint firstItem="pg3-lh-kp9" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="KBD-1B-1gJ"/>
<constraint firstItem="qfI-0k-kQG" firstAttribute="bottom" secondItem="gTV-IL-0wX" secondAttribute="centerY" id="Lpw-Mk-cR4"/> <constraint firstItem="qfI-0k-kQG" firstAttribute="bottom" secondItem="gTV-IL-0wX" secondAttribute="centerY" id="Lpw-Mk-cR4"/>
<constraint firstAttribute="bottom" secondItem="pg3-lh-kp9" secondAttribute="bottom" id="eFM-R9-BJo"/> <constraint firstAttribute="bottom" secondItem="pg3-lh-kp9" secondAttribute="bottom" id="eFM-R9-BJo"/>
<constraint firstAttribute="trailing" secondItem="Ajc-oX-hvc" secondAttribute="trailing" constant="10" id="gtC-oh-x4F"/>
<constraint firstItem="Ajc-oX-hvc" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="mj6-Gx-BZH"/>
<constraint firstItem="pg3-lh-kp9" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="skh-sW-fEO"/> <constraint firstItem="pg3-lh-kp9" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="skh-sW-fEO"/>
<constraint firstAttribute="bottom" secondItem="nZJ-9s-cJg" secondAttribute="bottom" constant="7" id="v6j-Yr-2wF"/> <constraint firstAttribute="bottom" secondItem="nZJ-9s-cJg" secondAttribute="bottom" constant="7" id="v6j-Yr-2wF"/>
</constraints> </constraints>
...@@ -47,6 +65,7 @@ ...@@ -47,6 +65,7 @@
<size key="customSize" width="100" height="69"/> <size key="customSize" width="100" height="69"/>
<connections> <connections>
<outlet property="bgImV" destination="pg3-lh-kp9" id="usC-7f-KnW"/> <outlet property="bgImV" destination="pg3-lh-kp9" id="usC-7f-KnW"/>
<outlet property="countLbl" destination="Ajc-oX-hvc" id="yUr-Ey-VHj"/>
<outlet property="itemImgV" destination="qfI-0k-kQG" id="qLI-Cx-MSh"/> <outlet property="itemImgV" destination="qfI-0k-kQG" id="qLI-Cx-MSh"/>
<outlet property="itemNameLbl" destination="nZJ-9s-cJg" id="D5k-6q-pu9"/> <outlet property="itemNameLbl" destination="nZJ-9s-cJg" id="D5k-6q-pu9"/>
</connections> </connections>
...@@ -55,8 +74,14 @@ ...@@ -55,8 +74,14 @@
</objects> </objects>
<resources> <resources>
<image name="bianji" width="17" height="16.5"/> <image name="bianji" width="17" height="16.5"/>
<namedColor name="密码错误字体颜色">
<color red="0.88999998569488525" green="0.27799999713897705" blue="0.27799999713897705" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="标题字颜色"> <namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources> </resources>
</document> </document>
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
import UIKit import UIKit
@objc protocol WorkItemTableViewCellDelegate { @objc protocol WorkItemTableViewCellDelegate {
@objc optional func WorkItemTableViewCellBtnClick(sender:WorkItemTableViewCell,idx:IndexPath) @objc optional func WorkItemTableViewCellBtnClick(sender:WorkItemTableViewCell,idx:IndexPath)
@objc optional func WorkItemTableViewCellAuthId(sender:WorkItemTableViewCell,auth_id:Int)
} }
class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UICollectionViewDataSource { class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UICollectionViewDataSource {
var delegate:WorkItemTableViewCellDelegate? var delegate:WorkItemTableViewCellDelegate?
...@@ -16,10 +18,11 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle ...@@ -16,10 +18,11 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
@IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var titleLbl: UILabel! @IBOutlet weak var titleLbl: UILabel!
@IBOutlet weak var gotoImgV: UIImageView! @IBOutlet weak var gotoImgV: UIImageView!
var dataIndexSection = 0
//数据 //数据
var itemArrs:[String] = [] var itemArrs:[String] = []
var itemDataArrs:[WorkcenterIndexAuthResModel] = []
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
self.selectionStyle = .none self.selectionStyle = .none
...@@ -32,7 +35,6 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle ...@@ -32,7 +35,6 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
forCellWithReuseIdentifier: "WorkItemCollectionViewCell") forCellWithReuseIdentifier: "WorkItemCollectionViewCell")
} }
//加载数据 //加载数据
...@@ -56,7 +58,7 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle ...@@ -56,7 +58,7 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
func collectionView(_ collectionView: UICollectionView, func collectionView(_ collectionView: UICollectionView,
numberOfItemsInSection section: Int) -> Int { numberOfItemsInSection section: Int) -> Int {
return 10 return itemArrs.count
} }
//返回对应的单元格 //返回对应的单元格
...@@ -64,32 +66,46 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle ...@@ -64,32 +66,46 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "WorkItemCollectionViewCell", let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "WorkItemCollectionViewCell",
for: indexPath) as! WorkItemCollectionViewCell for: indexPath) as! WorkItemCollectionViewCell
cell.itemImgV.image = UIImage.init(named: "worktest1")
// if indexPath.row % 2 == 0 {
// cell.bgImV.image = UIImage.init(named: "workjia")
// }else{
// cell.bgImV.image = UIImage.init(named: "workjian")
//
// }
// if indexPath.row == 10 {
// cell.bgImV.image = UIImage.init(named: "workkuang")
// cell.itemImgV.isHidden = true
// cell.itemNameLbl.isHidden = true
// }
cell.itemNameLbl.text = "itemN\(indexPath.row)"
if indexPath.row % 2 == 0 {
cell.itemImgV.image = UIImage.init(named: "worktest1")
}else{
cell.itemImgV.image = UIImage.init(named: "worktest2")
if dataIndexSection == 2 {
cell.countLbl.isHidden = false
cell.itemImgV.image = UIImage.init(named: ("work" + itemArrs[indexPath.row]))
cell.countLbl.text = StringByInt(number: indexPath.row)
if indexPath.row == 0 {
cell.countLbl.text = "100"
}
}else{
cell.countLbl.isHidden = true
} }
cell.itemNameLbl.text = itemArrs[indexPath.row]
//加减图——用于编辑工作中心用
// if indexPath.row % 2 == 0 {
// cell.bgImV.image = UIImage.init(named: "workjia")
// }else{
// cell.bgImV.image = UIImage.init(named: "workjian")
//
// }
//边框图——用于编辑工作中心用
// if indexPath.row == 10 {
// cell.bgImV.image = UIImage.init(named: "workkuang")
// cell.itemImgV.isHidden = true
// cell.itemNameLbl.isHidden = true
// }
return cell return cell
} }
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
// print("1选中item=\(indexPath.section)=\(indexPath.row)") if dataIndexSection == 2 {
delegate?.WorkItemTableViewCellBtnClick?(sender: self, idx: indexPath) delegate?.WorkItemTableViewCellBtnClick?(sender: self, idx: indexPath)
}else{
let rowModel = self.itemDataArrs[indexPath.row]
//真实数据要穿 auth_id
delegate?.WorkItemTableViewCellAuthId?(sender: self, auth_id: rowModel.auth_id!)
}
} }
......
//
// WorkTestModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/6/1.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import RealmSwift
//工作中心
class WorkDataModel:Object {
//类型名
@objc dynamic var dataModelStr = ""
@objc dynamic var star_time = 0
@objc dynamic var end_time = Date()
@objc dynamic var oftenArrStr = ""
}
...@@ -9,8 +9,13 @@ ...@@ -9,8 +9,13 @@
import UIKit import UIKit
class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UICollectionViewDataSource ,UICollectionViewDelegateFlowLayout{ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UICollectionViewDataSource ,UICollectionViewDelegateFlowLayout{
var items = ["科技","军事","国际","数码","星座","电影","时尚"]
var dataModel:WorkcenterIndexDataModel? = nil
var oftenArr:Array<WorkcenterIndexAuthResModel>? = [] //常用功能
//MARK:--一级分类
var titleStrArr:[String] = []
var pAuthResModelArr:[WorkcenterIndexAuthResModel] = []
@IBOutlet weak var topLayou: NSLayoutConstraint! @IBOutlet weak var topLayou: NSLayoutConstraint!
@IBOutlet weak var itemListCollectionView: UICollectionView! @IBOutlet weak var itemListCollectionView: UICollectionView!
@IBOutlet weak var titleView: UIView! @IBOutlet weak var titleView: UIView!
...@@ -18,6 +23,16 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC ...@@ -18,6 +23,16 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
@IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var collectionView: UICollectionView!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.dataModel?.auth_res?.forEach({ (md) in
if md.auth_pid == 0 {
titleStrArr.append(md.auth_name!)
pAuthResModelArr.append(md)
}
})
navbar.title = "功能列表" navbar.title = "功能列表"
navbar.rightTitle = "保存" navbar.rightTitle = "保存"
...@@ -56,7 +71,7 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC ...@@ -56,7 +71,7 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
func numberOfSections(in collectionView: UICollectionView) -> Int { func numberOfSections(in collectionView: UICollectionView) -> Int {
if collectionView == self.itemListCollectionView { if collectionView == self.itemListCollectionView {
return 5 return pAuthResModelArr.count
} }
return 1 return 1
} }
...@@ -64,9 +79,19 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC ...@@ -64,9 +79,19 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
func collectionView(_ collectionView: UICollectionView, func collectionView(_ collectionView: UICollectionView,
numberOfItemsInSection section: Int) -> Int { numberOfItemsInSection section: Int) -> Int {
if collectionView == self.itemListCollectionView { if collectionView == self.itemListCollectionView {
return 6 var chlicdAuthResModelArr:[WorkcenterIndexAuthResModel] = []
let pAuthModel = pAuthResModelArr[section]//父model
self.dataModel?.auth_res?.forEach({ (md) in //子model
if pAuthModel.auth_id == md.auth_pid {
chlicdAuthResModelArr.append(md)
}
})
return chlicdAuthResModelArr.count
}
if oftenArr!.count >= 10 {
return 10 //最多10个
} }
return items.count + 1 return oftenArr!.count + 1
} }
//返回对应的单元格 //返回对应的单元格
func collectionView(_ collectionView: UICollectionView, func collectionView(_ collectionView: UICollectionView,
...@@ -75,29 +100,39 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC ...@@ -75,29 +100,39 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
for: indexPath) as! WorkItemCollectionViewCell for: indexPath) as! WorkItemCollectionViewCell
if collectionView == self.itemListCollectionView { if collectionView == self.itemListCollectionView {
if indexPath.row % 2 == 0 {
cell.itemImgV.image = UIImage.init(named: "worktest1") cell.itemImgV.image = UIImage.init(named: "worktest2")
}else{ cell.bgImV.image = UIImage.init(named: "workjia")
cell.itemImgV.image = UIImage.init(named: "worktest2") //MARK:--如果oftenArr(常用有,这边就显示添加icon)
var chlicdAuthResModelArr:[WorkcenterIndexAuthResModel] = []
} let pAuthModel = pAuthResModelArr[indexPath.section]//父model
cell.bgImV.image = UIImage.init(named: "workjian") self.dataModel?.auth_res?.forEach({ (md) in //子model
if pAuthModel.auth_id == md.auth_pid {
chlicdAuthResModelArr.append(md)
}
})
let rowModel = chlicdAuthResModelArr[indexPath.row]
cell.itemNameLbl.text = rowModel.auth_name
oftenArr?.forEach({ (md) in
if md.auth_id == rowModel.auth_id {
cell.bgImV.image = UIImage.init(named: "workjian")
}
})
}else{ }else{
if indexPath.row == items.count { if indexPath.row == oftenArr!.count {
cell.itemNameLbl.isHidden = true cell.itemNameLbl.isHidden = true
cell.itemImgV.isHidden = true cell.itemImgV.isHidden = true
cell.bgImV.image = UIImage.init(named: "workkuang") cell.bgImV.image = UIImage.init(named: "workkuang")
}else{ }else{
cell.itemNameLbl.isHidden = false cell.itemNameLbl.isHidden = false
cell.itemImgV.isHidden = false cell.itemImgV.isHidden = false
cell.itemNameLbl.text = items[indexPath.row] let rowModel = oftenArr![indexPath.row]
if indexPath.row % 2 == 0 {
cell.itemImgV.image = UIImage.init(named: "worktest1") cell.itemNameLbl.text = rowModel.auth_name
}else{ cell.itemImgV.image = UIImage.init(named: "worktest2")
cell.itemImgV.image = UIImage.init(named: "worktest2")
}
cell.bgImV.image = UIImage.init(named: "workjian") cell.bgImV.image = UIImage.init(named: "workjian")
} }
...@@ -108,14 +143,15 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC ...@@ -108,14 +143,15 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
} }
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if collectionView == self.itemListCollectionView { if collectionView == self.itemListCollectionView {
let titleS = ["订单管理","商品管理","仓库管理","采购管理","财务关联"]
//MARK:--一级分类
let headerV = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "headerIdentifier", for: indexPath) let headerV = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "headerIdentifier", for: indexPath)
headerV.subviews.forEach { (view) in headerV.subviews.forEach { (view) in
view.removeFromSuperview() view.removeFromSuperview()
} }
let headerLbl = UILabel(frame: CGRect(x: 15*glscale, y: 10*glscale, width: 100*glscale, height: 20*glscale)) let headerLbl = UILabel(frame: CGRect(x: 15*glscale, y: 10*glscale, width: 100*glscale, height: 20*glscale))
headerLbl.text = titleS[indexPath.section] headerLbl.text = titleStrArr[indexPath.section]
headerLbl.textColor = UIColor.init(named: "标题字颜色") headerLbl.textColor = UIColor.init(named: "标题字颜色")
headerLbl.font = UIFont.systemFont(ofSize: 13) headerLbl.font = UIFont.systemFont(ofSize: 13)
headerV.addSubview(headerLbl) headerV.addSubview(headerLbl)
...@@ -135,21 +171,69 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC ...@@ -135,21 +171,69 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print("选中item=\(indexPath.section)=\(indexPath.row)") print("选中item=\(indexPath.section)=\(indexPath.row)")
if collectionView == self.itemListCollectionView { if collectionView == self.itemListCollectionView {
//MARK:--需要判断加还是减
var chlicdAuthResModelArr:[WorkcenterIndexAuthResModel] = []
let pAuthModel = pAuthResModelArr[indexPath.section]//父model
self.dataModel?.auth_res?.forEach({ (md) in //子model
if pAuthModel.auth_id == md.auth_pid {
chlicdAuthResModelArr.append(md)
}
})
var dataIndex = 0
let rowModel = chlicdAuthResModelArr[indexPath.row]
var isJia:Bool = true
oftenArr?.forEach({ (md) in
if md.auth_id == rowModel.auth_id {
isJia = false
}
if isJia {
dataIndex += 1
}
})
if isJia {
//添加
if oftenArr!.count < 10 {
oftenArr!.append(rowModel)
self.collectionView.reloadData()
//更新collectionView的高度约束
let contentSize = self.collectionView.collectionViewLayout.collectionViewContentSize
collectionVheight.constant = contentSize.height
self.collectionView.collectionViewLayout.invalidateLayout()
}else{
HUD.flash(.label("最多10个常用功能"),delay: 1.2)
}
}else{
//删除
oftenArr!.remove(at: dataIndex)
self.collectionView.reloadData()
//更新collectionView的高度约束
let contentSize = self.collectionView.collectionViewLayout.collectionViewContentSize
collectionVheight.constant = contentSize.height
self.collectionView.collectionViewLayout.invalidateLayout()
}
self.itemListCollectionView.reloadData()
}else{ }else{
items.remove(at: indexPath.row) if indexPath.row < oftenArr!.count {
self.collectionView.reloadData() oftenArr!.remove(at: indexPath.row)
//更新collectionView的高度约束 self.collectionView.reloadData()
let contentSize = self.collectionView.collectionViewLayout.collectionViewContentSize //更新collectionView的高度约束
collectionVheight.constant = contentSize.height let contentSize = self.collectionView.collectionViewLayout.collectionViewContentSize
collectionVheight.constant = contentSize.height
self.collectionView.collectionViewLayout.invalidateLayout() self.collectionView.collectionViewLayout.invalidateLayout()
self.itemListCollectionView.reloadData()
}
} }
} }
//MARK:--保存方法 //MARK:--保存方法
func rightBtnClick() { func rightBtnClick() {
print("要记得保存哦") print("要记得保存哦")
//保存本地
} }
//MARK:--长按所需的参数 //MARK:--长按所需的参数
var indexPath: IndexPath? var indexPath: IndexPath?
...@@ -189,7 +273,14 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC ...@@ -189,7 +273,14 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
collectionView.addSubview(dragingItem) collectionView.addSubview(dragingItem)
indexPath = collectionView.indexPathForItem(at: point) indexPath = collectionView.indexPathForItem(at: point)
if indexPath == nil || (indexPath?.section)! > 0 || indexPath?.row == items.count //最后一个是否可以拖动+当为10个时候,提示框不显示,全部都可以拖地,当小于10后,显示提示框 最后那个不能拖动
var endCount = 0
if oftenArr!.count >= 10 {
endCount = 11 //不存在的数
}else{
endCount = oftenArr!.count
}
if indexPath == nil || (indexPath?.section)! > 0 || indexPath?.row == endCount
{return} {return}
let item = collectionView.cellForItem(at: indexPath!) as! WorkItemCollectionViewCell let item = collectionView.cellForItem(at: indexPath!) as! WorkItemCollectionViewCell
...@@ -208,19 +299,31 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC ...@@ -208,19 +299,31 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
if indexPath == nil || (indexPath?.section)! > 0 {return} if indexPath == nil || (indexPath?.section)! > 0 {return}
dragingItem.center = point dragingItem.center = point
targetIndexPath = collectionView.indexPathForItem(at: point) targetIndexPath = collectionView.indexPathForItem(at: point)
if targetIndexPath == nil || (targetIndexPath?.section)! > 0 || indexPath == targetIndexPath || targetIndexPath?.row == items.count {return} //最后一个是否可以拖动+当为10个时候,提示框不显示,全部都可以拖地,当小于10后,显示提示框 最后那个不能拖动
var endCount = 0
if oftenArr!.count >= 10 {
endCount = 11 //不存在的数
}else{
endCount = oftenArr!.count
}
if targetIndexPath == nil || (targetIndexPath?.section)! > 0 || indexPath == targetIndexPath || targetIndexPath?.row == endCount {return}
// 更新数据 // 更新数据
let obj = items[indexPath!.item] let obj = oftenArr![indexPath!.item]
items.remove(at: indexPath!.row) oftenArr!.remove(at: indexPath!.row)
items.insert(obj, at: targetIndexPath!.item) oftenArr!.insert(obj, at: targetIndexPath!.item)
//交换位置 //交换位置
collectionView.moveItem(at: indexPath!, to: targetIndexPath!) collectionView.moveItem(at: indexPath!, to: targetIndexPath!)
indexPath = targetIndexPath indexPath = targetIndexPath
} }
//MARK: - 长按结束 //MARK: - 长按结束
private func drageEnded(point: CGPoint) { private func drageEnded(point: CGPoint) {
var endCount = 0
if indexPath == nil || (indexPath?.section)! > 0 || indexPath?.row == items.count {return} if oftenArr!.count >= 10 {
endCount = 11 //不存在的数
}else{
endCount = oftenArr!.count
}
if indexPath == nil || (indexPath?.section)! > 0 || indexPath?.row == endCount {return}
let endCell = collectionView.cellForItem(at: indexPath!) let endCell = collectionView.cellForItem(at: indexPath!)
UIView.animate(withDuration: 0.25, animations: { UIView.animate(withDuration: 0.25, animations: {
......
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