Commit ec4fdde961cff6d13201bc3772d9c28f660f035a
1 parent
056c9fba
no message
Showing
11 changed files
with
928 additions
and
0 deletions
CNLiveLoginModule.podspec
| ... | ... | @@ -62,6 +62,10 @@ TODO: 网家家-登录模块. |
| 62 | 62 | ss.dependency 'CNLiveLoginModule/View' |
| 63 | 63 | end |
| 64 | 64 | |
| 65 | + s.subspec 'BindingManage' do |ss| | |
| 66 | + ss.source_files = 'CNLiveLoginModule/Classes/BindingManage/*.{h,m}' | |
| 67 | + end | |
| 68 | + | |
| 65 | 69 | s.resource_bundles = { |
| 66 | 70 | 'CNLiveLoginModule' => ['CNLiveLoginModule/Assets/CNLiveLoginModule.xcassets'] |
| 67 | 71 | } | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageCell.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageCell.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | +@class CNLiveBindingManageModel; | |
| 13 | +#define kCNLiveBindingManageCell @"CNLiveBindingManageCell" | |
| 14 | + | |
| 15 | +@class CNLiveBindingManageCell; | |
| 16 | +@protocol CNLiveBindingManageCellDelegate <NSObject> | |
| 17 | +//isBinding YES 绑定操作 NO 解除绑定操作 | |
| 18 | +- (void)clickedBindingButton:(CNLiveBindingManageCell *)cell isBinding:(BOOL)isBinding; | |
| 19 | + | |
| 20 | +@end | |
| 21 | + | |
| 22 | +@interface CNLiveBindingManageCell : UITableViewCell | |
| 23 | +@property (nonatomic, strong) CNLiveBindingManageModel *model; | |
| 24 | +@property (nonatomic, weak) id<CNLiveBindingManageCellDelegate> delegate; | |
| 25 | + | |
| 26 | +@end | |
| 27 | + | |
| 28 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageCell.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageCell.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNLiveBindingManageCell.h" | |
| 10 | +#import <Masonry/Masonry.h> | |
| 11 | + | |
| 12 | +#import "CNLiveBindingManageModel.h" | |
| 13 | +#import "CNLiveBindingManageRequest.h" | |
| 14 | + | |
| 15 | +@interface CNLiveBindingManageCell() | |
| 16 | +@property (nonatomic, strong) UIImageView *icon; | |
| 17 | +@property (nonatomic, strong) UILabel *title; | |
| 18 | +@property (nonatomic, strong) UILabel *desc; | |
| 19 | +@property (nonatomic, strong) UIButton *manage; | |
| 20 | +@property (nonatomic, strong) UIView *line; | |
| 21 | + | |
| 22 | +@end | |
| 23 | +@implementation CNLiveBindingManageCell | |
| 24 | +static NSInteger const margin = 15; | |
| 25 | + | |
| 26 | +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | |
| 27 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
| 28 | + if (self) { | |
| 29 | + self.contentView.backgroundColor = [UIColor whiteColor]; | |
| 30 | + [self createSubViews]; | |
| 31 | + } | |
| 32 | + return self; | |
| 33 | +} | |
| 34 | +- (void)setModel:(CNBindingManageModel *)model{ | |
| 35 | + _model = model; | |
| 36 | + _icon.image = [UIImage imageNamed:model.image]; | |
| 37 | + _title.text = model.title; | |
| 38 | + _desc.text = model.desc; | |
| 39 | + if([model.isBinding isEqualToString:@"1"]){ | |
| 40 | + _manage.backgroundColor = RGBOF(0xd9d9d9); | |
| 41 | + [_manage setTitle:@"已绑定" forState:UIControlStateNormal]; | |
| 42 | + | |
| 43 | + }else{ | |
| 44 | + _manage.backgroundColor = RGBOF(0x23d41e); | |
| 45 | + [_manage setTitle:@"未绑定" forState:UIControlStateNormal]; | |
| 46 | + | |
| 47 | + } | |
| 48 | + | |
| 49 | +} | |
| 50 | +#pragma mark - setupUI | |
| 51 | +- (void)createSubViews { | |
| 52 | + [self.contentView addSubview:self.icon]; | |
| 53 | + [self.contentView addSubview:self.title]; | |
| 54 | + [self.contentView addSubview:self.desc]; | |
| 55 | + [self.contentView addSubview:self.manage]; | |
| 56 | + [self.contentView addSubview:self.line]; | |
| 57 | + | |
| 58 | +} | |
| 59 | + | |
| 60 | +- (void)layoutSubviews { | |
| 61 | + [self.icon mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 62 | + make.centerY.equalTo(self.contentView); | |
| 63 | + make.left.equalTo(self.contentView).offset(margin); | |
| 64 | + make.width.mas_equalTo(50); | |
| 65 | + make.height.mas_equalTo(50); | |
| 66 | + }]; | |
| 67 | + | |
| 68 | + [self.manage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 69 | + make.centerY.equalTo(self.contentView); | |
| 70 | + make.right.equalTo(self.contentView.mas_right).offset(-margin); | |
| 71 | + make.width.mas_equalTo(70); | |
| 72 | + make.height.mas_equalTo(30); | |
| 73 | + }]; | |
| 74 | + | |
| 75 | + [self.title mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 76 | + make.top.equalTo(self.icon.mas_top); | |
| 77 | + make.left.equalTo(self.icon.mas_right).offset(margin); | |
| 78 | + make.right.equalTo(self.manage.mas_left).offset(-margin); | |
| 79 | + make.height.mas_equalTo(25); | |
| 80 | + }]; | |
| 81 | + | |
| 82 | + [self.desc mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 83 | + make.top.equalTo(self.title.mas_bottom); | |
| 84 | + make.left.equalTo(self.title.mas_left); | |
| 85 | + make.right.equalTo(self.title.mas_right); | |
| 86 | + make.height.mas_equalTo(25); | |
| 87 | + }]; | |
| 88 | + [self.line mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 89 | + make.bottom.equalTo(self.contentView.mas_bottom).offset(-0.5); | |
| 90 | + make.left.equalTo(self.contentView.mas_left); | |
| 91 | + make.right.equalTo(self.contentView.mas_right); | |
| 92 | + make.height.mas_equalTo(0.5); | |
| 93 | + }]; | |
| 94 | +} | |
| 95 | + | |
| 96 | +- (void)awakeFromNib { | |
| 97 | + [super awakeFromNib]; | |
| 98 | + // Initialization code | |
| 99 | +} | |
| 100 | + | |
| 101 | +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | |
| 102 | + [super setSelected:selected animated:animated]; | |
| 103 | + | |
| 104 | + // Configure the view for the selected state | |
| 105 | +} | |
| 106 | + | |
| 107 | +#pragma mark - Lazy Loading | |
| 108 | +- (UIImageView *)icon { | |
| 109 | + if (!_icon) { | |
| 110 | + _icon = [[UIImageView alloc] init]; | |
| 111 | + _icon.contentMode = UIViewContentModeScaleAspectFill; | |
| 112 | + _icon.layer.cornerRadius = 25; | |
| 113 | + _icon.layer.masksToBounds = YES; | |
| 114 | + } | |
| 115 | + return _icon; | |
| 116 | +} | |
| 117 | +- (UILabel *)title { | |
| 118 | + if (!_title) { | |
| 119 | + _title = [[UILabel alloc] init]; | |
| 120 | + _title.textColor = RGBOF(0x333333); | |
| 121 | + _title.font = UIFontCNMake(16);//[UIFont fontWithName:@"PingFangSC-Regular" size:15]; | |
| 122 | + _title.numberOfLines = 0; | |
| 123 | + } | |
| 124 | + return _title; | |
| 125 | +} | |
| 126 | +- (UILabel *)desc { | |
| 127 | + if (!_desc) { | |
| 128 | + _desc = [[UILabel alloc] init]; | |
| 129 | + _desc.textColor = RGBOF(0x999999); | |
| 130 | + _desc.font = UIFontCNMake(12);//[UIFont fontWithName:@"PingFangSC-Regular" size:15]; | |
| 131 | + _desc.numberOfLines = 0; | |
| 132 | + } | |
| 133 | + return _desc; | |
| 134 | +} | |
| 135 | +- (UIButton *)manage { | |
| 136 | + if (!_manage) { | |
| 137 | + _manage = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 138 | + _manage.backgroundColor = RGBOF(0xd9d9d9); | |
| 139 | + [_manage setTitle:@"已绑定" forState:UIControlStateNormal]; | |
| 140 | + [_manage setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | |
| 141 | + _manage.titleLabel.font = UIFontCNMake(14); | |
| 142 | + _manage.layer.cornerRadius = 15; | |
| 143 | + _manage.layer.masksToBounds = YES; | |
| 144 | + [_manage addTarget:self action:@selector(manageDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | |
| 145 | + } | |
| 146 | + return _manage; | |
| 147 | +} | |
| 148 | + | |
| 149 | +- (UIView *)line { | |
| 150 | + if (!_line) { | |
| 151 | + _line = [[UIView alloc] init]; | |
| 152 | + _line.backgroundColor = RGBOF(0xeeeeee); | |
| 153 | + } | |
| 154 | + return _line; | |
| 155 | +} | |
| 156 | + | |
| 157 | +#pragma mark - Action | |
| 158 | +- (void)manageDidClicked:(UIButton *)btn{ | |
| 159 | + if([self.model.thirdPartyPlat isEqualToString:@"10"]){ | |
| 160 | + return; | |
| 161 | + } | |
| 162 | + if(![CNLiveNetworking isNetworking]){ | |
| 163 | + [QMUITips showError:@"无法连接网络" inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 164 | + return ; | |
| 165 | + } | |
| 166 | + btn.userInteractionEnabled = NO; | |
| 167 | + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedBindingButton:isBinding:)]) { | |
| 168 | + [self.delegate clickedBindingButton:self isBinding:![self.model.isBinding isEqualToString:@"1"]]; | |
| 169 | + btn.userInteractionEnabled = YES; | |
| 170 | + | |
| 171 | + } | |
| 172 | +} | |
| 173 | + | |
| 174 | + | |
| 175 | +@end | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageController.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageController.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | +// 绑定管理 | |
| 9 | +#import "CNCommonViewController.h" | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +@interface CNLiveBindingManageController : CNCommonViewController | |
| 14 | + | |
| 15 | +@end | |
| 16 | + | |
| 17 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageController.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageController.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNLiveBindingManageController.h" | |
| 10 | +#import <Masonry/Masonry.h> | |
| 11 | + | |
| 12 | +#import "CNLiveBindingManageHeaderView.h" | |
| 13 | +#import "CNLiveBindingManageCell.h" | |
| 14 | +#import "CNLiveBindingManageModel.h" | |
| 15 | +#import "CNLiveBindingManageRequest.h" | |
| 16 | + | |
| 17 | +@interface CNLiveBindingManageController ()<UITableViewDelegate, UITableViewDataSource,CNLiveBindingManageCellDelegate> | |
| 18 | +@property (nonatomic, strong) UITableView *tableView; | |
| 19 | +@property (nonatomic, strong) NSArray *bindingData; | |
| 20 | +@property (nonatomic, strong) NSArray *unBindingData; | |
| 21 | + | |
| 22 | +@end | |
| 23 | + | |
| 24 | +@implementation CNLiveBindingManageController | |
| 25 | +#pragma mark - CNLiveBindingManageCellDelegate | |
| 26 | +- (void)clickedBindingButton:(CNLiveBindingManageCell *)cell isBinding:(BOOL)isBinding{ | |
| 27 | + if(isBinding){ | |
| 28 | + //绑定操作 | |
| 29 | + [self requestBindingManage:cell.model]; | |
| 30 | + | |
| 31 | + }else{ | |
| 32 | + //解除绑定操作 | |
| 33 | + UIAlertController *actionAlert1 = [UIAlertController alertControllerWithTitle:@"确定解除绑定?" message:nil preferredStyle:UIAlertControllerStyleAlert]; | |
| 34 | + | |
| 35 | + UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:NULL]; | |
| 36 | + __weak typeof(self) weakSelf = self; | |
| 37 | + UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | |
| 38 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 39 | + if(!strongSelf) return; | |
| 40 | + [strongSelf requestBindingManage:cell.model]; | |
| 41 | + | |
| 42 | + }]; | |
| 43 | + [action1 setValue:RGBOF(0x23D41E) forKey:@"_titleTextColor"]; | |
| 44 | + [action2 setValue:RGBOF(0x23D41E) forKey:@"_titleTextColor"]; | |
| 45 | + | |
| 46 | + [actionAlert1 addAction:action1]; | |
| 47 | + [actionAlert1 addAction:action2]; | |
| 48 | + [self presentViewController:actionAlert1 animated:YES completion:nil]; | |
| 49 | + } | |
| 50 | + | |
| 51 | +} | |
| 52 | +- (void)requestBindingManage:(CNLiveBindingManageModel *)model{ | |
| 53 | + switch (model.type) { | |
| 54 | + case CNLiveSendAuthRespWX: | |
| 55 | + { | |
| 56 | + if(![WXApi isWXAppInstalled]){ | |
| 57 | + [QMUITips showWithText:@"未安装微信" inView:self.view hideAfterDelay:1.5]; | |
| 58 | + return; | |
| 59 | + } | |
| 60 | + } | |
| 61 | + break; | |
| 62 | + case CNLiveSendAuthRespQQ: | |
| 63 | + { | |
| 64 | + if(![TencentOAuth iphoneQQInstalled]){ | |
| 65 | + [QMUITips showWithText:@"未安装QQ" inView:self.view hideAfterDelay:1.5]; | |
| 66 | + return; | |
| 67 | + } | |
| 68 | + } | |
| 69 | + break; | |
| 70 | + case CNLiveSendAuthRespWB: | |
| 71 | + { | |
| 72 | + if(![WeiboSDK isWeiboAppInstalled]){ | |
| 73 | + [QMUITips showWithText:@"未安装微博" inView:self.view hideAfterDelay:1.5]; | |
| 74 | + return; | |
| 75 | + } | |
| 76 | + } | |
| 77 | + break; | |
| 78 | + case CNLiveSendAuthRespApple: | |
| 79 | + { | |
| 80 | + } | |
| 81 | + break; | |
| 82 | + } | |
| 83 | + __weak typeof(self) weakSelf = self; | |
| 84 | + [CNLiveBindingManageRequest requestModel:model block:^(BOOL isSuccess, CNBindingManageModel * _Nullable model, BOOL isBinding) { | |
| 85 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 86 | + if(!strongSelf) return; | |
| 87 | + if(isSuccess){ | |
| 88 | + [strongSelf loadData]; | |
| 89 | + | |
| 90 | + } | |
| 91 | + | |
| 92 | + }]; | |
| 93 | +} | |
| 94 | +#pragma mark - Data | |
| 95 | +- (void)loadData{ | |
| 96 | + __weak typeof(self) weakSelf = self; | |
| 97 | + [CNLiveBindingManageRequest requestModels:^(NSArray * _Nullable bindingData, NSArray * _Nullable unBindingData) { | |
| 98 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 99 | + if(!strongSelf) return; | |
| 100 | + strongSelf.bindingData = bindingData; | |
| 101 | + strongSelf.unBindingData = unBindingData; | |
| 102 | + [strongSelf.tableView reloadData]; | |
| 103 | + }]; | |
| 104 | + | |
| 105 | +} | |
| 106 | + | |
| 107 | +- (void)viewDidLoad { | |
| 108 | + [super viewDidLoad]; | |
| 109 | + // Do any additional setup after loading the view. | |
| 110 | + self.view.backgroundColor = RGBOF(0xf4f4f4); | |
| 111 | + self.title = @"绑定管理"; | |
| 112 | + if (@available(iOS 11.0, *)) { | |
| 113 | + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; | |
| 114 | + } else { | |
| 115 | + self.automaticallyAdjustsScrollViewInsets = NO; | |
| 116 | + } | |
| 117 | + [self loadData]; | |
| 118 | + [self createUI]; | |
| 119 | + | |
| 120 | +} | |
| 121 | + | |
| 122 | +- (void)createUI{ | |
| 123 | + [self.view addSubview:self.tableView]; | |
| 124 | + | |
| 125 | +} | |
| 126 | + | |
| 127 | +- (void)viewDidLayoutSubviews { | |
| 128 | + [super viewDidLayoutSubviews]; | |
| 129 | + [_tableView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 130 | + make.top.equalTo(self.view.mas_top).with.offset(kVerticalStatusHeight+44); | |
| 131 | + make.left.equalTo(self.view.mas_left).with.offset(0); | |
| 132 | + make.right.equalTo(self.view.mas_right).with.offset(-0); | |
| 133 | + make.bottom.equalTo(self.view.mas_bottom).with.offset(-0); | |
| 134 | + | |
| 135 | + }]; | |
| 136 | + | |
| 137 | +} | |
| 138 | + | |
| 139 | +#pragma mark - UITableViewDataSource | |
| 140 | +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |
| 141 | + return 2; | |
| 142 | + | |
| 143 | +} | |
| 144 | + | |
| 145 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
| 146 | + if(section == 0){ | |
| 147 | + return self.bindingData.count; | |
| 148 | + | |
| 149 | + }else if(section == 1){ | |
| 150 | + return self.unBindingData.count; | |
| 151 | + | |
| 152 | + }else{ | |
| 153 | + return 0; | |
| 154 | + } | |
| 155 | + | |
| 156 | +} | |
| 157 | + | |
| 158 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| 159 | + return 80; | |
| 160 | + | |
| 161 | +} | |
| 162 | + | |
| 163 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| 164 | + CNBindingManageCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNBindingManageCell forIndexPath:indexPath]; | |
| 165 | + cell.selectionStyle = UITableViewCellSelectionStyleNone; | |
| 166 | + cell.delegate = self; | |
| 167 | + if(indexPath.section == 0){ | |
| 168 | + if(self.bindingData.count > 0){ | |
| 169 | + cell.model = self.bindingData[indexPath.row]; | |
| 170 | + } | |
| 171 | + | |
| 172 | + }else if(indexPath.section == 1){ | |
| 173 | + if(self.unBindingData.count > 0){ | |
| 174 | + cell.model = self.unBindingData[indexPath.row]; | |
| 175 | + } | |
| 176 | + } | |
| 177 | + return cell; | |
| 178 | + | |
| 179 | +} | |
| 180 | + | |
| 181 | +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ | |
| 182 | + return 40.0; | |
| 183 | + | |
| 184 | +} | |
| 185 | +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ | |
| 186 | + return 0.0000001f; | |
| 187 | + | |
| 188 | +} | |
| 189 | + | |
| 190 | +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { | |
| 191 | + NSArray *array = @[@"您已绑定网家家手机号账号", @"其他绑定方式"]; | |
| 192 | + CNBindingManageHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kCNBindingManageHeaderView]; | |
| 193 | + header.text = array[section]; | |
| 194 | + return header; | |
| 195 | + | |
| 196 | +} | |
| 197 | + | |
| 198 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | |
| 199 | + | |
| 200 | + | |
| 201 | +} | |
| 202 | + | |
| 203 | +/* | |
| 204 | + #pragma mark - Navigation | |
| 205 | + | |
| 206 | + // In a storyboard-based application, you will often want to do a little preparation before navigation | |
| 207 | + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 208 | + // Get the new view controller using [segue destinationViewController]. | |
| 209 | + // Pass the selected object to the new view controller. | |
| 210 | + } | |
| 211 | + */ | |
| 212 | + | |
| 213 | +#pragma mark - Lazy loading | |
| 214 | +- (UITableView *)tableView { | |
| 215 | + if (!_tableView) { | |
| 216 | + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; | |
| 217 | + _tableView.backgroundColor = RGBOF(0xf4f4f4); | |
| 218 | + _tableView.delegate = self; | |
| 219 | + _tableView.dataSource = self; | |
| 220 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| 221 | + _tableView.showsVerticalScrollIndicator = NO; | |
| 222 | + _tableView.showsHorizontalScrollIndicator = NO; | |
| 223 | + _tableView.estimatedRowHeight = 0; | |
| 224 | + _tableView.estimatedSectionFooterHeight = 0; | |
| 225 | + _tableView.estimatedSectionHeaderHeight = 0; | |
| 226 | + [_tableView registerClass:[CNBindingManageCell class] forCellReuseIdentifier:kCNBindingManageCell]; | |
| 227 | + [_tableView registerClass:[CNBindingManageHeaderView class] forHeaderFooterViewReuseIdentifier:kCNBindingManageHeaderView]; | |
| 228 | + | |
| 229 | + } | |
| 230 | + return _tableView; | |
| 231 | +} | |
| 232 | + | |
| 233 | +@end | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageHeaderView.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageHeaderView.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | +#define kCNLiveBindingManageHeaderView @"CNLiveBindingManageHeaderView" | |
| 13 | + | |
| 14 | +@interface CNLiveBindingManageHeaderView : UITableViewHeaderFooterView | |
| 15 | +@property (nonatomic, copy) NSString *text; | |
| 16 | + | |
| 17 | +@end | |
| 18 | + | |
| 19 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageHeaderView.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageHeaderView.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNLiveBindingManageHeaderView.h" | |
| 10 | +#import <Masonry/Masonry.h> | |
| 11 | + | |
| 12 | +@interface CNLiveBindingManageHeaderView() | |
| 13 | +@property (nonatomic, strong) UILabel *title; | |
| 14 | + | |
| 15 | +@end | |
| 16 | +@implementation CNLiveBindingManageHeaderView | |
| 17 | +static NSInteger const margin = 15; | |
| 18 | + | |
| 19 | +- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier { | |
| 20 | + if (self = [super initWithReuseIdentifier:reuseIdentifier]) { | |
| 21 | + //在这里向contentView添加控件 | |
| 22 | + self.backgroundColor = RGBOF(0xf4f4f4); | |
| 23 | + [self createSubviews]; | |
| 24 | + [self xw_layoutSubviews]; | |
| 25 | + | |
| 26 | + } | |
| 27 | + return self; | |
| 28 | +} | |
| 29 | +- (void)setText:(NSString *)text{ | |
| 30 | + _text = text; | |
| 31 | + _title.text = text; | |
| 32 | +} | |
| 33 | + | |
| 34 | +#pragma mark - setupUI | |
| 35 | +- (void)createSubviews { | |
| 36 | + [self.contentView addSubview:self.title]; | |
| 37 | + | |
| 38 | +} | |
| 39 | + | |
| 40 | +- (void)xw_layoutSubviews { | |
| 41 | + [self.title mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 42 | + make.top.equalTo(self.contentView); | |
| 43 | + make.left.equalTo(self.contentView.mas_left).offset(margin); | |
| 44 | + make.right.equalTo(self.contentView.mas_right).offset(-margin); | |
| 45 | + make.bottom.equalTo(self.contentView.mas_bottom); | |
| 46 | + | |
| 47 | + }]; | |
| 48 | + | |
| 49 | +} | |
| 50 | + | |
| 51 | +/* | |
| 52 | +// Only override drawRect: if you perform custom drawing. | |
| 53 | +// An empty implementation adversely affects performance during animation. | |
| 54 | +- (void)drawRect:(CGRect)rect { | |
| 55 | + // Drawing code | |
| 56 | +} | |
| 57 | +*/ | |
| 58 | + | |
| 59 | +#pragma mark - Lazy Loading | |
| 60 | +- (UILabel *)title { | |
| 61 | + if (!_title) { | |
| 62 | + _title = [[UILabel alloc] init]; | |
| 63 | + _title.textColor = RGBOF(0x999999); | |
| 64 | + _title.font = UIFontCNMake(14); | |
| 65 | + _title.numberOfLines = 0; | |
| 66 | + } | |
| 67 | + return _title; | |
| 68 | +} | |
| 69 | + | |
| 70 | +@end | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageModel.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageModel.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | +#import "CNLiveShareImageManager.h" | |
| 11 | + | |
| 12 | +NS_ASSUME_NONNULL_BEGIN | |
| 13 | + | |
| 14 | +@interface CNLiveBindingManageModel : NSObject | |
| 15 | +@property (nonatomic, copy) NSString *title; | |
| 16 | +@property (nonatomic, copy) NSString *desc; | |
| 17 | +@property (nonatomic, copy) NSString *image; | |
| 18 | +@property (nonatomic, copy) NSString *isBinding;//是否绑定 | |
| 19 | + | |
| 20 | +@property (nonatomic, copy) NSString *thirdPartyPlat; | |
| 21 | +@property (nonatomic, copy) NSString *thirdPartyId; | |
| 22 | +@property (nonatomic, assign) CNLiveSendAuthResp type; | |
| 23 | + | |
| 24 | + | |
| 25 | +@end | |
| 26 | + | |
| 27 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageModel.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageModel.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNLiveBindingManageModel.h" | |
| 10 | + | |
| 11 | +@implementation CNLiveBindingManageModel | |
| 12 | +- (CNLiveSendAuthResp)type{ | |
| 13 | + CNLiveSendAuthResp type = CNLiveSendAuthRespWX; | |
| 14 | + | |
| 15 | + if([self.thirdPartyPlat isEqualToString:@"1"]){ | |
| 16 | + type = CNLiveSendAuthRespWB; | |
| 17 | + | |
| 18 | + }else if ([self.thirdPartyPlat isEqualToString:@"2"]){ | |
| 19 | + type = CNLiveSendAuthRespQQ; | |
| 20 | + | |
| 21 | + }else if([self.thirdPartyPlat isEqualToString:@"3"]){ | |
| 22 | + type = CNLiveSendAuthRespWX; | |
| 23 | + | |
| 24 | + }else if([self.thirdPartyPlat isEqualToString:@"5"]){ | |
| 25 | + type = CNLiveSendAuthRespApple; | |
| 26 | + | |
| 27 | + } | |
| 28 | + return type; | |
| 29 | + | |
| 30 | +} | |
| 31 | + | |
| 32 | +@end | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageRequest.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageRequest.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | +#import "CNLiveShareImageManager.h" | |
| 11 | + | |
| 12 | +NS_ASSUME_NONNULL_BEGIN | |
| 13 | +@class CNBindingManageModel; | |
| 14 | +@class CNThreeLoginModel; | |
| 15 | + | |
| 16 | +typedef void (^CNLiveBindingResponseBlock)(BOOL isSuccess, CNLiveBindingManageModel * _Nullable model, BOOL isBinding); | |
| 17 | +typedef void (^CNLiveBindingArrayBlock)(NSArray * _Nullable bindingData, NSArray * _Nullable unBindingData); | |
| 18 | +typedef void (^CNLiveLoginResponseBlock)(NSURLSessionTask *requestTask, id responseObject, NSError *error); | |
| 19 | + | |
| 20 | +@interface CNLiveBindingManageRequest : NSObject | |
| 21 | +/** | |
| 22 | + * @abstract 绑定/解除绑定 | |
| 23 | + * | |
| 24 | + * @param model 模型 | |
| 25 | + * @param block 回调 | |
| 26 | + */ | |
| 27 | ++ (void)requestModel:(CNLiveBindingManageModel *)model block:(CNLiveBindingResponseBlock)block; | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * @abstract 获取绑定数据 | |
| 31 | + * | |
| 32 | + * @param block 回调 | |
| 33 | + */ | |
| 34 | ++ (void)requestModels:(CNLiveBindingArrayBlock)block; | |
| 35 | + | |
| 36 | +/** | |
| 37 | + * @abstract 三方登录 | |
| 38 | + * | |
| 39 | + * @param type 三方类型 | |
| 40 | + * @param model 模型 | |
| 41 | + * @param block 回调 | |
| 42 | + */ | |
| 43 | ++ (void)thirdPartyLoginWithType:(CNLiveSendAuthResp)type model:(CNThreeLoginModel *)model block:(CNLoginResponseBlock)block; | |
| 44 | + | |
| 45 | +@end | |
| 46 | + | |
| 47 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveLoginModule/Classes/BindingManage/CNLiveBindingManageRequest.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBindingManageRequest.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2019/9/10. | |
| 6 | +// Copyright © 2019 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNLiveBindingManageRequest.h" | |
| 10 | +#import "CNLiveBindingManageModel.h" | |
| 11 | +#import "CNThreeLoginModel.h" | |
| 12 | +#import "CNLiveShareImageManager.h" | |
| 13 | + | |
| 14 | +@implementation CNLiveBindingManageRequest | |
| 15 | ++ (void)requestModel:(CNLiveBindingManageModel *)model block:(CNLiveBindingResponseBlock)block{ | |
| 16 | + if([model.isBinding isEqualToString:@"1"]){ | |
| 17 | + //解除绑定操作 | |
| 18 | + [CNLiveBindingManageRequest requestUnBindingModel:model block:^(BOOL isSuccess, CNBindingManageModel * _Nullable model, BOOL isBinding) { | |
| 19 | + block?block(isSuccess, model, isBinding):@""; | |
| 20 | + }]; | |
| 21 | + } | |
| 22 | + else{ | |
| 23 | + //绑定操作 | |
| 24 | + [CNLiveBindingManageRequest requestBindingModel:model block:^(BOOL isSuccess, CNBindingManageModel * _Nullable model, BOOL isBinding) { | |
| 25 | + block?block(isSuccess, model, isBinding):@""; | |
| 26 | + }]; | |
| 27 | + } | |
| 28 | +} | |
| 29 | + | |
| 30 | +//绑定操作 | |
| 31 | ++ (void)requestBindingModel:(CNLiveBindingManageModel *)model block:(CNBindingResponseBlock)block{ | |
| 32 | + __weak typeof(self) weakSelf = self; | |
| 33 | + // 获取第三方id | |
| 34 | + [CNLiveShareImageManager send:model.type authRespBlock:^(CNLiveSendAuthResp type, CNLiveThirdPartyModel *userInfo, NSError *error) { | |
| 35 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 36 | + if(!strongSelf) return; | |
| 37 | + if(error){ | |
| 38 | + if(error.code == 10000){ | |
| 39 | + //用户取消 | |
| 40 | + }else{ | |
| 41 | + [QMUITips showWithText:@"绑定失败" inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 42 | + } | |
| 43 | + return ; | |
| 44 | + } | |
| 45 | + if(userInfo.thirdPartyId&&![userInfo.thirdPartyId isEqualToString:@""]){ | |
| 46 | + // 发起绑定请求 | |
| 47 | + model.thirdPartyId = userInfo.thirdPartyId; | |
| 48 | + [strongSelf sendBindingModel:model block:block]; | |
| 49 | + | |
| 50 | + }else{ | |
| 51 | + [QMUITips showWithText:@"绑定失败" inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 52 | + | |
| 53 | + } | |
| 54 | + | |
| 55 | + }]; | |
| 56 | + | |
| 57 | +} | |
| 58 | + | |
| 59 | ++ (void)sendBindingModel:(CNBindingManageModel *)model block:(CNBindingResponseBlock)block{ | |
| 60 | + NSDictionary *params = @{ | |
| 61 | + @"uid":CNUserShareModel.uid?CNUserShareModel.uid:@"", | |
| 62 | + @"thirdPartyPlat":model.thirdPartyPlat?model.thirdPartyPlat:@"", | |
| 63 | + @"thirdPartyId":model.thirdPartyId?model.thirdPartyId:@"", | |
| 64 | + @"token":CNUserShareModel.token?CNUserShareModel.token:@"", | |
| 65 | + @"clientPlat":@"i"}; | |
| 66 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 67 | + [CNLiveNetworking setupShowDataResult:NO]; | |
| 68 | + | |
| 69 | + __weak typeof(self) weakSelf = self; | |
| 70 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNLoginBind3rdUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 71 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 72 | + if(!strongSelf) return; | |
| 73 | + | |
| 74 | + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | |
| 75 | + //绑定,并更新本地数据 | |
| 76 | + CNBindingManageModel *bindingModel = [strongSelf updateBindingModel:model isBinding:@"1"]; | |
| 77 | + block?block(YES, bindingModel, YES):@""; | |
| 78 | + } | |
| 79 | + else if([responseObject isKindOfClass:[NSDictionary class]]) { | |
| 80 | + [QMUITips showWithText:responseObject[@"errorMessage"] inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 81 | + block?block(NO, nil, NO):@""; | |
| 82 | + } | |
| 83 | + else{ | |
| 84 | + [QMUITips showWithText:@"绑定失败" inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 85 | + block?block(NO, nil, NO):@""; | |
| 86 | + } | |
| 87 | + | |
| 88 | + }]; | |
| 89 | +} | |
| 90 | + | |
| 91 | +//解除绑定操作 | |
| 92 | ++ (void)requestUnBindingModel:(CNBindingManageModel *)model block:(CNBindingResponseBlock)block{ | |
| 93 | + NSDictionary *params = @{ | |
| 94 | + @"uid":CNUserShareModel.uid?CNUserShareModel.uid:@"", | |
| 95 | + @"thirdPartyPlat":model.thirdPartyPlat?model.thirdPartyPlat:@"", | |
| 96 | + @"thirdPartyId":model.thirdPartyId?model.thirdPartyId:@"", | |
| 97 | + @"token":CNUserShareModel.token?CNUserShareModel.token:@"", | |
| 98 | + @"clientPlat":@"i"}; | |
| 99 | + | |
| 100 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 101 | + [CNLiveNetworking setupShowDataResult:NO]; | |
| 102 | + | |
| 103 | + __weak typeof(self) weakSelf = self; | |
| 104 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNLoginUnBind3rdUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 105 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 106 | + if(!strongSelf) return; | |
| 107 | + | |
| 108 | + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { | |
| 109 | + //解除绑定,并更新本地数据 | |
| 110 | + CNBindingManageModel *unbindingModel = [strongSelf updateBindingModel:model isBinding:@"0"]; | |
| 111 | + block?block(YES, unbindingModel, NO):@""; | |
| 112 | + } | |
| 113 | + else if ([responseObject isKindOfClass:[NSDictionary class]]) { | |
| 114 | + [QMUITips showWithText:responseObject[@"errorMessage"] inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 115 | + block?block(NO, nil, NO):@""; | |
| 116 | + } | |
| 117 | + else{ | |
| 118 | + [QMUITips showWithText:@"解除绑定失败" inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 119 | + block?block(NO, nil, NO):@""; | |
| 120 | + } | |
| 121 | + | |
| 122 | + }]; | |
| 123 | + | |
| 124 | +} | |
| 125 | + | |
| 126 | +//改变绑定数据 | |
| 127 | ++ (CNBindingManageModel *)updateBindingModel:(CNBindingManageModel *)model isBinding:(NSString *)isBinding{ | |
| 128 | + if([isBinding isEqualToString:@"0"]){ | |
| 129 | + //解除绑定 | |
| 130 | + model.isBinding = @"0"; | |
| 131 | + //微博 | |
| 132 | + if([model.thirdPartyPlat isEqualToString:@"1"]){ | |
| 133 | + CNUserShareModel.sinaUid = @""; | |
| 134 | + | |
| 135 | + } | |
| 136 | ||
| 137 | + else if([model.thirdPartyPlat isEqualToString:@"2"]){ | |
| 138 | + CNUserShareModel.qqUid = @""; | |
| 139 | + | |
| 140 | + } | |
| 141 | + //微信 | |
| 142 | + else if([model.thirdPartyPlat isEqualToString:@"3"]){ | |
| 143 | + CNUserShareModel.wxUid = @""; | |
| 144 | + | |
| 145 | + } | |
| 146 | + //苹果 | |
| 147 | + else if([model.thirdPartyPlat isEqualToString:@"5"]){ | |
| 148 | + CNUserShareModel.appleUid = @""; | |
| 149 | + | |
| 150 | + } | |
| 151 | + [QMUITips showWithText:@"解除绑定成功" inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 152 | + return model; | |
| 153 | + } | |
| 154 | + else if ([isBinding isEqualToString:@"1"]){ | |
| 155 | + //添加绑定 | |
| 156 | + model.isBinding = @"1"; | |
| 157 | + //微博 | |
| 158 | + if([model.thirdPartyPlat isEqualToString:@"1"]){ | |
| 159 | + CNUserShareModel.sinaUid = model.thirdPartyId; | |
| 160 | + | |
| 161 | + } | |
| 162 | ||
| 163 | + else if([model.thirdPartyPlat isEqualToString:@"2"]){ | |
| 164 | + CNUserShareModel.qqUid = model.thirdPartyId; | |
| 165 | + | |
| 166 | + } | |
| 167 | + //微信 | |
| 168 | + else if([model.thirdPartyPlat isEqualToString:@"3"]){ | |
| 169 | + CNUserShareModel.wxUid = model.thirdPartyId; | |
| 170 | + | |
| 171 | + } | |
| 172 | + //苹果 | |
| 173 | + else if([model.thirdPartyPlat isEqualToString:@"5"]){ | |
| 174 | + CNUserShareModel.appleUid = model.thirdPartyId; | |
| 175 | + | |
| 176 | + } | |
| 177 | + [QMUITips showWithText:@"绑定成功" inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 178 | + return model; | |
| 179 | + | |
| 180 | + } | |
| 181 | + return nil; | |
| 182 | + | |
| 183 | +} | |
| 184 | + | |
| 185 | +//请求绑定数据 | |
| 186 | ++ (void)requestModels:(CNBindingArrayBlock)block{ | |
| 187 | + NSMutableArray *bindingData = [[NSMutableArray alloc] init]; | |
| 188 | + NSMutableArray *unBindingData = [[NSMutableArray alloc] init]; | |
| 189 | + CNBindingManageModel *tmodel = [[CNBindingManageModel alloc]init]; | |
| 190 | + tmodel.title = @"手机号"; | |
| 191 | + tmodel.image = @"login_telephone"; | |
| 192 | + NSString *mobile = [CNUserShareModel.mobile stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"****"]; | |
| 193 | + tmodel.desc = mobile; | |
| 194 | + tmodel.isBinding = @"1"; | |
| 195 | + tmodel.thirdPartyPlat = @"10"; | |
| 196 | + tmodel.thirdPartyId = CNUserShareModel.uid; | |
| 197 | + [bindingData addObject:tmodel]; | |
| 198 | + | |
| 199 | + CNBindingManageModel *wmodel = [[CNBindingManageModel alloc]init]; | |
| 200 | + wmodel.title = @"微信"; | |
| 201 | + wmodel.image = @"login_wechat"; | |
| 202 | + wmodel.thirdPartyPlat = @"3"; | |
| 203 | + | |
| 204 | + if(CNUserShareModel.wxUid&&![CNUserShareModel.wxUid isEqualToString:@""]){ | |
| 205 | + wmodel.desc = @"已绑定微信"; | |
| 206 | + wmodel.thirdPartyId = CNUserShareModel.wxUid; | |
| 207 | + wmodel.isBinding = @"1"; | |
| 208 | + }else{ | |
| 209 | + wmodel.desc = @"未绑定微信"; | |
| 210 | + wmodel.isBinding = @"0"; | |
| 211 | + } | |
| 212 | + [unBindingData addObject:wmodel]; | |
| 213 | + | |
| 214 | + CNBindingManageModel *qmodel = [[CNBindingManageModel alloc]init]; | |
| 215 | + qmodel.title = @"QQ"; | |
| 216 | + qmodel.image = @"login_qq"; | |
| 217 | + qmodel.thirdPartyPlat = @"2"; | |
| 218 | + if(CNUserShareModel.qqUid&&![CNUserShareModel.qqUid isEqualToString:@""]){ | |
| 219 | + qmodel.desc = @"已绑定QQ"; | |
| 220 | + qmodel.thirdPartyId = CNUserShareModel.qqUid; | |
| 221 | + qmodel.isBinding = @"1"; | |
| 222 | + }else{ | |
| 223 | + qmodel.desc = @"未绑定QQ"; | |
| 224 | + qmodel.isBinding = @"0"; | |
| 225 | + } | |
| 226 | + [unBindingData addObject:qmodel]; | |
| 227 | + | |
| 228 | + CNBindingManageModel *smodel = [[CNBindingManageModel alloc]init]; | |
| 229 | + smodel.title = @"微博"; | |
| 230 | + smodel.image = @"login_weibo"; | |
| 231 | + smodel.thirdPartyPlat = @"1"; | |
| 232 | + if(CNUserShareModel.sinaUid&&![CNUserShareModel.sinaUid isEqualToString:@""]){ | |
| 233 | + smodel.desc = @"已绑定微博"; | |
| 234 | + smodel.thirdPartyId = CNUserShareModel.sinaUid; | |
| 235 | + smodel.isBinding = @"1"; | |
| 236 | + }else{ | |
| 237 | + smodel.desc = @"未绑定微博"; | |
| 238 | + smodel.isBinding = @"0"; | |
| 239 | + } | |
| 240 | + [unBindingData addObject:smodel]; | |
| 241 | + | |
| 242 | + CNBindingManageModel *amodel = [[CNBindingManageModel alloc]init]; | |
| 243 | + amodel.title = @"苹果账号"; | |
| 244 | + amodel.image = @"login_apple_icon"; | |
| 245 | + amodel.thirdPartyPlat = @"5"; | |
| 246 | + if(CNUserShareModel.appleUid&&![CNUserShareModel.appleUid isEqualToString:@""]){ | |
| 247 | + amodel.desc = @"已绑定苹果账号"; | |
| 248 | + amodel.thirdPartyId = CNUserShareModel.appleUid; | |
| 249 | + amodel.isBinding = @"1"; | |
| 250 | + }else{ | |
| 251 | + amodel.desc = @"未绑定苹果账号"; | |
| 252 | + amodel.isBinding = @"0"; | |
| 253 | + } | |
| 254 | + [unBindingData addObject:amodel]; | |
| 255 | + | |
| 256 | + block?block(bindingData,unBindingData):@""; | |
| 257 | +} | |
| 258 | + | |
| 259 | +//三方登录 | |
| 260 | ++ (void)thirdPartyLoginWithType:(CNLiveSendAuthResp)type model:(CNThreeLoginModel *)model block:(CNLoginResponseBlock)block{ | |
| 261 | + NSDictionary *params = @{@"thirdPartyPlat":model.thirdPartyPlat?model.thirdPartyPlat:@"", | |
| 262 | + @"thirdPartyId":model.thirdPartyId?model.thirdPartyId:@"", | |
| 263 | + @"frmId":model.frmId?model.frmId:@"", | |
| 264 | + @"clientPlat":@"i"}; | |
| 265 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 266 | + [CNLiveNetworking setupShowDataResult:NO]; | |
| 267 | + | |
| 268 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNLoginIn3rdForWJJUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 269 | + block?block(requestTask, responseObject, error):@""; | |
| 270 | + | |
| 271 | + }]; | |
| 272 | + | |
| 273 | + | |
| 274 | +} | |
| 275 | + | |
| 276 | +@end | ... | ... |