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
e0753515
Commit
e0753515
authored
Feb 27, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理 登录逻辑
parent
150c462b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
3 deletions
+50
-3
YHServiceCenterMainViewController.swift
...ntService(服务中心)/C/YHServiceCenterMainViewController.swift
+45
-0
YHLoginViewModel.swift
...alaxy/Classes/Modules/Login(登录)/VM/YHLoginViewModel.swift
+5
-3
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/C/YHServiceCenterMainViewController.swift
View file @
e0753515
...
...
@@ -34,6 +34,12 @@ class YHServiceCenterMainViewController: YHBaseViewController {
return
view
}()
private
func
loginOp
()
{
let
vc
=
UINavigationController
(
rootVC
:
YHPhoneLoginViewController
())
vc
.
modalPresentationStyle
=
.
custom
self
.
navigationController
?
.
present
(
vc
,
animated
:
true
)
}
var
homeTableView
:
UITableView
=
{
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
...
...
@@ -55,12 +61,25 @@ class YHServiceCenterMainViewController: YHBaseViewController {
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
if
YHLoginManager
.
shared
.
isLogin
()
==
false
{
loginTipsView
.
isHidden
=
false
noDataView
.
isHidden
=
true
homeTableView
.
isHidden
=
true
}
else
{
loginTipsView
.
isHidden
=
true
}
loadData
()
}
}
extension
YHServiceCenterMainViewController
{
func
loadData
()
{
if
YHLoginManager
.
shared
.
isLogin
()
==
false
{
return
}
self
.
serviceCenterMainReqVM
.
getContactList
{
success
,
error
in
if
success
==
true
{
...
...
@@ -84,6 +103,10 @@ extension YHServiceCenterMainViewController {
gk_navTitle
=
"服务中心"
gk_navBarAlpha
=
1.0
loginTipsView
.
clickLoginBtnCallBackBlock
=
{
self
.
loginOp
()
}
view
.
addSubview
(
topBkg
)
topBkg
.
snp
.
makeConstraints
{
make
in
make
.
top
.
left
.
right
.
equalToSuperview
()
...
...
@@ -116,6 +139,13 @@ extension YHServiceCenterMainViewController {
self
.
homeTableView
.
isHidden
=
true
self
.
noDataView
.
isHidden
=
false
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
)
}
}
...
...
@@ -170,3 +200,18 @@ extension YHServiceCenterMainViewController : UITableViewDelegate,UITableViewDat
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
extension
YHServiceCenterMainViewController
{
@objc
func
loginSuccess
()
{
printLog
(
"登录成功,进行相应的 UI刷新操作"
)
loadData
()
}
@objc
func
logoutSuccess
()
{
loginTipsView
.
isHidden
=
false
noDataView
.
isHidden
=
true
self
.
homeTableView
.
isHidden
=
true
}
}
galaxy/galaxy/Classes/Modules/Login(登录)/VM/YHLoginViewModel.swift
View file @
e0753515
...
...
@@ -49,10 +49,11 @@ extension YHLoginViewModel {
func
login
(
phone
:
String
,
code
:
String
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
params
:
[
String
:
Any
]
=
[
"mobile"
:
phone
,
"sms_code"
:
code
,
"channel"
:
"app"
,
"client"
:
"super_app"
]
let
strUrl
=
"http://test.api.diymanager.galaxy-immi.com/"
+
"auth/login"
// let strUrl = "http://192.168.34.106:18088/" + "auth/login"
let
strUrl
=
"http://test.api.diymanager.galaxy-immi.com/"
+
"infoflow/auth/login"
// http:test.api.diymanager.galaxy-immi.com/infoflow/auth/login
// let strUrl = "http://192.168.34.106:18088/" + "infoflow/auth/login"
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
...
...
@@ -62,6 +63,7 @@ extension YHLoginViewModel {
callBackBlock
(
false
,
error
)
return
}
printLog
(
model
)
let
dic
=
model
.
data
?
.
peel
guard
let
resultModel
=
YHUserModel
.
deserialize
(
dict
:
dic
as?
[
AnyHashable
:
Any
])
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
-
1
,
errorMsg
:
"数据解析不成功"
)
...
...
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