Commit 9b7ae4d6 authored by pete谢兆麟's avatar pete谢兆麟

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

parents f5eb3d19 88a40150
......@@ -1193,6 +1193,7 @@
04AFEF452D5DDCCB0007A011 /* YHMyFunctionGroup2Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF442D5DDCCB0007A011 /* YHMyFunctionGroup2Cell.swift */; };
04AFEF492D5DDE180007A011 /* YHMyFunctionGroupItem2Cell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF482D5DDE180007A011 /* YHMyFunctionGroupItem2Cell.swift */; };
04AFEF4B2D5DF3710007A011 /* YHMyUserInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF4A2D5DF3710007A011 /* YHMyUserInfoView.swift */; };
04AFEF4D2D5EEF860007A011 /* YHUserVipInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AFEF4C2D5EEF860007A011 /* YHUserVipInfoView.swift */; };
04E4CF3E2D5C6D32004D4013 /* YHCountryMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */; };
04E4CF402D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */; };
04EA376D2BEA06EF00DBAF64 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376C2BEA06EF00DBAF64 /* WebKit.framework */; };
......@@ -2424,6 +2425,7 @@
04AFEF442D5DDCCB0007A011 /* YHMyFunctionGroup2Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFunctionGroup2Cell.swift; sourceTree = "<group>"; };
04AFEF482D5DDE180007A011 /* YHMyFunctionGroupItem2Cell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFunctionGroupItem2Cell.swift; sourceTree = "<group>"; };
04AFEF4A2D5DF3710007A011 /* YHMyUserInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyUserInfoView.swift; sourceTree = "<group>"; };
04AFEF4C2D5EEF860007A011 /* YHUserVipInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUserVipInfoView.swift; sourceTree = "<group>"; };
04E4CF3D2D5C6D32004D4013 /* YHCountryMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCountryMessageView.swift; sourceTree = "<group>"; };
04E4CF3F2D5C83AE004D4013 /* YHSelectPhoneCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSelectPhoneCountryViewController.swift; sourceTree = "<group>"; };
04EA376C2BEA06EF00DBAF64 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
......@@ -5781,6 +5783,7 @@
045C0EF82D12CA5E00BD2DC0 /* YHPersonalCenterCell.swift */,
045C0EF92D12CA5E00BD2DC0 /* YHUserInfoHeaderView.swift */,
04AFEF4A2D5DF3710007A011 /* YHMyUserInfoView.swift */,
04AFEF4C2D5EEF860007A011 /* YHUserVipInfoView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -7239,6 +7242,7 @@
045C11282D12CA5F00BD2DC0 /* YHH5WebViewVC.swift in Sources */,
045C11292D12CA5F00BD2DC0 /* YHAIMessageModel.swift in Sources */,
045C112A2D12CA5F00BD2DC0 /* YHBasicInfoFillBottomView.swift in Sources */,
04AFEF4D2D5EEF860007A011 /* YHUserVipInfoView.swift in Sources */,
045C112B2D12CA5F00BD2DC0 /* YHResignUploadDocListProgressModel.swift in Sources */,
045C112C2D12CA5F00BD2DC0 /* YHPersonalCenterCell.swift in Sources */,
045C112D2D12CA5F00BD2DC0 /* YHPrincipleApprovedWaitSubmitVC.swift in Sources */,
......@@ -8060,7 +8064,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyTestEnv.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -8206,7 +8210,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -8414,7 +8418,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -8462,7 +8466,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......
......@@ -213,7 +213,7 @@ class YHCodeSueecssViewController: YHBaseViewController {
//苹果登录逻辑
var params = self.appleLoginParams
params["sms_code"] = code
params["mobile"] = phone
params["mobile"] = XXTEA.encryptString(toBase64String: phone, stringKey: "galaxyapps") ?? phone
params["mobile_area_code"] = "+" + self.country.code
printLog("Apple login parmas: \(params)")
YHHUD.show(.progress(message: ""))
......
......@@ -56,8 +56,55 @@ class YHMyNewViewController: YHBaseViewController {
}()
lazy var userInfoView: YHMyUserInfoView = {
let v = YHMyUserInfoView.createView()
return v
let view = YHMyUserInfoView.createView()
view.enterClick = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
enterMyNameCard()
}
view.avatarClickBlock = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
}
view.nickNameClickBlock = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
}
view.likeClick = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
let vc = YHMyLikeActivityViewController()
vc.myDefaultNavItemIndex = 0
self.navigationController?.pushViewController(vc)
}
view.collectClick = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
let vc = YHMyLikeActivityViewController()
vc.myDefaultNavItemIndex = 1
self.navigationController?.pushViewController(vc)
print("收藏")
}
view.recentScanClick = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
let vc = YHMyLikeActivityViewController()
vc.myDefaultNavItemIndex = 2
self.navigationController?.pushViewController(vc)
print("最近浏览")
}
return view
}()
private lazy var settingBtn: UIButton = {
......@@ -88,8 +135,8 @@ class YHMyNewViewController: YHBaseViewController {
view.addSubview(bgImgView)
view.addSubview(tableView)
view.addSubview(settingBtn)
view.addSubview(settingRedPointView)
bgImgView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(bgImgView.snp.width)
......@@ -107,11 +154,35 @@ class YHMyNewViewController: YHBaseViewController {
make.right.equalToSuperview().offset(-17)
make.top.equalTo(k_Height_statusBar()+10)
}
settingRedPointView.snp.makeConstraints { make in
make.width.height.equalTo(6)
make.left.equalTo(settingBtn.snp.right).offset(-3)
make.bottom.equalTo(settingBtn.snp.top).offset(3)
}
updateUserUI()
NotificationCenter.default.addObserver(self, selector: #selector(loginSuccess), name: YhConstant.YhNotification.didLoginSuccessNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(logoutSuccess), name: YhConstant.YhNotification.didLogoutSuccessNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(clearUnreadBadge), name: YhConstant.YhNotification.didMarkAllMessagesReadedNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didRevUatParam), name: YhConstant.YhNotification.didRevUatParam, object: nil)
}
deinit {
NotificationCenter.default.removeObserver(self)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadItems()
requestLikeCollectionCount()
getTotalUnreadMsgCount()
checkSettingRedPoint()
userInfoView.updateAvatar()
requstUserBasicInfo()
showAlert()
}
func checkLogin()->Bool {
......@@ -128,17 +199,14 @@ class YHMyNewViewController: YHBaseViewController {
var scoreGroupArr:[PersonalModuleItem] = []
var serviceGroupArr:[PersonalModuleItem] = []
var otherGroupArr:[PersonalModuleItem] = []
// if YHUatHelper.shared.getUatModuleStatusBy(module: .Mine_MyCard) == 1 {
// let item = PersonalModuleItem(icon: "mine_item_card", title: "我的名片".local, type:.myCard)
// items.append(item)
// }
// 我的名片
// userInfoView.arrowImgView.isHidden = (YHUatHelper.shared.getUatModuleStatusBy(module: .Mine_MyCard) != 1)
// 邀请好友和积分商城
do {
let item = PersonalModuleItem(icon: "mine_item_invite", title: "邀请好友".local, desc: "推荐好友享好礼", type:.scoreCenter)
let item = PersonalModuleItem(icon: "mine_item_invite", title: "邀请好友".local, desc: "推荐好友享好礼", type:.inviteFriends)
scoreGroupArr.append(item)
}
......@@ -178,12 +246,12 @@ class YHMyNewViewController: YHBaseViewController {
}
if YHUatHelper.shared.getUatModuleStatusBy(module: .Mine_EvaluationCode) == 1 {
let item = PersonalModuleItem(icon: "mine_item_code", title: "我的测评码".local, type:.myTestCode)
let item = PersonalModuleItem(icon: "mine_item_code", title: "测评码".local, type:.myTestCode)
otherGroupArr.append(item)
}
if YHUatHelper.shared.getUatModuleStatusBy(module: .Mine_AboutYinHeHarbour) == 1 {
let item = PersonalModuleItem(icon: "mine_item_appoint", title: "关于银河湾".local, type:.appointGalaxyBay)
let item = PersonalModuleItem(icon: "mine_item_appoint", title: "银河湾".local, type:.appointGalaxyBay)
otherGroupArr.append(item)
}
......@@ -200,7 +268,6 @@ class YHMyNewViewController: YHBaseViewController {
functionGroupArr.append(scoreGroup)
functionGroupArr.append(serviceGroup)
functionGroupArr.append(otherGroup)
tableView.reloadData()
}
......@@ -226,8 +293,18 @@ extension YHMyNewViewController : UITableViewDelegate, UITableViewDataSource {
if group.type == .score {
let cell2 = tableView.dequeueReusableCell(withIdentifier: YHMyFunctionGroup2Cell.cellReuseIdentifier, for: indexPath) as! YHMyFunctionGroup2Cell
cell2.updateGroup(group)
cell2.clickItem = {
[weak self] item in
guard let self = self else { return }
self.clickItem(item)
}
return cell2
}
cell.clickItem = {
[weak self] item in
guard let self = self else { return }
self.clickItem(item)
}
cell.updateGroup(group)
}
return cell
......@@ -237,116 +314,10 @@ extension YHMyNewViewController : UITableViewDelegate, UITableViewDataSource {
return UITableView.automaticDimension
}
// func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// if (indexPath.row >= items.count) { return }
//
// if !checkLogin() {
// return
// }
//
// let item: PersonalModuleItem = items[indexPath.row]
// switch item.type {
// case .myCard://我的名片
// if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
// let vc = YHNameCardViewController()
// vc.userId = userId
// self.navigationController?.pushViewController(vc)
// } else {
// YHHUD.show(.progress(message: "加载中..."))
// self.loginViewModel.getUserId {
// [weak self] uid in
// YHHUD.hide()
// guard let self = self else { return }
// if !uid.isEmpty {
// YHLoginManager.shared.userModel?.id = uid
// let vc = YHNameCardViewController()
// vc.userId = uid
// self.navigationController?.pushViewController(vc)
// }
// }
// }
// case .myMessage://我的消息
// printLog("我的消息")
// goToMessagePage()
//
// case .scoreCenter:////积分中心
// printLog("积分中心")
// if let param = YHLoginManager.shared.userModel?.token,param.count>5 {
// printLog(param)
// var url = YHBaseUrlManager.shared.curH5URL() + "superApp/integral"
// url = url + "?param=" + YHLoginManager.shared.h5Token
//
// let vc = YHH5WebViewVC()
// vc.title = "积分中心"
// vc.navTitle = "积分中心"
// vc.url = url
// vc.isFullScreenFlag = false
// vc.isSupportWebviewInterBackFlag = true
// self.navigationController?.pushViewController(vc)
// }
// case .myTestCode://我的测评码
// printLog("我的测评码")
// let vc = YHHomeWebViewController()
// vc.title = "香港身份测评码"
// vc.vcTitle = "香港身份测评码"
// vc.showSavePicBottomFlag = true
// vc.url = "https://cdn-public.galaxy-immi.com/app/cepingma.png"
// self.navigationController?.pushViewController(vc)
// case .appointGalaxyBay://预约银河湾
// printLog("预约银河湾")
// let vc = YHListViewController()
// self.navigationController?.pushViewController(vc)
// case .myActivity:
// printLog("我的活动")
// let vc = YHActivityListViewController()
// vc.type = 1
// self.navigationController?.pushViewController(vc)
// case .aboutUs:
// let vc = YHAboutGalaxyViewController()
// self.navigationController?.pushViewController(vc)
// case .myOrder:
//// 我的订单
// if let token = YHLoginManager.shared.userModel?.token,token.count > 5 {
// var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/order/my"
// url = url + "?param=" + YHLoginManager.shared.h5Token
// printLog("URL: \(url)")
// let vc = YHH5WebViewVC()
// vc.url = url
// vc.isFullScreenFlag = false
// vc.navTitle = "我的订单"
// vc.isSupportWebviewInterBackFlag = true
// UIViewController.current?.navigationController?.pushViewController(vc)
// }
// case .mycart:
//// 我的订单
// if let token = YHLoginManager.shared.userModel?.token,token.count > 5 {
// var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/goods/cart"
// url = url + "?param=" + YHLoginManager.shared.h5Token
// printLog("URL: \(url)")
// 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.isFullScreenFlag = false
// vc.navTitle = "购物车"
// vc.isSupportWebviewInterBackFlag = true
// UIViewController.current?.navigationController?.pushViewController(vc)
// }
// case .serviceStep:
// UIViewController.current?.tabBarController?.selectedIndex = 1
// default:
// printLog("不需要响应")
// }
// }
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 1.0
return 113.0
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
......@@ -359,8 +330,316 @@ extension YHMyNewViewController : UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
let v = YHUserVipInfoView(frame: CGRectMake(0, 0, tableView.width, 113))
return v
}
}
extension YHMyNewViewController {
@objc func loginSuccess() {
printLog("登录成功,进行相应的 UI刷新操作")
updateUserUI()
}
@objc func logoutSuccess() {
updateUserUI()
}
func updateUserUI() {
if YHLoginManager.shared.isLogin() {
userInfoView.userNameLabel.text = YHLoginManager.shared.userModel?.nickname ?? "Hi, 银河用户".local
} else {
userInfoView.userNameLabel.text = "登录/注册"
}
userInfoView.updateAvatar()
requestLikeCollectionCount()
getTotalUnreadMsgCount()
checkSettingRedPoint()
requstUserBasicInfo()
}
func requstUserBasicInfo() {
if YHLoginManager.shared.isLogin() {
if isEmptyString(YHLoginManager.shared.userModel?.id) {
self.loginViewModel.getUserId {
[weak self] uid in
guard let self = self else { return }
requestUserAvatar()
}
} else {
requestUserAvatar()
}
} else {
userInfoView.updateAvatar()
}
}
func requestUserAvatar() {
if let uid = YHLoginManager.shared.userModel?.id, !uid.isEmpty {
self.userViewModel.getUserNameCardInfo(uid: uid) {
[weak self] success, error in
guard let self = self else { return }
let url = URL(string: self.userViewModel.nameCardInfo.avatar)
self.userInfoView.avarImgView.kf.setImage(with: url, placeholder: UIImage(named: "people_head_default"))
}
}
}
func requestLikeCollectionCount() {
self.likeViewModel.getLikeCollectionRecentScanCountInfo {
[weak self] success, error in
guard let self = self else { return }
self.userInfoView.updateLikeCollectCount(self.likeViewModel.likeCollectCountInfo)
}
}
// 请求未读消息总数
func getTotalUnreadMsgCount() {
if YHLoginManager.shared.isLogin() {
self.msgViewModel.requestTotalUnreadMsgCount {
[weak self] success, error in
guard let self = self else { return }
DispatchQueue.main.async {
var unreadCount = self.msgViewModel.unreadTotalCount
if YHButlerServiceManager.shared.isUatAllowed() {
unreadCount = self.msgViewModel.unreadTotalCount + YHButlerServiceManager.shared.unreadCount
}
for group in self.functionGroupArr {
for item in group.arr {
if item.type == .myMessage {
item.isShowRedPoint = unreadCount > 0
break
}
}
}
self.tableView .reloadData()
}
}
}
}
@objc func didRevUatParam() {
loadItems()
}
@objc func clearUnreadBadge() {
DispatchQueue.main.async {
for group in self.functionGroupArr {
for item in group.arr {
if item.type == .myMessage {
item.isShowRedPoint = false
break
}
}
}
self.tableView .reloadData()
}
}
func checkSettingRedPoint() {
if YHConfigManager.shared.loadNewDataFlag == false {
YHConfigManager.shared.loadConfigData {
[weak self] in
guard let self = self else { return }
self.settingRedPointView.isHidden = !YHAppVersionManager.shared.needShowRedPointOfSuggestVersionUpdate()
}
} else {
self.settingRedPointView.isHidden = !YHAppVersionManager.shared.needShowRedPointOfSuggestVersionUpdate()
}
}
private func showAlert() {
guard YHLoginManager.shared.isLogin() else {
return
}
princleVM.getPrincleStatus { [weak self] success, error in
if success {
guard let self = self else {
return
}
guard let model = self.princleVM.alertStatusModel else {
return
}
if model.type == 20 {
self.showYHManagerGuideView(self.navigationController)
}
}
}
}
}
extension YHMyNewViewController {
//MARK: - 跳银河管家
private func showYHManagerGuideView(_ navigationController: UINavigationController?) {
if YHUatHelper.shared.getUatModuleStatusBy(module: .QiYu_Service) != 1 {
printLog("非目标用户")
return
}
if let key = YHButlerServiceManager.shared.guideWindowShowedKey, YHButlerServiceManager.shared.didShowWindowDict[key] == true {
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
if let key = YHButlerServiceManager.shared.guideWindowShowedKey {
YHButlerServiceManager.shared.didShowWindowDict[key] = true
}
let view = YHConversationGuideView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.checkButtonEvent = { [weak self] in
guard let self = self else {
return
}
self.princleVM.postAlertStatus(20) { success, error in
}
self.gotoYinHeManager(navigationController)
}
view.show()
}
}
private func gotoYinHeManager(_ navigationController: UINavigationController?) {
guard let userId = YHLoginManager.shared.userModel?.id, userId.count > 0 else {
return
}
//YHAnalytics.track("APP_HomeTab_IntelligentAssistant")
YHButlerServiceManager.shared.gotoButlerServiceSessionVC(navigationController: navigationController, completion: { _ in
})
}
}
extension YHMyNewViewController {
func enterMyNameCard() {
if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
let vc = YHNameCardViewController()
vc.userId = userId
self.navigationController?.pushViewController(vc)
} else {
YHHUD.show(.progress(message: "加载中..."))
self.loginViewModel.getUserId {
[weak self] uid in
YHHUD.hide()
guard let self = self else { return }
if !uid.isEmpty {
YHLoginManager.shared.userModel?.id = uid
let vc = YHNameCardViewController()
vc.userId = uid
self.navigationController?.pushViewController(vc)
}
}
}
}
func inviteFriends() {
//判断是否登录成功
if YHLoginManager.shared.isLogin() {
let vc = YHInvitationWithGiftsViewController()
self.navigationController?.pushViewController(vc)
} else {
YHOneKeyLoginManager.shared.oneKeyLogin()
YHLoginManager.shared.loginSuccessActionBlock = {[weak self] in
guard self != nil else { return }
let vc = YHInvitationWithGiftsViewController()
self?.navigationController?.pushViewController(vc)
YHLoginManager.shared.loginSuccessActionBlock = nil
}
}
}
func clickItem(_ item: PersonalModuleItem) {
if !checkLogin() {
return
}
switch item.type {
case .myCard://我的名片
enterMyNameCard()
case .myMessage://我的消息
printLog("我的消息")
goToMessagePage()
case .scoreCenter:////积分中心
printLog("积分中心")
if let param = YHLoginManager.shared.userModel?.token,param.count>5 {
printLog(param)
var url = YHBaseUrlManager.shared.curH5URL() + "superApp/integral"
url = url + "?param=" + YHLoginManager.shared.h5Token
let vc = YHH5WebViewVC()
vc.title = "积分中心"
vc.navTitle = "积分中心"
vc.url = url
vc.isFullScreenFlag = false
vc.isSupportWebviewInterBackFlag = true
self.navigationController?.pushViewController(vc)
}
case .myTestCode://我的测评码
printLog("我的测评码")
let vc = YHHomeWebViewController()
vc.title = "香港身份测评码"
vc.vcTitle = "香港身份测评码"
vc.showSavePicBottomFlag = true
vc.url = "https://cdn-public.galaxy-immi.com/app/cepingma.png"
self.navigationController?.pushViewController(vc)
case .appointGalaxyBay://预约银河湾
printLog("预约银河湾")
let vc = YHListViewController()
self.navigationController?.pushViewController(vc)
case .myActivity:
printLog("我的活动")
let vc = YHActivityListViewController()
vc.type = 1
self.navigationController?.pushViewController(vc)
case .aboutUs:
let vc = YHAboutGalaxyViewController()
self.navigationController?.pushViewController(vc)
case .myOrder:
// 我的订单
if let token = YHLoginManager.shared.userModel?.token,token.count > 5 {
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/order/my"
url = url + "?param=" + YHLoginManager.shared.h5Token
printLog("URL: \(url)")
let vc = YHH5WebViewVC()
vc.url = url
vc.isFullScreenFlag = false
vc.navTitle = "我的订单"
vc.isSupportWebviewInterBackFlag = true
UIViewController.current?.navigationController?.pushViewController(vc)
}
case .mycart:
// 我的订单
if let token = YHLoginManager.shared.userModel?.token,token.count > 5 {
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/goods/cart"
url = url + "?param=" + YHLoginManager.shared.h5Token
printLog("URL: \(url)")
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.isFullScreenFlag = false
vc.navTitle = "购物车"
vc.isSupportWebviewInterBackFlag = true
UIViewController.current?.navigationController?.pushViewController(vc)
}
case .serviceStep:
UIViewController.current?.tabBarController?.selectedIndex = 1
case .inviteFriends:
inviteFriends()
default:
printLog("不需要响应")
}
}
}
......@@ -18,6 +18,7 @@ enum YHPersonalModuleItemType: Int {
case myProgress
case myActivity
case scoreCenter
case inviteFriends
case recommend
case myPoster
case myTestCode
......
......@@ -12,6 +12,9 @@ class YHMyFunctionGroup2Cell: UITableViewCell {
static let cellReuseIdentifier = "YHMyFunctionGroup2Cell"
static let itemHeight = 74.0
var clickItem:((PersonalModuleItem)->())?
func updateGroup(_ group: YHFunctionGroupInfo) {
groupArr = group.arr
}
......@@ -105,7 +108,11 @@ extension YHMyFunctionGroup2Cell: UICollectionViewDelegate, UICollectionViewData
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if 0 <= indexPath.item && indexPath.item < groupArr.count {
let item: PersonalModuleItem = groupArr[indexPath.item]
if let click = clickItem {
click(item)
}
}
}
}
......@@ -14,6 +14,7 @@ class YHMyFunctionGroupItemCell: UICollectionViewCell {
func updateItem(_ item : PersonalModuleItem) {
titleLabel.text = item.title
redPointView.isHidden = !item.isShowRedPoint
if let icon = item.icon, !icon.isEmpty {
iconImgView.image = UIImage(named:icon)
} else {
......@@ -34,6 +35,15 @@ class YHMyFunctionGroupItemCell: UICollectionViewCell {
return v
}()
private lazy var redPointView: UIView = {
let view = UIView()
view.layer.cornerRadius = 2.5
view.clipsToBounds = true
view.backgroundColor = .failColor
view.isHidden = true
return view
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
......@@ -46,6 +56,8 @@ class YHMyFunctionGroupItemCell: UICollectionViewCell {
func setupUI() {
self.contentView.addSubview(titleLabel)
self.contentView.addSubview(iconImgView)
self.contentView.addSubview(redPointView)
iconImgView.snp.makeConstraints { make in
make.top.equalTo(20)
......@@ -53,6 +65,12 @@ class YHMyFunctionGroupItemCell: UICollectionViewCell {
make.centerX.equalToSuperview()
}
redPointView.snp.makeConstraints { make in
make.width.height.equalTo(5)
make.top.equalTo(iconImgView)
make.left.equalTo(iconImgView.snp.right).offset(0)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(iconImgView.snp.bottom).offset(8)
make.height.equalTo(18)
......
......@@ -12,6 +12,8 @@ class YHMySectionGroupCell: UITableViewCell {
static let cellReuseIdentifier = "YHMySectionGroupCell"
var clickItem:((PersonalModuleItem)->())?
func updateGroup(_ group: YHFunctionGroupInfo) {
titleLabel.text = group.title
groupArr = group.arr
......@@ -134,7 +136,11 @@ extension YHMySectionGroupCell: UICollectionViewDelegate, UICollectionViewDataSo
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if 0 <= indexPath.item && indexPath.item < groupArr.count {
let item: PersonalModuleItem = groupArr[indexPath.item]
if let click = clickItem {
click(item)
}
}
}
}
......@@ -19,6 +19,7 @@ class YHMyUserInfoView: UIView {
var likeClick:(()->Void)?
var collectClick:(()->Void)?
var recentScanClick:(()->Void)?
var enterClick:(()->Void)?
lazy var contentView: UIView = {
let view = UIView()
......@@ -36,7 +37,7 @@ class YHMyUserInfoView: UIView {
return imgView
}()
private lazy var userNameLabel:UILabel = {
lazy var userNameLabel:UILabel = {
let label = UILabel()
label.text = "登录/注册".local
label.textColor = .mainTextColor
......@@ -99,12 +100,24 @@ class YHMyUserInfoView: UIView {
return line
}()
lazy var vipImgView: UIImageView = {
let imgV = UIImageView()
imgV.image = UIImage(named: "mine_vip_1")
return imgV
}()
lazy var arrowImgView: UIImageView = {
let imgV = UIImageView()
imgV.image = UIImage(named: "form_right_arrow")
return imgV
}()
lazy var enterBtn: UIButton = {
let btn = UIButton()
btn.addTarget(self, action: #selector(enterBtnClicked), for: .touchUpInside)
return btn
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.clipsToBounds = true
......@@ -125,7 +138,8 @@ class YHMyUserInfoView: UIView {
self.addSubview(contentView)
contentView.addSubview(avarImgView)
contentView.addSubview(userNameLabel)
contentView.addSubview(vipImgView)
contentView.addSubview(likeLabel)
contentView.addSubview(collectLabel)
contentView.addSubview(scanLabel)
......@@ -133,6 +147,7 @@ class YHMyUserInfoView: UIView {
contentView.addSubview(line2View)
contentView.addSubview(arrowImgView)
contentView.addSubview(enterBtn)
contentView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
......@@ -150,10 +165,17 @@ class YHMyUserInfoView: UIView {
userNameLabel.snp.makeConstraints { make in
make.left.equalTo(avarImgView.snp.right).offset(16)
make.top.equalTo(avarImgView)
make.right.equalTo(arrowImgView.snp.left)
make.height.equalTo(29.0)
}
vipImgView.snp.makeConstraints { make in
make.width.equalTo(43)
make.height.equalTo(16)
make.centerY.equalTo(userNameLabel)
make.left.equalTo(userNameLabel.snp.right).offset(8)
make.right.lessThanOrEqualTo(arrowImgView.snp.left).offset(0)
}
likeLabel.snp.makeConstraints { make in
make.left.equalTo(userNameLabel)
make.right.equalTo(line1View.snp.left).offset(-12)
......@@ -196,17 +218,38 @@ class YHMyUserInfoView: UIView {
make.right.equalTo(0)
}
enterBtn.snp.makeConstraints { make in
make.right.top.bottom.equalToSuperview()
make.width.equalTo(enterBtn.snp.height)
}
update(count: 0, label: likeLabel)
update(count: 0, label: collectLabel)
update(count: 0, label: scanLabel)
}
@objc func enterBtnClicked() {
enterClick?()
}
func updateAvatar() {
let headImgName = YHLoginManager.shared.isLogin() ? "people_head_default" : "mine_head_logout"
avarImgView.image = UIImage(named: headImgName)
}
func updateLikeCollectCount(_ model: YHCollectionModel) {
update(count: model.myLikeCount, label: likeLabel)
update(count: model.myCollectCount, label: collectLabel)
update(count: model.myViewCount, label: scanLabel)
}
func update(count: Int, label: UILabel) {
var text = ""
var count = "\(count) "
var countStr = count < 10000 ? String(count) : String(format: "%.1fw", Double(count/1000)/10.0)
if label.tag == Self.likeTag {
text = "点赞"
......@@ -215,13 +258,12 @@ class YHMyUserInfoView: UIView {
} else if label.tag == Self.scanTag {
text = "最近浏览"
}
let attrStr = NSMutableAttributedString(string: "")
let countAttrStr = NSAttributedString(
string: count,
string: countStr,
attributes: [NSAttributedString.Key.foregroundColor: UIColor.mainTextColor,
NSAttributedString.Key.font: UIFont(name: "DINAlternate-Bold", size: 14)!])
let titleAttrStr = NSAttributedString(
......
//
// YHUserVipInfoView.swift
// galaxy
//
// Created by Dufet on 2025/2/14.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHUserVipFunctionInfoView: UIView {
var title: String = "" {
didSet {
titleLabel.text = title
}
}
var desc: String = "" {
didSet {
descLabel.text = desc
}
}
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .white
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize: 12)
return label
}()
lazy var descLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hex: 0xFFFFFF, alpha: 0.6)
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize: 10)
return label
}()
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xFFFFFF, alpha: 0.16)
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.clipsToBounds = true
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func createUI() {
self.addSubview(lineView)
self.addSubview(titleLabel)
self.addSubview(descLabel)
lineView.snp.makeConstraints { make in
make.width.equalTo(1)
make.height.equalTo(33)
make.left.equalTo(0)
make.centerY.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-5)
make.top.equalTo(12)
make.height.equalTo(17)
}
descLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-5)
make.top.equalTo(titleLabel.snp.bottom).offset(2)
make.height.equalTo(14)
}
}
}
class YHUserVipInfoView: UIView {
lazy var bgImgView: UIImageView = {
let imgV = UIImageView()
imgV.image = UIImage(named: "mine_member_bg_vip_1")
return imgV
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.text = "大众会员"
label.textColor = .white
label.textAlignment = .left
label.font = UIFont.PFSC_B(ofSize: 17)
return label
}()
lazy var growValueLabel: UILabel = {
let label = UILabel()
label.textAlignment = .left
return label
}()
lazy var function1View: YHUserVipFunctionInfoView = {
let v = YHUserVipFunctionInfoView(frame: .zero)
v.lineView.isHidden = true
v.title = "舒适出行"
v.desc = "深港专车服务"
return v
}()
lazy var function2View: YHUserVipFunctionInfoView = {
let v = YHUserVipFunctionInfoView(frame: .zero)
v.title = "奢华会客"
v.desc = "北上深港体验中心"
return v
}()
lazy var function3View: YHUserVipFunctionInfoView = {
let v = YHUserVipFunctionInfoView(frame: .zero)
v.title = "高端私董会"
v.desc = "打造高端人脉圈子"
return v
}()
lazy var rightBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .init(hex:0x323849)
btn.titleLabel?.font = .PFSC_M(ofSize:10)
btn.setTitle("更多权益", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.layer.cornerRadius = 15.0
return btn
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.clipsToBounds = true
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func createUI() {
self.addSubview(bgImgView)
self.addSubview(titleLabel)
self.addSubview(growValueLabel)
self.addSubview(rightBtn)
self.addSubview(function1View)
self.addSubview(function2View)
self.addSubview(function3View)
bgImgView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.bottom.equalTo(self.snp.centerY).offset(-16)
make.left.equalTo(16)
make.height.equalTo(24)
make.width.equalTo(68)
}
growValueLabel.snp.makeConstraints { make in
make.centerY.equalTo(titleLabel)
make.left.equalTo(titleLabel.snp.right).offset(4)
make.height.equalTo(17)
make.right.equalTo(rightBtn.snp.left).offset(-16)
}
rightBtn.snp.makeConstraints { make in
make.height.equalTo(30)
make.width.equalTo(72)
make.centerY.equalTo(titleLabel)
make.right.equalTo(-16)
}
function1View.snp.makeConstraints { make in
make.left.equalTo(0)
make.top.equalTo(self.snp.centerY)
make.bottom.equalTo(0)
make.width.equalTo(function2View)
}
function2View.snp.makeConstraints { make in
make.left.equalTo(function1View.snp.right)
make.top.equalTo(function1View)
make.bottom.equalTo(0)
make.width.equalTo(function3View)
}
function3View.snp.makeConstraints { make in
make.left.equalTo(function2View.snp.right)
make.right.equalTo(0)
make.top.equalTo(function1View)
make.bottom.equalTo(0)
}
self.update(growValue: 0)
}
func update(growValue: Int) {
let text = "当前成长值"
let count = " \(growValue)"
let attrStr = NSMutableAttributedString(string: "")
let countAttrStr = NSAttributedString(
string: count,
attributes: [NSAttributedString.Key.foregroundColor: UIColor(hex: 0xFFFFFF, alpha: 0.6),
NSAttributedString.Key.font: UIFont(name: "DINAlternate-Bold", size: 13)!])
let titleAttrStr = NSAttributedString(
string: text,
attributes: [NSAttributedString.Key.foregroundColor: UIColor(hex: 0xFFFFFF, alpha: 0.6),
NSAttributedString.Key.font: UIFont.PFSC_R(ofSize: 12)])
attrStr.append(titleAttrStr)
attrStr.append(countAttrStr)
growValueLabel.attributedText = attrStr
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033197226@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033197226@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033197225@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033197225@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033197211@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033197211@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033197212@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033197212@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