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

首页UI调整

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