Commit 76da1e2e authored by guanghui.shi's avatar guanghui.shi

还款页面开发

parent 5da89d23
......@@ -110,6 +110,8 @@
464F32452435FB8400656D2A /* QGDepositPwdView.m in Sources */ = {isa = PBXBuildFile; fileRef = 464F32442435FB8400656D2A /* QGDepositPwdView.m */; };
464F324824364D1B00656D2A /* QGDepositeCardModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 464F324724364D1B00656D2A /* QGDepositeCardModel.m */; };
464F324B24364ED300656D2A /* QGDepositPwdManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 464F324A24364ED300656D2A /* QGDepositPwdManager.m */; };
46500DCB2477CF4E00816069 /* QGRepaymentCommitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 46500DCA2477CF4E00816069 /* QGRepaymentCommitViewController.m */; };
46500DCF2477D9F400816069 /* QGPayCardViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 46500DCE2477D9F400816069 /* QGPayCardViewCell.m */; };
465A6E1C24596E3300BF924E /* QGFansEmptyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 465A6E1B24596E3300BF924E /* QGFansEmptyView.m */; };
465A6E222459837000BF924E /* QGSharePosterCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 465A6E212459837000BF924E /* QGSharePosterCollectionViewCell.m */; };
465A6E90245AC9CF00BF924E /* SASecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 465A6E24245AC9CF00BF924E /* SASecurityPolicy.m */; };
......@@ -208,6 +210,7 @@
46B6A94323BB4FA700184B85 /* YTTrackPro.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 46B6A93623BB4FA700184B85 /* YTTrackPro.framework */; };
46B6A94423BB4FA700184B85 /* NextCV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 46B6A93723BB4FA700184B85 /* NextCV.framework */; };
46B6A94523BB4FA700184B85 /* WBCloudReflectionFaceVerify_framework.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 46B6A93823BB4FA700184B85 /* WBCloudReflectionFaceVerify_framework.podspec */; };
46BE22B2247B99C0002088A6 /* QGRepayResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 46BE22B1247B99C0002088A6 /* QGRepayResultViewController.m */; };
46C3C98424570FE600B4F7BF /* QGBusinessFansViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 46C3C98324570FE600B4F7BF /* QGBusinessFansViewCell.m */; };
46C3C988245714CC00B4F7BF /* QGBusinessFansModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 46C3C987245714CC00B4F7BF /* QGBusinessFansModel.m */; };
46C3C98E24572BA900B4F7BF /* QGSharePosterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 46C3C98D24572BA800B4F7BF /* QGSharePosterViewController.m */; };
......@@ -901,6 +904,10 @@
464F324924364ED300656D2A /* QGDepositPwdManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGDepositPwdManager.h; sourceTree = "<group>"; };
464F324A24364ED300656D2A /* QGDepositPwdManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGDepositPwdManager.m; sourceTree = "<group>"; };
464F324C2436575A00656D2A /* QGDeposit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGDeposit.h; sourceTree = "<group>"; };
46500DC92477CF4E00816069 /* QGRepaymentCommitViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGRepaymentCommitViewController.h; sourceTree = "<group>"; };
46500DCA2477CF4E00816069 /* QGRepaymentCommitViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGRepaymentCommitViewController.m; sourceTree = "<group>"; };
46500DCD2477D9F400816069 /* QGPayCardViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGPayCardViewCell.h; sourceTree = "<group>"; };
46500DCE2477D9F400816069 /* QGPayCardViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGPayCardViewCell.m; sourceTree = "<group>"; };
465A6E1A24596E3300BF924E /* QGFansEmptyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGFansEmptyView.h; sourceTree = "<group>"; };
465A6E1B24596E3300BF924E /* QGFansEmptyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGFansEmptyView.m; sourceTree = "<group>"; };
465A6E202459837000BF924E /* QGSharePosterCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGSharePosterCollectionViewCell.h; sourceTree = "<group>"; };
......@@ -1075,6 +1082,8 @@
46B6A93623BB4FA700184B85 /* YTTrackPro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = YTTrackPro.framework; sourceTree = "<group>"; };
46B6A93723BB4FA700184B85 /* NextCV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = NextCV.framework; sourceTree = "<group>"; };
46B6A93823BB4FA700184B85 /* WBCloudReflectionFaceVerify_framework.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WBCloudReflectionFaceVerify_framework.podspec; sourceTree = "<group>"; };
46BE22B0247B99C0002088A6 /* QGRepayResultViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGRepayResultViewController.h; sourceTree = "<group>"; };
46BE22B1247B99C0002088A6 /* QGRepayResultViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGRepayResultViewController.m; sourceTree = "<group>"; };
46C3C98224570FE600B4F7BF /* QGBusinessFansViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGBusinessFansViewCell.h; sourceTree = "<group>"; };
46C3C98324570FE600B4F7BF /* QGBusinessFansViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QGBusinessFansViewCell.m; sourceTree = "<group>"; };
46C3C986245714CC00B4F7BF /* QGBusinessFansModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QGBusinessFansModel.h; sourceTree = "<group>"; };
......@@ -2385,6 +2394,7 @@
46440DBE22BA340F0021346A /* Controller */ = {
isa = PBXGroup;
children = (
46500DC62477CE4500816069 /* QGRepayment */,
9E4D1FD72340938900867C47 /* QGShouldAmountDetail */,
9E4D1FD52340936900867C47 /* QGRepaymentHome */,
);
......@@ -2485,6 +2495,43 @@
path = PwdView;
sourceTree = "<group>";
};
46500DC62477CE4500816069 /* QGRepayment */ = {
isa = PBXGroup;
children = (
46500DCC2477D49B00816069 /* Cell */,
46500DC82477CF2700816069 /* Controller */,
46500DC72477CF1F00816069 /* View */,
);
path = QGRepayment;
sourceTree = "<group>";
};
46500DC72477CF1F00816069 /* View */ = {
isa = PBXGroup;
children = (
);
path = View;
sourceTree = "<group>";
};
46500DC82477CF2700816069 /* Controller */ = {
isa = PBXGroup;
children = (
46500DC92477CF4E00816069 /* QGRepaymentCommitViewController.h */,
46500DCA2477CF4E00816069 /* QGRepaymentCommitViewController.m */,
46BE22B0247B99C0002088A6 /* QGRepayResultViewController.h */,
46BE22B1247B99C0002088A6 /* QGRepayResultViewController.m */,
);
path = Controller;
sourceTree = "<group>";
};
46500DCC2477D49B00816069 /* Cell */ = {
isa = PBXGroup;
children = (
46500DCD2477D9F400816069 /* QGPayCardViewCell.h */,
46500DCE2477D9F400816069 /* QGPayCardViewCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
465A6E1924596E1C00BF924E /* View */ = {
isa = PBXGroup;
children = (
......@@ -6127,6 +6174,7 @@
9EB1D7D922BCC0A7008D28CE /* ZHRichHelpModel.m in Sources */,
465A6E9C245AC9CF00BF924E /* SAAlertController.m in Sources */,
465A6EAD245AC9D000BF924E /* SAObjectSerializerContext.m in Sources */,
46500DCB2477CF4E00816069 /* QGRepaymentCommitViewController.m in Sources */,
97CDB63522891D4200257F77 /* YYClassInfo.m in Sources */,
465A7524241886C1000A4660 /* QGMallGoodsListViewController.m in Sources */,
46C3C98E24572BA900B4F7BF /* QGSharePosterViewController.m in Sources */,
......@@ -6233,6 +6281,7 @@
9EBE245324347882009C83A1 /* QGCreditApplyViewController.m in Sources */,
9EA79812228275D400CDCB80 /* QGColorNavigationBar.m in Sources */,
7F4C80DE22C9E1C6003B9D07 /* QGImageCollectionViewCell.m in Sources */,
46BE22B2247B99C0002088A6 /* QGRepayResultViewController.m in Sources */,
46F085C423A3982800979029 /* QGFloatsPopView.m in Sources */,
462E004A22C3173C0010C0E2 /* QGRepaymentOverDueCell.m in Sources */,
462DFD8324568A4C001BF47B /* QGBusinessFansViewController.m in Sources */,
......@@ -6482,6 +6531,7 @@
9EA79BD22282D61300CDCB80 /* SDInternalMacros.m in Sources */,
9EBE24462434336C009C83A1 /* QGCardAccountNormalCell.m in Sources */,
46F085C323A3982800979029 /* QGActivityPopModel.m in Sources */,
46500DCF2477D9F400816069 /* QGPayCardViewCell.m in Sources */,
9EB1DB4E22C30847008D28CE /* DES3EncryptUtil.m in Sources */,
9E6E28A623A2165100085C21 /* QGUserCenterDataModel.m in Sources */,
9EA79BC92282D61300CDCB80 /* SDImageCoderHelper.m in Sources */,
......
......@@ -13,6 +13,7 @@ typedef NS_ENUM(NSInteger,QGDepositType)
{
QGDepositTypeIn = 1, /// 转入
QGDepositTypeOut, /// 转出
QGDepositTypeRepay /// 还款
};
......
......@@ -26,6 +26,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *type ;
/// 卡Id,享花卡还款中用到
@property (nonatomic, copy) NSString *cardId ;
@end
NS_ASSUME_NONNULL_END
......@@ -154,7 +154,13 @@
/// 对密码进行DES加密
NSString *encryptPwd = [NSString encryptUseDES:pwd key:salt];
/// 校验交易密码
if (self.type == QGDepositTypeRepay) {
///还款交易
[self verifyPaymentWithEbcryPwd:encryptPwd];
}else{
/// 转入转出交易
[self verifyTradeWithEncryptPwd:encryptPwd];
}
}];
};
}
......@@ -179,6 +185,42 @@
}];
}
#pragma mark - 享花卡还款交易
-(void)verifyPaymentWithEbcryPwd:(NSString *)pwd
{
QGTalosNetwork *networking = [QGTalosNetwork shareManager];
NSMutableDictionary *param = [NSMutableDictionary dictionary];
[param setObject:self.card.cardId forKey:@"cardId"];
[param setObject:pwd forKey:@"pwd"];
[networking POST:@"http://yapi.quantgroups.com/mock/305/vcc/repay" parameters:param success:^(id _Nonnull responseObject) {
[QGHUDManager hideHud];
if ([QGTalosNetwork checkBusinessCodeAndCodeWithResponseObjectObject:responseObject]) {
if (self.tradeResultBlock) {
self.tradeResultBlock(YES, nil, nil);
}
if (self.resultBlock) {
self.resultBlock(QGDepositResultTypeSuccess, nil);
}
}else{
/// 失败信息
NSString *message = responseObject[@"msg"] ? responseObject[@"msg"] :@"未知错误,交易失败";
/// 回调:交易失败
if (self.tradeResultBlock) {
self.tradeResultBlock(NO, nil,message);
}
[self handleRepayFailureWithResponse:responseObject];
}
} failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
[QGHUDManager showHud:@"网络错误,交易失败"];
}];
}
#pragma mark - 转入转出交易
/// 验证交易密码
- (void)verifyTradeWithEncryptPwd:(NSString *)pwd
{
......@@ -222,6 +264,32 @@
}];
}
- (void)handleRepayFailureWithResponse:(NSDictionary *)responseObject
{
NSString *bussinessCode = [NSString stringWithFormat:@"%@",responseObject[@"businessCode"]];
if ([bussinessCode integerValue] == 2) {
self.errorCount ++;
/// 超过次数
if (self.errorCount >= self.totalCount) {
if (self.resultBlock) {
self.resultBlock(QGDepositResultTypeFailure, @"密码错误次数过多");
}
[self showPwdNotAvailableView];
}else{
NSString *message = [NSString stringWithFormat:@"密码错误%lu次,还剩%lu次尝试",self.errorCount,self.totalCount - self.errorCount];
if (self.resultBlock) {
self.resultBlock(QGDepositResultTypeFailureForPwd, message);
}
}
}else{
NSString *message = responseObject[@"msg"];
[QGHUDManager showHud:message?message:@"未知错误,交易失败"];
if (self.resultBlock) {
self.resultBlock(QGDepositResultTypeFailure, nil);
}
}
}
///BIZ_CODE_DEBIT_REQ_ERROR(3101L,"请求入参错误,请确认后重试")
///BIZ_CODE_DEBIT_QUICK_ERROR(3102L, "同一用户连续请求多次")
///BIZ_CODE_DEBIT_USER_ERROR(3103L, "该用户尚未开通储蓄卡")
......
......@@ -30,6 +30,8 @@
/// 错误信息反馈
@property (nonatomic, strong) UILabel *errorLab ;
@property (nonatomic, strong) UILabel *acountTitleLab ;
///交易结果回调
@property (nonatomic, copy) QGDepositResultBlock resultBlock ;
......@@ -133,6 +135,8 @@
make.left.inset(25);
make.top.equalTo(amountLab.mas_bottom).offset(12);
}];
self.acountTitleLab = acountTitleLab;
///转出账户具体银行
UILabel *acountLab = [UILabel creatLabelWithSuperView:backView title:@"**银行(****)" titleFontSize:[UIFont qg_lightFontOfSize:14.0] textColor:UIColor.textColor3333 alignment:NSTextAlignmentRight];
[acountLab mas_makeConstraints:^(MASConstraintMaker *make) {
......@@ -297,15 +301,30 @@
{
if (_type != type) {
_type = type;
self.depositeTitleLab.text = type == QGDepositTypeIn ? @"转入金额":@"转出金额";
self.depositeImageV.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",type == QGDepositTypeIn ? @"deposit_in":@"deposit_out"]];
if (type == QGDepositTypeIn) {
self.acountTitleLab.text = @"转出账户";
self.depositeTitleLab.text = @"转入金额";
self.depositeImageV.image = [UIImage imageNamed:@"deposit_in"];
}else if (type == QGDepositTypeOut){
self.acountTitleLab.text = @"转出账户";
self.depositeTitleLab.text = @"转出金额";
self.depositeImageV.image = [UIImage imageNamed:@"deposit_out"];
}else if (type == QGDepositTypeRepay){
self.acountTitleLab.text = @"付款方式";
self.depositeTitleLab.text = @"享花卡还款";
self.depositeImageV.image = nil;
}
}
}
- (void)setCard:(QGDepositeCardModel *)card
{
_card = card;
if (self.type == QGDepositTypeRepay) {
self.acountLab.text = [NSString stringWithFormat:@"%@(%@)",card.bankName,card.tailCardNo];
}else{
self.acountLab.text = [NSString stringWithFormat:@"%@%@(%@)",card.bankName,card.type,card.tailCardNo];
}
}
- (void)setAmount:(NSString *)amount
......
//
// QGPayModeViewCell.h
// VirtualPayment
//
// Created by silicn on 2020/5/22.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import "QGTableViewCommonCell.h"
NS_ASSUME_NONNULL_BEGIN
@interface QGPayCardViewCell : QGTableViewCommonCell
@property (nonatomic, copy) NSString *bankName ;
@property (nonatomic, copy) NSString *limitDes ;
@end
NS_ASSUME_NONNULL_END
//
// QGPayModeViewCell.m
// VirtualPayment
//
// Created by silicn on 2020/5/22.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import "QGPayCardViewCell.h"
#import "QGBasicUITool.h"
@interface QGPayCardViewCell ()
@property (nonatomic, strong) UILabel *cardLab ;
@property (nonatomic, strong) UILabel *desLab ;
@end
@implementation QGPayCardViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
UILabel *nameLab = [UILabel creatLabelWithSuperView:self.contentView title:@"付款方式" titleFontSize:[UIFont qg_lightFontOfSize:14.0f] textColor:UIColor.textColor9999 alignment:NSTextAlignmentLeft];
[nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.inset(20);
make.centerY.equalTo(self.contentView);
}];
[nameLab setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
self.cardLab = [UILabel creatLabelWithSuperView:self.contentView title:@"中国建设银行(8888)" titleFontSize:[UIFont qg_lightFontOfSize:14.0f] textColor:UIColor.textColor3333 alignment:NSTextAlignmentRight];
[self.cardLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.arrowImage.mas_left).offset(-10);
make.centerY.equalTo(self.contentView.mas_centerY).offset(-10);
make.left.greaterThanOrEqualTo(nameLab.mas_right).offset(10);
}];
UILabel *desLab = [UILabel creatLabelWithSuperView:self.contentView title:@"限额" titleFontSize:[UIFont qg_lightFontOfSize:11.0f] textColor:UIColor.textColor9999 alignment:NSTextAlignmentRight];
[desLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.cardLab);
make.top.equalTo(self.cardLab.mas_bottom).offset(2);
}];
self.desLab = desLab;
}
return self;
}
- (void)setBankName:(NSString *)bankName
{
_bankName = bankName;
self.cardLab.text = bankName;
}
- (void)setLimitDes:(NSString *)limitDes
{
_limitDes = limitDes;
self.desLab.text = limitDes;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// QGRepayResultViewController.h
// VirtualPayment
//
// Created by silicn on 2020/5/25.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import "QGBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger,QGRepayResultViewType)
{
QGRepayResultViewTypeNone = 0, /// 默认加载中
QGRepayResultViewTypeSuccess, /// 还款成功
QGRepayResultViewTypeFailure, /// 还款失败
QGRepayResultViewTypeWaiting /// 正在还款
};
typedef void(^QGRepayResultActionBlock)(QGRepayResultViewType viewType);
@interface QGRepayResultViewController : QGBaseViewController
/// 再转一笔的回调
@property (nonatomic, copy) QGRepayResultActionBlock actionBlock;
@end
NS_ASSUME_NONNULL_END
//
// QGRepayResultViewController.m
// VirtualPayment
//
// Created by silicn on 2020/5/25.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import "QGRepayResultViewController.h"
#import "QGCountDown.h"
#import "QGRepaymentReuestApi.h"
#import "QGGradientShadowButton.h"
@interface QGRepayResultViewController ()
/// 图片
@property (nonatomic, strong)UIImageView *imageView;
/// 时间
@property (nonatomic, strong)UILabel *timeLab;
/// 主提示
@property (nonatomic, strong)UILabel *titleLab;
/// 副提示
@property (nonatomic, strong)UILabel *subTitleLab ;
/// 还款按钮
@property (nonatomic, strong) QGGradientShadowButton *repayBtn ;
/// 计时器
@property (nonatomic, strong) QGCountDown *timer ;
/// 秒数
@property (nonatomic, assign)NSInteger seconds;
/// 页面样式
@property (nonatomic, assign)QGRepayResultViewType viewType;
/// 转账失败错误信息
@property (nonatomic, copy)NSString *errorMsg;
@end
@implementation QGRepayResultViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setupNavigation];
[self initNomalUI];
[self initData];
// Do any additional setup after loading the view.
}
- (void)setupNavigation
{
[self custemLeftDefaultBarButtonItem];
[self setNavBarBottomLineHidden:YES];
self.title = @"还款结果";
}
- (void)initNomalUI
{
/// 图片
UIImageView *imageView = [[UIImageView alloc]init];
[self.view addSubview:imageView];
imageView.image = [UIImage imageNamed:@"deposit_wait"];
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.height.width.mas_equalTo(120);
if (@available(iOS 11.0, *)) {
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop).inset(40);
} else {
make.top.equalTo(self.view.mas_top).inset(104);
}
}];
self.imageView = imageView;
/// 时间倒计时
UILabel *timeLab = [UILabel creatLabelWithSuperView:self.view title:@"15s" titleFontSize:[UIFont qg_mediumFontOfSize:15.0f] textColor:UIColor.yyMainThemeColor alignment:NSTextAlignmentCenter];
[timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(self.imageView);
make.height.width.mas_equalTo(40);
}];
self.timeLab = timeLab;
/// 正在转入/出
NSString *title = @"还款中,请稍后…";
UILabel *titleLab = [UILabel creatLabelWithSuperView:self.view title:title titleFontSize:[UIFont qg_regularFontOfSize:16.0f] textColor:UIColor.textColor3333 alignment:NSTextAlignmentCenter];
[titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(imageView.mas_bottom).offset(20);
make.centerX.equalTo(imageView);
}];
self.titleLab = titleLab;
///温馨提示
UILabel *subTitleLab = [UILabel creatLabelWithSuperView:self.view title:@" " titleFontSize:[UIFont qg_lightFontOfSize:12.0f] textColor:UIColor.textColor9999 alignment:NSTextAlignmentCenter];
subTitleLab.numberOfLines = 0;
[subTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(titleLab.mas_bottom).offset(6);
make.centerX.equalTo(titleLab);
make.left.right.greaterThanOrEqualTo(self.view).inset(25);
}];
self.subTitleLab = subTitleLab;
/// 再转一笔
self.repayBtn = [QGGradientShadowButton creatGradientColorButtonWithSuperView:self.view title:@" " textFont:[UIFont qg_regularFontOfSize:17.0]];
_repayBtn.layer.cornerRadius = 20;
_repayBtn.layer.borderColor = UIColor.yyMainThemeColor.CGColor;
_repayBtn.layer.borderWidth = 1;
_repayBtn.layer.masksToBounds = YES;
_repayBtn.hidden = YES;
[_repayBtn addTarget:self action:@selector(depositBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[self.repayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.inset(20);
make.top.equalTo(self.subTitleLab.mas_bottom).offset(50);
make.height.mas_equalTo(40);
}];
}
/// 初始化数据
- (void)initData
{
self.seconds = 15;
self.timer = [[QGCountDown alloc]init];
@weakify(self);
[self.timer countDownWithSEC:1.0f isImmediatelySelector:YES eventBlock:^{
@strongify(self);
/// 时间间隔
static NSInteger interval = 0;
self.seconds--;
interval++;
self.timeLab.text = [NSString stringWithFormat:@"%lus",self.seconds];
if (self.seconds == 0) {
[self stopTimer];
self.viewType = QGRepayResultViewTypeWaiting;
}
/// 三秒刷新一次接口
if (interval == 3) {
[self queryResult];
interval = 0;
}
}];
}
///成功/失败/处理中,交易状态 0-处理中 1-成功 2-失败
/// 查询交易结果
- (void)queryResult
{
QGTalosNetwork *networking = [QGTalosNetwork shareManager];
[networking GET:[QGRepaymentReuestApi urlWithIndex:QGRepaymentRequestServerMethodRepayStatus] parameters:nil success:^(id _Nonnull responseObject) {
if ([QGTalosNetwork checkBusinessCodeAndCodeWithResponseObjectObject:responseObject]) {
NSDictionary *data = responseObject[@"data"];
NSInteger status = [data[@"status"] integerValue];
/// 仅处理成功和失败, status=0 在计时seconds=15的逻辑里
if (status == 1) {
[self stopTimer];
self.viewType = QGRepayResultViewTypeSuccess;
/// 通知刷新页面
[[NSNotificationCenter defaultCenter] postNotificationName:VCCRepaymentReloadNotification object:nil];
}else if (status == 2){
[self stopTimer];
self.errorMsg = data[@"failedReason"];
self.viewType = QGRepayResultViewTypeFailure;
}
}
} failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
}];
}
/// 停止计时,并且终止Gif动画
- (void)stopTimer
{
[self.timer destoryTimer];
}
- (void)setViewType:(QGRepayResultViewType)viewType
{
if (_viewType != viewType) {
_viewType = viewType;
[self refreshViewWithType:viewType];
}
}
- (void)depositBtnAction:(UIButton *)btn
{
if (self.actionBlock) {
self.actionBlock(self.viewType);
}
if (self.viewType == QGRepayResultViewTypeSuccess) {
NSArray *viewControllers = self.navigationController.viewControllers;
UIViewController *popVC = nil;
for (UIViewController *vc in viewControllers) {
if ([vc isKindOfClass:NSClassFromString(@"QGRepaymentGroupViewController")]) {
popVC = vc;
break;
}
}
if (popVC) {
[self.navigationController popToViewController:popVC animated:YES];
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark - 切换页面样式
/// 切换页面样式
- (void)refreshViewWithType:(QGRepayResultViewType)type
{
switch (type) {
case QGRepayResultViewTypeNone:
{
self.timeLab.hidden = YES;
self.imageView.image = [UIImage imageNamed:@"deposit_wait"];
self.titleLab.text = @"还款中,请稍后…";
self.subTitleLab.text = nil;
self.repayBtn.hidden = YES;
}
break;
case QGRepayResultViewTypeSuccess: /// 转账成功
{
self.timeLab.hidden = YES;
self.imageView.image = [UIImage imageNamed:@"deposit_success"];
self.subTitleLab.text = nil;
self.titleLab.text = @"还款成功";
self.repayBtn.hidden = NO;
[self.repayBtn setTitle:@"完成" forState:UIControlStateNormal];
}
break;
case QGRepayResultViewTypeFailure: /// 转账失败
{
self.timeLab.hidden = YES;
self.imageView.image = [UIImage imageNamed:@"deposit_failure"];
self.titleLab.text = @"还款失败";
self.subTitleLab.text = nil;
self.repayBtn.hidden = NO;
[self.repayBtn setTitle:@"重新还款" forState:UIControlStateNormal];
}
break;
case QGRepayResultViewTypeWaiting: /// 正在转账
{
self.timeLab.hidden = YES;
self.imageView.image = [UIImage imageNamed:@"deposit_wait"];
self.titleLab.text = @"还款中,请稍后…";
self.subTitleLab.text = nil;
self.repayBtn.hidden = NO;
[self.repayBtn setTitle:@"返回" forState:UIControlStateNormal];
}
break;
default:
break;
}
}
- (void)setErrorMsg:(NSString *)errorMsg
{
if (_errorMsg != errorMsg) {
_errorMsg = errorMsg;
self.subTitleLab.text = errorMsg;
}
}
- (NSArray *)getImages
{
NSURL *gifImageUrl = [[NSBundle mainBundle] URLForResource:@"count_down" withExtension:@"gif"];
//获取Gif图的原数据
CGImageSourceRef gifSource = CGImageSourceCreateWithURL((CFURLRef)gifImageUrl, NULL);
//获取Gif图有多少帧
size_t gifcount = CGImageSourceGetCount(gifSource);
NSMutableArray *images = [[NSMutableArray alloc] init];
for (NSInteger i = 0; i < gifcount; i++) {
CGImageRef imageRef = CGImageSourceCreateImageAtIndex(gifSource, i, NULL);
UIImage *image = [UIImage imageWithCGImage:imageRef];
[images addObject:image];
CGImageRelease(imageRef);
}
return images;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// QGRepaymentCommitViewController.h
// VirtualPayment
//
// Created by silicn on 2020/5/22.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import "QGBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QGRepaymentCommitViewController : QGBaseViewController
@end
NS_ASSUME_NONNULL_END
//
// QGRepaymentCommitViewController.m
// VirtualPayment
//
// Created by silicn on 2020/5/22.
// Copyright © 2020 bo.zhang. All rights reserved.
//
#import "QGRepaymentCommitViewController.h"
#import "QGPayCardViewCell.h"
#import "QGGradientShadowButton.h"
#import "QGAlertView.h"
#import "QGDepositPwdManager.h"
#import "QGDepositeCardModel.h"
#import "QGRepayResultViewController.h"
@interface QGRepaymentCommitViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong)UITableView *tableView;
@property (nonatomic, strong) UIView *headerView ;
@property (nonatomic, strong) UILabel *payNameLab ;
@property (nonatomic, strong) UILabel *amountLab ;
@property (nonatomic, strong) UILabel *payDesLab ;
/// 银行名字
@property (nonatomic, copy) NSString *bankName ;
/// 银行卡号
@property (nonatomic, copy) NSString *bankCardNo ;
/// 每单限额
@property (nonatomic, assign) CGFloat bankLimitAmtPerDay;
/// 每日限额
@property (nonatomic, assign) CGFloat bankLimitAmtPerTrade;
///卡id
@property (nonatomic, copy) NSString *cardId ;
/// 卡列表URL
@property (nonnull, copy) NSString *bankCardListH5Url;
/// 还款-提前还款 1:还款2:提前还款
@property (nonatomic, assign) NSInteger repayType;
///还款金额
@property (nonatomic, assign) CGFloat repayAmt;
@end
@implementation QGRepaymentCommitViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self custemLeftDefaultBarButtonItem];
[self setNavBarBottomLineHidden:YES];
self.title = @"还款";
[self initNomalUI];
// Do any additional setup after loading the view.
}
- (void)initNomalUI
{
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
if (@available(iOS 11.0, *)) {
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
} else {
make.top.equalTo(self.view).inset(64);
}
make.left.right.bottom.equalTo(self.view);
}];
self.headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, MAINSCREEN_WIDTH, 140)];
self.headerView.backgroundColor = UIColor.whiteColor;
UILabel *payNameLab = [UILabel creatLabelWithSuperView:self.headerView title:@"应还金额(元)" titleFontSize:[UIFont qg_lightFontOfSize:12.0f] textColor:UIColor.textColor9999 alignment:NSTextAlignmentCenter];
[payNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.inset(30);
make.centerX.equalTo(self.headerView);
}];
self.payNameLab = payNameLab;
UILabel *amountLab = [UILabel creatLabelWithSuperView:self.headerView title:@"0.00" titleFontSize:[UIFont qg_numberFontOfSize:30.0f] textColor:UIColor.textColor3333 alignment:NSTextAlignmentCenter];
[amountLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(payNameLab.mas_bottom).offset(12);
make.centerX.equalTo(payNameLab);
}];
self.amountLab = amountLab;
UILabel *payDesLab = [UILabel creatLabelWithSuperView:self.headerView title:@"" titleFontSize:[UIFont qg_lightFontOfSize:12.0f] textColor:UIColor.textColor9999 alignment:NSTextAlignmentCenter];
payDesLab.numberOfLines = 0;
[payDesLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(amountLab.mas_bottom).offset(13);
make.left.right.inset(20);
make.bottom.lessThanOrEqualTo(self.headerView).inset(10);
}];
self.payDesLab = payDesLab;
self.tableView.tableHeaderView = self.headerView;
UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, MAINSCREEN_WIDTH, 100)];
footerView.backgroundColor = UIColor.clearColor;
QGGradientShadowButton *commitBtn = [QGGradientShadowButton creatGradientColorButtonWithSuperView:footerView title:@"确认还款" textFont:[UIFont qg_regularFontOfSize:17.0f]];
[commitBtn addTarget:self action:@selector(commitAction:) forControlEvents:UIControlEventTouchUpInside];
[commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.inset(20);
make.top.inset(50);
make.height.mas_equalTo(40);
}];
self.tableView.tableFooterView = footerView;
[self requestData];
}
#pragma mark - Request
- (void)requestData
{
QGTalosNetwork *networking = [QGTalosNetwork shareManager];
[QGHUDManager showHud:nil];
[networking GET:@"http://yapi.quantgroups.com/mock/305/vcc/repay/page" parameters:nil success:^(id _Nonnull responseObject) {
[QGHUDManager hideHud];
if ([QGTalosNetwork checkBusinessCodeAndCodeWithResponseObjectObject:responseObject]) {
self.payNameLab.text = responseObject[@"data"][@"repayContent"];
self.amountLab.text = [NSString stringWithFormat:@"%.2f", [responseObject[@"data"][@"repayAmt"] floatValue]];
self.payDesLab.text = responseObject[@"data"][@"billTotalAmtContent"];
self.bankName = responseObject[@"data"][@"bankName"];
self.bankCardNo = responseObject[@"data"][@"bankCardNo"];
self.bankLimitAmtPerDay = [responseObject[@"data"][@"bankLimitAmtPerDay"] floatValue];
self.bankLimitAmtPerTrade = [responseObject[@"data"][@"bankLimitAmtPerTrade"] floatValue];
self.bankCardListH5Url = responseObject[@"data"][@"bankCardListH5Url"];
self.repayType = [responseObject[@"data"][@"repayType"] integerValue];
self.repayAmt = [responseObject[@"data"][@"repayAmt"] floatValue];
self.cardId = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"bankCardId"]];
[self.tableView reloadData];
}
} failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
[QGHUDManager hideHud];
QGDefaultView * view = [QGDefaultView defaultViewShowWithSuperView:self.view inset:UIEdgeInsetsMake([DeviceAdaptation getNavBarAndStatusBarHeight], 0, 0, 0) reloadBlock:^{
//开始下拉刷新
[self requestData];
}];
view.viewType = QGDefaultViewTypeBadNetwork;
}];
}
#pragma mark - TableView Delegate & DataSource
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, MAINSCREEN_WIDTH, 10)];
view.backgroundColor = UIColor.moduleSeparatorColorF7F7;
return view;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 10.0f;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
QGPayCardViewCell *cell = (QGPayCardViewCell *)[self getCellFromClassName:NSStringFromClass([QGPayCardViewCell class]) dequeueTableView:tableView];
if (self.bankName.length) {
cell.bankName = self.bankName;
}else{
cell.bankName = @"请添加银行卡";
}
cell.limitDes = [NSString stringWithFormat:@"单笔限额%.f元,单日限额%.f元",self.bankLimitAmtPerTrade,self.bankLimitAmtPerDay];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.bankCardListH5Url) {
[self navigationToWeb:self.bankCardListH5Url];
}
}
- (void)commitAction:(UIButton *)btn
{
if (self.repayAmt > self.bankLimitAmtPerTrade) {
QGAlertView *alert = [[QGAlertView alloc]initWithTitle:nil message:@"您的还款金额已经超过对应银行单笔还款限额,请您更换银行卡还款。" cancelButtonTitle:nil sureButtonTitle:@"知道了" clickBlock:NULL];
[alert showInView:self.view];
return;
}
if (self.cardId == nil || [self.cardId isEqualToString:@""]) {
[QGHUDManager showHud:@"获取信息错误"];
return;
}
QGDepositeCardModel *card = [[QGDepositeCardModel alloc]init];
card.bankName = self.bankName;
if (self.bankCardNo.length > 4) {
card.tailCardNo = [self.bankCardNo substringWithRange:NSMakeRange(self.bankCardNo.length - 4, 4)];
}else{
card.tailCardNo = self.bankCardNo;
}
card.cardId = self.cardId;
card.minAmount = @"0.00";
card.maxAmount = [NSString stringWithFormat:@"%.2f",self.bankLimitAmtPerTrade];
QGDepositPwdManager *manager = [QGDepositPwdManager defaultMangerWithType:QGDepositTypeRepay amount:[NSString stringWithFormat:@"%.2f",self.repayAmt] card:card];
[manager showInView:self.view];
@weakify(self);
manager.tradeResultBlock = ^(BOOL success, NSString * _Nullable tradeNo, NSString * _Nullable message) {
@strongify(self);
[self toReslut];
};
}
- (void)toReslut
{
QGRepayResultViewController *vc = [[QGRepayResultViewController alloc]init];
[self.navigationController pushViewController:vc animated:YES];
}
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.estimatedRowHeight = 0;
_tableView.rowHeight = 74;
_tableView.estimatedSectionFooterHeight = 0;
_tableView.estimatedSectionHeaderHeight = 0;
_tableView.backgroundColor = UIColor.moduleSeparatorColorF7F7;
}
return _tableView;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -40,6 +40,7 @@
#import "QGAnalyticsService.h"
#import "QGRepaymentCommitViewController.h"
......@@ -127,20 +128,24 @@
[self setupAnalyticsWith:isRight];
NSString *urlString = nil;
if (self.bottomView.type == RepaymentBottomTypeSignle){
urlString = self.billHead.forwardUrl;
urlString = [urlString filterURLParam:@"isBothBtn" value:@"false"];
}else{
urlString = isRight ? self.billHead.installmentUrl:self.billHead.forwardUrl;
urlString = [urlString filterURLParam:@"isBothBtn" value:@"true"];
}
// NSString *urlString = nil;
// if (self.bottomView.type == RepaymentBottomTypeSignle){
// urlString = self.billHead.forwardUrl;
// urlString = [urlString filterURLParam:@"isBothBtn" value:@"false"];
// }else{
// urlString = isRight ? self.billHead.installmentUrl:self.billHead.forwardUrl;
// urlString = [urlString filterURLParam:@"isBothBtn" value:@"true"];
// }
//
// urlString = [urlString filterURLParam:@"billNumber" value:self.billModel.billNo];
// urlString = [urlString filterURLParam:@"itemPrice" value:self.billModel.balanceAmount];
// urlString = [urlString filterURLParam:@"addPrice" value:self.shouldAmount == nil ? @"0":self.shouldAmount];
// urlString = [urlString filterURLParam:@"from" value:self.billModel.isShould ? @"should":@"await"];
// [self navigationToWeb:urlString];
QGRepaymentCommitViewController *vc = [[QGRepaymentCommitViewController alloc]init];
[self.navigationController pushViewController:vc animated:YES];
urlString = [urlString filterURLParam:@"billNumber" value:self.billModel.billNo];
urlString = [urlString filterURLParam:@"itemPrice" value:self.billModel.balanceAmount];
urlString = [urlString filterURLParam:@"addPrice" value:self.shouldAmount == nil ? @"0":self.shouldAmount];
urlString = [urlString filterURLParam:@"from" value:self.billModel.isShould ? @"should":@"await"];
[self navigationToWeb:urlString];
};
/// 设置tableView
[self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
......
......@@ -14,6 +14,9 @@ typedef NS_ENUM(NSInteger,QGRepaymentRequestServerMethod){
QGRepaymentRequestServerMethodGroupMerge, // 首页列表接口
QGRepaymentRequestServerMethodHistoryBills, // 历史账单接口
QGRepaymentRequestServerMethodBillDetail, // 账单详情接口
QGRepaymentRequestServerMethodRepay, // 还款
QGRepaymentRequestServerMethodRepayStatus, // 还款状态
QGRepaymentRequestServerMethodRepayInfo // 还款页面信息
} ;
@interface QGRepaymentReuestApi : NSObject
......
......@@ -22,6 +22,15 @@
case QGRepaymentRequestServerMethodBillDetail:
return @"vcc/bill_detail";
break;
case QGRepaymentRequestServerMethodRepay:
return @"vcc/repay";
break;
case QGRepaymentRequestServerMethodRepayStatus:
return @"vcc/repayStatus";
break;
case QGRepaymentRequestServerMethodRepayInfo:
return @"vcc/repay/page";
break;
default:
return nil;
break;
......
......@@ -485,7 +485,7 @@
CGFloat scale = 3;
/// 二维码尺寸
CGFloat qr_width = 103/312.0 *MAINSCREEN_WIDTH;
CGFloat qr_height = 116/103.0 *qr_width;
CGFloat qr_height = qr_width;
/// 图片缩放高度
CGFloat adjustScaleHeight = image.size.height/(image.size.width/MAINSCREEN_WIDTH);
......
......@@ -17,6 +17,8 @@
#import "QGAlertView.h"
#import "QGMallRequestApi.h"
#import "QGThirdPlatformService.h"
@interface QGSafeCenterViewController ()
///列表模型数组
@property (nonatomic, strong)NSMutableArray *dataArray;
......@@ -108,6 +110,16 @@
}];
[self.dataArray addObject:loginPassword];
QGMineModel *wxAuthModel = [[QGMineModel alloc]initWithTitle:@"微信授权" subtitle:@"未授权" clickAction:^(QGMineModel *model) {
@strongify(self);
// if (alimamaAuth) {
// [self cancleTaoBaoAuth];
// }else{
// [[QGBaiChuanManager shareInstance] authAllAuthoritiesWithController:self.navigationController];
// }
}];
[self.dataArray addObject:wxAuthModel];
/// 淘宝授权
bool alimamaAuth = QGUserInfo.sharedUserInfo.alimamaAuth;
QGMineModel *tbAuthModel = [[QGMineModel alloc]initWithTitle:@"淘宝授权" subtitle:alimamaAuth ? @"已授权":@"未授权" clickAction:^(QGMineModel *model) {
......@@ -125,6 +137,18 @@
}
- (void)bindWxAuth
{
[[QGThirdPlatformService shareInstance] wxAuthWithSuccess:^(QGWechatLoginInfoModel *infoModel) {
}];
}
- (void)unBindWxAuth
{
}
- (void)cancleTaoBaoAuth
{
QGAlertView *alert = [[QGAlertView alloc] initWithTitle:nil message:@"确认取消淘宝授权?取消后将无法继续获得返现哦~" cancelButtonTitle:@"取消" sureButtonTitle:@"确认" clickBlock:^(NSInteger index) {
......
......@@ -525,7 +525,6 @@
}
/// 客服点击事件
- (void)serviceButtonClickWithNavUrl:(NSString *)navUrl
{
......
......@@ -70,8 +70,8 @@ static NSString *const kDefaultIconUrl = @"http://7xodoz.dl1.z0.glb.clouddn.com/
static NSString *const kTencentAppID = @"1108767784";
static NSString *const kTencentSchemeKey = @"tencent1108767784";
/// 保存分享海报的url信息,用于做对比
#define kSharePosterKey @"kSharePosterNativeKey"
#define kPasteboardCurrentContentKey @"kPasteboardCurrentContentKey"
//字节跳动APM
#define ByteDanceApmAppID @"173771"
......
......@@ -69,13 +69,20 @@ static SystemManager * shareManager = nil;
}
/// 监听App的粘贴板
- (void)pasteboardChanged
{
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
if (pasteboard.string.length) {
/// 大于100 取 100
if (pasteboard.string.length > 100) {
self.pasteboardString = [pasteboard.string substringToIndex:99];
}else{
self.pasteboardString = pasteboard.string;
}
self.pasteboardStrings = pasteboard.strings;
[[QGCacheManager shareCacheManager] setAPPConfigValue:self.pasteboardString forKey:kPasteboardCurrentContentKey];
}else{
self.pasteboardString = nil;
self.pasteboardStrings = nil;
......@@ -227,8 +234,26 @@ static SystemManager * shareManager = nil;
NSString *string = [UIPasteboard generalPasteboard].string;
/// 空或者字符串长度小于15
if ([NSString isEmpty:string] || string.length <= 15) return NO;
if (self.pasteboardString.length == 0) {
NSString *pasterBoard = [[QGCacheManager shareCacheManager] appConfigValueForKey:kPasteboardCurrentContentKey];
if (pasterBoard.length) {
self.pasteboardString = pasterBoard;
}
}
/// 与粘贴板相同
if (self.pasteboardString && [self.pasteboardString isEqualToString:string]) return NO;
if (self.pasteboardString) {
// 字符串大于100,取100
if (string.length > 100) {
NSString *subString = [string substringToIndex:99];
if ([self.pasteboardString isEqualToString:subString]) {
return NO;
}
}else{
if ([self.pasteboardString isEqualToString:string]) {
return NO;
}
}
}
/// 纯数字
if ([string isNumber]) return NO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment