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

Merge branch 'revert-d0d5ed91' into 'main'

Revert "Merge branch 'dev_1013' into 'main'"

See merge request !28
parents d0d5ed91 309ab19c
...@@ -254,8 +254,7 @@ NSString *const TUILogoutFailNotification = @"TUILogoutFailNotification"; ...@@ -254,8 +254,7 @@ NSString *const TUILogoutFailNotification = @"TUILogoutFailNotification";
[NSNotificationCenter.defaultCenter postNotificationName:TUILoginSuccessNotification object:nil]; [NSNotificationCenter.defaultCenter postNotificationName:TUILoginSuccessNotification object:nil];
} }
fail:^(int code, NSString *desc) { fail:^(int code, NSString *desc) {
__strong __typeof(weakSelf) strongSelf = weakSelf; self.loginWithInit = NO;
strongSelf.loginWithInit = NO;
if (fail) { if (fail) {
fail(code, desc); fail(code, desc);
} }
......
...@@ -48,11 +48,10 @@ platform :ios do ...@@ -48,11 +48,10 @@ platform :ios do
kjzf = "kjzf" kjzf = "kjzf"
develop_fix_adopter = "develop_fix_adopter" develop_fix_adopter = "develop_fix_adopter"
txim_add_card = "txim_add_card" txim_add_card = "txim_add_card"
dev_1013 = "dev_1013"
#打包正使用的分支 #打包正使用的分支
myPack_branch = dev_1013 myPack_branch = txim_add_card
# 打adhoc包 执行命令 fastlane galaxyTest # 打adhoc包 执行命令 fastlane galaxyTest
......
This diff is collapsed.
...@@ -276,33 +276,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -276,33 +276,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
vc.url = tUrl vc.url = tUrl
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
} }
} else if iType == 10 {
// 多主体订单二维码跳转
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
if !YHLoginManager.shared.isLogin() {
printLog("需要登录")
return
}
// - 获取它对应的参数
if let orderId = arrItems["orderId"] as? String, !orderId.isEmpty {
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/order/detail?id=\(orderId)"
if YHLoginManager.shared.isLogin() {
let token = YHLoginManager.shared.h5Token
url = url + "&param=" + token
}
var tUrl = url
if !url.contains("navigationH=") {
tUrl = url + "?navigationH=\(k_Height_NavigationtBarAndStatuBar)"
if url.contains("?") {
tUrl = url + "&navigationH=\(k_Height_NavigationtBarAndStatuBar)"
}
}
let vc = YHH5WebViewVC()
vc.url = tUrl
vc.isHideNavigationBar = false
UIViewController.current?.navigationController?.pushViewController(vc, animated: true)
}
}
} else { } else {
printLog("未处理的类型 \(iType)") printLog("未处理的类型 \(iType)")
} }
......
...@@ -39,7 +39,7 @@ class YHNavigationController: UINavigationController { ...@@ -39,7 +39,7 @@ class YHNavigationController: UINavigationController {
if let lastVC = viewControllers.last { if let lastVC = viewControllers.last {
let className = String(describing: type(of: lastVC)) let className = String(describing: type(of: lastVC))
if !className.hasPrefix("TUI") { // 模糊匹配类名,使得腾讯IM页面不用隐藏NavigationBar if !className.hasPrefix("TUI") { // 模糊匹配类名,使得腾讯IM页面不用隐藏NavigationBar
var needAnimated = animated var needAnimated = false
let lastSecondCount = viewControllers.count - 2 let lastSecondCount = viewControllers.count - 2
if lastSecondCount >= 0 { if lastSecondCount >= 0 {
let lastSecondVC = viewControllers[lastSecondCount] let lastSecondVC = viewControllers[lastSecondCount]
......
// YHIMMessageHandler.swift
import UIKit
import SafariServices
import TUIConversation
import TUIChat
import IQKeyboardManagerSwift
class YHIMMessageHandler: NSObject {
weak var viewController: UIViewController?
weak var navigationController: UINavigationController?
private lazy var previewFileTool: YHFilePreviewTool = {
guard let vc = viewController else { fatalError("ViewController不能为空") }
return YHFilePreviewTool(targetVC: vc)
}()
init(viewController: UIViewController,
navigationController: UINavigationController?) {
self.viewController = viewController
self.navigationController = navigationController
super.init()
}
}
// MARK: - TUIYHCustomCellClickDelegate
extension YHIMMessageHandler: TUIYHCustomCellClickDelegate {
func didTap(inFileCell cellData: TUIFileMessageCellData) {
var isExist: ObjCBool = false
let path = cellData.getFilePath(&isExist)
if isExist.boolValue {
let url = URL(fileURLWithPath: path)
previewFileTool.openXLSXFile(at: url, fileName: cellData.fileName)
} else {
cellData.downloadFile()
}
}
func didTapCustomOrderCell(_ cellData: TUIOrderCellData) {
let linkAddress = cellData.link ?? ""
// 处理普通URL
if linkAddress.count > 0,
linkAddress.isValidHttpUrl || linkAddress.isValidHttpsUrl || linkAddress.isValidFileUrl,
let url = URL(string: linkAddress) {
showSafari(url: url)
return
}
// 处理自定义消息
handleCustomMessage(linkAddress)
}
private func handleCustomMessage(_ content: String?) {
guard let dicData = content,
!dicData.isEmpty,
let data = dicData.data(using: .utf8),
let jsonObject = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
!jsonObject.isEmpty else {
printLog("消息解析失败")
return
}
let msgType = jsonObject["msg_type"] as? String ?? ""
let navH5Url = jsonObject["nav_h5_url"] as? String ?? ""
let orderID = jsonObject["order_id"] as? Int ?? -1
let type = jsonObject["type"] as? Int ?? -1
let batchId = jsonObject["batch_id"] as? Int ?? 0
if msgType == "card_msg", navH5Url.count > 0 {
let title = jsonObject["title"] as? String ?? ""
showH5Page(baseUrl: navH5Url, title: title)
} else if orderID > -1, type > -1 {
showOrderMessage(type: type, orderId: orderID, batchId: batchId)
}
}
}
// MARK: - 公开方法
extension YHIMMessageHandler {
/// 处理IM消息点击
/// - Parameter conversationData: 会话数据
@MainActor func handleIMMessageTap(conversationData: TUIConversationCellData) {
updateNavigateBarBeforeEnterChatVC()
let params: [String: Any] = [
TUICore_TUIChatObjectFactory_ChatViewController_Title: conversationData.title,
TUICore_TUIChatObjectFactory_ChatViewController_UserID: conversationData.userID,
TUICore_TUIChatObjectFactory_ChatViewController_GroupID: conversationData.groupID,
TUICore_TUIChatObjectFactory_ChatViewController_AvatarImage: conversationData.avatarImage,
TUICore_TUIChatObjectFactory_ChatViewController_AvatarUrl: conversationData.faceUrl,
TUICore_TUIChatObjectFactory_ChatViewController_ConversationID: conversationData.conversationID,
TUICore_TUIChatObjectFactory_ChatViewController_AtTipsStr: conversationData.atTipsStr,
TUICore_TUIChatObjectFactory_ChatViewController_AtMsgSeqs: conversationData.atMsgSeqs,
TUICore_TUIChatObjectFactory_ChatViewController_Draft: conversationData.draftText
]
pushToChatViewController(with: params)
}
/// 处理远程通知
/// - Parameter userInfo: 通知数据
@MainActor func handleRemoteNotification(_ userInfo: [AnyHashable: Any]) {
let extString = userInfo["ext"] as? String ?? "{}"
let extData = extString.data(using: .utf8) ?? Data()
let ext = (try? JSONSerialization.jsonObject(with: extData, options: [])) as? [String: Any] ?? [:]
let entity = ext["entity"] as? [String: Any] ?? [:]
let chatType = entity["chatType"] as? Int ?? 0
let senderID = entity["sender"] as? String ?? ""
let nickName = entity["nickname"] as? String ?? ""
let aps = userInfo["aps"] as? [String: Any] ?? [:]
let alert = aps["alert"] as? [String: Any] ?? [:]
let title = alert["title"] as? String ?? nickName
guard senderID.count > 0 else { return }
updateNavigateBarBeforeEnterChatVC()
var param: [String: Any] = [
TUICore_TUIChatObjectFactory_ChatViewController_Title: title,
TUICore_TUIChatObjectFactory_ChatViewController_AvatarUrl: "",
TUICore_TUIChatObjectFactory_ChatViewController_AtTipsStr: "",
TUICore_TUIChatObjectFactory_ChatViewController_AtMsgSeqs: [],
TUICore_TUIChatObjectFactory_ChatViewController_Draft: ""
]
if chatType == 2 { // 群聊
param[TUICore_TUIChatObjectFactory_ChatViewController_GroupID] = senderID
param[TUICore_TUIChatObjectFactory_ChatViewController_ConversationID] = "group_\(senderID)"
} else { // 单聊
param[TUICore_TUIChatObjectFactory_ChatViewController_UserID] = senderID
param[TUICore_TUIChatObjectFactory_ChatViewController_ConversationID] = "c2c_\(senderID)"
}
pushToChatViewController(with: param)
}
@MainActor func gotoChatVC(senderID: String, isGroupChat: Bool = false) {
guard senderID.count > 0 else { return }
updateNavigateBarBeforeEnterChatVC()
var param: [String: Any] = [
TUICore_TUIChatObjectFactory_ChatViewController_Title: "",
TUICore_TUIChatObjectFactory_ChatViewController_AvatarUrl: "",
TUICore_TUIChatObjectFactory_ChatViewController_AtTipsStr: "",
TUICore_TUIChatObjectFactory_ChatViewController_AtMsgSeqs: [],
TUICore_TUIChatObjectFactory_ChatViewController_Draft: ""
]
if isGroupChat { // 群聊
param[TUICore_TUIChatObjectFactory_ChatViewController_GroupID] = senderID
param[TUICore_TUIChatObjectFactory_ChatViewController_ConversationID] = "group_\(senderID)"
} else { // 单聊
param[TUICore_TUIChatObjectFactory_ChatViewController_UserID] = senderID
param[TUICore_TUIChatObjectFactory_ChatViewController_ConversationID] = "c2c_\(senderID)"
}
pushToChatViewController(with: param)
}
}
// MARK: - 私有方法
extension YHIMMessageHandler {
/// 跳转到聊天页面(统一方法)
private func pushToChatViewController(with params: [String: Any]) {
let vc = navigationController?.push(
TUICore_TUIChatObjectFactory_ChatViewController_Classic,
param: params,
forResult: nil
)
if let chatVC = vc as? TUIBaseChatViewController {
chatVC.navigationItem.rightBarButtonItem = nil
chatVC.navigationItem.rightBarButtonItems = nil
chatVC.yhCustomCellClickDelegate = self
}
}
/// 更新导航栏配置
@MainActor private func updateNavigateBarBeforeEnterChatVC() {
IQKeyboardManager.shared.isEnabled = false
navigationController?.gk_hideNavigationBar = false
navigationController?.isNavigationBarHidden = false
let appearance = UINavigationBarAppearance()
appearance.backgroundColor = .white
appearance.shadowImage = UIImage()
appearance.shadowColor = .clear
navigationController?.navigationBar.tintColor = .black
navigationController?.navigationBar.standardAppearance = appearance
navigationController?.navigationBar.scrollEdgeAppearance = appearance
}
/// 显示Safari浏览器
private func showSafari(url: URL) {
let safariVC = SFSafariViewController(url: url)
safariVC.dismissButtonStyle = .close
safariVC.modalPresentationStyle = .fullScreen
viewController?.present(safariVC, animated: true)
}
/// 显示H5页面(带Token)
private func showH5Page(baseUrl: String, title: String) {
var finalUrl = baseUrl
if YHLoginManager.shared.isLogin() {
let token = YHLoginManager.shared.h5Token
let separator = baseUrl.contains("?") ? "&" : "?"
finalUrl = baseUrl + separator + "param=" + token
}
let webVC = YHH5WebViewVC()
webVC.isFullScreenFlag = false
webVC.navTitle = title
webVC.url = finalUrl
navigationController?.pushViewController(webVC)
}
/// 显示订单消息页面
private func showOrderMessage(type: Int, orderId: Int, batchId: Int) {
YHServiceOrderListViewController.jumpToMessageController(
type: type,
orderId: orderId,
batchId
)
}
}
...@@ -126,23 +126,8 @@ class YHActivityListViewController: YHBaseViewController { ...@@ -126,23 +126,8 @@ class YHActivityListViewController: YHBaseViewController {
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell") tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHActivityListCell.self, forCellReuseIdentifier: YHActivityListCell.cellReuseIdentifier) tableView.register(YHActivityListCell.self, forCellReuseIdentifier: YHActivityListCell.cellReuseIdentifier)
tableView.backgroundView = self.emptyDataTipsView tableView.backgroundView = self.emptyDataTipsView
tableView.tableHeaderView = self.headerView
return tableView return tableView
}() }()
lazy var headerView: UIView = {
let radio = 88.0/335.0
let imgWidth = KScreenWidth - 20.0 * 2
let imgHeight = imgWidth * radio
var height = imgHeight + 16.0
let view = UIView(frame: CGRect(x: 20, y: 0, width: imgWidth, height: height))
let imgV = UIImageView(frame: CGRect(x: 0, y: 16, width: imgWidth, height: imgHeight))
imgV.image = UIImage(named: "activity_header_img")
view.addSubview(imgV)
let tap = UITapGestureRecognizer(target: self, action: #selector(didHeaderClicked))
view.addGestureRecognizer(tap)
return view
}()
lazy var emptyDataTipsView: YHEmptyDataView = { lazy var emptyDataTipsView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("暂无活动", kEmptyCommonBgName) let view = YHEmptyDataView.createView("暂无活动", kEmptyCommonBgName)
...@@ -150,13 +135,6 @@ class YHActivityListViewController: YHBaseViewController { ...@@ -150,13 +135,6 @@ class YHActivityListViewController: YHBaseViewController {
view.isHidden = true view.isHidden = true
return view return view
}() }()
lazy var messageHandler: YHIMMessageHandler = {
return YHIMMessageHandler(
viewController: self,
navigationController: navigationController
)
}()
// MARK: - 生命周期方法 // MARK: - 生命周期方法
...@@ -207,26 +185,6 @@ class YHActivityListViewController: YHBaseViewController { ...@@ -207,26 +185,6 @@ class YHActivityListViewController: YHBaseViewController {
} }
extension YHActivityListViewController { extension YHActivityListViewController {
@objc func didHeaderClicked() {
YHGrayCommonAlertView.show("联系银河管家", "银河可为您组织线下活动,快来与我们聊聊您的需求吧~", "取消", "前往联系", fullGuestureEnable: false) {
} callBack: { [weak self] in
guard let self = self else {
return
}
YHHUD.show(.progress(message: "加载中..."))
self.viewModel.getActiticyYhId { id in
YHHUD.hide()
if id.isEmpty {
YHHUD.flash(message: "获取银河ID失败")
return
}
self.messageHandler.gotoChatVC(senderID: id)
}
}
}
func loadMoreData() { func loadMoreData() {
viewModel.getActivityList(firstFlag: false, type: type) { [weak self] _, _ in viewModel.getActivityList(firstFlag: false, type: type) { [weak self] _, _ in
guard let self = self else { return } guard let self = self else { return }
...@@ -342,11 +300,20 @@ extension YHActivityListViewController: UITableViewDelegate, UITableViewDataSour ...@@ -342,11 +300,20 @@ extension YHActivityListViewController: UITableViewDelegate, UITableViewDataSour
} }
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 20.0 var height: CGFloat = 16.0
if section != 0 {
height = 20.0
}
return height
} }
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth - 16.0 * 2, height: 20)) var height: CGFloat = 16.0
if section != 0 {
height = 20.0
}
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth - 16.0 * 2, height: height))
view.backgroundColor = .clear view.backgroundColor = .clear
return view return view
} }
......
...@@ -19,13 +19,6 @@ class YHActivityHelpModel: SmartCodable { ...@@ -19,13 +19,6 @@ class YHActivityHelpModel: SmartCodable {
} }
} }
class ActiticyIdModel: SmartCodable {
var yh_id: String = ""
required init() {
}
}
class YHActivityViewModel: YHBaseViewModel { class YHActivityViewModel: YHBaseViewModel {
// 1、活动列表 、 我的报名活动列表 // 1、活动列表 、 我的报名活动列表
var hasMoreForActivityList: Bool = true var hasMoreForActivityList: Bool = true
...@@ -265,22 +258,4 @@ extension YHActivityViewModel { ...@@ -265,22 +258,4 @@ extension YHActivityViewModel {
callBackBlock(false, err) callBackBlock(false, err)
} }
} }
func getActiticyYhId(callback: @escaping (String) -> Void) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Resource.yhManagerId + "?mode=2"
_ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, _ in
guard let self = self else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [String: Any], let result = ActiticyIdModel.deserialize(from: dic) else {
return
}
callback(result.yh_id)
} else {
callback("")
}
} failBlock: { _ in
callback("")
}
}
} }
...@@ -36,10 +36,10 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController { ...@@ -36,10 +36,10 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
self.photoImageView.kf.setImage(with: url) self.photoImageView.kf.setImage(with: url)
if self.viewModel.isCanNext() { if self.viewModel.isCanNext() {
nextButton.isEnabled = true nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandGrayColor8 nextButton.backgroundColor = UIColor.brandMainColor
} else { } else {
nextButton.isEnabled = false nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandGrayColor4 nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
} }
} }
} }
...@@ -51,7 +51,7 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController { ...@@ -51,7 +51,7 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
stepOneView = { stepOneView = {
let view = UIView() let view = UIView()
view.backgroundColor = UIColor.brandGrayColor8 view.backgroundColor = UIColor.brandMainColor
return view return view
}() }()
view.addSubview(stepOneView) view.addSubview(stepOneView)
...@@ -64,7 +64,7 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController { ...@@ -64,7 +64,7 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
stepTwoView = { stepTwoView = {
let view = UIView() let view = UIView()
view.backgroundColor = UIColor.brandGrayColor2 view.backgroundColor = UIColor(hex: 0xf4f6fa)
return view return view
}() }()
view.addSubview(stepTwoView) view.addSubview(stepTwoView)
...@@ -122,10 +122,10 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController { ...@@ -122,10 +122,10 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
nextButton = { nextButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandGrayColor4 button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16) button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center button.contentHorizontalAlignment = .center
button.setTitle("确定", for: .normal) button.setTitle("提交", for: .normal)
button.setTitleColor( UIColor(hex: 0xffffff), for: .normal) button.setTitleColor( UIColor(hex: 0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius3 button.layer.cornerRadius = kCornerRadius3
button.addTarget(self, action: #selector(nextStep), for: .touchUpInside) button.addTarget(self, action: #selector(nextStep), for: .touchUpInside)
...@@ -161,9 +161,9 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController { ...@@ -161,9 +161,9 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
promptView = { promptView = {
let view = YHFailPromptView() let view = YHFailPromptView()
view.titleLable.text = "温馨提示:请填写真实信息,便于资源互换" view.titleLable.text = "温馨提示:请填写真实信息,AI人脉匹配更精准"
view.backgroundColor = UIColor.brandGrayColor2 view.backgroundColor = UIColor(hex: 0xf0f4fb)
view.titleLable.textColor = UIColor.brandGrayColor8 view.titleLable.textColor = UIColor.brandMainColor
view.alertImageView.image = UIImage(named: "user_prompt_image") view.alertImageView.image = UIImage(named: "user_prompt_image")
return view return view
}() }()
...@@ -209,7 +209,6 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController { ...@@ -209,7 +209,6 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
guard let self = self else { return } guard let self = self else { return }
let vc = YHInformationAuthorizationStepTwoViewController() let vc = YHInformationAuthorizationStepTwoViewController()
vc.name = self.viewModel.model.username vc.name = self.viewModel.model.username
vc.popToRoot = true
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
} }
...@@ -228,10 +227,10 @@ extension YHInformationAuthorizationStepOneViewController: UITableViewDelegate, ...@@ -228,10 +227,10 @@ extension YHInformationAuthorizationStepOneViewController: UITableViewDelegate,
self.viewModel.updateModel(model) self.viewModel.updateModel(model)
if self.viewModel.isCanNext() { if self.viewModel.isCanNext() {
nextButton.isEnabled = true nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandGrayColor8 nextButton.backgroundColor = UIColor.brandMainColor
} else { } else {
nextButton.isEnabled = false nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandGrayColor4 nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
} }
if model.id != .id1 && model.id != .id3 && model.id != .id5 { if model.id != .id1 && model.id != .id3 && model.id != .id5 {
self.items = viewModel.getBaseDataSource() self.items = viewModel.getBaseDataSource()
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
import UIKit import UIKit
class YHInformationAuthorizationStepTwoViewController: YHBaseViewController { class YHInformationAuthorizationStepTwoViewController: YHBaseViewController {
var popToRoot: Bool = false
var stepOneView: UIView! var stepOneView: UIView!
var stepTwoView: UIView! var stepTwoView: UIView!
var nextButton: UIButton! var nextButton: UIButton!
...@@ -25,16 +24,16 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController { ...@@ -25,16 +24,16 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController {
} }
func getData() { func getData() {
// if stepFlag { if stepFlag {
// items = viewModel.getBaseSetDataSource() items = viewModel.getBaseSetDataSource()
// tableView.reloadData() tableView.reloadData()
// } else { } else {
viewModel.requestUserAuthorization {[weak self] _, _ in viewModel.requestUserAuthorization {[weak self] _, _ in
guard let self = self else { return } guard let self = self else { return }
items = viewModel.getBaseSetDataSource() items = viewModel.getBaseSetDataSource()
tableView.reloadData() tableView.reloadData()
} }
// } }
} }
func setView() { func setView() {
...@@ -43,7 +42,7 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController { ...@@ -43,7 +42,7 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController {
stepOneView = { stepOneView = {
let view = UIView() let view = UIView()
view.backgroundColor = UIColor.brandGrayColor8 view.backgroundColor = UIColor.brandMainColor
return view return view
}() }()
view.addSubview(stepOneView) view.addSubview(stepOneView)
...@@ -56,7 +55,7 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController { ...@@ -56,7 +55,7 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController {
stepTwoView = { stepTwoView = {
let view = UIView() let view = UIView()
view.backgroundColor = UIColor.brandGrayColor8 view.backgroundColor = UIColor.brandMainColor
return view return view
}() }()
view.addSubview(stepTwoView) view.addSubview(stepTwoView)
...@@ -69,7 +68,7 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController { ...@@ -69,7 +68,7 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController {
nextButton = { nextButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.backgroundColor = UIColor.brandGrayColor8 button.backgroundColor = UIColor.brandMainColor
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16) button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center button.contentHorizontalAlignment = .center
button.setTitle("完成", for: .normal) button.setTitle("完成", for: .normal)
...@@ -118,19 +117,15 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController { ...@@ -118,19 +117,15 @@ class YHInformationAuthorizationStepTwoViewController: YHBaseViewController {
@objc func nextStep() { @objc func nextStep() {
viewModel.requestAuthorizationSubmit {[weak self] _, _ in viewModel.requestAuthorizationSubmit {[weak self] _, _ in
guard let self = self else { return } guard let self = self else { return }
// if self.stepFlag { if self.stepFlag {
// self.navigationController?.popToRootViewController(animated: true)
// let view = YHPeopleSuccessView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
// view.titleLabel.text = "Hi,\(self.name)\n您的人脉网络已激活"
// let window = UIApplication.shared.yhKeyWindow()
// window?.addSubview(view)
// } else {
if popToRoot {
self.navigationController?.popToRootViewController(animated: true) self.navigationController?.popToRootViewController(animated: true)
let view = YHPeopleSuccessView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.titleLabel.text = "Hi,\(self.name)\n您的人脉网络已激活"
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
} else { } else {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
// }
} }
} }
} }
......
...@@ -178,7 +178,7 @@ class YHMatchResultListViewController: YHBaseViewController { ...@@ -178,7 +178,7 @@ class YHMatchResultListViewController: YHBaseViewController {
} }
if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty { if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
let vc = YHNewNameCardViewController() let vc = YHNameCardViewController()
vc.userId = userId vc.userId = userId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} else { } else {
...@@ -189,7 +189,7 @@ class YHMatchResultListViewController: YHBaseViewController { ...@@ -189,7 +189,7 @@ class YHMatchResultListViewController: YHBaseViewController {
guard let self = self else { return } guard let self = self else { return }
if !uid.isEmpty { if !uid.isEmpty {
YHLoginManager.shared.userModel?.id = uid YHLoginManager.shared.userModel?.id = uid
let vc = YHNewNameCardViewController() let vc = YHNameCardViewController()
vc.userId = uid vc.userId = uid
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
...@@ -31,11 +31,7 @@ class YHMyGoodFriendsVC: YHBaseViewController { ...@@ -31,11 +31,7 @@ class YHMyGoodFriendsVC: YHBaseViewController {
view.bottomBtnClick = { view.bottomBtnClick = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
goTabBarBy(tabType: .community) self.navigationController?.popViewController(animated: true)
UIViewController.current?.navigationController?.popToRootViewController(animated: true)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
NotificationCenter.default.post(name: YhConstant.YhNotification.goConnectionVCNotifiction, object: nil)
}
} }
view.isHidden = true view.isHidden = true
return view return view
...@@ -148,7 +144,7 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -148,7 +144,7 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
if indexPath.section == 1 { if indexPath.section == 1 {
if 0 <= indexPath.row && indexPath.row < friendsArr.count { if 0 <= indexPath.row && indexPath.row < friendsArr.count {
let friend = self.friendsArr[indexPath.row] let friend = self.friendsArr[indexPath.row]
let vc = YHNewNameCardViewController() let vc = YHNameCardViewController()
vc.userId = friend.yhId vc.userId = friend.yhId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
//
// YHCircleAddPhotoCell.swift
// galaxy
//
// Created by alexzzw on 2025/9/26.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCircleAddPhotoCell: UICollectionViewCell {
private lazy var containerView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.systemGray6
return view
}()
private lazy var plusImageView: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "circle_plus_icon")
return imageView
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
contentView.addSubview(containerView)
containerView.addSubview(plusImageView)
containerView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
plusImageView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.height.equalTo(40)
}
}
}
//
// YHCircleHeaderButtonsView.swift
// galaxy
//
// Created by alexzzw on 2025/9/24.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHeaderButtonItemView: UIControl {
private lazy var iconView: UIImageView = {
let imageView = UIImageView()
return imageView
}()
private lazy var contentLabel: UILabel = {
let label = UILabel()
label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize: 13)
label.textColor = UIColor.brandGrayColor8
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor.brandGrayColor1
addSubview(iconView)
addSubview(contentLabel)
contentLabel.snp.makeConstraints { make in
make.bottom.equalToSuperview().offset(-14)
make.left.right.equalToSuperview()
}
iconView.snp.makeConstraints { make in
make.bottom.equalTo(contentLabel.snp.top).offset(-6)
make.width.height.equalTo(24)
make.centerX.equalToSuperview()
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setup(text: String, iconString: String) {
contentLabel.text = text
iconView.image = UIImage(named: iconString)
}
}
// 按钮点击回调协议
protocol YHCircleHeaderButtonsViewDelegate: AnyObject {
func headerButtonsView(_ view: YHCircleHeaderButtonsView, didTapButtonAt index: Int)
}
class YHCircleHeaderButtonsView: UIView {
weak var delegate: YHCircleHeaderButtonsViewDelegate?
// 按钮数据模型
private let buttonData: [(title: String, imageName: String)] = [
("找客户", "icon_find_customer"),
("找服务", "icon_find_service"),
("拓人脉", "icon_expand_network"),
("办活动", "icon_organize_event")
]
// 按钮数组
private var buttons: [UIControl] = []
// 容器栈视图
private lazy var stackView: UIStackView = {
let stack = UIStackView()
stack.axis = .horizontal
stack.distribution = .fillEqually
stack.alignment = .fill
stack.spacing = 10
stack.translatesAutoresizingMaskIntoConstraints = false
return stack
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
setupUI()
}
private func setupUI() {
backgroundColor = .white
addSubview(stackView)
// 设置约束
stackView.snp.makeConstraints { make in
make.left.right.equalToSuperview().inset(20)
make.top.equalToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-20)
}
// 创建按钮
createButtons()
}
private func createButtons() {
for (index, data) in buttonData.enumerated() {
let button = createButton(title: data.title, imageName: data.imageName, tag: index)
buttons.append(button)
stackView.addArrangedSubview(button)
}
}
private func createButton(title: String, imageName: String, tag: Int) -> UIControl {
let button = YHHeaderButtonItemView()
button.setup(text: title, iconString: imageName)
button.tag = tag
// 添加点击事件
button.addTarget(self, action: #selector(buttonTapped(_:)), for: .touchUpInside)
return button
}
@objc private func buttonTapped(_ sender: UIControl) {
// 调用代理方法
delegate?.headerButtonsView(self, didTapButtonAt: sender.tag)
}
}
// MARK: - UICollectionReusableView 版本(用于 CollectionView Header)
class YHCircleHeaderReusableView: UICollectionReusableView {
static let reuseIdentifier = "YHCircleHeaderReusableView"
weak var delegate: YHCircleHeaderButtonsViewDelegate?
private lazy var headerButtonsView: YHCircleHeaderButtonsView = {
let view = YHCircleHeaderButtonsView()
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
setupUI()
}
private func setupUI() {
backgroundColor = .white
addSubview(headerButtonsView)
headerButtonsView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
headerButtonsView.delegate = self
}
}
// MARK: - YHCircleHeaderButtonsViewDelegate
extension YHCircleHeaderReusableView: YHCircleHeaderButtonsViewDelegate {
func headerButtonsView(_ view: YHCircleHeaderButtonsView, didTapButtonAt index: Int) {
delegate?.headerButtonsView(view, didTapButtonAt: index)
}
}
//
// YHCircleMediaCell.swift
// galaxy
//
// Created by alexzzw on 2025/9/27.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AVFoundation
class YHCircleMediaCell: UICollectionViewCell {
var deleteCallback: (() -> Void)?
// MARK: - UI Components
private lazy var imageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFill
imageView.clipsToBounds = true
imageView.backgroundColor = UIColor.brandGrayColor2
return imageView
}()
private lazy var deleteButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(systemName: "xmark.circle.fill"), for: .normal)
button.tintColor = .white
button.backgroundColor = UIColor.black.withAlphaComponent(0.5)
button.layer.cornerRadius = 10
button.addTarget(self, action: #selector(deleteButtonTapped), for: .touchUpInside)
button.isHidden = true
return button
}()
private lazy var playIcon: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "circle_play_icon")
imageView.isHidden = true
return imageView
}()
private lazy var durationLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 12, weight: .medium)
label.textColor = .white
label.backgroundColor = UIColor.black.withAlphaComponent(0.5)
label.textAlignment = .center
label.layer.cornerRadius = 8
label.clipsToBounds = true
label.isHidden = true
return label
}()
// MARK: - Initialization
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - Setup UI
private func setupUI() {
contentView.addSubview(imageView)
contentView.addSubview(playIcon)
contentView.addSubview(durationLabel)
contentView.addSubview(deleteButton)
imageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
playIcon.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.height.equalTo(40)
}
durationLabel.snp.makeConstraints { make in
make.bottom.right.equalToSuperview().inset(8)
make.height.equalTo(20)
make.width.greaterThanOrEqualTo(35)
}
deleteButton.snp.makeConstraints { make in
make.top.right.equalToSuperview().inset(4)
make.width.height.equalTo(20)
}
}
// MARK: - Configure Cell
func configure(with mediaItem: YHSelectMediaItem) {
resetCell()
switch mediaItem.type {
case .image:
configureForImage(mediaItem)
case .video:
configureForVideo(mediaItem)
}
}
private func resetCell() {
imageView.image = nil
playIcon.isHidden = true
durationLabel.isHidden = true
durationLabel.text = nil
}
private func configureForImage(_ mediaItem: YHSelectMediaItem) {
if let url = mediaItem.imageURL {
imageView.sd_setImage(with: url, placeholderImage: UIImage(named: "global_default_image"), context: nil)
} else {
imageView.image = mediaItem.image
}
playIcon.isHidden = true
durationLabel.isHidden = true
}
private func configureForVideo(_ mediaItem: YHSelectMediaItem) {
// 显示视频相关UI
playIcon.isHidden = false
// 生成视频缩略图
if let videoURL = mediaItem.videoURL {
generateVideoThumbnail(from: videoURL) { [weak self] thumbnail in
DispatchQueue.main.async {
self?.imageView.image = thumbnail
}
}
}
// 显示视频时长
// if let duration = mediaItem.duration {
// durationLabel.text = formatDuration(duration)
// durationLabel.isHidden = false
// } else if let videoURL = mediaItem.videoURL {
// // 如果没有时长信息,尝试获取
// getVideoDuration(from: videoURL) { [weak self] duration in
// DispatchQueue.main.async {
// if duration > 0 {
// self?.durationLabel.text = self?.formatDuration(duration)
// self?.durationLabel.isHidden = false
// }
// }
// }
// }
}
// MARK: - Video Helpers
private func generateVideoThumbnail(from url: URL, completion: @escaping (UIImage?) -> Void) {
DispatchQueue.global(qos: .userInitiated).async {
let asset = AVAsset(url: url)
let imageGenerator = AVAssetImageGenerator(asset: asset)
imageGenerator.appliesPreferredTrackTransform = true
imageGenerator.maximumSize = CGSize(width: 300, height: 300)
let time = CMTime(seconds: 0.0, preferredTimescale: 600)
do {
let cgImage = try imageGenerator.copyCGImage(at: time, actualTime: nil)
let thumbnail = UIImage(cgImage: cgImage)
completion(thumbnail)
} catch {
print("生成视频缩略图失败: \(error)")
completion(nil)
}
}
}
private func getVideoDuration(from url: URL, completion: @escaping (TimeInterval) -> Void) {
DispatchQueue.global(qos: .userInitiated).async {
let asset = AVAsset(url: url)
let duration = CMTimeGetSeconds(asset.duration)
completion(duration.isNaN ? 0 : duration)
}
}
private func formatDuration(_ duration: TimeInterval) -> String {
let totalSeconds = Int(duration)
let minutes = totalSeconds / 60
let seconds = totalSeconds % 60
if minutes > 0 {
return String(format: "%d:%02d", minutes, seconds)
} else {
return String(format: "0:%02d", seconds)
}
}
// MARK: - Actions
@objc private func deleteButtonTapped() {
deleteCallback?()
}
}
//
// YHCirclePhotoCell.swift
// galaxy
//
// Created by alexzzw on 2025/9/26.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
// MARK: - Custom Cells
class YHCirclePhotoCell: UICollectionViewCell {
var deleteCallback: (() -> Void)?
private lazy var imageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFill
imageView.clipsToBounds = true
return imageView
}()
private lazy var deleteButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(systemName: "xmark.circle.fill"), for: .normal)
button.tintColor = .white
button.backgroundColor = UIColor.black.withAlphaComponent(0.5)
button.layer.cornerRadius = 10
button.addTarget(self, action: #selector(deleteButtonTapped), for: .touchUpInside)
button.isHidden = true
return button
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
contentView.addSubview(imageView)
contentView.addSubview(deleteButton)
imageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
deleteButton.snp.makeConstraints { make in
make.top.right.equalToSuperview().inset(4)
make.width.height.equalTo(20)
}
}
func configure(with image: UIImage) {
imageView.image = image
}
@objc private func deleteButtonTapped() {
deleteCallback?()
}
}
//
// YHConnectListViewController.swift
// galaxy
//
// Created by Dufet on 2025/9/25.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import JXSegmentedView
import UIKit
class YHConnectListViewController: YHBaseViewController {
let viewModel = YHContactViewModel()
let matchViewModel = YHMatchUserViewModel()
var arr: [YHContact] = []
lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.showsVerticalScrollIndicator = false
tableView.contentInsetAdjustmentBehavior = .never
tableView.estimatedSectionHeaderHeight = 1.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor.white
tableView.register(YHConnectListCell.self, forCellReuseIdentifier: YHConnectListCell.cellReuseIdentifier)
tableView.es.addYHPullToRefresh {
self.reguestData(true)
}
tableView.es.addInfiniteScrolling {
self.reguestData(false)
}
return tableView
}()
lazy var noDataView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("暂无内容", kEmptyCommonBgName)
view.isHidden = true
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
gk_navigationBar.isHidden = true
view.backgroundColor = UIColor.white
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.equalTo(0)
make.right.equalTo(0)
make.bottom.equalToSuperview()
make.top.equalToSuperview().offset(0)
}
view.addSubview(noDataView)
noDataView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.centerY.equalToSuperview()
make.width.equalTo(KScreenWidth)
make.height.equalTo(150)
}
reguestData(true)
}
func reguestData(_ isFirstPage: Bool) {
self.viewModel.getList(isFirstPage) { _, _ in
self.arr.removeAll()
self.arr.append(contentsOf: (self.viewModel.contacts))
self.noDataView.isHidden = self.arr.count > 0
self.tableView.reloadData()
self.tableView.es.stopLoadingMore()
self.tableView.es.stopPullToRefresh()
if !self.viewModel.hasMore {
self.tableView.es.noticeNoMoreData()
}
}
}
}
extension YHConnectListViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: YHConnectListCell.cellReuseIdentifier, for: indexPath) as? YHConnectListCell else { return UITableViewCell() }
if 0 <= indexPath.row, indexPath.row < arr.count {
let model = arr[indexPath.row]
cell.updateModel(model)
cell.addFriendBlock = {[weak self] text in
guard let self = self else { return }
YHHUD.show(.progress(message: "加载中..."))
self.matchViewModel.addFriendWithText(text!, yhId: model.yh_id) {
success, error in
YHHUD.hide()
if success {
model.type = YHContactRelation.unvalidate.rawValue
self.tableView.reloadData()
} else {
var msg = "申请失败"
if let errMsg = error?.errorMsg, !errMsg.isEmpty {
msg = errMsg
}
YHHUD.flash(message: msg)
}
}
}
}
return cell
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 1.0
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 1.0
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.row && indexPath.row < arr.count {
let contact = arr[indexPath.row]
let vc = YHNewNameCardViewController()
vc.userId = contact.yh_id
navigationController?.pushViewController(vc)
}
}
}
extension YHConnectListViewController: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
//
// YHContact.swift
// galaxy
//
// Created by Dufet on 2025/9/25.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import SmartCodable
class YHContactListModel: SmartCodable {
var total: Int = 0
var list: [YHContact] = []
required init() {
}
}
enum YHContactRelation: Int {
case stranger = 1 // 陌生人
case unvalidate = 3 // 待验证
case friend = 5 // 好友
}
// 联系人数据模型
class YHContact: SmartCodable {
var id: String = ""
var yh_id: String = ""
var username: String = ""
var avatar: String = ""
var position: String = ""
var industry: String = ""
var signature: String = ""
var bio: String = ""
var type: Int = 1 // 人脉状态 1: 陌生人 3: 待验证 5: 好友
required init() {
}
}
//
// YHContactViewModel.swift
// galaxy
//
// Created by Dufet on 2025/9/28.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHContactViewModel: YHBaseViewModel {
var curPageIndex: Int = 1
var pageSize = 10
var totalCount: Int = 0
var contacts: [YHContact] = []
var hasMore: Bool = true
// super-app/business-card/list
// 最近浏览
func getList(_ firstFlag: Bool, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
var params: [String: Any] = ["page": curPageIndex,
"page_size": pageSize]
if firstFlag {
curPageIndex = 1
params = ["page": curPageIndex,
"page_size": pageSize]
} else {
params = ["page": curPageIndex + 1,
"page_size": pageSize]
}
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Contact.contactList
_ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, _ in
guard let self = self else { return }
// 1. json字符串 转 对象
if json.code == 200 {
guard let dic = json.data?.peel as? [String: Any], let result = YHContactListModel.deserialize(from: dic) else {
callBackBlock(false, nil)
return
}
if firstFlag {
self.totalCount = result.total
self.contacts.removeAll()
self.contacts = result.list
} else {
self.contacts.append(contentsOf: result.list)
curPageIndex += 1
}
if self.contacts.count >= self.totalCount {
self.hasMore = false
} else {
self.hasMore = true
}
callBackBlock(true, nil)
} else {
let error: YHErrorModel = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
}
...@@ -67,14 +67,17 @@ class YHMatchUserAddress: SmartCodable { ...@@ -67,14 +67,17 @@ class YHMatchUserAddress: SmartCodable {
class YHAuthorizationModel: SmartCodable { class YHAuthorizationModel: SmartCodable {
var public_education_experience: Int = 0 var educationExperience: Int = 0
var public_work_experience: Int = 0 var workExperience: Int = 0
var friend_education_experience: Int = 0
var friend_work_experience: Int = 0
required init() { required init() {
} }
enum CodingKeys: String, CodingKey {
case educationExperience = "public_education_experience"
case workExperience = "public_work_experience"
}
} }
enum YHNameCardInfoType: Int { enum YHNameCardInfoType: Int {
...@@ -107,20 +110,19 @@ class YHUserNameCardInfo: SmartCodable { ...@@ -107,20 +110,19 @@ class YHUserNameCardInfo: SmartCodable {
var topics: [String] = [] var topics: [String] = []
var draftTopics: [String] = [] var draftTopics: [String] = []
var authorization: YHAuthorizationModel = YHAuthorizationModel() var authorization: YHAuthorizationModel = YHAuthorizationModel()
var type: Int = 1 // 人脉状态 1: 陌生人 3: 待验证 5: 好友
// 自定义属性 // 自定义属性
var infoType: YHNameCardInfoType = .unknown var type: YHNameCardInfoType = .unknown
var isCurrentUser = false var isCurrentUser = false
var isHiddenEducation: Bool { var isHiddenEducation: Bool {
get { get {
return self.authorization.public_education_experience != 2 || self.authorization.friend_education_experience != 2 return self.authorization.educationExperience != 2
} }
} }
var isHiddenWorkExperience: Bool { var isHiddenWorkExperience: Bool {
get { get {
return self.authorization.public_work_experience != 2 || self.authorization.friend_work_experience != 2 return self.authorization.workExperience != 2
} }
} }
...@@ -147,10 +149,8 @@ class YHUserNameCardInfo: SmartCodable { ...@@ -147,10 +149,8 @@ class YHUserNameCardInfo: SmartCodable {
self.position = model.position self.position = model.position
self.industry = model.industry self.industry = model.industry
self.honor = model.honor self.honor = model.honor
self.authorization.public_education_experience = model.authorization.public_education_experience self.authorization.educationExperience = model.authorization.educationExperience
self.authorization.public_work_experience = model.authorization.public_work_experience self.authorization.workExperience = model.authorization.workExperience
self.authorization.friend_education_experience = model.authorization.friend_education_experience
self.authorization.friend_work_experience = model.authorization.friend_work_experience
self.topics.removeAll() self.topics.removeAll()
self.topics.append(contentsOf: model.topics) self.topics.append(contentsOf: model.topics)
} }
...@@ -160,7 +160,7 @@ class YHUserNameCardInfo: SmartCodable { ...@@ -160,7 +160,7 @@ class YHUserNameCardInfo: SmartCodable {
case isSigned = "is_signed" case isSigned = "is_signed"
case companyName = "company_name" case companyName = "company_name"
case draftTopics = "draft_topics" case draftTopics = "draft_topics"
case id, avatar, username, zodiac, signature, bio, college, major, background, position, industry, honor, type case id, avatar, username, zodiac, signature, bio, college, major, background, position, industry, honor
case topics case topics
case address case address
case authorization case authorization
......
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