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

完成极光业务推送

parent 7f18d5f1
......@@ -311,6 +311,7 @@
F905A7D8246CF82400E3A74D /* SwipeCellKit in Frameworks */ = {isa = PBXBuildFile; productRef = F905A7D7246CF82400E3A74D /* SwipeCellKit */; };
F9171EFC245128B200359C2B /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171EFB245128B200359C2B /* Interface.swift */; };
F9171F0224513C5B00359C2B /* UpDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9171F0124513C5B00359C2B /* UpDataModel.swift */; };
F9217E012485E6E800C4CF67 /* MessageListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9217E002485E6E800C4CF67 /* MessageListModel.swift */; };
F933C42E2484A66C0058940C /* WorkTestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933C42D2484A66C0058940C /* WorkTestModel.swift */; };
F933F6C02452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6AF2452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift */; };
F933F6C12452C68B00189561 /* PKHUDAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6B02452C68B00189561 /* PKHUDAnimation.swift */; };
......@@ -818,6 +819,7 @@
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>"; };
F9217E002485E6E800C4CF67 /* MessageListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListModel.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>"; };
F933F6B02452C68B00189561 /* PKHUDAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDAnimation.swift; sourceTree = "<group>"; };
......@@ -2227,6 +2229,7 @@
F950FDAA2451634B00C40530 /* LocationGeliPayModel.swift */,
F94A314624624E9500FEC38E /* GetGelipayInfoModel.swift */,
F94A314824624FA400FEC38E /* ShopAdministratorInfoModel.swift */,
F9217E002485E6E800C4CF67 /* MessageListModel.swift */,
);
path = PersonCenterModel;
sourceTree = "<group>";
......@@ -2959,6 +2962,7 @@
F9023F692449A50900DD5A63 /* TitleContentCell.swift in Sources */,
F95A9ED8245520E500867849 /* OrderListVC.swift in Sources */,
E03549A8245820C2008BD021 /* PiCiXuanZeCell.swift in Sources */,
F9217E012485E6E800C4CF67 /* MessageListModel.swift in Sources */,
F956D59E246A2D9C003FF510 /* LMNTextStorage+Export.m in Sources */,
E0337EF12464F69000952EF4 /* YingFuZKListViewController.swift in Sources */,
E099B588246BF8FA009F587F /* OrderDViewController.swift in Sources */,
......
This diff is collapsed.
......@@ -37,8 +37,8 @@ class BaseViewController: UIViewController ,NavBarViewDelegate{
self.view.backgroundColor = UIColor(named: "app底色")
footerMJ.setTitle("暂无内容", for: .noMoreData)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
......
......@@ -128,6 +128,9 @@ extension NetworkRequest {
delay(1.5) {
UserDefaults.standard.removeObject(forKey: "user_token")
NotificationCenter.default.post(name: Notification.Name(rawValue: "logout"), object: nil)
JPUSHService.deleteAlias({ (resCode, alias, num) in
}, seq: 1433223)
}
}else if json["code"].intValue == 11 {
HUD.flash(.label(json["message"].stringValue), delay: 1.5)
......
......@@ -126,5 +126,7 @@
<string>Warehouse/OutGoodsDetail</string>
<key>手机号登录</key>
<string>Passport/mobileLogin</string>
<key>消息列表</key>
<string>Admin/messageList</string>
</dict>
</plist>
......@@ -163,7 +163,17 @@ func saveFile(image: UIImage,_ params:[String:Any],success:@escaping (_ res:Any)
//MARK:--手机号登
//params-key(mobile(手机号),auth_code(登录验证码(必须先发送验证码) ))
func mobileLogin(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("登录", params, { (rep:DataResponse<LoginModel>) in
NetworkRequest.sharedInstance.postRequest("手机号登录", params, { (rep:DataResponse<LoginModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--消息列表
//params-key(user_token)
func messageList(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("消息列表", params, { (rep:DataResponse<MessageListModel>) in
}, success: { (data) in
success(data)
}) { (error) in
......
//
// MessageListModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/6/2.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//消息列表
class MessageListModel: Mappable {
var code:Int?
var message : String?
var data : Array<MessageListDataModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class MessageListDataModel: Mappable {
var pm_id : Int? //消息id
var message : String? //消息内容
var create_time : Double? //时间
var shop_id : Int?
var title : String? //消息标题
required init?( map: Map) {
}
func mapping(map: Map) {
pm_id <- map["pm_id"]
message <- map["message"]
create_time <- map["create_time"]
shop_id <- map["shop_id"]
title <- map["title"]
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" 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"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......@@ -10,7 +11,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="120" id="KGk-i7-Jjw" customClass="MsgCenterCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="120" id="KGk-i7-Jjw" customClass="MsgCenterCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="120"/>
<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">
......@@ -24,7 +25,6 @@
<rect key="frame" x="220" y="18.5" width="110" height="11"/>
<constraints>
<constraint firstAttribute="height" constant="11" id="nxW-7d-8Z8"/>
<constraint firstAttribute="width" constant="110" id="ubi-9M-h88"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" name="灰色字体颜色"/>
......
......@@ -74,6 +74,13 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable
make.height.equalTo(20)
}
*/
NotificationCenter.default.addObserver(self, selector: #selector(jpushServiceNotification(notion:)), name: NSNotification.Name(rawValue: "jpushServiceNotification4"), object: nil)
}
//MARK:--jpushServiceNotification
@objc func jpushServiceNotification(notion:Notification) {
let vc = MsgCenterViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
//MARK: -方法
@IBAction func editAction(_ sender: Any) {
......@@ -89,9 +96,8 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable
//MARK:--跳转消息中心
@IBAction func toMsgCenterAction(_ sender: Any) {
print("跳转消息中心")
HUD.flash(.label("敬请期待"),delay: 1.2)
// let vc = MsgCenterViewController()
// self.navigationController?.pushViewController(vc, animated: true)
let vc = MsgCenterViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
//MARK: -Cell delegate方法
......
......@@ -44,8 +44,14 @@ class WarehoseMangementListVC: BaseViewController, UISearchBarDelegate, UITableV
footerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadMoreData))
self.tableV!.mj_footer = footerMJ
self.tableV?.mj_header?.beginRefreshing()
}
NotificationCenter.default.addObserver(self, selector: #selector(jpushServiceNotification(notion:)), name: NSNotification.Name(rawValue: "jpushServiceNotification3"), object: nil)
}
//MARK:--jpushServiceNotification
@objc func jpushServiceNotification(notion:Notification) {
let vc = MsgCenterViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
@objc func loadData(){
print("加载数据")
isUpData = true
......
......@@ -84,8 +84,14 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
footerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadMoreData))
self.collection!.mj_footer = footerMJ
self.collection?.mj_header?.beginRefreshing()
NotificationCenter.default.addObserver(self, selector: #selector(jpushServiceNotification(notion:)), name: NSNotification.Name(rawValue: "jpushServiceNotification1"), object: nil)
}
//MARK:--jpushServiceNotification
@objc func jpushServiceNotification(notion:Notification) {
let vc = MsgCenterViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
//MARK:--整理排序数据
func getSortData (){
for i in 0..<selectIndexArr.count{
......
......@@ -48,6 +48,13 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
override func viewDidLoad() {
super.viewDidLoad()
setTabv()
NotificationCenter.default.addObserver(self, selector: #selector(jpushServiceNotification(notion:)), name: NSNotification.Name(rawValue: "jpushServiceNotification2"), object: nil)
}
//MARK:--jpushServiceNotification
@objc func jpushServiceNotification(notion:Notification) {
let vc = MsgCenterViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
//MARK:--二维码方法
@IBAction func codeAction(_ sender: UIButton) {
......
......@@ -13,7 +13,7 @@ class MsgCenterViewController: BaseViewController,UITableViewDelegate,UITableVie
//MARK: -animateView
private let animations = AnimationType.from(direction: .bottom, offset: 150)
private let animations = [AnimationType.from(direction: .bottom, offset: 300*glscale)]
var msgTbv:UITableView?
......@@ -35,7 +35,66 @@ class MsgCenterViewController: BaseViewController,UITableViewDelegate,UITableVie
})
msgTbv?.register(UINib(nibName: "MsgCenterCell", bundle: nil), forCellReuseIdentifier: "MsgCenterCell")
//下拉刷新相关设置
headerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadData))
self.msgTbv!.mj_header = headerMJ
//上拉加载相关设置
footerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadMoreData))
self.msgTbv!.mj_footer = footerMJ
self.msgTbv?.mj_header?.beginRefreshing()
}
var dataModelArr:Array<MessageListDataModel> = []
var page = 1
//加载数据
@objc func loadData(){
page = 1
let UserToken = UserDefaults.standard.value(forKey: "user_token")
messageList(["page":page as Any,"user_token":UserToken as Any], success: { (data) in
let dataM = data as! MessageListModel
self.dataModelArr.removeAll()
dataM.data?.forEach({ (model) in
self.dataModelArr.append(model)
})
self.msgTbv?.reloadData()
self.page = 2
self.msgTbv?.mj_header?.endRefreshing()
self.msgTbv?.performBatchUpdates({
UIView.animate(views: self.msgTbv!.visibleCells,
animations: self.animations, completion: {
})
}, completion: nil)
if dataM.data?.count == 0 {
self.msgTbv?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.msgTbv?.mj_footer?.endRefreshing()
}
}) { (error) in
self.msgTbv?.mj_header?.endRefreshing()
}
}
//加载更多数据
@objc func loadMoreData() {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
messageList(["page":page as Any,"user_token":UserToken as Any], success: { (data) in
let dataM = data as! MessageListModel
if dataM.data?.count == 0 {
self.msgTbv?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.page += 1
dataM.data?.forEach({ (model) in
self.dataModelArr.append(model)
})
self.msgTbv?.reloadData()
self.msgTbv?.mj_footer?.endRefreshing()
}
}) { (error) in
self.msgTbv?.mj_footer?.endRefreshing()
}
}
......@@ -44,22 +103,28 @@ class MsgCenterViewController: BaseViewController,UITableViewDelegate,UITableVie
return 120
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
return self.dataModelArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MsgCenterCell") as! MsgCenterCell
if cell.isShow == false {//未显示
cell.titleLbl.showSkeleton(transition: .crossDissolve(0.25))
cell.dateLbl.showSkeleton(transition: .crossDissolve(0.25))
cell.contentLbl.showSkeleton(transition: .crossDissolve(0.25))
DispatchQueue.main.asyncAfter(deadline: .now() + 0.33) {
cell.isShow = true//已显示
cell.titleLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25))
cell.dateLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25))
cell.contentLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25))
}
}
// if cell.isShow == false {//未显示
// cell.titleLbl.showSkeleton(transition: .crossDissolve(0.25))
// cell.dateLbl.showSkeleton(transition: .crossDissolve(0.25))
// cell.contentLbl.showSkeleton(transition: .crossDissolve(0.25))
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.33) {
// cell.isShow = true//已显示
// cell.titleLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25))
// cell.dateLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25))
// cell.contentLbl.hideSkeleton(reloadDataAfter: true, transition: .crossDissolve(0.25))
// }
// }
let rowModel = self.dataModelArr[indexPath.row]
cell.titleLbl.text = rowModel.title
cell.dateLbl.text = TimeByDouble(sender: rowModel.create_time!)
cell.contentLbl.text = rowModel.message
return cell
}
......
......@@ -201,9 +201,9 @@ class LoginViewController: BaseViewController, CodeViewDelegate,GeliAlertViewDel
self.loginBtn.isLoading = false
self.delegate?.successLogin()
// JPUSHService.setAlias(self.phoneTF.text, completion: { (resCode, alias, num) in
//
// }, seq: 1433223)
JPUSHService.setAlias(dataM.data?.user_token, completion: { (resCode, alias, num) in
}, seq: 1433223)
}) { (error) in
self.loginBtn.isLoading = false
}
......@@ -230,9 +230,10 @@ class LoginViewController: BaseViewController, CodeViewDelegate,GeliAlertViewDel
self.loginBtn.isLoading = false
self.delegate?.successLogin()
// JPUSHService.setAlias(self.phoneTF.text, completion: { (resCode, alias, num) in
//
// }, seq: 1433223)
JPUSHService.setAlias(dataM.data?.user_token, completion: { (resCode, alias, num) in
}, seq: 1433223)
}) { (error) in
self.loginBtn.isLoading = false
}
......
......@@ -68,6 +68,13 @@ class OrderListViewController: BaseViewController ,UISearchBarDelegate, SearchBa
//MARK:--添加个刷新通知
NotificationCenter.default.addObserver(self, selector: #selector(refreshingByOrderHavChange), name: NSNotification.Name(rawValue: "orderChange"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(jpushServiceNotification(notion:)), name: NSNotification.Name(rawValue: "jpushServiceNotification0"), object: nil)
}
//MARK:--jpushServiceNotification
@objc func jpushServiceNotification(notion:Notification) {
let vc = MsgCenterViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
@objc func refreshingByOrderHavChange(){
viewControllers.forEach { (vc) in
......
......@@ -53,9 +53,10 @@ class AccountViewController: BaseViewController{
print("退出登录")
//模拟退出登录
UserDefaults.standard.removeObject(forKey: "user_token")
// UserDefaults.standard.synchronize()
NotificationCenter.default.post(name: Notification.Name(rawValue: "logout"), object: nil)
JPUSHService.deleteAlias({ (resCode, alias, num) in
}, seq: 1433223)
}
}
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