CNLIVEViewController.m
9.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
//
// CNLIVEViewController.m
// CNLiveCommunitModule
//
// Created by woshiliushiyu on 01/30/2022.
// Copyright (c) 2022 woshiliushiyu. All rights reserved.
//
#import "CNLIVEViewController.h"
#import "CNLiveCommuntActiviRecordViewController.h"
#import "CNLiveCommuntActiviRepairViewController.h"
#import "CNLiveCommuntInformViewController.h"
#import "CNLiveCommuntEvaluaViewController.h"
#import "CNLiveCommuntSignUpViewController.h"
#import "CNLiveCommuntyOrderViewController.h"
#import "CNLiveCommuntyHomeListViewController.h"
#import "CNLiveCommuntViewController.h"
#import <Masonry/Masonry.h>
#import "CNLiveCommuntyModule.h"
#import "CNLIVEAppDelegate.h"
#import <YYCategories/YYCategories.h>
#import <JXCategoryView/JXCategoryView.h>
#import <JXPagingView/JXPagerView.h>
#import <Masonry/Masonry.h>
#import <MJExtension/MJExtension.h>
#import <YYText/YYText.h>
#import "CNLiveCommuntViewModel.h"
#import "CNLiveCommuntSignUpView.h"
#import "CNLiveCommuntyResultListViewController.h"
#import <CNLiveEnvironment/CNLiveEnvironment.h>
#import <CNLiveUserManagement/CNUserInfoManager.h>
#import <CNLiveRequestBastKit/CNLiveNetworking.h>
@interface CNLIVEViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView * tableView;
@property (nonatomic, strong) NSMutableArray * dataArray;
@property (nonatomic, assign) BOOL isChange;
@end
@implementation CNLIVEViewController
-(NSMutableArray *)dataArray
{
if (!_dataArray) {
_dataArray = [[NSMutableArray alloc] initWithArray:@[
@"有底部导航栏的界面",@"活动记录",@"报修记录",@"填写记录",@"活动评价",@"报名",@"订单详情-未接单",@"订单详情-已接单",@"145680",@"暂时点击无效",@"选择小区",@"主界面跳转"
]];
}
return _dataArray;
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = NO;
// if (@available(iOS 11.0, *)) {
// self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
// } else {
// // Fallback on earlier versions
// self.automaticallyAdjustsScrollViewInsets = NO;
// }
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
__block NSArray * array = @[@"123",@"123",@"123",@"123",@"123",@"123"];
__block NSMutableString *picString = [[NSMutableString alloc] init];
[array enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[picString appendString:obj];
if (array.count != idx+1) [picString appendString:@","];
}];
NSLog(@"===>%@",picString);
NSString * oldValue = @"1";
oldValue = [NSString stringWithFormat:@"%.2f",[oldValue floatValue]/100];
float unitPrice = [oldValue floatValue];
NSString * p = [NSString stringWithFormat:@"合计: ¥%.2f",(8 * unitPrice)];
NSLog(@"%@ =>%f ==>%@",oldValue,unitPrice,p);
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(UITableViewCell.class)];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(UITableViewCell.class)];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.text = [NSString stringWithFormat:@"%@==%ld",self.dataArray[indexPath.row],(long)indexPath.row];
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 40.0f;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0) {
[[CNLiveCommuntyModule shareInstance] pushCommuntyHomeViewMethod];
}
if (indexPath.row == 1) {
NSString * nb_info = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithFormat:@"kCNLiveCommuntyNBhdInfoIdentifier%@",[CNUserInfoManager manager].userInfoModel.uid]];
NSDictionary * dict = [nb_info mj_JSONObject];
CNLiveCommuntActiviRecordViewController * recordVC = [[CNLiveCommuntActiviRecordViewController alloc] initWithNBhdId:[dict stringValueForKey:@"id" default:@""]];
[self.navigationController pushViewController:recordVC animated:YES];
// [[NSUserDefaults standardUserDefaults] setObject:@"" forKey:@"kCNLiveCommuntyNBhdIdIdentifier"];
// [[NSUserDefaults standardUserDefaults] synchronize];
}
if (indexPath.row == 2) {
CNLiveCommuntActiviRepairViewController * repairView = [[CNLiveCommuntActiviRepairViewController alloc] init];
[self.navigationController pushViewController:repairView animated:YES];
}
if (indexPath.row == 3) {
NSString * nbhdId = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"kCNLiveCommuntyNBhdIdIdentifier"];
CNLiveCommuntInformViewController * informView = [[CNLiveCommuntInformViewController alloc] initWithNBhdId:nbhdId];
[self.navigationController pushViewController:informView animated:YES];
}
if (indexPath.row == 4) {
CNLiveCommuntEvaluaViewController * evaluaView = [[CNLiveCommuntEvaluaViewController alloc] init];
[self.navigationController pushViewController:evaluaView animated:YES];
}
if (indexPath.row == 5) {
CNLiveCommuntSignUpViewController * signUpView = [[CNLiveCommuntSignUpViewController alloc] initWithStyle:UITableViewStyleGrouped ActivityId:@"52"];
[self.navigationController pushViewController:signUpView animated:YES];
}
if (indexPath.row == 6) {
NSString * cmnt_id = [[NSUserDefaults standardUserDefaults] objectForKey:@"cmnt_id"];
if ([cmnt_id isNotBlank]) {
CNLiveCommuntyOrderViewController * orderVC = [[CNLiveCommuntyOrderViewController alloc] initWithMaintenId:cmnt_id];
[self.navigationController pushViewController:orderVC animated:YES];
}
}
if (indexPath.row == 7) {
CNLiveCommuntyResultListViewController * orderVC = [[CNLiveCommuntyResultListViewController alloc] initWithStyle:UITableViewStyleGrouped SignId:@"48" OrderId:@"" handworkId:@"52"];
[self.navigationController pushViewController:orderVC animated:YES];
}
// if (indexPath.row == 8) {
// CNLiveCommuntyOrderViewController * orderVC = [[CNLiveCommuntyOrderViewController alloc] initWithShowType:CNLiveCommuntyOrderShowTypeChatCompletOrder MaintenId:@"cmnt2022021166936098185"];
// [self.navigationController pushViewController:orderVC animated:YES];
// }
if (indexPath.row == 8) {
[CNUserInfoManager manager].userInfoModel.uid = self.isChange ? @"11973842" : @"145680";
[self.dataArray replaceObjectAtIndex:8 withObject:self.isChange ? @"11973842" : @"145680"];
self.isChange = !self.isChange;
NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init];
[mDict setValue:[CNUserInfoManager manager].userInfoModel.uid forKey:@"loginSid"];
[mDict setValue:@"com.cnlive.CNLiveNetAdd.debug" forKey:@"platform_id"];
[mDict setValue:[[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""] forKey:@"uuid"];
[mDict setValue:@"i" forKey:@"plat"];
[mDict setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] forKey:@"ver"];
[mDict setObject:AppId forKey:@"appId"];
[mDict setObject:[CNUserInfoManager manager].userInfoModel.uid forKey:@"sid"];
[CNLiveNetworking setupDefaultParam:mDict];
[CNLiveNetworking setupShowResult:NO];
[CNLiveNetworking setupSignKey:APPKey];
[CNLiveNetworking setAllowRequestDefaultArgument:YES];
[CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON];
[self.tableView reloadData];
// CNLiveCommuntyOrderViewController * orderVC = [[CNLiveCommuntyOrderViewController alloc] initWithShowType:CNLiveCommuntyOrderShowTypeHave MaintenId:@"cmnt2022021166936098185"];
// [self.navigationController pushViewController:orderVC animated:YES];
}
if (indexPath.row == 10) {
CNLiveCommuntyHomeListViewController * listVC = [[CNLiveCommuntyHomeListViewController alloc] init];
[self.navigationController pushViewController:listVC animated:YES];
}
if (indexPath.row == 11) {
[[CNLiveCommuntyModule shareInstance] pushCommuntyHomeViewMethod];
}
}
-(UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
_tableView.backgroundColor = [UIColor whiteColor];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.backgroundColor = [UIColor whiteColor];
_tableView.tableFooterView =[[UIView alloc] init];
_tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
[_tableView registerClass:UITableViewCell.class forCellReuseIdentifier:NSStringFromClass(UITableViewCell.class)];
}
return _tableView;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end