Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
9b418d2a
Commit
9b418d2a
authored
Jun 25, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '630-dev' of
http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS
into 630-dev
parents
48923549
f38d9c52
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
538 additions
and
90 deletions
+538
-90
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+28
-0
YHActivityListViewController.swift
...ity(社区)/Activity(活动)/C/YHActivityListViewController.swift
+25
-35
YHActivityListModel.swift
...es/Community(社区)/Activity(活动)/M/YHActivityListModel.swift
+16
-0
YHActivityModel.swift
...odules/Community(社区)/Activity(活动)/M/YHActivityModel.swift
+23
-0
YHActivityViewModel.swift
...s/Community(社区)/Activity(活动)/VM/YHActivityViewModel.swift
+110
-0
YHInformationAuthorizationStepOneViewController.swift
...)/C/YHInformationAuthorizationStepOneViewController.swift
+1
-0
YHInformationAuthorizationStepTwoViewController.swift
...)/C/YHInformationAuthorizationStepTwoViewController.swift
+6
-2
YHMyNameCardViewController.swift
.../Modules/Community(社区)/C/YHMyNameCardViewController.swift
+6
-1
YHPeopleViewController.swift
...sses/Modules/Community(社区)/C/YHPeopleViewController.swift
+4
-7
YHMyInformationItemCell.swift
...ses/Modules/Community(社区)/V/YHMyInformationItemCell.swift
+9
-1
YHPeopleSuccessView.swift
...Classes/Modules/Community(社区)/V/YHPeopleSuccessView.swift
+0
-1
YHEditBaseUserInfoViewController.swift
...我的)/MyCard(我的名片)/C/YHEditBaseUserInfoViewController.swift
+18
-2
YHEditHonorViewController.swift
...s/Mine(我的)/MyCard(我的名片)/C/YHEditHonorViewController.swift
+9
-1
YHEditInterestViewController.swift
...ine(我的)/MyCard(我的名片)/C/YHEditInterestViewController.swift
+30
-4
YHEditPersonalProfileViewController.swift
.../MyCard(我的名片)/C/YHEditPersonalProfileViewController.swift
+9
-1
YHEditSchoolViewController.swift
.../Mine(我的)/MyCard(我的名片)/C/YHEditSchoolViewController.swift
+8
-1
YHEditWorkViewController.swift
...es/Mine(我的)/MyCard(我的名片)/C/YHEditWorkViewController.swift
+8
-1
YHEditBaseInfoFootView.swift
...ules/Mine(我的)/MyCard(我的名片)/V/YHEditBaseInfoFootView.swift
+1
-0
YHEditViewModel.swift
...es/Modules/Mine(我的)/MyCard(我的名片)/VM/YHEditViewModel.swift
+140
-1
YHConstantArrayData.swift
galaxy/galaxy/Classes/Tools/Helper/YHConstantArrayData.swift
+12
-12
YHAllApiName.swift
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
+9
-2
YHNetRequest.swift
galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
+18
-11
YHOSSManager.swift
galaxy/galaxy/Classes/Tools/Upload/YHOSSManager.swift
+48
-7
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
9b418d2a
...
@@ -371,6 +371,9 @@
...
@@ -371,6 +371,9 @@
A520124F2BABCE05008655EA
/* YHFileListContentView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A520124E2BABCE05008655EA
/* YHFileListContentView.swift */
;
};
A520124F2BABCE05008655EA
/* YHFileListContentView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A520124E2BABCE05008655EA
/* YHFileListContentView.swift */
;
};
A53B61122BB128AF0010B573
/* YHFileListItemsView2.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A53B61112BB128AF0010B573
/* YHFileListItemsView2.swift */
;
};
A53B61122BB128AF0010B573
/* YHFileListItemsView2.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A53B61112BB128AF0010B573
/* YHFileListItemsView2.swift */
;
};
A53B61192BB3C9960010B573
/* YHMyDocListHeaderView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A53B61182BB3C9960010B573
/* YHMyDocListHeaderView.swift */
;
};
A53B61192BB3C9960010B573
/* YHMyDocListHeaderView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A53B61182BB3C9960010B573
/* YHMyDocListHeaderView.swift */
;
};
A540342F2C2A606900E63A20
/* YHActivityListModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A540342E2C2A606900E63A20
/* YHActivityListModel.swift */
;
};
A54034312C2A612100E63A20
/* YHActivityModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A54034302C2A612100E63A20
/* YHActivityModel.swift */
;
};
A54034342C2A621000E63A20
/* YHActivityViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A54034332C2A621000E63A20
/* YHActivityViewModel.swift */
;
};
A554A5122B99715000EA5973
/* YHConstantArrayData.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A554A5112B99715000EA5973
/* YHConstantArrayData.swift */
;
};
A554A5122B99715000EA5973
/* YHConstantArrayData.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A554A5112B99715000EA5973
/* YHConstantArrayData.swift */
;
};
A5551FFE2B4C26CE00510980
/* YHBaseViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5551FFD2B4C26CE00510980
/* YHBaseViewModel.swift */
;
};
A5551FFE2B4C26CE00510980
/* YHBaseViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5551FFD2B4C26CE00510980
/* YHBaseViewModel.swift */
;
};
A5573ED22B317BFF00D98EC0
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5573ED12B317BFF00D98EC0
/* AppDelegate.swift */
;
};
A5573ED22B317BFF00D98EC0
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5573ED12B317BFF00D98EC0
/* AppDelegate.swift */
;
};
...
@@ -933,6 +936,9 @@
...
@@ -933,6 +936,9 @@
A520124E2BABCE05008655EA
/* YHFileListContentView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHFileListContentView.swift
;
sourceTree
=
"<group>"
;
};
A520124E2BABCE05008655EA
/* YHFileListContentView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHFileListContentView.swift
;
sourceTree
=
"<group>"
;
};
A53B61112BB128AF0010B573
/* YHFileListItemsView2.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHFileListItemsView2.swift
;
sourceTree
=
"<group>"
;
};
A53B61112BB128AF0010B573
/* YHFileListItemsView2.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHFileListItemsView2.swift
;
sourceTree
=
"<group>"
;
};
A53B61182BB3C9960010B573
/* YHMyDocListHeaderView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMyDocListHeaderView.swift
;
sourceTree
=
"<group>"
;
};
A53B61182BB3C9960010B573
/* YHMyDocListHeaderView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMyDocListHeaderView.swift
;
sourceTree
=
"<group>"
;
};
A540342E2C2A606900E63A20
/* YHActivityListModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHActivityListModel.swift
;
sourceTree
=
"<group>"
;
};
A54034302C2A612100E63A20
/* YHActivityModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHActivityModel.swift
;
sourceTree
=
"<group>"
;
};
A54034332C2A621000E63A20
/* YHActivityViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHActivityViewModel.swift
;
sourceTree
=
"<group>"
;
};
A554A5112B99715000EA5973
/* YHConstantArrayData.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHConstantArrayData.swift
;
sourceTree
=
"<group>"
;
};
A554A5112B99715000EA5973
/* YHConstantArrayData.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHConstantArrayData.swift
;
sourceTree
=
"<group>"
;
};
A5551FFD2B4C26CE00510980
/* YHBaseViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHBaseViewModel.swift
;
sourceTree
=
"<group>"
;
};
A5551FFD2B4C26CE00510980
/* YHBaseViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHBaseViewModel.swift
;
sourceTree
=
"<group>"
;
};
A5573ECE2B317BFF00D98EC0
/* galaxy.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
galaxy.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
A5573ECE2B317BFF00D98EC0
/* galaxy.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
galaxy.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
...
@@ -2301,6 +2307,23 @@
...
@@ -2301,6 +2307,23 @@
path
=
V
;
path
=
V
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
A540342D2C2A602500E63A20
/* M */
=
{
isa
=
PBXGroup
;
children
=
(
A540342E2C2A606900E63A20
/* YHActivityListModel.swift */
,
A54034302C2A612100E63A20
/* YHActivityModel.swift */
,
);
path
=
M
;
sourceTree
=
"<group>"
;
};
A54034322C2A61E500E63A20
/* VM */
=
{
isa
=
PBXGroup
;
children
=
(
A54034332C2A621000E63A20
/* YHActivityViewModel.swift */
,
);
path
=
VM
;
sourceTree
=
"<group>"
;
};
A5573EC52B317BFF00D98EC0
=
{
A5573EC52B317BFF00D98EC0
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -2360,6 +2383,8 @@
...
@@ -2360,6 +2383,8 @@
A566A79D2C228C8C00980D06
/* Activity(活动) */
=
{
A566A79D2C228C8C00980D06
/* Activity(活动) */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
A54034322C2A61E500E63A20
/* VM */
,
A540342D2C2A602500E63A20
/* M */
,
A566A7A02C228DDE00980D06
/* V */
,
A566A7A02C228DDE00980D06
/* V */
,
A566A79F2C228DB500980D06
/* C */
,
A566A79F2C228DB500980D06
/* C */
,
);
);
...
@@ -3167,6 +3192,7 @@
...
@@ -3167,6 +3192,7 @@
A5ACE9292B4564F7002C94D2
/* YHSmsCodeInputView.swift in Sources */
,
A5ACE9292B4564F7002C94D2
/* YHSmsCodeInputView.swift in Sources */
,
A5ACE9452B4564F7002C94D2
/* YHHUDContainerView.swift in Sources */
,
A5ACE9452B4564F7002C94D2
/* YHHUDContainerView.swift in Sources */
,
045EEEFD2B9F171A0022A143
/* YHSheetPickerViewType.swift in Sources */
,
045EEEFD2B9F171A0022A143
/* YHSheetPickerViewType.swift in Sources */
,
A54034342C2A621000E63A20
/* YHActivityViewModel.swift in Sources */
,
045EEEC72B9F171A0022A143
/* YHOtherYesOrNoItemView.swift in Sources */
,
045EEEC72B9F171A0022A143
/* YHOtherYesOrNoItemView.swift in Sources */
,
04FD85702C21646200BEF9C5
/* YHMyInterestTopicCell.swift in Sources */
,
04FD85702C21646200BEF9C5
/* YHMyInterestTopicCell.swift in Sources */
,
04A7BD172BA43A0F00BD35A2
/* YHMyDocumentsDetailViewModel.swift in Sources */
,
04A7BD172BA43A0F00BD35A2
/* YHMyDocumentsDetailViewModel.swift in Sources */
,
...
@@ -3488,6 +3514,7 @@
...
@@ -3488,6 +3514,7 @@
A5DF3D462BF72BA1003D5F03
/* YHTestViewController.swift in Sources */
,
A5DF3D462BF72BA1003D5F03
/* YHTestViewController.swift in Sources */
,
A566A79C2C227C9B00980D06
/* YHOrderTipsItemView.swift in Sources */
,
A566A79C2C227C9B00980D06
/* YHOrderTipsItemView.swift in Sources */
,
A517A4E52BB6C4BB000DEECD
/* YHDocumentFileItemView.swift in Sources */
,
A517A4E52BB6C4BB000DEECD
/* YHDocumentFileItemView.swift in Sources */
,
A540342F2C2A606900E63A20
/* YHActivityListModel.swift in Sources */
,
045EEEFE2B9F171A0022A143
/* YHFormItemInputTextCell.swift in Sources */
,
045EEEFE2B9F171A0022A143
/* YHFormItemInputTextCell.swift in Sources */
,
045EEEDD2B9F171A0022A143
/* YHCollegeNameCell.swift in Sources */
,
045EEEDD2B9F171A0022A143
/* YHCollegeNameCell.swift in Sources */
,
045EEF162B9F171A0022A143
/* YHMainApplicantInformationViewController.swift in Sources */
,
045EEF162B9F171A0022A143
/* YHMainApplicantInformationViewController.swift in Sources */
,
...
@@ -3582,6 +3609,7 @@
...
@@ -3582,6 +3609,7 @@
A5F8AC082B9F414000A21EFA
/* YHCustomTextView.swift in Sources */
,
A5F8AC082B9F414000A21EFA
/* YHCustomTextView.swift in Sources */
,
0414BDAD2BC7F02C00225367
/* YHMyNotifySettingVC.swift in Sources */
,
0414BDAD2BC7F02C00225367
/* YHMyNotifySettingVC.swift in Sources */
,
0425E6402BA9357D00A5E763
/* YHScemeItemModel.swift in Sources */
,
0425E6402BA9357D00A5E763
/* YHScemeItemModel.swift in Sources */
,
A54034312C2A612100E63A20
/* YHActivityModel.swift in Sources */
,
A5D335F92BCE51E700236F21
/* YHServiceCenterProgressModel.swift in Sources */
,
A5D335F92BCE51E700236F21
/* YHServiceCenterProgressModel.swift in Sources */
,
045EEECC2B9F171A0022A143
/* YHScoreResultModel.swift in Sources */
,
045EEECC2B9F171A0022A143
/* YHScoreResultModel.swift in Sources */
,
045EEEDC2B9F171A0022A143
/* YHQualificationDetailVC.swift in Sources */
,
045EEEDC2B9F171A0022A143
/* YHQualificationDetailVC.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/C/YHActivityListViewController.swift
View file @
9b418d2a
...
@@ -16,6 +16,11 @@ class YHActivityListViewController: YHBaseViewController {
...
@@ -16,6 +16,11 @@ class YHActivityListViewController: YHBaseViewController {
var
type
:
Int
=
0
//0-活动列表 1-我的报名活动
var
type
:
Int
=
0
//0-活动列表 1-我的报名活动
lazy
var
viewModel
:
YHActivityViewModel
=
{
let
vm
=
YHActivityViewModel
()
return
vm
}()
lazy
var
tableView
:
UITableView
=
{
lazy
var
tableView
:
UITableView
=
{
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
tableView
.
showsVerticalScrollIndicator
=
false
tableView
.
showsVerticalScrollIndicator
=
false
...
@@ -44,9 +49,8 @@ class YHActivityListViewController: YHBaseViewController {
...
@@ -44,9 +49,8 @@ class YHActivityListViewController: YHBaseViewController {
gk_navigationBar
.
isHidden
=
true
gk_navigationBar
.
isHidden
=
true
gk_navigationBar
.
backgroundColor
=
.
white
gk_navigationBar
.
backgroundColor
=
.
white
view
.
addSubview
(
tableView
)
view
.
addSubview
(
tableView
)
if
type
==
1
{
if
type
==
1
{
gk_navTitle
=
"我的活动"
gk_navTitle
=
"我的活动"
gk_navigationBar
.
isHidden
=
false
gk_navigationBar
.
isHidden
=
false
...
@@ -76,10 +80,8 @@ class YHActivityListViewController: YHBaseViewController {
...
@@ -76,10 +80,8 @@ class YHActivityListViewController: YHBaseViewController {
self
.
loadMoreData
()
self
.
loadMoreData
()
}
}
emptyDataTipsView
.
isHidden
=
friendsArr
.
count
>
0
?
true
:
false
loadFirstData
()
}
}
var
friendsArr
:[
String
]
=
[
""
,
""
,
""
,
""
]
}
}
extension
YHActivityListViewController
{
extension
YHActivityListViewController
{
...
@@ -106,42 +108,30 @@ extension YHActivityListViewController {
...
@@ -106,42 +108,30 @@ extension YHActivityListViewController {
}
}
func
loadFirstData
()
{
func
loadFirstData
()
{
// self.viewModel.getHomeNewsList(firstPageFlag : true) {[weak self] success, error in
self
.
viewModel
.
getActivityList
(
firstPageFlag
:
true
)
{[
weak
self
]
success
,
error
in
// guard let self = self else { return }
guard
let
self
=
self
else
{
return
}
//
// if let arrB = self.viewModel.arrHomeNewsData,arrB.count > 0 {
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
0.5
,
execute
:
{
// let arrString = arrB.toJSONString()
self
.
tableView
.
es
.
stopPullToRefresh
()
// UserDefaults.standard.set(arrString, forKey: "homeFirstPageNewsData")
// UserDefaults.standard.synchronize()
// }
if
self
.
viewModel
.
hasMoreForActivityList
==
false
{
//
self
.
tableView
.
es
.
noticeNoMoreData
()
// DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {
self
.
tableView
.
footer
?
.
alpha
=
1
// self.homeCollectView.es.stopPullToRefresh()
}
//
self
.
tableView
.
reloadData
()
//
// if self.viewModel.hasMoreForHomeNews == false {
self
.
emptyDataTipsView
.
isHidden
=
self
.
viewModel
.
arrActivityListData
.
count
>
0
?
true
:
false
// self.homeCollectView.es.noticeNoMoreData()
})
// self.homeCollectView.footer?.alpha = 1
}
// }
//
// CATransaction.setDisableActions(true)
// self.homeCollectView.reloadData()
// CATransaction.commit()
// })
// }
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
0.5
,
execute
:
{
self
.
tableView
.
es
.
stopPullToRefresh
()
})
}
}
}
}
extension
YHActivityListViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
extension
YHActivityListViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
if
self
.
friendsArr
.
count
>
0
{
if
viewModel
.
arrActivityListData
.
count
>
0
{
return
friendsArr
.
count
return
viewModel
.
arrActivityListData
.
count
}
}
return
0
return
0
}
}
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/M/YHActivityListModel.swift
0 → 100644
View file @
9b418d2a
//
// YHActivityListModel.swift
// galaxy
//
// Created by davidhuangA on 2024/6/25.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHActivityListModel
:
YHBaseModel
{
var
total
:
String
=
""
var
data
:
[
YHActivityModel
]
=
[]
required
init
()
{
}
}
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/M/YHActivityModel.swift
0 → 100644
View file @
9b418d2a
//
// YHActivityModel.swift
// galaxy
//
// Created by davidhuangA on 2024/6/25.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHActivityModel
:
YHBaseModel
{
var
id
:
Int
=
0
var
tag
:
Int
=
0
var
name
:
String
=
""
var
cover
:
String
=
""
var
beginTime
:
String
=
""
var
endTime
:
String
=
""
var
place
:
String
=
""
var
status
:
String
=
""
// required init() {
//
// }
}
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/VM/YHActivityViewModel.swift
0 → 100644
View file @
9b418d2a
//
// YHActivityViewModel.swift
// galaxy
//
// Created by davidhuangA on 2024/6/25.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHActivityViewModel
:
YHBaseViewModel
{
//1、活动列表
var
hasMoreForActivityList
:
Bool
=
true
var
isRequestActivityListDataFlag
:
Bool
=
false
private
var
curPageIndex
:
Int
=
1
private
var
page_Size
:
Int
=
20
private
var
totalCount
:
Int
=
0
var
arrActivityListData
:
[
YHActivityModel
]
=
[]
//2.
}
extension
YHActivityViewModel
{
/*
firstPageFlag true - 首次 false - 更多
*/
func
getActivityList
(
firstPageFlag
:
Bool
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
if
firstPageFlag
==
false
{
guard
hasMoreForActivityList
==
true
else
{
printLog
(
"无更多数据可请求"
)
return
}
}
guard
isRequestActivityListDataFlag
==
false
else
{
printLog
(
"正在进行请求"
)
return
}
isRequestActivityListDataFlag
=
true
var
params
:
[
String
:
Any
]
=
[
"page"
:
curPageIndex
,
"page_size"
:
page_Size
]
if
firstPageFlag
{
params
=
[
"page"
:
1
,
"page_size"
:
page_Size
]
}
else
{
params
=
[
"page"
:
curPageIndex
+
1
,
"page_size"
:
page_Size
]
}
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Activity
.
listApi
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
guard
let
self
=
self
else
{
return
}
self
.
isRequestActivityListDataFlag
=
false
//1. json字符串 转 对象
if
json
.
code
==
200
{
let
dic
=
json
.
data
guard
let
result
=
YHActivityListModel
.
deserialize
(
from
:
dic
as?
Dictionary
)
else
{
self
.
arrActivityListData
=
[]
callBackBlock
(
false
,
nil
)
return
}
if
firstPageFlag
{
self
.
totalCount
=
Int
(
result
.
total
)
??
0
self
.
arrActivityListData
=
result
.
data
curPageIndex
=
1
}
else
{
curPageIndex
=
curPageIndex
+
1
self
.
arrActivityListData
.
append
(
contentsOf
:
result
.
data
)
}
if
result
.
data
.
count
>=
page_Size
{
if
self
.
arrActivityListData
.
count
>=
self
.
totalCount
{
self
.
hasMoreForActivityList
=
false
}
else
{
self
.
hasMoreForActivityList
=
true
}
}
else
{
self
.
hasMoreForActivityList
=
false
}
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
self
.
isRequestActivityListDataFlag
=
false
callBackBlock
(
false
,
err
)
}
}
}
galaxy/galaxy/Classes/Modules/Community(社区)/C/YHInformationAuthorizationStepOneViewController.swift
View file @
9b418d2a
...
@@ -195,6 +195,7 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
...
@@ -195,6 +195,7 @@ class YHInformationAuthorizationStepOneViewController: YHBaseViewController {
viewModel
.
requestSaveUserInfo
{[
weak
self
]
success
,
error
in
viewModel
.
requestSaveUserInfo
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
vc
=
YHInformationAuthorizationStepTwoViewController
()
let
vc
=
YHInformationAuthorizationStepTwoViewController
()
vc
.
name
=
self
.
viewModel
.
model
.
username
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/C/YHInformationAuthorizationStepTwoViewController.swift
View file @
9b418d2a
...
@@ -16,7 +16,7 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController {
...
@@ -16,7 +16,7 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController {
var
items
:
[
YHSettingItem
]
=
[
YHSettingItem
(
type
:
.
normal
,
title
:
"允许您的信息在名片中使用"
,
subTitle
:
"开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见"
,
isSelect
:
true
,
isShowAlert
:
false
)]
var
items
:
[
YHSettingItem
]
=
[
YHSettingItem
(
type
:
.
normal
,
title
:
"允许您的信息在名片中使用"
,
subTitle
:
"开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见"
,
isSelect
:
true
,
isShowAlert
:
false
)]
var
viewModel
:
YHInformationAuthorizeViewModel
=
YHInformationAuthorizeViewModel
()
var
viewModel
:
YHInformationAuthorizeViewModel
=
YHInformationAuthorizeViewModel
()
var
stepFlag
:
Bool
=
true
var
stepFlag
:
Bool
=
true
var
name
:
String
=
""
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
setView
()
setView
()
...
@@ -116,7 +116,11 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController {
...
@@ -116,7 +116,11 @@ class YHInformationAuthorizationStepTwoViewController: UIViewController {
@objc
func
nextStep
()
{
@objc
func
nextStep
()
{
viewModel
.
requestAuthorizationSubmit
{[
weak
self
]
success
,
error
in
viewModel
.
requestAuthorizationSubmit
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
navigationController
?
.
popViewController
(
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
)
}
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/C/YHMyNameCardViewController.swift
View file @
9b418d2a
...
@@ -122,9 +122,11 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -122,9 +122,11 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
if
cardInfo
.
type
==
.
honor
{
if
cardInfo
.
type
==
.
honor
{
let
vc
=
YHEditHonorViewController
()
let
vc
=
YHEditHonorViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
else
if
cardInfo
.
type
==
.
introduce
{
}
else
if
cardInfo
.
type
==
.
introduce
{
let
vc
=
YHEditPersonalProfileViewController
()
let
vc
=
YHEditPersonalProfileViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
}
}
...
@@ -137,6 +139,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -137,6 +139,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
eduCell
.
editBlock
=
{
[
weak
self
]
in
eduCell
.
editBlock
=
{
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
vc
=
YHEditSchoolViewController
()
let
vc
=
YHEditSchoolViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
return
eduCell
return
eduCell
...
@@ -148,6 +151,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -148,6 +151,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
workCell
.
editBlock
=
{
[
weak
self
]
in
workCell
.
editBlock
=
{
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
vc
=
YHEditWorkViewController
()
let
vc
=
YHEditWorkViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
return
workCell
return
workCell
...
@@ -159,6 +163,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -159,6 +163,7 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
topicCell
.
editBlock
=
{
[
weak
self
]
in
topicCell
.
editBlock
=
{
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
vc
=
YHEditInterestViewController
()
let
vc
=
YHEditInterestViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
return
topicCell
return
topicCell
...
@@ -170,9 +175,9 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -170,9 +175,9 @@ extension YHMyNameCardViewController: UITableViewDelegate, UITableViewDataSource
cell
.
editBlock
=
{
[
weak
self
]
in
cell
.
editBlock
=
{
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
vc
=
YHEditBaseUserInfoViewController
()
let
vc
=
YHEditBaseUserInfoViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
return
cell
return
cell
}
}
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/C/YHPeopleViewController.swift
View file @
9b418d2a
...
@@ -148,14 +148,11 @@ class YHPeopleViewController: YHBaseViewController {
...
@@ -148,14 +148,11 @@ class YHPeopleViewController: YHBaseViewController {
@objc
func
didMatchBtnClicked
()
{
@objc
func
didMatchBtnClicked
()
{
if
true
{
//
if true {
startMatchUsers
()
//
startMatchUsers()
return
//
return
}
//
}
// let view = YHPeopleSuccessView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
// let window = UIApplication.shared.yhKeyWindow()
// window?.addSubview(view)
let
vc
=
YHInformationAuthorizationStepOneViewController
()
let
vc
=
YHInformationAuthorizationStepOneViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/V/YHMyInformationItemCell.swift
View file @
9b418d2a
...
@@ -116,6 +116,14 @@ class YHMyInformationItemCell: UITableViewCell {
...
@@ -116,6 +116,14 @@ class YHMyInformationItemCell: UITableViewCell {
titleLabel
.
attributedText
=
questionAttrStr
titleLabel
.
attributedText
=
questionAttrStr
messageTextField
.
placeholder
=
dataSource
.
prompts
messageTextField
.
placeholder
=
dataSource
.
prompts
messageTextField
.
text
=
dataSource
.
message
messageTextField
.
text
=
dataSource
.
message
if
dataSource
.
type
==
.
constellation
{
let
arr
=
YHConstantArrayData
.
arrDegreeConstellation
arr
.
forEach
{
item
in
if
item
[
"id"
]
==
dataSource
.
message
{
messageTextField
.
text
=
item
[
"title"
]
}
}
}
if
dataSource
.
isUserKeyBoard
??
false
{
if
dataSource
.
isUserKeyBoard
??
false
{
nextStepImageView
.
isHidden
=
true
nextStepImageView
.
isHidden
=
true
centerButton
.
isHidden
=
true
centerButton
.
isHidden
=
true
...
@@ -175,7 +183,7 @@ class YHMyInformationItemCell: UITableViewCell {
...
@@ -175,7 +183,7 @@ class YHMyInformationItemCell: UITableViewCell {
case
.
constellation
:
case
.
constellation
:
YHOtherPickerView
.
show
(
type
:
.
constellation
,
selectTitle
:
self
.
dataSource
?
.
message
??
""
)
{
item
in
YHOtherPickerView
.
show
(
type
:
.
constellation
,
selectTitle
:
self
.
dataSource
?
.
message
??
""
)
{
item
in
print
(
item
)
print
(
item
)
self
.
dataSource
?
.
message
=
item
.
title
self
.
dataSource
?
.
message
=
item
.
index
self
.
updateAllViews
()
self
.
updateAllViews
()
if
let
block
=
self
.
block
{
if
let
block
=
self
.
block
{
block
(
self
.
dataSource
??
YHUserInformationModel
())
block
(
self
.
dataSource
??
YHUserInformationModel
())
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/V/YHPeopleSuccessView.swift
View file @
9b418d2a
...
@@ -16,7 +16,6 @@ class YHPeopleSuccessView: UIView {
...
@@ -16,7 +16,6 @@ class YHPeopleSuccessView: UIView {
var
bottomImageView
:
UIImageView
!
var
bottomImageView
:
UIImageView
!
var
bottomButton
:
UIButton
!
var
bottomButton
:
UIButton
!
override
init
(
frame
:
CGRect
)
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
backgroundColor
=
UIColor
(
white
:
0.5
,
alpha
:
0.1
)
backgroundColor
=
UIColor
(
white
:
0.5
,
alpha
:
0.1
)
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/MyCard(我的名片)/C/YHEditBaseUserInfoViewController.swift
View file @
9b418d2a
...
@@ -128,15 +128,31 @@ class YHEditBaseUserInfoViewController: YHBaseViewController {
...
@@ -128,15 +128,31 @@ class YHEditBaseUserInfoViewController: YHBaseViewController {
YHImagePickerView
.
show
()
{[
weak
self
]
image
in
YHImagePickerView
.
show
()
{[
weak
self
]
image
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
photoImageView
.
image
=
image
self
.
photoImageView
.
image
=
image
self
.
viewModel
.
uploadImage
(
image
,
true
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
model
.
avatar
=
success
??
""
}
}
}
}
}
@objc
func
changeHead
()
{
@objc
func
changeHead
()
{
viewModel
.
requestChangeHead
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
let
url
=
URL
(
string
:
self
.
viewModel
.
model
.
avatar
)
self
.
photoImageView
.
kf
.
setImage
(
with
:
url
)
}
}
}
@objc
func
nextStep
()
{
@objc
func
nextStep
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
self
.
viewModel
.
model
.
signature
=
footView
.
messageTextField
.
text
viewModel
.
requestSaveUserInfo
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
{
YHHUD
.
flash
(
message
:
"保存失败"
)
}
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/MyCard(我的名片)/C/YHEditHonorViewController.swift
View file @
9b418d2a
...
@@ -109,7 +109,15 @@ class YHEditHonorViewController: YHBaseViewController {
...
@@ -109,7 +109,15 @@ class YHEditHonorViewController: YHBaseViewController {
}
}
@objc
func
nextStep
()
{
@objc
func
nextStep
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
viewModel
.
model
.
honor
=
messageTextField
.
text
viewModel
.
requestSaveAward
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
{
YHHUD
.
flash
(
message
:
"保存失败"
)
}
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/MyCard(我的名片)/C/YHEditInterestViewController.swift
View file @
9b418d2a
...
@@ -12,8 +12,8 @@ import IQKeyboardManagerSwift
...
@@ -12,8 +12,8 @@ import IQKeyboardManagerSwift
class
YHEditInterestViewController
:
YHBaseViewController
{
class
YHEditInterestViewController
:
YHBaseViewController
{
var
collectionView
:
UICollectionView
!
var
collectionView
:
UICollectionView
!
var
nextButton
:
UIButton
!
var
nextButton
:
UIButton
!
var
normalItems
:
[
YHInterestModel
]
=
[
YHInterestModel
(
name
:
"香港子女教育"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港房产"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港创业"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港就业"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"
香港保险"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港商务"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"企业家"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"ENTJ指挥家"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"ENTP辩论家"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"INTJ建筑师
"
,
isNormal
:
true
,
isSelect
:
false
)]
var
normalItems
:
[
YHInterestModel
]
=
[
YHInterestModel
(
name
:
"香港子女教育"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港房产"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港创业"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港就业"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"
港宝"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港保险"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"香港商务"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"ESTP(企业家)"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"ENTJ(指挥官)"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"ENTP(辩论家)"
,
isNormal
:
true
,
isSelect
:
false
),
YHInterestModel
(
name
:
"INTJ(建筑师)
"
,
isNormal
:
true
,
isSelect
:
false
)]
var
likeItems
:
[
YHInterestModel
]
=
[
YHInterestModel
(
name
:
"
ENTP辩论家"
,
isNormal
:
false
,
isSelect
:
false
),
YHInterestModel
(
name
:
"
+自定义"
,
isNormal
:
false
,
isSelect
:
true
)]
var
likeItems
:
[
YHInterestModel
]
=
[
YHInterestModel
(
name
:
"+自定义"
,
isNormal
:
false
,
isSelect
:
true
)]
var
viewModel
:
YHEditViewModel
=
YHEditViewModel
()
var
viewModel
:
YHEditViewModel
=
YHEditViewModel
()
var
model
:
YHUserNameCardInfo
=
YHUserNameCardInfo
()
var
model
:
YHUserNameCardInfo
=
YHUserNameCardInfo
()
...
@@ -38,7 +38,15 @@ class YHEditInterestViewController: YHBaseViewController {
...
@@ -38,7 +38,15 @@ class YHEditInterestViewController: YHBaseViewController {
func
getData
()
{
func
getData
()
{
viewModel
.
model
=
model
viewModel
.
model
=
model
for
item
in
model
.
topics
{
if
let
index
=
normalItems
.
firstIndex
(
where
:
{
$0
.
name
==
item
})
{
normalItems
[
index
]
.
isSelect
=
!
normalItems
[
index
]
.
isSelect
}
else
{
let
model
=
YHInterestModel
(
name
:
item
,
isNormal
:
false
,
isSelect
:
true
)
self
.
likeItems
.
insert
(
model
,
at
:
likeItems
.
count
-
1
)
}
}
collectionView
.
reloadData
()
}
}
func
setView
()
{
func
setView
()
{
...
@@ -113,7 +121,25 @@ class YHEditInterestViewController: YHBaseViewController {
...
@@ -113,7 +121,25 @@ class YHEditInterestViewController: YHBaseViewController {
}
}
@objc
func
nextStep
()
{
@objc
func
nextStep
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
var
topics
:
[
String
]
=
[]
for
item
in
normalItems
{
if
item
.
isSelect
{
topics
.
append
(
item
.
name
)
}
}
for
like
in
likeItems
{
if
like
.
isSelect
&&
like
.
name
!=
"+自定义"
{
topics
.
append
(
like
.
name
)
}
}
viewModel
.
requestSaveTopics
(
topics
:
topics
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
{
YHHUD
.
flash
(
message
:
"保存失败"
)
}
}
}
}
// 计算文字宽度大小
// 计算文字宽度大小
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/MyCard(我的名片)/C/YHEditPersonalProfileViewController.swift
View file @
9b418d2a
...
@@ -109,7 +109,15 @@ class YHEditPersonalProfileViewController: YHBaseViewController {
...
@@ -109,7 +109,15 @@ class YHEditPersonalProfileViewController: YHBaseViewController {
}
}
@objc
func
nextStep
()
{
@objc
func
nextStep
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
viewModel
.
model
.
bio
=
messageTextField
.
text
viewModel
.
requestSavePersonalProfile
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
{
YHHUD
.
flash
(
message
:
"保存失败"
)
}
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/MyCard(我的名片)/C/YHEditSchoolViewController.swift
View file @
9b418d2a
...
@@ -71,7 +71,14 @@ class YHEditSchoolViewController: YHBaseViewController {
...
@@ -71,7 +71,14 @@ class YHEditSchoolViewController: YHBaseViewController {
}
}
@objc
func
nextStep
()
{
@objc
func
nextStep
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
viewModel
.
requestSaveSchool
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
{
YHHUD
.
flash
(
message
:
"保存失败"
)
}
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/MyCard(我的名片)/C/YHEditWorkViewController.swift
View file @
9b418d2a
...
@@ -71,7 +71,14 @@ class YHEditWorkViewController: YHBaseViewController {
...
@@ -71,7 +71,14 @@ class YHEditWorkViewController: YHBaseViewController {
}
}
@objc
func
nextStep
()
{
@objc
func
nextStep
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
viewModel
.
requestSaveWork
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
if
success
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
else
{
YHHUD
.
flash
(
message
:
"保存失败"
)
}
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/MyCard(我的名片)/V/YHEditBaseInfoFootView.swift
View file @
9b418d2a
...
@@ -137,6 +137,7 @@ extension YHEditBaseInfoFootView: UITextViewDelegate {
...
@@ -137,6 +137,7 @@ extension YHEditBaseInfoFootView: UITextViewDelegate {
}
}
numberLabel
.
text
=
textView
.
text
.
count
.
string
+
"/20"
numberLabel
.
text
=
textView
.
text
.
count
.
string
+
"/20"
}
}
func
textView
(
_
textView
:
UITextView
,
shouldChangeTextIn
range
:
NSRange
,
replacementText
text
:
String
)
->
Bool
{
func
textView
(
_
textView
:
UITextView
,
shouldChangeTextIn
range
:
NSRange
,
replacementText
text
:
String
)
->
Bool
{
let
newLength
=
(
textView
.
text
as
NSString
)
.
length
+
text
.
count
-
range
.
length
let
newLength
=
(
textView
.
text
as
NSString
)
.
length
+
text
.
count
-
range
.
length
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/MyCard(我的名片)/VM/YHEditViewModel.swift
View file @
9b418d2a
...
@@ -10,11 +10,32 @@ import UIKit
...
@@ -10,11 +10,32 @@ import UIKit
class
YHEditViewModel
:
YHBaseViewModel
{
class
YHEditViewModel
:
YHBaseViewModel
{
var
model
:
YHUserNameCardInfo
=
YHUserNameCardInfo
()
var
model
:
YHUserNameCardInfo
=
YHUserNameCardInfo
()
override
init
()
{
override
init
()
{
super
.
init
()
super
.
init
()
}
}
func
requestChangeHead
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
change
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
let
dic
=
json
.
data
guard
let
result
=
YHChangeHeadModel
.
deserialize
(
from
:
dic
as?
Dictionary
)
else
{
callBackBlock
(
false
,
nil
)
return
}
self
.
model
.
avatar
=
result
.
avatar
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
getBaseDataSource
()
->
[
YHUserInformationModel
]
{
func
getBaseDataSource
()
->
[
YHUserInformationModel
]
{
let
item1
=
YHUserInformationModel
(
id
:
.
id1
,
title
:
"真实姓名"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入您的真实姓名"
,
message
:
model
.
username
)
let
item1
=
YHUserInformationModel
(
id
:
.
id1
,
title
:
"真实姓名"
,
isUserKeyBoard
:
true
,
prompts
:
"请输入您的真实姓名"
,
message
:
model
.
username
)
let
item2
=
YHUserInformationModel
(
id
:
.
id6
,
title
:
"所在地"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择您的所在地"
,
message
:
model
.
address
.
country
,
type
:
.
country
)
let
item2
=
YHUserInformationModel
(
id
:
.
id6
,
title
:
"所在地"
,
isUserKeyBoard
:
false
,
prompts
:
"请选择您的所在地"
,
message
:
model
.
address
.
country
,
type
:
.
country
)
...
@@ -74,4 +95,122 @@ class YHEditViewModel: YHBaseViewModel {
...
@@ -74,4 +95,122 @@ class YHEditViewModel: YHBaseViewModel {
return
[
item1
,
item2
,
item3
]
return
[
item1
,
item2
,
item3
]
}
}
func
requestSaveUserInfo
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
address
:
[
String
:
Any
]
=
[
"country"
:
model
.
address
.
country
,
"province"
:
model
.
address
.
province
,
"city"
:
model
.
address
.
city
]
let
basic
:
[
String
:
Any
]
=
[
"avatar"
:
model
.
avatar
,
"username"
:
model
.
username
,
"zodiac"
:
model
.
zodiac
,
"address"
:
address
,
"signature"
:
model
.
signature
]
let
params
:
[
String
:
Any
]
=
[
"basic_info"
:
basic
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
cardSave
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestSavePersonalProfile
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
introduction
:
[
String
:
Any
]
=
[
"bio"
:
model
.
bio
]
let
params
:
[
String
:
Any
]
=
[
"introduction"
:
introduction
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
cardSave
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestSaveWork
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
work
:
[
String
:
Any
]
=
[
"company_name"
:
model
.
companyName
,
"position"
:
model
.
position
,
"industry"
:
model
.
industry
]
let
params
:
[
String
:
Any
]
=
[
"work"
:
work
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
cardSave
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestSaveSchool
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
education
:
[
String
:
Any
]
=
[
"college"
:
model
.
college
,
"major"
:
model
.
major
,
"background"
:
model
.
background
]
let
params
:
[
String
:
Any
]
=
[
"education"
:
education
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
cardSave
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestSaveAward
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
award
:
[
String
:
Any
]
=
[
"honor"
:
model
.
honor
]
let
params
:
[
String
:
Any
]
=
[
"award"
:
award
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
cardSave
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestSaveTopics
(
topics
:
[
String
],
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
interest
:
[
String
:
Any
]
=
[
"topics"
:
topics
]
let
params
:
[
String
:
Any
]
=
[
"interest"
:
interest
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
cardSave
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
}
}
galaxy/galaxy/Classes/Tools/Helper/YHConstantArrayData.swift
View file @
9b418d2a
...
@@ -372,51 +372,51 @@ class YHConstantArrayData {
...
@@ -372,51 +372,51 @@ class YHConstantArrayData {
static
let
arrDegreeConstellation
=
[
static
let
arrDegreeConstellation
=
[
[
[
"id"
:
"
1
"
,
"id"
:
"
aquarius
"
,
"title"
:
"水瓶座"
,
"title"
:
"水瓶座"
,
],
],
[
[
"id"
:
"
2
"
,
"id"
:
"
pisces
"
,
"title"
:
"双鱼座"
,
"title"
:
"双鱼座"
,
],
],
[
[
"id"
:
"
3
"
,
"id"
:
"
aries
"
,
"title"
:
"白羊座"
,
"title"
:
"白羊座"
,
],
],
[
[
"id"
:
"
4
"
,
"id"
:
"
taurus
"
,
"title"
:
"金牛座"
,
"title"
:
"金牛座"
,
],
],
[
[
"id"
:
"
5
"
,
"id"
:
"
gemini
"
,
"title"
:
"双子座"
,
"title"
:
"双子座"
,
],
],
[
[
"id"
:
"
6
"
,
"id"
:
"
cancer
"
,
"title"
:
"巨蟹座"
,
"title"
:
"巨蟹座"
,
],
],
[
[
"id"
:
"
7
"
,
"id"
:
"
leo
"
,
"title"
:
"狮子座"
,
"title"
:
"狮子座"
,
],
],
[
[
"id"
:
"
8
"
,
"id"
:
"
virgo
"
,
"title"
:
"处女座"
,
"title"
:
"处女座"
,
],
],
[
[
"id"
:
"
9
"
,
"id"
:
"
libra
"
,
"title"
:
"天秤座"
,
"title"
:
"天秤座"
,
],
],
[
[
"id"
:
"
10
"
,
"id"
:
"
scorpio
"
,
"title"
:
"天蝎座"
,
"title"
:
"天蝎座"
,
],
],
[
[
"id"
:
"
11
"
,
"id"
:
"
sagittarius
"
,
"title"
:
"射手座"
,
"title"
:
"射手座"
,
],
],
[
[
"id"
:
"
12
"
,
"id"
:
"
capricorn
"
,
"title"
:
"摩羯座"
,
"title"
:
"摩羯座"
,
],
],
]
]
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
View file @
9b418d2a
...
@@ -8,6 +8,14 @@
...
@@ -8,6 +8,14 @@
class
YHAllApiName
{
class
YHAllApiName
{
//活动相关接口
struct
Activity
{
//活动列表
static
let
listApi
=
"super-app/activity/list"
}
//首页界面相关接口
//首页界面相关接口
struct
Home
{
struct
Home
{
//获取签约用户的 最新信息提醒
//获取签约用户的 最新信息提醒
...
@@ -15,8 +23,6 @@ class YHAllApiName {
...
@@ -15,8 +23,6 @@ class YHAllApiName {
//获取签约用户信息
//获取签约用户信息
static
let
signerInfoApi
=
"super-app/infoflow/signer/info"
static
let
signerInfoApi
=
"super-app/infoflow/signer/info"
}
}
//接口 模块名 Common
//接口 模块名 Common
...
@@ -326,6 +332,7 @@ class YHAllApiName {
...
@@ -326,6 +332,7 @@ class YHAllApiName {
static
let
authorizationSubmit
=
"super-app/authorization/submit"
static
let
authorizationSubmit
=
"super-app/authorization/submit"
static
let
userInfo
=
"super-app/user-base/info"
static
let
userInfo
=
"super-app/user-base/info"
static
let
userAuthorization
=
"super-app/user/authorization"
static
let
userAuthorization
=
"super-app/user/authorization"
static
let
cardSave
=
"super-app/business-card/save"
}
}
}
}
galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
View file @
9b418d2a
...
@@ -77,7 +77,8 @@ class YHNetRequest: NSObject {
...
@@ -77,7 +77,8 @@ class YHNetRequest: NSObject {
private
var
headers
:
HTTPHeaders
?
private
var
headers
:
HTTPHeaders
?
/// 数据请求
/// 数据请求
private
var
httpRequest
:
DataRequest
?
private
var
httpRequest
:
DataRequest
?
private
var
businessCode
:
String
=
"4001001"
override
init
()
{
override
init
()
{
super
.
init
()
super
.
init
()
...
@@ -95,7 +96,7 @@ class YHNetRequest: NSObject {
...
@@ -95,7 +96,7 @@ class YHNetRequest: NSObject {
requestHeader
.
add
(
name
:
"app_version"
,
value
:
version
)
requestHeader
.
add
(
name
:
"app_version"
,
value
:
version
)
requestHeader
.
add
(
name
:
"pass"
,
value
:
""
)
requestHeader
.
add
(
name
:
"pass"
,
value
:
""
)
requestHeader
.
add
(
name
:
"businessCode"
,
value
:
"4001001"
)
//
requestHeader.add(name:"businessCode",value:"4001001")
let
appkey
=
"958364f87222c200a72414f492bf0e26"
let
appkey
=
"958364f87222c200a72414f492bf0e26"
let
signOrgiString
=
"appid="
+
"1"
+
"&"
+
"timestamp="
+
dateStr
+
"&"
+
"appkey="
+
appkey
let
signOrgiString
=
"appid="
+
"1"
+
"&"
+
"timestamp="
+
dateStr
+
"&"
+
"appkey="
+
appkey
...
@@ -113,6 +114,11 @@ class YHNetRequest: NSObject {
...
@@ -113,6 +114,11 @@ class YHNetRequest: NSObject {
headers
=
requestHeader
headers
=
requestHeader
}
}
func
businessCode
(
_
code
:
String
)
->
Self
{
self
.
businessCode
=
code
return
self
}
/// 链式语法
/// 链式语法
func
url
(
_
url
:
String
?)
->
Self
{
func
url
(
_
url
:
String
?)
->
Self
{
self
.
url
=
url
??
""
self
.
url
=
url
??
""
...
@@ -163,7 +169,7 @@ class YHNetRequest: NSObject {
...
@@ -163,7 +169,7 @@ class YHNetRequest: NSObject {
return
httpRequest
return
httpRequest
}
}
let
requestHeaders
=
getHeader
()
var
requestHeaders
=
getHeader
()
#if DEBUG
#if DEBUG
printLog
(
"网络请求头数据:"
)
printLog
(
"网络请求头数据:"
)
...
@@ -175,6 +181,7 @@ class YHNetRequest: NSObject {
...
@@ -175,6 +181,7 @@ class YHNetRequest: NSObject {
AF
.
sessionConfiguration
.
timeoutIntervalForRequest
=
20
AF
.
sessionConfiguration
.
timeoutIntervalForRequest
=
20
let
encoding
=
(
self
.
requestType
==
.
get
?
URLEncoding
(
destination
:
.
queryString
)
:
JSONEncoding
())
as
ParameterEncoding
let
encoding
=
(
self
.
requestType
==
.
get
?
URLEncoding
(
destination
:
.
queryString
)
:
JSONEncoding
())
as
ParameterEncoding
requestHeaders
.
add
(
name
:
"businessCode"
,
value
:
businessCode
)
httpRequest
=
AF
.
request
(
self
.
url
!
,
method
:
self
.
requestType
,
parameters
:
self
.
params
,
encoding
:
encoding
,
headers
:
requestHeaders
,
interceptor
:
nil
,
requestModifier
:
nil
)
httpRequest
=
AF
.
request
(
self
.
url
!
,
method
:
self
.
requestType
,
parameters
:
self
.
params
,
encoding
:
encoding
,
headers
:
requestHeaders
,
interceptor
:
nil
,
requestModifier
:
nil
)
httpRequest
?
.
responseString
(
completionHandler
:
{
string
in
httpRequest
?
.
responseString
(
completionHandler
:
{
string
in
...
@@ -372,26 +379,26 @@ class YHNetRequest: NSObject {
...
@@ -372,26 +379,26 @@ class YHNetRequest: NSObject {
}
}
extension
YHNetRequest
{
extension
YHNetRequest
{
class
func
getRequest
(
url
:
String
,
params
:[
String
:
Any
]
=
[:],
successBlock
:
SuccessResultType
!
,
failBlock
:
FailureHandlerType
!
)
->
Request
?
{
class
func
getRequest
(
url
:
String
,
params
:[
String
:
Any
]
=
[:],
_
businessCode
:
String
=
"4001001"
,
successBlock
:
SuccessResultType
!
,
failBlock
:
FailureHandlerType
!
)
->
Request
?
{
printLog
(
"
\n
发起请求的URL是===> url =
\(
url
)
"
)
printLog
(
"
\n
发起请求的URL是===> url =
\(
url
)
"
)
printLog
(
"
\n
发起请求的参数是===> url =
\(
params
)
"
)
printLog
(
"
\n
发起请求的参数是===> url =
\(
params
)
"
)
return
YHNetRequest
()
.
url
(
url
)
.
requestType
(
.
get
)
.
params
(
params
)
.
success
(
successBlock
)
.
failed
(
failBlock
)
.
startRequest
()
return
YHNetRequest
()
.
businessCode
(
businessCode
)
.
url
(
url
)
.
requestType
(
.
get
)
.
params
(
params
)
.
success
(
successBlock
)
.
failed
(
failBlock
)
.
startRequest
()
}
}
class
func
postRequest
(
url
:
String
,
params
:[
String
:
Any
]
=
[:],
successBlock
:
SuccessResultType
!
,
failBlock
:
FailureHandlerType
!
)
->
Request
?
{
class
func
postRequest
(
url
:
String
,
params
:[
String
:
Any
]
=
[:],
_
businessCode
:
String
=
"4001001"
,
successBlock
:
SuccessResultType
!
,
failBlock
:
FailureHandlerType
!
)
->
Request
?
{
printLog
(
"
\n
发起请求的URL是===> url =
\(
url
)
"
)
printLog
(
"
\n
发起请求的URL是===> url =
\(
url
)
"
)
printLog
(
"
\n
发起请求的参数是===> url =
\(
params
)
"
)
printLog
(
"
\n
发起请求的参数是===> url =
\(
params
)
"
)
return
YHNetRequest
()
.
url
(
url
)
.
requestType
(
.
post
)
.
params
(
params
)
.
success
(
successBlock
)
.
failed
(
failBlock
)
.
startRequest
()
return
YHNetRequest
()
.
businessCode
(
businessCode
)
.
url
(
url
)
.
requestType
(
.
post
)
.
params
(
params
)
.
success
(
successBlock
)
.
failed
(
failBlock
)
.
startRequest
()
}
}
class
func
uplaodRequest
(
url
:
String
,
headers
:
HTTPHeaders
,
image
:
UIImage
,
successBlock
:
SuccessResultType
!
,
failBlock
:
FailureHandlerType
!
)
->
Request
?
{
class
func
uplaodRequest
(
url
:
String
,
headers
:
HTTPHeaders
,
image
:
UIImage
,
_
businessCode
:
String
=
"4001001"
,
successBlock
:
SuccessResultType
!
,
failBlock
:
FailureHandlerType
!
)
->
Request
?
{
printLog
(
"
\n
发起请求的URL是===> url =
\(
url
)
"
)
printLog
(
"
\n
发起请求的URL是===> url =
\(
url
)
"
)
return
YHNetRequest
()
.
url
(
url
)
.
success
(
successBlock
)
.
failed
(
failBlock
)
.
uploadRequest
(
headers
,
image
)
return
YHNetRequest
()
.
businessCode
(
businessCode
)
.
url
(
url
)
.
success
(
successBlock
)
.
failed
(
failBlock
)
.
uploadRequest
(
headers
,
image
)
}
}
class
func
uplaodFileRequest
(
url
:
String
,
headers
:
HTTPHeaders
,
fileUrl
:
String
,
successBlock
:
SuccessResultType
!
,
failBlock
:
FailureHandlerType
!
)
->
Request
?
{
class
func
uplaodFileRequest
(
url
:
String
,
headers
:
HTTPHeaders
,
fileUrl
:
String
,
_
businessCode
:
String
=
"4001001"
,
successBlock
:
SuccessResultType
!
,
failBlock
:
FailureHandlerType
!
)
->
Request
?
{
printLog
(
"
\n
发起请求的URL是===> url =
\(
url
)
"
)
printLog
(
"
\n
发起请求的URL是===> url =
\(
url
)
"
)
return
YHNetRequest
()
.
url
(
url
)
.
success
(
successBlock
)
.
failed
(
failBlock
)
.
uploadFileRequest
(
headers
,
fileUrl
)
return
YHNetRequest
()
.
businessCode
(
businessCode
)
.
url
(
url
)
.
success
(
successBlock
)
.
failed
(
failBlock
)
.
uploadFileRequest
(
headers
,
fileUrl
)
}
}
}
}
galaxy/galaxy/Classes/Tools/Upload/YHOSSManager.swift
View file @
9b418d2a
...
@@ -22,6 +22,7 @@ class YHOSSModel: YHBaseModel {
...
@@ -22,6 +22,7 @@ class YHOSSModel: YHBaseModel {
class
YHOSSManager
:
NSObject
,
URLSessionDelegate
{
class
YHOSSManager
:
NSObject
,
URLSessionDelegate
{
static
let
share
=
YHOSSManager
()
static
let
share
=
YHOSSManager
()
var
model
:
YHOSSModel
=
YHOSSModel
()
var
model
:
YHOSSModel
=
YHOSSModel
()
var
publicModel
:
YHOSSModel
=
YHOSSModel
()
var
mProvider
:
OSSStsTokenCredentialProvider
!
var
mProvider
:
OSSStsTokenCredentialProvider
!
var
mClient
:
OSSClient
!
var
mClient
:
OSSClient
!
var
fileName
:
[
String
]
=
[]
var
fileName
:
[
String
]
=
[]
...
@@ -59,8 +60,20 @@ class YHOSSManager: NSObject, URLSessionDelegate {
...
@@ -59,8 +60,20 @@ class YHOSSManager: NSObject, URLSessionDelegate {
return
return
}
}
self
.
model
=
resultModel
self
.
model
=
resultModel
self
.
mProvider
=
OSSStsTokenCredentialProvider
(
accessKeyId
:
self
.
model
.
accessKeyId
,
secretKeyId
:
self
.
model
.
accessKeySecret
,
securityToken
:
self
.
model
.
securityToken
)
if
let
block
=
completionHandler
{
self
.
mClient
=
OSSClient
(
endpoint
:
self
.
model
.
endpoint
,
credentialProvider
:
self
.
mProvider
)
block
()
}
}
failBlock
:
{
err
in
}
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
,
params
:
param
,
"5000000"
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
let
dic
=
json
.
data
guard
let
resultModel
=
YHOSSModel
.
deserialize
(
from
:
dic
as?
Dictionary
)
else
{
return
}
self
.
publicModel
=
resultModel
if
let
block
=
completionHandler
{
if
let
block
=
completionHandler
{
block
()
block
()
}
}
...
@@ -75,10 +88,21 @@ class YHOSSManager: NSObject, URLSessionDelegate {
...
@@ -75,10 +88,21 @@ class YHOSSManager: NSObject, URLSessionDelegate {
callBackBlock
(
nil
,
YHErrorModel
())
callBackBlock
(
nil
,
YHErrorModel
())
return
return
}
}
if
isPublic
{
self
.
mProvider
=
OSSStsTokenCredentialProvider
(
accessKeyId
:
self
.
publicModel
.
accessKeyId
,
secretKeyId
:
self
.
publicModel
.
accessKeySecret
,
securityToken
:
self
.
publicModel
.
securityToken
)
self
.
mClient
=
OSSClient
(
endpoint
:
self
.
publicModel
.
endpoint
,
credentialProvider
:
self
.
mProvider
)
}
else
{
self
.
mProvider
=
OSSStsTokenCredentialProvider
(
accessKeyId
:
self
.
model
.
accessKeyId
,
secretKeyId
:
self
.
model
.
accessKeySecret
,
securityToken
:
self
.
model
.
securityToken
)
self
.
mClient
=
OSSClient
(
endpoint
:
self
.
model
.
endpoint
,
credentialProvider
:
self
.
mProvider
)
}
DispatchQueue
.
global
()
.
async
{
DispatchQueue
.
global
()
.
async
{
request
.
uploadingData
=
imageData
request
.
uploadingData
=
imageData
request
.
bucketName
=
self
.
model
.
bucket
if
isPublic
{
request
.
bucketName
=
self
.
publicModel
.
bucket
}
else
{
request
.
bucketName
=
self
.
model
.
bucket
}
let
timestamp
=
Date
()
.
timeIntervalSince1970
let
timestamp
=
Date
()
.
timeIntervalSince1970
let
randomInt
=
Int
.
random
(
in
:
1
...
100
)
// 随机生成1到10之间的整数
let
randomInt
=
Int
.
random
(
in
:
1
...
100
)
// 随机生成1到10之间的整数
let
name
=
"
\(
UInt64
(
timestamp
)
)
"
+
"
\(
randomInt
)
"
+
".jpg"
let
name
=
"
\(
UInt64
(
timestamp
)
)
"
+
"
\(
randomInt
)
"
+
".jpg"
...
@@ -109,7 +133,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
...
@@ -109,7 +133,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
var
string
=
""
var
string
=
""
if
isPublic
{
if
isPublic
{
string
=
"https://"
+
self
.
m
odel
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"5000000"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
string
=
"https://"
+
self
.
publicM
odel
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"5000000"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
}
else
{
}
else
{
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
}
}
...
@@ -127,11 +151,21 @@ class YHOSSManager: NSObject, URLSessionDelegate {
...
@@ -127,11 +151,21 @@ class YHOSSManager: NSObject, URLSessionDelegate {
callBackBlock
(
nil
,
YHErrorModel
())
callBackBlock
(
nil
,
YHErrorModel
())
return
return
}
}
if
isPublic
{
self
.
mProvider
=
OSSStsTokenCredentialProvider
(
accessKeyId
:
self
.
publicModel
.
accessKeyId
,
secretKeyId
:
self
.
publicModel
.
accessKeySecret
,
securityToken
:
self
.
publicModel
.
securityToken
)
self
.
mClient
=
OSSClient
(
endpoint
:
self
.
publicModel
.
endpoint
,
credentialProvider
:
self
.
mProvider
)
}
else
{
self
.
mProvider
=
OSSStsTokenCredentialProvider
(
accessKeyId
:
self
.
model
.
accessKeyId
,
secretKeyId
:
self
.
model
.
accessKeySecret
,
securityToken
:
self
.
model
.
securityToken
)
self
.
mClient
=
OSSClient
(
endpoint
:
self
.
model
.
endpoint
,
credentialProvider
:
self
.
mProvider
)
}
DispatchQueue
.
global
()
.
async
{
DispatchQueue
.
global
()
.
async
{
let
fileExtension
=
URL
(
fileURLWithPath
:
file
)
.
pathExtension
.
lowercased
()
let
fileExtension
=
URL
(
fileURLWithPath
:
file
)
.
pathExtension
.
lowercased
()
request
.
uploadingData
=
fileData
request
.
uploadingData
=
fileData
request
.
bucketName
=
self
.
model
.
bucket
if
isPublic
{
request
.
bucketName
=
self
.
publicModel
.
bucket
}
else
{
request
.
bucketName
=
self
.
model
.
bucket
}
let
timestamp
=
Date
()
.
timeIntervalSince1970
let
timestamp
=
Date
()
.
timeIntervalSince1970
let
name
=
"
\(
UInt64
(
timestamp
)
)
"
+
".
\(
fileExtension
)
"
let
name
=
"
\(
UInt64
(
timestamp
)
)
"
+
".
\(
fileExtension
)
"
self
.
fileName
.
append
(
name
)
self
.
fileName
.
append
(
name
)
...
@@ -163,7 +197,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
...
@@ -163,7 +197,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
var
string
=
""
var
string
=
""
if
isPublic
{
if
isPublic
{
string
=
"https://"
+
self
.
m
odel
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"5000000"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
string
=
"https://"
+
self
.
publicM
odel
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"5000000"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
}
else
{
}
else
{
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
}
}
...
@@ -176,6 +210,13 @@ class YHOSSManager: NSObject, URLSessionDelegate {
...
@@ -176,6 +210,13 @@ class YHOSSManager: NSObject, URLSessionDelegate {
}
}
func
getPublic
(
url
:
String
,
_
isPublic
:
Bool
=
false
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
func
getPublic
(
url
:
String
,
_
isPublic
:
Bool
=
false
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
if
isPublic
{
self
.
mProvider
=
OSSStsTokenCredentialProvider
(
accessKeyId
:
self
.
publicModel
.
accessKeyId
,
secretKeyId
:
self
.
publicModel
.
accessKeySecret
,
securityToken
:
self
.
publicModel
.
securityToken
)
self
.
mClient
=
OSSClient
(
endpoint
:
self
.
publicModel
.
endpoint
,
credentialProvider
:
self
.
mProvider
)
}
else
{
self
.
mProvider
=
OSSStsTokenCredentialProvider
(
accessKeyId
:
self
.
model
.
accessKeyId
,
secretKeyId
:
self
.
model
.
accessKeySecret
,
securityToken
:
self
.
model
.
securityToken
)
self
.
mClient
=
OSSClient
(
endpoint
:
self
.
model
.
endpoint
,
credentialProvider
:
self
.
mProvider
)
}
DispatchQueue
.
global
()
.
async
{
DispatchQueue
.
global
()
.
async
{
let
bucketName
=
self
.
getBucket
(
url
)
let
bucketName
=
self
.
getBucket
(
url
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment