Commit 99291443 authored by Alex朱枝文's avatar Alex朱枝文

首页UI调整

parent cdb17ebe
...@@ -15,9 +15,13 @@ class YHButlerServiceManager: NSObject { ...@@ -15,9 +15,13 @@ class YHButlerServiceManager: NSObject {
private weak var conversationManager = QYSDK.shared().conversationManager() private weak var conversationManager = QYSDK.shared().conversationManager()
// customerHeadImageUrl // 调整UI
private weak var customUIConfig = QYSDK.shared().customUIConfig() private weak var customUIConfig = QYSDK.shared().customUIConfig()
// 增加事件
private weak var customActionConfig = QYSDK.shared().customActionConfig()
private lazy var getUserInfoViewModel: YHButlerServiceViewModel = YHButlerServiceViewModel() private lazy var getUserInfoViewModel: YHButlerServiceViewModel = YHButlerServiceViewModel()
var lastMessage: YHButlerServiceMessage? var lastMessage: YHButlerServiceMessage?
...@@ -40,6 +44,8 @@ class YHButlerServiceManager: NSObject { ...@@ -40,6 +44,8 @@ class YHButlerServiceManager: NSObject {
let qyOption = QYSDKOption(appKey: YhConstant.QiYuSDK.appKey) let qyOption = QYSDKOption(appKey: YhConstant.QiYuSDK.appKey)
qyOption.appName = YhConstant.QiYuSDK.appName qyOption.appName = YhConstant.QiYuSDK.appName
QYSDK.shared().register(with: qyOption) QYSDK.shared().register(with: qyOption)
//setupCustomAction()
/* /*
QYSDK.shared().registerPushMessageNotification { pushMessage in QYSDK.shared().registerPushMessageNotification { pushMessage in
os_log("#####registerPushMessageNotification %@ %ld %f", (pushMessage?.text ?? ""), (pushMessage?.type.rawValue ?? 0), (pushMessage?.time ?? 0)) os_log("#####registerPushMessageNotification %@ %ld %f", (pushMessage?.text ?? ""), (pushMessage?.type.rawValue ?? 0), (pushMessage?.time ?? 0))
...@@ -130,6 +136,7 @@ extension YHButlerServiceManager { ...@@ -130,6 +136,7 @@ extension YHButlerServiceManager {
return return
} }
initSDKAccountAndLastMessage() initSDKAccountAndLastMessage()
NotificationCenter.default.post(name: YhConstant.YhNotification.didQiYuAccountUpdateNotification, object: nil)
} }
@objc private func logoutSuccess() { @objc private func logoutSuccess() {
...@@ -142,7 +149,7 @@ extension YHButlerServiceManager { ...@@ -142,7 +149,7 @@ extension YHButlerServiceManager {
} }
*/ */
logoutCurrentUser { _ in logoutCurrentUser { _ in
// NotificationCenter.default.post(name: YhConstant.YhNotification.didQiYuAccountUpdateNotification, object: nil)
} }
} }
...@@ -200,6 +207,14 @@ extension YHButlerServiceManager { ...@@ -200,6 +207,14 @@ extension YHButlerServiceManager {
completion(flag) completion(flag)
} }
} }
private func setupCustomAction() {
customActionConfig?.linkClickBlock = { linkAddress in
//
return QYLinkClickActionPolicy.open
}
}
} }
extension YHButlerServiceManager { extension YHButlerServiceManager {
......
...@@ -310,7 +310,7 @@ private extension YHHomePageViewController { ...@@ -310,7 +310,7 @@ private extension YHHomePageViewController {
} }
} }
@objc func didQiYuReceiveNewMsg() { @objc func needUpdateYinheManager() {
if !isTopMostAndVisible { if !isTopMostAndVisible {
// 需要回到页面再刷新已读,因为不在当前页 // 需要回到页面再刷新已读,因为不在当前页
self.needUpdateMgrItem = true self.needUpdateMgrItem = true
...@@ -319,11 +319,15 @@ private extension YHHomePageViewController { ...@@ -319,11 +319,15 @@ private extension YHHomePageViewController {
} }
} }
@objc func didQiYuReceiveNewMsg() {
needUpdateYinheManager()
}
@objc func didRevUatParam() { @objc func didRevUatParam() {
guard serviceCenterMainReqVM.arrContactList.count > 0 else { guard serviceCenterMainReqVM.arrContactList.count > 0 else {
return return
} }
updateMgrItem() needUpdateYinheManager()
} }
func setupNotification() { func setupNotification() {
...@@ -331,6 +335,8 @@ private extension YHHomePageViewController { ...@@ -331,6 +335,8 @@ private extension YHHomePageViewController {
// NotificationCenter.default.addObserver(self, selector: #selector(didQiYuReceiveNewMsg), name: YhConstant.YhNotification.didQiYuReceiveNewMsgNotification, object: nil) // NotificationCenter.default.addObserver(self, selector: #selector(didQiYuReceiveNewMsg), name: YhConstant.YhNotification.didQiYuReceiveNewMsgNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didQiYuReceiveNewMsg), name: YhConstant.YhNotification.didQiYuUnReadMsgCountChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(didQiYuReceiveNewMsg), name: YhConstant.YhNotification.didQiYuUnReadMsgCountChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didRevUatParam), name: YhConstant.YhNotification.didRevUatParam, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(didRevUatParam), name: YhConstant.YhNotification.didRevUatParam, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(needUpdateYinheManager), name: YhConstant.YhNotification.didQiYuAccountUpdateNotification, object: nil)
} }
} }
......
...@@ -29,9 +29,9 @@ enum YHOrderTipsViewStyleType: Int { ...@@ -29,9 +29,9 @@ enum YHOrderTipsViewStyleType: Int {
class YHOrderTipsView: UIView { class YHOrderTipsView: UIView {
fileprivate static let viewH : CGFloat = 91.0 fileprivate static let viewH : CGFloat = 84.0
fileprivate static let viewH2 : CGFloat = 162.0 fileprivate static let viewH2 : CGFloat = 154.0
fileprivate static let viewH3 : CGFloat = 226.0 fileprivate static let viewH3 : CGFloat = 218.0
private var orderTipsViewStyle: YHOrderTipsViewStyleType = .none { private var orderTipsViewStyle: YHOrderTipsViewStyleType = .none {
didSet { didSet {
...@@ -51,9 +51,6 @@ class YHOrderTipsView: UIView { ...@@ -51,9 +51,6 @@ class YHOrderTipsView: UIView {
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
setupUI() setupUI()
let tap : UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapButton(gestureRecognizer:)))
addGestureRecognizer(tap)
} }
var dataModelForBasicInfo : YHSignerInfoModel? { var dataModelForBasicInfo : YHSignerInfoModel? {
...@@ -89,13 +86,6 @@ class YHOrderTipsView: UIView { ...@@ -89,13 +86,6 @@ class YHOrderTipsView: UIView {
return imgV return imgV
}() }()
lazy var topImageV: UIImageView = {
let imgV : UIImageView = UIImageView()
imgV.contentMode = .scaleAspectFill
imgV.image = UIImage(named: "home_order_tips_top_bkg")
return imgV
}()
lazy var iconImageV: UIImageView = { lazy var iconImageV: UIImageView = {
let imgV : UIImageView = UIImageView() let imgV : UIImageView = UIImageView()
imgV.contentMode = .scaleAspectFill imgV.contentMode = .scaleAspectFill
...@@ -107,59 +97,26 @@ class YHOrderTipsView: UIView { ...@@ -107,59 +97,26 @@ class YHOrderTipsView: UIView {
override func layoutSubviews() { override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
bkgImageV.snp.makeConstraints { make in bkgImageV.snp.remakeConstraints { make in
make.edges.equalToSuperview() make.edges.equalToSuperview()
} }
} }
//智能助理 //智能助理
lazy var lableTip: UILabel = { lazy var lableTip: UILabel = {
let lable : UILabel = UILabel() let label : UILabel = UILabel()
return lable label.text = "银河管家"
}() label.font = UIFont.PFSC_B(ofSize: 15)
label.textColor = UIColor.mainTextColor
//我的订单 return label
lazy var lableMyOrder: UILabel = {
let lable : UILabel = UILabel()
lable.text = "我的订单"
lable.font = UIFont.PFSC_R(ofSize: 13)
lable.textColor = UIColor.yhGreyColor
return lable
}()
//右箭头
lazy var rightIconImageV: UIImageView = {
let imgV : UIImageView = UIImageView()
imgV.contentMode = .scaleAspectFill
imgV.image = UIImage(named: "home_order_tips_right_arrow")
return imgV
}()
//上午好!张先生
lazy var lableName: UILabel = {
let lable : UILabel = UILabel()
lable.text = "上午好!张先生"
lable.font = UIFont.PFSC_R(ofSize: 12)
lable.textColor = UIColor.mainTextColor50
return lable
}()
//分割线
lazy var segmentationView: UIView = {
let view : UIView = UIView()
view.backgroundColor = UIColor.mainTextColor18
return view
}() }()
//银河港生活陪伴您的第190天 background: #94A3B8;
//银河港生活陪伴您的第190天
lazy var lableDays: UILabel = { lazy var lableDays: UILabel = {
let lable : UILabel = UILabel() let lable : UILabel = UILabel()
lable.text = "银河港生活陪伴您的第190天" lable.text = "银河港生活陪伴您的第190天"
lable.font = UIFont.PFSC_R(ofSize: 12) lable.font = UIFont.PFSC_R(ofSize: 12)
lable.textColor = UIColor.mainTextColor50 lable.textColor = UIColor.yhGreyColor
return lable return lable
}() }()
...@@ -199,9 +156,7 @@ private extension YHOrderTipsView { ...@@ -199,9 +156,7 @@ private extension YHOrderTipsView {
guard let model = dataModelForBasicInfo else { guard let model = dataModelForBasicInfo else {
return return
} }
lableName.text = timeName() + "好," + model.name + model.sex.sexDescribe()
let now = Date() let now = Date()
let timestamp = now.timeIntervalSince1970 let timestamp = now.timeIntervalSince1970
print("当前时间戳:\(timestamp)") print("当前时间戳:\(timestamp)")
...@@ -238,55 +193,55 @@ private extension YHOrderTipsView { ...@@ -238,55 +193,55 @@ private extension YHOrderTipsView {
} else { } else {
orderTipsViewStyle = .none orderTipsViewStyle = .none
} }
layoutIfNeeded()
} }
private func updateItemsStyle() { private func updateItemsStyle() {
switch orderTipsViewStyle { switch orderTipsViewStyle {
case .none: case .none:
mgrItem.snp.remakeConstraints { make in mgrItem.snp.remakeConstraints { make in
make.top.equalTo(lableName.snp.bottom).offset(20) make.top.equalTo(iconImageV.snp.bottom).offset(18)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.width.height.equalTo(0) make.width.height.equalTo(0)
} }
firstItem.snp.remakeConstraints { make in firstItem.snp.remakeConstraints { make in
make.top.equalTo(mgrItem.snp.bottom).offset(20) make.top.equalTo(mgrItem.snp.bottom).offset(12)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.width.height.equalTo(0) make.width.height.equalTo(0)
} }
case .onlyMgr: case .onlyMgr:
mgrItem.snp.remakeConstraints { make in mgrItem.snp.remakeConstraints { make in
make.top.equalTo(lableName.snp.bottom).offset(20) make.top.equalTo(iconImageV.snp.bottom).offset(18)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.right.equalTo(-kMargin) make.right.equalTo(-kMargin)
make.height.equalTo(YHGalaxyManagerTipsItemView.viewH) make.height.equalTo(YHGalaxyManagerTipsItemView.viewH)
} }
firstItem.snp.remakeConstraints { make in firstItem.snp.remakeConstraints { make in
make.top.equalTo(mgrItem.snp.bottom).offset(20) make.top.equalTo(mgrItem.snp.bottom).offset(12)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.width.height.equalTo(0) make.width.height.equalTo(0)
} }
case .onlyOneOrder: case .onlyOneOrder:
mgrItem.snp.makeConstraints { make in mgrItem.snp.makeConstraints { make in
make.top.equalTo(lableName.snp.bottom).offset(20) make.top.equalTo(iconImageV.snp.bottom).offset(18)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.width.height.equalTo(0) make.width.height.equalTo(0)
} }
firstItem.snp.remakeConstraints { make in firstItem.snp.remakeConstraints { make in
make.top.equalTo(lableName.snp.bottom).offset(20) make.top.equalTo(iconImageV.snp.bottom).offset(18)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.right.equalTo(-kMargin) make.right.equalTo(-kMargin)
make.height.equalTo(YHOrderTipsItemView.viewH) make.height.equalTo(YHOrderTipsItemView.viewH)
} }
case .mgrAndOrder: case .mgrAndOrder:
mgrItem.snp.remakeConstraints { make in mgrItem.snp.remakeConstraints { make in
make.top.equalTo(lableName.snp.bottom).offset(20) make.top.equalTo(iconImageV.snp.bottom).offset(18)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.right.equalTo(-kMargin) make.right.equalTo(-kMargin)
make.height.equalTo(YHGalaxyManagerTipsItemView.viewH) make.height.equalTo(YHGalaxyManagerTipsItemView.viewH)
} }
firstItem.snp.remakeConstraints { make in firstItem.snp.remakeConstraints { make in
make.top.equalTo(mgrItem.snp.bottom).offset(20) make.top.equalTo(mgrItem.snp.bottom).offset(12)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.right.equalTo(-kMargin) make.right.equalTo(-kMargin)
make.height.equalTo(YHOrderTipsItemView.viewH) make.height.equalTo(YHOrderTipsItemView.viewH)
...@@ -294,11 +249,6 @@ private extension YHOrderTipsView { ...@@ -294,11 +249,6 @@ private extension YHOrderTipsView {
} }
} }
@objc func tapButton(gestureRecognizer:UITapGestureRecognizer) {
goTabBarBy(tabType: .service)
}
func setupUI() { func setupUI() {
backgroundColor = UIColor.pageBkgColor backgroundColor = UIColor.pageBkgColor
...@@ -311,79 +261,26 @@ private extension YHOrderTipsView { ...@@ -311,79 +261,26 @@ private extension YHOrderTipsView {
make.height.equalTo(YHOrderTipsView.viewH) make.height.equalTo(YHOrderTipsView.viewH)
} }
addSubview(topImageV)
topImageV.snp.makeConstraints { make in
// 182 99
make.top.left.equalToSuperview()
make.width.equalTo(182)
make.height.equalTo(99)
}
//智能头像 //智能头像
addSubview(iconImageV) addSubview(iconImageV)
iconImageV.snp.makeConstraints { make in iconImageV.snp.makeConstraints { make in
make.top.equalTo(18) make.top.equalTo(20)
make.left.equalTo(kMargin) make.left.equalTo(kMargin)
make.width.height.equalTo(27) make.width.height.equalTo(44)
} }
addSubview(lableTip) addSubview(lableTip)
lableTip.snp.makeConstraints { make in lableTip.snp.makeConstraints { make in
make.centerY.equalTo(iconImageV) make.top.equalToSuperview().offset(21)
make.left.equalTo(iconImageV.snp.right).offset(6) make.left.equalTo(iconImageV.snp.right).offset(12)
} make.right.lessThanOrEqualToSuperview().offset(12)
let aa: ASAttributedString = .init("智能", .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("助理", .font(UIFont.PFSC_B(ofSize: 17)),.foreground(UIColor.mainTextColor))
lableTip.attributed.text = aa+bb
addSubview(rightIconImageV)
rightIconImageV.snp.makeConstraints { make in
make.right.equalTo(-20)
make.top.equalTo(23)
make.width.height.equalTo(12)
} }
addSubview(lableMyOrder)
lableMyOrder.snp.makeConstraints { make in
make.right.equalTo(rightIconImageV.snp.left)
make.centerY.equalTo(rightIconImageV)
make.height.equalTo(18)
}
addSubview(lableName)
lableName.snp.makeConstraints { make in
make.top.equalTo(iconImageV.snp.bottom).offset(9)
make.left.equalTo(iconImageV.snp.left)
make.height.equalTo(17)
}
addSubview(segmentationView)
segmentationView.snp.makeConstraints { make in
make.left.equalTo(lableName.snp.right).offset(8)
make.height.equalTo(10)
make.width.equalTo(1)
make.centerY.equalTo(lableName.snp.centerY)
}
addSubview(lableDays) addSubview(lableDays)
lableDays.snp.makeConstraints { make in lableDays.snp.makeConstraints { make in
make.left.equalTo(segmentationView.snp.right).offset(8) make.left.equalTo(lableTip.snp.left)
make.height.equalTo(17) make.height.equalTo(17)
make.centerY.equalTo(segmentationView.snp.centerY) make.top.equalTo(lableTip.snp.bottom).offset(4)
// make.right.equalTo(-kMargin)
} }
addSubview(mgrItem) addSubview(mgrItem)
......
...@@ -292,6 +292,9 @@ extension YhConstant { ...@@ -292,6 +292,9 @@ extension YhConstant {
// 七鱼未读消息数量变化 // 七鱼未读消息数量变化
public static let didQiYuUnReadMsgCountChangeNotification = Notification.Name(rawValue: "com.yinhe.qiyu.unReadMsgCountChange") public static let didQiYuUnReadMsgCountChangeNotification = Notification.Name(rawValue: "com.yinhe.qiyu.unReadMsgCountChange")
// 七鱼登录登出
public static let didQiYuAccountUpdateNotification = Notification.Name(rawValue: "com.yinhe.qiyu.accountUpdate")
//获取灰度参数 //获取灰度参数
public static let didRevUatParam = Notification.Name(rawValue: "com.yinhe.didRevUatParam") public static let didRevUatParam = Notification.Name(rawValue: "com.yinhe.didRevUatParam")
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "消息入口背景@2x.png", "filename" : "home_order_tips_bkg@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "消息入口背景@3x.png", "filename" : "home_order_tips_bkg@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "对话头像@2x.png", "filename" : "home_order_tips_icon@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "对话头像@3x.png", "filename" : "home_order_tips_icon@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Mask group@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Mask group@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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