Commit 192205e2 authored by 刘俊宏's avatar 刘俊宏

完成InterfaceModel

parent 98953855
......@@ -51,7 +51,6 @@
E09B03C12445B96500211A51 /* FgPassViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E09B03BF2445B96500211A51 /* FgPassViewController.xib */; };
E09B03C32445BD9500211A51 /* NavViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E09B03C22445BD9500211A51 /* NavViewController.swift */; };
E09B03C62445BF6700211A51 /* NavBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E09B03C52445BF6700211A51 /* NavBarView.swift */; };
E09B03C82445BF9300211A51 /* SwiftNotice.swift in Sources */ = {isa = PBXBuildFile; fileRef = E09B03C72445BF9300211A51 /* SwiftNotice.swift */; };
E0A7548A244A8F0F00A84B67 /* CheckWareHourseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0A75488244A8F0F00A84B67 /* CheckWareHourseViewController.swift */; };
E0A7548B244A8F0F00A84B67 /* CheckWareHourseViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0A75489244A8F0F00A84B67 /* CheckWareHourseViewController.xib */; };
E0B6036E244D376900A56B38 /* KuWeiCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B6036C244D376900A56B38 /* KuWeiCell.swift */; };
......@@ -103,6 +102,14 @@
F9023F6E2449A9B100DD5A63 /* TitleAndTFCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9023F6C2449A9B100DD5A63 /* TitleAndTFCell.xib */; };
F9023F712449ACA800DD5A63 /* TitleAndSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9023F6F2449ACA800DD5A63 /* TitleAndSwitchCell.swift */; };
F9023F722449ACA800DD5A63 /* TitleAndSwitchCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9023F702449ACA800DD5A63 /* TitleAndSwitchCell.xib */; };
F9171EFC245128B200359C2B /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171EFB245128B200359C2B /* Interface.swift */; };
F9171F0224513C5B00359C2B /* UpDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171F0124513C5B00359C2B /* UpDataModel.swift */; };
F950FDA32451438A00C40530 /* AdminInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F950FDA22451438A00C40530 /* AdminInfoModel.swift */; };
F950FDA52451453A00C40530 /* ShopInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F950FDA42451453A00C40530 /* ShopInfoModel.swift */; };
F950FDA72451494500C40530 /* GeliPayInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F950FDA62451494500C40530 /* GeliPayInfoModel.swift */; };
F950FDA92451613500C40530 /* GetMobileModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F950FDA82451613500C40530 /* GetMobileModel.swift */; };
F950FDAB2451634B00C40530 /* LocationGeliPayModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F950FDAA2451634B00C40530 /* LocationGeliPayModel.swift */; };
F950FDAD245163E500C40530 /* GoodsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F950FDAC245163E500C40530 /* GoodsListModel.swift */; };
F95D9B5024484FAE0080D6E3 /* GeliAlertView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F95D9B4F24484FAE0080D6E3 /* GeliAlertView.xib */; };
F95D9B522448530E0080D6E3 /* GeliAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F95D9B512448530E0080D6E3 /* GeliAlertView.swift */; };
F95D9CA424493E840080D6E3 /* ShopInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F95D9CA224493E840080D6E3 /* ShopInfoViewController.swift */; };
......@@ -189,7 +196,6 @@
E09B03BF2445B96500211A51 /* FgPassViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FgPassViewController.xib; sourceTree = "<group>"; };
E09B03C22445BD9500211A51 /* NavViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavViewController.swift; sourceTree = "<group>"; };
E09B03C52445BF6700211A51 /* NavBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavBarView.swift; sourceTree = "<group>"; };
E09B03C72445BF9300211A51 /* SwiftNotice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftNotice.swift; sourceTree = "<group>"; };
E0A75488244A8F0F00A84B67 /* CheckWareHourseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckWareHourseViewController.swift; sourceTree = "<group>"; };
E0A75489244A8F0F00A84B67 /* CheckWareHourseViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CheckWareHourseViewController.xib; sourceTree = "<group>"; };
E0B6036C244D376900A56B38 /* KuWeiCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KuWeiCell.swift; sourceTree = "<group>"; };
......@@ -250,6 +256,14 @@
F9023F6C2449A9B100DD5A63 /* TitleAndTFCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndTFCell.xib; sourceTree = "<group>"; };
F9023F6F2449ACA800DD5A63 /* TitleAndSwitchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleAndSwitchCell.swift; 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>"; };
F9171F0124513C5B00359C2B /* UpDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpDataModel.swift; sourceTree = "<group>"; };
F950FDA22451438A00C40530 /* AdminInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminInfoModel.swift; sourceTree = "<group>"; };
F950FDA42451453A00C40530 /* ShopInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopInfoModel.swift; sourceTree = "<group>"; };
F950FDA62451494500C40530 /* GeliPayInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeliPayInfoModel.swift; sourceTree = "<group>"; };
F950FDA82451613500C40530 /* GetMobileModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetMobileModel.swift; sourceTree = "<group>"; };
F950FDAA2451634B00C40530 /* LocationGeliPayModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationGeliPayModel.swift; sourceTree = "<group>"; };
F950FDAC245163E500C40530 /* GoodsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoodsListModel.swift; sourceTree = "<group>"; };
F95D9B4F24484FAE0080D6E3 /* GeliAlertView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GeliAlertView.xib; sourceTree = "<group>"; };
F95D9B512448530E0080D6E3 /* GeliAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeliAlertView.swift; sourceTree = "<group>"; };
F95D9CA224493E840080D6E3 /* ShopInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopInfoViewController.swift; sourceTree = "<group>"; };
......@@ -498,7 +512,6 @@
E09B039F2445AF4D00211A51 /* Define */ = {
isa = PBXGroup;
children = (
E09B03C72445BF9300211A51 /* SwiftNotice.swift */,
E09B03A22445AF9500211A51 /* NetworkRequest.swift */,
E09B03A02445AF7100211A51 /* Define.swift */,
E01C26BA2446D68500ADCC70 /* Bridge_Header.h */,
......@@ -519,7 +532,15 @@
E09B03A92445B09200211A51 /* Model */ = {
isa = PBXGroup;
children = (
F9171EFB245128B200359C2B /* Interface.swift */,
E09B03AA2445B0A300211A51 /* LoginModel.swift */,
F9171F0124513C5B00359C2B /* UpDataModel.swift */,
F950FDA22451438A00C40530 /* AdminInfoModel.swift */,
F950FDA42451453A00C40530 /* ShopInfoModel.swift */,
F950FDA62451494500C40530 /* GeliPayInfoModel.swift */,
F950FDA82451613500C40530 /* GetMobileModel.swift */,
F950FDAA2451634B00C40530 /* LocationGeliPayModel.swift */,
F950FDAC245163E500C40530 /* GoodsListModel.swift */,
);
path = Model;
sourceTree = "<group>";
......@@ -1003,6 +1024,7 @@
E09B03B62445B85A00211A51 /* LoginViewController.swift in Sources */,
E0C4F4B9244EEA7C00CC7E2F /* JiaTiJiaCell.swift in Sources */,
E02DDD90244FE54C00ABB707 /* NewCreateHeader.swift in Sources */,
F950FDA92451613500C40530 /* GetMobileModel.swift in Sources */,
E0336DD5244EC40000380BE9 /* CreatNewSpecsViewController.swift in Sources */,
E0DDCB18244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.swift in Sources */,
E0D197C12448431C002B080C /* BabyToy.m in Sources */,
......@@ -1010,9 +1032,12 @@
E02DDD85244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift in Sources */,
E0D197C02448431C002B080C /* BabyCentralManager.m in Sources */,
F95D9CA424493E840080D6E3 /* ShopInfoViewController.swift in Sources */,
F9171EFC245128B200359C2B /* Interface.swift in Sources */,
E00D85DF244561FD00F5F816 /* AppDelegate.swift in Sources */,
E0516F7F244806C500E373CE /* MsgCenterViewController.swift in Sources */,
F950FDA52451453A00C40530 /* ShopInfoModel.swift in Sources */,
E0516F822448086700E373CE /* MsgCenterCell.swift in Sources */,
F950FDA32451438A00C40530 /* AdminInfoModel.swift in Sources */,
E0D197D5244860B1002B080C /* BlueToothCell.swift in Sources */,
F95D9B522448530E0080D6E3 /* GeliAlertView.swift in Sources */,
E0D197BB2448431C002B080C /* BabyCallback.m in Sources */,
......@@ -1021,6 +1046,8 @@
E0C4F4A7244EC82A00CC7E2F /* TitleAndBtnCell.swift in Sources */,
E09B03C62445BF6700211A51 /* NavBarView.swift in Sources */,
E0C9EF12244E922200277435 /* OrderDViewController.swift in Sources */,
F9171F0224513C5B00359C2B /* UpDataModel.swift in Sources */,
F950FDAD245163E500C40530 /* GoodsListModel.swift in Sources */,
E0D197BD2448431C002B080C /* BabySpeaker.m in Sources */,
E00D85E1244561FD00F5F816 /* SceneDelegate.swift in Sources */,
F969BF1E244EE67900C79953 /* GoodsManageListVC.swift in Sources */,
......@@ -1032,7 +1059,9 @@
E09B03A82445B04E00211A51 /* BaseView.swift in Sources */,
E0DDCB0F244AD8C500DF54C7 /* DaiQueRenCell.swift in Sources */,
F969BF07244EC38000C79953 /* GoodsCollectionViewCell.swift in Sources */,
F950FDA72451494500C40530 /* GeliPayInfoModel.swift in Sources */,
E09B03C02445B96500211A51 /* FgPassViewController.swift in Sources */,
F950FDAB2451634B00C40530 /* LocationGeliPayModel.swift in Sources */,
E0D197C6244845FD002B080C /* PersonCenterViewController.swift in Sources */,
E09B03AB2445B0A300211A51 /* LoginModel.swift in Sources */,
E0D197BE2448431C002B080C /* BabyOptions.m in Sources */,
......@@ -1040,7 +1069,6 @@
F9023F692449A50900DD5A63 /* TitleContentCell.swift in Sources */,
E0DDCB1D244AE81800DF54C7 /* GuanLianKeHuCell.swift in Sources */,
E0D197BF2448431C002B080C /* BabyBluetooth.m in Sources */,
E09B03C82445BF9300211A51 /* SwiftNotice.swift in Sources */,
E0D4165F24482AAF008DCAB4 /* AccountViewController.swift in Sources */,
E01C26B62446AF3100ADCC70 /* DemoViewController.swift in Sources */,
E0A7548A244A8F0F00A84B67 /* CheckWareHourseViewController.swift in Sources */,
......
......@@ -25,11 +25,11 @@ let systemVersion = (UIDevice.current.systemVersion as String)
//接口地址
//test
//let SERVERCE_ImageHost = "http://admin.lgw.com/"
//let SERVERCE_HOST = "http://admin.lgw.com/api/"
let SERVERCE_HOST = "http://z.gelifood.com/admin/"
//online
let SERVERCE_ImageHost = "https://api.laigewan.com/upload/images/"
let SERVERCE_HOST = "http://a.gelifood.com/apia"
//let SERVERCE_ImageHost = "https://api.laigewan.com/upload/images/"
//let SERVERCE_HOST = "http://a.gelifood.com/apia"
//视图常量
let IS_IPHONE_X = __CGSizeEqualToSize(CGSize(width: 375.0, height: 812.0),UIScreen.main.bounds.size ) || __CGSizeEqualToSize(CGSize(width: 812.0, height: 375.0),UIScreen.main.bounds.size)||__CGSizeEqualToSize(CGSize(width: 414.0, height: 896.0),UIScreen.main.bounds.size ) || __CGSizeEqualToSize(CGSize(width: 896.0, height: 414.0),UIScreen.main.bounds.size)
......
......@@ -90,7 +90,7 @@ extension NetworkRequest {
let dicstr:String = dic?[url] as! String
let allUrl = SERVERCE_HOST + "/" + dicstr
let allUrl = SERVERCE_HOST + dicstr
print(allUrl)
print(params)
......@@ -112,23 +112,29 @@ extension NetworkRequest {
case .success(let value):
let json = JSON(value)
print(json)
SwiftNotice.clear()
if json["code"].intValue == 200 {
if json["code"].intValue == 1 {
success(Mapper<T>().map(JSONObject: value))
}else if json["code"].intValue == 999 {
print("uid错误")
SwiftNotice.showText(json["message"].stringValue)
}else if json["code"].intValue == 2 {
//正常-数据为空
success(Mapper<T>().map(JSONObject: value))
}else if json["code"].intValue == 3 {
//业务逻辑运行异常,一般作用于验证失败、参数异常(缺失)等异常情况返回
// SwiftNotice.showText(json["message"].stringValue)
failture(DogError.DataInvalidError)
}else if json["code"].intValue == 10 {
NotificationCenter.default.post(name: Notification.Name(rawValue: "logout"), object: nil)
// SwiftNotice.showText(json["message"].stringValue)
failture(DogError.DataInvalidError)
}else if json["code"].intValue == 11 {
// SwiftNotice.showText(json["message"].stringValue)
failture(DogError.DataInvalidError)
}else{
SwiftNotice.showText(json["message"].stringValue)
// SwiftNotice.showText(json["message"].stringValue)
failture(DogError.DataInvalidError)
}
case .failure(let error):
SwiftNotice.clear()
failture(error)
print("error:\(error)")
......@@ -176,7 +182,7 @@ extension NetworkRequest {
let dicstr:String = dic?[url] as! String
let allUrl = SERVERCE_HOST + dicstr
print(allUrl)
print(params)
......@@ -193,27 +199,32 @@ extension NetworkRequest {
case .success(let value):
let json = JSON(value)
print(json)
SwiftNotice.clear()
UserDefaults.standard.setValue(json["message"].stringValue, forKey: "jsonMessage")
if json["code"].intValue == 200 {
if json["code"].intValue == 1 {
success(Mapper<T>().map(JSONObject: value))
}else if json["code"].intValue == 999 {
}else if json["code"].intValue == 2 {
//正常-数据为空
success(Mapper<T>().map(JSONObject: value))
}else if json["code"].intValue == 3 {
//业务逻辑运行异常,一般作用于验证失败、参数异常(缺失)等异常情况返回
failture(DogError.DataInvalidError)
}else if json["code"].intValue == 10 {
failture(DogError.DataInvalidError)
NotificationCenter.default.post(name: Notification.Name(rawValue: "logout"), object: nil)
}else if json["code"].intValue == 11 {
// SwiftNotice.showText(json["message"].stringValue)
failture(DogError.DataInvalidError)
}else{
if json["code"].intValue == 500 {
success(Mapper<T>().map(JSONObject: value))
}else{
failture(DogError.DataInvalidError)
}
failture(DogError.DataInvalidError)
}
case .failure(let error):
SwiftNotice.clear()
failture(error)
}
}
......
//
// SwiftNotice.swift
// SwiftNotice
//
// Created by JohnLui on 15/4/15.
// Copyright (c) 2015年 com.lvwenhan. All rights reserved.
//
import Foundation
import UIKit
private let sn_topBar: Int = 1001
extension UIResponder {
/// wait with your own animated images
@discardableResult
func pleaseWaitWithImages(_ imageNames: Array<UIImage>, timeInterval: Int) -> UIWindow{
return SwiftNotice.wait(imageNames, timeInterval: timeInterval)
}
// api changed from v3.3
@discardableResult
func noticeTop(_ text: String, autoClear: Bool = true, autoClearTime: Int = 1) -> UIWindow{
return SwiftNotice.noticeOnStatusBar(text, autoClear: autoClear, autoClearTime: autoClearTime)
}
// new apis from v3.3
@discardableResult
func noticeSuccess(_ text: String, autoClear: Bool = false, autoClearTime: Int = 3) -> UIWindow{
return SwiftNotice.showNoticeWithText(NoticeType.success, text: text, autoClear: autoClear, autoClearTime: autoClearTime)
}
@discardableResult
func noticeError(_ text: String, autoClear: Bool = false, autoClearTime: Int = 3) -> UIWindow{
return SwiftNotice.showNoticeWithText(NoticeType.error, text: text, autoClear: autoClear, autoClearTime: autoClearTime)
}
@discardableResult
func noticeInfo(_ text: String, autoClear: Bool = false, autoClearTime: Int = 3) -> UIWindow{
return SwiftNotice.showNoticeWithText(NoticeType.info, text: text, autoClear: autoClear, autoClearTime: autoClearTime)
}
// old apis
@discardableResult
func successNotice(_ text: String, autoClear: Bool = true) -> UIWindow{
return SwiftNotice.showNoticeWithText(NoticeType.success, text: text, autoClear: autoClear, autoClearTime: 3)
}
@discardableResult
func errorNotice(_ text: String, autoClear: Bool = true) -> UIWindow{
return SwiftNotice.showNoticeWithText(NoticeType.error, text: text, autoClear: autoClear, autoClearTime: 3)
}
@discardableResult
func infoNotice(_ text: String, autoClear: Bool = true) -> UIWindow{
return SwiftNotice.showNoticeWithText(NoticeType.info, text: text, autoClear: autoClear, autoClearTime: 3)
}
@discardableResult
func notice(_ text: String, type: NoticeType, autoClear: Bool, autoClearTime: Int = 3) -> UIWindow{
return SwiftNotice.showNoticeWithText(type, text: text, autoClear: autoClear, autoClearTime: autoClearTime)
}
@discardableResult
func pleaseWait() -> UIWindow{
return SwiftNotice.wait()
}
@discardableResult
func noticeOnlyText(_ text: String) -> UIWindow{
return SwiftNotice.showText(text)
}
func clearAllNotice() {
SwiftNotice.clear()
}
}
enum NoticeType{
case success
case error
case info
}
class SwiftNotice: NSObject {
static var windows = Array<UIWindow?>()
static let rv = UIApplication.shared.keyWindow?.subviews.first as UIView?
static var timer: DispatchSource!
static var timerTimes = 0
/* just for iOS 8
*/
static var degree: Double {
get {
return [0, 0, 180, 270, 90][UIApplication.shared.statusBarOrientation.hashValue] as Double
}
}
// fix https://github.com/johnlui/SwiftNotice/issues/2
// thanks broccolii(https://github.com/broccolii) and his PR https://github.com/johnlui/SwiftNotice/pull/5
static func clear() {
self.cancelPreviousPerformRequests(withTarget: self)
if let _ = timer {
timer.cancel()
timer = nil
timerTimes = 0
}
windows.removeAll(keepingCapacity: false)
}
@discardableResult
static func noticeOnStatusBar(_ text: String, autoClear: Bool, autoClearTime: Int) -> UIWindow{
let frame = UIApplication.shared.statusBarFrame
let window = UIWindow()
window.backgroundColor = UIColor.clear
let view = UIView()
view.backgroundColor = UIColor(red: 0x6a/0x100, green: 0xb4/0x100, blue: 0x9f/0x100, alpha: 1)
let label = UILabel(frame: frame.height > 20 ? CGRect(x: frame.origin.x, y: frame.origin.y + frame.height - 17, width: frame.width, height: 20) : frame)
label.textAlignment = NSTextAlignment.center
label.font = UIFont.systemFont(ofSize: 12)
label.textColor = UIColor.white
label.text = text
view.addSubview(label)
window.frame = frame
view.frame = frame
if let version = Double(UIDevice.current.systemVersion),
version < 9.0 {
// change center
var array = [UIScreen.main.bounds.width, UIScreen.main.bounds.height]
array = array.sorted(by: <)
let screenWidth = array[0]
let screenHeight = array[1]
let x = [0, screenWidth/2, screenWidth/2, 10, screenWidth-10][UIApplication.shared.statusBarOrientation.hashValue] as CGFloat
let y = [0, 10, screenHeight-10, screenHeight/2, screenHeight/2][UIApplication.shared.statusBarOrientation.hashValue] as CGFloat
window.center = CGPoint(x: x, y: y)
// change direction
window.transform = CGAffineTransform(rotationAngle: CGFloat(degree * Double.pi / 180))
}
window.windowLevel = UIWindow.Level.statusBar
window.isHidden = false
window.addSubview(view)
windows.append(window)
var origPoint = view.frame.origin
origPoint.y = -(view.frame.size.height)
let destPoint = view.frame.origin
view.tag = sn_topBar
view.frame = CGRect(origin: origPoint, size: view.frame.size)
UIView.animate(withDuration: 0.3, animations: {
view.frame = CGRect(origin: destPoint, size: view.frame.size)
}, completion: { b in
if autoClear {
self.perform(.hideNotice, with: window, afterDelay: TimeInterval(autoClearTime))
}
})
return window
}
@discardableResult
static func wait(_ imageNames: Array<UIImage> = Array<UIImage>(), timeInterval: Int = 0) -> UIWindow {
let frame = CGRect(x: 0, y: 0, width: 78, height: 78)
let window = UIWindow()
window.backgroundColor = UIColor.clear
let mainView = UIView()
mainView.layer.cornerRadius = 12
mainView.backgroundColor = UIColor(red:0, green:0, blue:0, alpha: 0.8)
if imageNames.count > 0 {
if imageNames.count > timerTimes {
let iv = UIImageView(frame: frame)
iv.image = imageNames.first!
iv.contentMode = UIView.ContentMode.scaleAspectFit
mainView.addSubview(iv)
timer = DispatchSource.makeTimerSource(flags: DispatchSource.TimerFlags(rawValue: UInt(0)), queue: DispatchQueue.main) as! DispatchSource
timer.schedule(deadline: DispatchTime.now(), repeating: DispatchTimeInterval.milliseconds(timeInterval))
timer.setEventHandler(handler: { () -> Void in
let name = imageNames[timerTimes % imageNames.count]
iv.image = name
timerTimes += 1
})
timer.resume()
}
} else {
let ai = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.whiteLarge)
ai.frame = CGRect(x: 21, y: 21, width: 36, height: 36)
ai.startAnimating()
mainView.addSubview(ai)
}
window.frame = frame
mainView.frame = frame
window.center = rv!.center
if let version = Double(UIDevice.current.systemVersion),
version < 9.0 {
// change center
window.center = getRealCenter()
// change direction
window.transform = CGAffineTransform(rotationAngle: CGFloat(degree * Double.pi / 180))
}
window.windowLevel = UIWindow.Level.alert
window.isHidden = false
window.addSubview(mainView)
windows.append(window)
mainView.alpha = 0.0
UIView.animate(withDuration: 0.2, animations: {
mainView.alpha = 1
})
return window
}
@discardableResult
static func showText(_ text: String, autoClear: Bool=true, autoClearTime: Int=2) -> UIWindow {
let window = UIWindow()
window.backgroundColor = UIColor.clear
let mainView = UIView()
mainView.layer.cornerRadius = 12
mainView.backgroundColor = UIColor(red:0, green:0, blue:0, alpha: 0.8)
let label = UILabel()
label.text = text
label.numberOfLines = 0
label.font = UIFont.systemFont(ofSize: 13)
label.textAlignment = NSTextAlignment.center
label.textColor = UIColor.white
let size = label.sizeThatFits(CGSize(width: UIScreen.main.bounds.width-82, height: CGFloat.greatestFiniteMagnitude))
label.bounds = CGRect(x: 0, y: 0, width: size.width, height: size.height)
mainView.addSubview(label)
let superFrame = CGRect(x: 0, y: 0, width: label.frame.width + 50 , height: label.frame.height + 30)
window.frame = superFrame
mainView.frame = superFrame
label.center = mainView.center
window.center = rv!.center
if let version = Double(UIDevice.current.systemVersion),
version < 9.0 {
// change center
window.center = getRealCenter()
// change direction
window.transform = CGAffineTransform(rotationAngle: CGFloat(degree * Double.pi / 180))
}
window.windowLevel = UIWindow.Level.alert
window.isHidden = false
window.addSubview(mainView)
windows.append(window)
if autoClear {
self.perform(.hideNotice, with: window, afterDelay: TimeInterval(autoClearTime))
}
return window
}
@discardableResult
static func showNoticeWithText(_ type: NoticeType,text: String, autoClear: Bool, autoClearTime: Int) -> UIWindow {
let frame = CGRect(x: 0, y: 0, width: 90, height: 90)
let window = UIWindow()
window.backgroundColor = UIColor.clear
let mainView = UIView()
mainView.layer.cornerRadius = 10
mainView.backgroundColor = UIColor(red:0, green:0, blue:0, alpha: 0.7)
var image = UIImage()
switch type {
case .success:
image = SwiftNoticeSDK.imageOfCheckmark
case .error:
image = SwiftNoticeSDK.imageOfCross
case .info:
image = SwiftNoticeSDK.imageOfInfo
}
let checkmarkView = UIImageView(image: image)
checkmarkView.frame = CGRect(x: 27, y: 15, width: 36, height: 36)
mainView.addSubview(checkmarkView)
let label = UILabel(frame: CGRect(x: 0, y: 60, width: 90, height: 16))
label.font = UIFont.systemFont(ofSize: 13)
label.textColor = UIColor.white
label.text = text
label.textAlignment = NSTextAlignment.center
mainView.addSubview(label)
window.frame = frame
mainView.frame = frame
window.center = rv!.center
if let version = Double(UIDevice.current.systemVersion),
version < 9.0 {
// change center
window.center = getRealCenter()
// change direction
window.transform = CGAffineTransform(rotationAngle: CGFloat(degree * Double.pi / 180))
}
window.windowLevel = UIWindow.Level.alert
window.center = rv!.center
window.isHidden = false
window.addSubview(mainView)
windows.append(window)
mainView.alpha = 0.0
UIView.animate(withDuration: 0.2, animations: {
mainView.alpha = 1
})
if autoClear {
self.perform(.hideNotice, with: window, afterDelay: TimeInterval(autoClearTime))
}
return window
}
// just for iOS 8
static func getRealCenter() -> CGPoint {
if UIApplication.shared.statusBarOrientation.hashValue >= 3 {
return CGPoint(x: rv!.center.y, y: rv!.center.x)
} else {
return rv!.center
}
}
}
class SwiftNoticeSDK {
struct Cache {
static var imageOfCheckmark: UIImage?
static var imageOfCross: UIImage?
static var imageOfInfo: UIImage?
}
class func draw(_ type: NoticeType) {
let checkmarkShapePath = UIBezierPath()
// draw circle
checkmarkShapePath.move(to: CGPoint(x: 36, y: 18))
checkmarkShapePath.addArc(withCenter: CGPoint(x: 18, y: 18), radius: 17.5, startAngle: 0, endAngle: CGFloat(Double.pi*2), clockwise: true)
checkmarkShapePath.close()
switch type {
case .success: // draw checkmark
checkmarkShapePath.move(to: CGPoint(x: 10, y: 18))
checkmarkShapePath.addLine(to: CGPoint(x: 16, y: 24))
checkmarkShapePath.addLine(to: CGPoint(x: 27, y: 13))
checkmarkShapePath.move(to: CGPoint(x: 10, y: 18))
checkmarkShapePath.close()
case .error: // draw X
checkmarkShapePath.move(to: CGPoint(x: 10, y: 10))
checkmarkShapePath.addLine(to: CGPoint(x: 26, y: 26))
checkmarkShapePath.move(to: CGPoint(x: 10, y: 26))
checkmarkShapePath.addLine(to: CGPoint(x: 26, y: 10))
checkmarkShapePath.move(to: CGPoint(x: 10, y: 10))
checkmarkShapePath.close()
case .info:
checkmarkShapePath.move(to: CGPoint(x: 18, y: 6))
checkmarkShapePath.addLine(to: CGPoint(x: 18, y: 22))
checkmarkShapePath.move(to: CGPoint(x: 18, y: 6))
checkmarkShapePath.close()
UIColor.white.setStroke()
checkmarkShapePath.stroke()
let checkmarkShapePath = UIBezierPath()
checkmarkShapePath.move(to: CGPoint(x: 18, y: 27))
checkmarkShapePath.addArc(withCenter: CGPoint(x: 18, y: 27), radius: 1, startAngle: 0, endAngle: CGFloat(Double.pi*2), clockwise: true)
checkmarkShapePath.close()
UIColor.white.setFill()
checkmarkShapePath.fill()
}
UIColor.white.setStroke()
checkmarkShapePath.stroke()
}
class var imageOfCheckmark: UIImage {
if (Cache.imageOfCheckmark != nil) {
return Cache.imageOfCheckmark!
}
UIGraphicsBeginImageContextWithOptions(CGSize(width: 36, height: 36), false, 0)
SwiftNoticeSDK.draw(NoticeType.success)
Cache.imageOfCheckmark = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return Cache.imageOfCheckmark!
}
class var imageOfCross: UIImage {
if (Cache.imageOfCross != nil) {
return Cache.imageOfCross!
}
UIGraphicsBeginImageContextWithOptions(CGSize(width: 36, height: 36), false, 0)
SwiftNoticeSDK.draw(NoticeType.error)
Cache.imageOfCross = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return Cache.imageOfCross!
}
class var imageOfInfo: UIImage {
if (Cache.imageOfInfo != nil) {
return Cache.imageOfInfo!
}
UIGraphicsBeginImageContextWithOptions(CGSize(width: 36, height: 36), false, 0)
SwiftNoticeSDK.draw(NoticeType.info)
Cache.imageOfInfo = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return Cache.imageOfInfo!
}
}
extension UIWindow{
func hide(){
SwiftNotice.hideNotice(self)
}
}
fileprivate extension Selector {
static let hideNotice = #selector(SwiftNotice.hideNotice(_:))
}
@objc extension SwiftNotice {
// fix https://github.com/johnlui/SwiftNotice/issues/2
static func hideNotice(_ sender: AnyObject) {
if let window = sender as? UIWindow {
if let v = window.subviews.first {
UIView.animate(withDuration: 0.2, animations: {
if v.tag == sn_topBar {
v.frame = CGRect(x: 0, y: -v.frame.height, width: v.frame.width, height: v.frame.height)
}
v.alpha = 0
}, completion: { b in
if let index = windows.index(where: { (item) -> Bool in
return item == window
}) {
windows.remove(at: index)
}
})
}
}
}
}
......@@ -16,6 +16,14 @@
<string>Gelipay/geliPayInfo</string>
<key>获取格利支付账号绑定的手机号</key>
<string>Gelipay/getGelipayMobile</string>
<key>获取商店管理员验证手机号</key>
<string>Admin/getShopMobile</string>
<key>修改登录密码</key>
<string>Admin/changePwd</string>
<key>绑定、更换绑定格利支付账号</key>
<string>Admin/bindGeliPay</string>
<key>格利支付的跳转</key>
<string>Gelipay/locationGeliPay</string>
<key>商品列表</key>
<string>goods/goodsList</string>
</dict>
......
//
// AdminInfoModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//个人中心首页+账号信息
class AdminInfoModel: Mappable {
var code:Int?
var message : String?
var data : AdminInfoDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class AdminInfoDataModel: Mappable {
var shop_name : String? //商店名
var shop_img : String? //商店logo
var logo_word_img : String? //商店文字logo
var stall_name : String? //档口名
var company_name : String? //公司名
var user_name : String? //管理员账号
var admin_name : String? //管理员名称
var phone : String? //管理员手机号
required init?( map: Map) {
}
func mapping(map: Map) {
shop_name <- map["shop_name"]
shop_img <- map["shop_img"]
logo_word_img <- map["logo_word_img"]
stall_name <- map["stall_name"]
company_name <- map["company_name"]
user_name <- map["user_name"]
admin_name <- map["admin_name"]
phone <- map["phone"]
}
}
//
// GeliPayInfoModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//支付账号信息
class GeliPayInfoModel: Mappable {
var code:Int?
var message : String?
var data : GeliPayInfoDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class GeliPayInfoDataModel: Mappable {
var gelipay_username : String? //支付账号
var status : Int? //状态:1已绑定格利支付且格利支付已绑卡,2已绑定格利支付且格利支付未绑卡,3未绑定格利支付
required init?( map: Map) {
}
func mapping(map: Map) {
gelipay_username <- map["gelipay_username"]
status <- map["status"]
}
}
//
// GetGelipayMobileModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//获取格利支付账号绑定的手机号
class GetMobileModel: Mappable {
var code:Int?
var message : String?
var data : GetMobileDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class GetMobileDataModel: Mappable {
var mobile : String? //手机号
required init?( map: Map) {
}
func mapping(map: Map) {
mobile <- map["mobile"]
}
}
//
// GoodsListModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//商品列表
class GoodsListModel: Mappable {
var code:Int?
var message : String?
var data : GoodsListDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class GoodsListDataModel: Mappable {
var count : Int? //(筛选)商品总数
var goods_res : Array<GoodsResModel>? //商品数据
required init?( map: Map) {
}
func mapping(map: Map) {
count <- map["count"]
}
}
class GoodsResModel: Mappable {
var sales : String? //销量
var sku_id : Int? //规格
var goods_id : Int? //商品id
var goods_name : String? //商品名
var goods_thumb : String? //商品缩略图
var is_show : Int? //上、下架状态,0下架,1上架
var price : String? //价格
required init?( map: Map) {
}
func mapping(map: Map) {
sales <- map["sales"]
sku_id <- map["sku_id"]
goods_id <- map["goods_id"]
goods_name <- map["goods_name"]
goods_thumb <- map["goods_thumb"]
is_show <- map["is_show"]
price <- map["price"]
}
}
//
// Interface.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import Alamofire
//MARK:--登录
//params-key(user_name(用户名),pwd(密码))
func login(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("登录", params, { (rep:DataResponse<LoginModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--发送验证码
//params-key(phone(手机号),type( 验证类型,1注册,2修改密码,3登录,4格利商家绑定(修改绑定)格利支付,5格利支付绑定格利商家))
func sendSmsCaptcha(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("发送验证码", params, { (rep:DataResponse<UpDataModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--验证短信验证码
//params-key(phone(手机号),type(验证类型,需与发送时的类型一致),code(验证码))
func verifyMmsCaptcha(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("验证短信验证码", params, { (rep:DataResponse<UpDataModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--个人中心首页+账号信息
//params-key(user_token)
func adminInfo(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("个人中心首页+账号信息", params, { (rep:DataResponse<AdminInfoModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--商家信息
//params-key(user_token)
func shopInfo(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("商家信息", params, { (rep:DataResponse<ShopInfoModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--支付账号信息
//params-key(user_token)
func geliPayInfo(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("支付账号信息", params, { (rep:DataResponse<GeliPayInfoModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--获取格利支付账号绑定的手机号
//params-key(user_token,geli_pay_user(格利支付用户名))
func getGelipayMobile(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("获取格利支付账号绑定的手机号", params, { (rep:DataResponse<GetMobileModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--获取商店管理员验证手机号
//params-key(user_token)
func getShopMobile(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("获取商店管理员验证手机号", params, { (rep:DataResponse<GetMobileModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--修改登录密码
//params-key(user_token,pwd(当前用户密码(明文传输)),new_pwd(修改后的新密码(明文传输)))
func changePwd(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("修改登录密码", params, { (rep:DataResponse<UpDataModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--绑定、更换绑定格利支付账号
//params-key(user_token,geli_pay_user(需要绑定的格利支付账号))
func bindGeliPay(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("绑定、更换绑定格利支付账号", params, { (rep:DataResponse<UpDataModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--格利支付的跳转
//params-key(user_token,type(跳转类型:1登录,2设置支付密码))
func locationGeliPay(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("格利支付的跳转", params, { (rep:DataResponse<LocationGeliPayModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--商品列表
//params-key(user_token,keyword(关键字),sort(1时间降序,2时间升序,3销量降序,4销量升序),is_show(上、下架,0下架,1上架,2全部),page(第几页))
func goodsList(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("商品列表", params, { (rep:DataResponse<GoodsListModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//
// LocationGeliPayModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//格利支付的跳转
class LocationGeliPayModel: Mappable {
var code:Int?
var message : String?
var data : LocationGeliPayDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class LocationGeliPayDataModel: Mappable {
var url : String? //跳转的URL,有效期为15秒
required init?( map: Map) {
}
func mapping(map: Map) {
url <- map["url"]
}
}
......@@ -8,11 +8,11 @@
import Foundation
import ObjectMapper
//登录
class LoginModel: Mappable {
var code:Int?
var message : String?
var data : UserIdModel?
var data : LoginDataModel?
required init?( map: Map) {
......@@ -24,16 +24,13 @@ class LoginModel: Mappable {
}
}
class UserIdModel: Mappable {
var user_id : String?
var user_qrcode:String?
class LoginDataModel: Mappable {
var user_token : String? //返回token值,用于用户验证
required init?( map: Map) {
}
func mapping(map: Map) {
user_id <- map["user_id"]
user_qrcode <- map["user_qrcode"]
user_token <- map["user_token"]
}
}
//
// ShopInfoModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//商家信息
class ShopInfoModel: Mappable {
var code:Int?
var message : String?
var data : ShopInfoDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class ShopInfoDataModel: Mappable {
var shop_id : Int? //商店id
var shop_name : String? //商店名
var shop_img : String? //商店logo
var province : Int? //省份id
var city : Int? //城市ID
var district : Int? //街道ID
var address : String? //详细地址
var shop_tel : String? //联系方式
var shop_email : String? //邮件
var shop_intro : String? //公司简介
var shop_scale : String? //公司规模
var stall_name : String? //档口名称
var contacts_name : String? //联系人姓名
var contacts_phone : String? //联系人电话
var identity_card_front : String? //负责人身份证(正面)
var identity_card_back : String? //负责人身份证(反面)
var agreement : String? //商家入驻协议
var upload_status : Int?
var business_licence_number : String? //营业执照号
var business_sphere : String? //法定经营范围
var zhizhao : String? //营业执照电子版
var food_production_license : String? //流通许可证
var addr_str : String? //商家地址(省市区)拼接
required init?( map: Map) {
}
func mapping(map: Map) {
shop_id <- map["shop_id"]
shop_name <- map["shop_name"]
shop_img <- map["shop_img"]
province <- map["province"]
city <- map["city"]
district <- map["district"]
address <- map["address"]
shop_tel <- map["shop_tel"]
shop_email <- map["shop_email"]
shop_intro <- map["shop_intro"]
shop_scale <- map["shop_scale"]
stall_name <- map["stall_name"]
contacts_name <- map["contacts_name"]
contacts_phone <- map["contacts_phone"]
identity_card_front <- map["identity_card_front"]
identity_card_back <- map["identity_card_back"]
agreement <- map["agreement"]
upload_status <- map["upload_status"]
business_licence_number <- map["business_licence_number"]
business_sphere <- map["business_sphere"]
zhizhao <- map["zhizhao"]
food_production_license <- map["food_production_license"]
addr_str <- map["addr_str"]
}
}
//
// sendSmsCaptchaModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/23.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号
class UpDataModel: Mappable {
var code:Int?
var message : String?
var data : [String: Any]?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
......@@ -87,6 +87,12 @@ class LoginViewController: BaseViewController {
// alertView.tishiLbl.text = "202121";
// alertView.titileLbl.text = "是否确认取消订单?"
// self.view.window?.addSubview(alertView)
//MARK:--登录接口样式
login(["user_name":"zxpf","pwd":"123456"], success: { (data) in
let dataM = data as! LoginModel
print("data=\(dataM.data?.user_token)")
}) { (error) in
print("error=\(error)")
}
}
}
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