Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
红
红星美凯龙管理在线APP IOS
Project
Project
Details
Activity
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
张杰
红星美凯龙管理在线APP IOS
Commits
54a3efee
Commit
54a3efee
authored
Dec 08, 2015
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复公告不显示
parent
1b1906b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
10 deletions
+60
-10
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
AnnounceViewController.m
...unce/AnnounceList/ViewController/AnnounceViewController.m
+60
-10
No files found.
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
54a3efee
No preview for this file type
redstar/Classes/Module/Announce/AnnounceList/ViewController/AnnounceViewController.m
View file @
54a3efee
...
...
@@ -12,6 +12,8 @@
#import "AnnounceModel.h"
#import "AnnoDetailViewController.h"
#import "NoDataView.h"
#import <MBProgressHUD.h>
#define kAnnoTableViewCell @"AnnoTableViewCell"
...
...
@@ -23,6 +25,8 @@
@property
(
nonatomic
,
strong
)
NSString
*
stateStr
;
@property
(
nonatomic
,
assign
)
BOOL
isRead
;
@property
(
nonatomic
,
strong
)
NoDataView
*
noDataView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
allAnnoArray
;
@end
...
...
@@ -69,10 +73,9 @@
NSString
*
user_uuid
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
];
int
page_number
=
0
;
int
page_size
=
10
;
//NSString *url = [NSString stringWithFormat:@"%@%@%@?read=%@&page_number=%d&page_size=%d", kRedStarURL, kAnnounceListURL ,user_uuid ,_stateStr, page_number, page_size];
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@%@?page_number=%d&page_size=%d"
,
kRedStarURL
,
kAnnounceListURL
,
user_uuid
,
page_number
,
page_size
];
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@%@?read=%@&page_number=%d&page_size=%d"
,
kRedStarURL
,
kAnnounceListURL
,
user_uuid
,
_stateStr
,
page_number
,
page_size
];
NSLog
(
@"urlll = %@"
,
url
)
;
[
MBProgressHUD
showHUDAddedTo
:
self
.
view
animated
:
YES
]
;
HttpClient
*
httpClient
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
[
httpClient
getAnnounceListWithCompletion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"公告response = %@"
,
response
);
...
...
@@ -82,11 +85,17 @@
for
(
NSDictionary
*
annoDict
in
array
)
{
AnnounceModel
*
anno
=
[
AnnounceModel
announceModelWithDict
:
annoDict
];
[
_allAnnoArray
addObject
:
anno
];
}
if
(
_allAnnoArray
.
count
==
0
)
{
self
.
noDataView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}
else
{
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}
}
}];
}
...
...
@@ -123,7 +132,6 @@
-
(
void
)
segmentChangedValue
:
(
UISegmentedControl
*
)
sender
{
NSString
*
url
;
NSString
*
user_uuid
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
];
int
page_number
=
0
;
...
...
@@ -140,8 +148,9 @@
}
NSLog
(
@"url ==== %@"
,
url
);
NSLog
(
@"22url ==== %@"
,
url
);
[
MBProgressHUD
showHUDAddedTo
:
self
.
view
animated
:
YES
];
HttpClient
*
httpClient
=
[[
HttpClient
alloc
]
initWithUrl
:
url
];
[
httpClient
getAnnounceListWithCompletion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"segemnt 公告 = %@ error = %@"
,
response
,
error
);
...
...
@@ -153,10 +162,29 @@
AnnounceModel
*
anno
=
[
AnnounceModel
announceModelWithDict
:
annoDict
];
[
annoArray
addObject
:
anno
];
}
_allAnnoArray
=
annoArray
;
_allAnnoArray
=
[
NSMutableArray
arrayWithArray
:
annoArray
]
;
}
[
self
.
tableView
reloadData
];
if
(
_allAnnoArray
.
count
==
0
)
{
if
(
_tableView
)
{
[
_tableView
removeFromSuperview
];
_tableView
=
nil
;
}
self
.
noDataView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}
else
{
if
(
_noDataView
)
{
[
_noDataView
removeFromSuperview
];
_noDataView
=
nil
;
}
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
tableView
reloadData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}
}];
...
...
@@ -274,4 +302,26 @@
return
_tableView
;
}
-
(
NoDataView
*
)
noDataView
{
if
(
!
_noDataView
)
{
_noDataView
=
[[
NoDataView
alloc
]
init
];
_noDataView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
view
addSubview
:
_noDataView
];
NSLayoutConstraint
*
tableTop
=
[
NSLayoutConstraint
constraintWithItem
:
_noDataView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
bgBar
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
self
.
view
addConstraint
:
tableTop
];
NSLayoutConstraint
*
tableLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_noDataView
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
view
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
[
self
.
view
addConstraint
:
tableLeft
];
NSLayoutConstraint
*
tableRight
=
[
NSLayoutConstraint
constraintWithItem
:
_noDataView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
view
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
view
addConstraint
:
tableRight
];
NSLayoutConstraint
*
tableBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_noDataView
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
view
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
self
.
view
addConstraint
:
tableBottom
];
}
return
_noDataView
;
}
@end
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