新增获取客服接口
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
@property (nonatomic, strong) NSArray<NSArray<NSDictionary *> *> *data; // 分组数据
|
||||
@property (nonatomic, strong) UIImageView *bgImageView; // 全屏背景图
|
||||
@property (nonatomic, strong) KBMyVM *viewModel; // 我的页面 VM
|
||||
@property (nonatomic, copy) NSString *customerMail; // 客服邮箱
|
||||
@end
|
||||
|
||||
@implementation MyVC
|
||||
@@ -43,7 +44,7 @@
|
||||
// 数据源(title + SF Symbols 名称 + 色值),分两组 my_record_icon
|
||||
self.data = @[
|
||||
@[@{ @"title": KBLocalized(@"Consumption Record"), @"icon": @"my_record_icon", @"color": @(0x60A3FF),@"id":@"8" }],
|
||||
@[@{ @"title": KBLocalized(@"Notice"), @"icon": @"my_notice_icon", @"color": @(0x60A3FF),@"id":@"1" }],
|
||||
// @[@{ @"title": KBLocalized(@"Notice"), @"icon": @"my_notice_icon", @"color": @(0x60A3FF),@"id":@"1" }],
|
||||
@[@{ @"title": KBLocalized(@"invite"), @"icon": @"my_share_icon", @"color": @(0xF5A623),@"id":@"2" }],
|
||||
@[@{ @"title": KBLocalized(@"Feedback"), @"icon": @"my_feedback_icon", @"color": @(0xB06AFD),@"id":@"3" },
|
||||
@{ @"title": KBLocalized(@"E-mail"), @"icon": @"my_email_icon", @"color": @(0xFF8A65),@"id":@"4" },
|
||||
@@ -63,6 +64,11 @@
|
||||
self.header = [[KBMyHeaderView alloc] initWithFrame:CGRectMake(0, 0, KB_SCREEN_WIDTH, 357)];
|
||||
self.header.backgroundColor = UIColor.clearColor; // 透明,显示背景图
|
||||
self.tableView.tableHeaderView = self.header;
|
||||
|
||||
if (!self.viewModel) {
|
||||
self.viewModel = [[KBMyVM alloc] init];
|
||||
}
|
||||
[self loadCustomerMailOnce];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
@@ -81,6 +87,30 @@
|
||||
|
||||
// 系统导航栏的显隐由 BaseViewController 统一处理(始终隐藏),此处无需再设置。
|
||||
|
||||
/// 1:viewDidLoad 触发一次,预加载客服邮箱
|
||||
- (void)loadCustomerMailOnce {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.viewModel fetchCustomerMailWithCompletion:^(NSString * _Nullable customerMail, NSError * _Nullable error) {
|
||||
if (error) { return; }
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
__strong typeof(weakSelf) self = weakSelf;
|
||||
if (!self) { return; }
|
||||
self.customerMail = customerMail;
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
/// 2:点击 E-mail 复制邮箱并提示
|
||||
- (void)handleEmailCopy {
|
||||
NSString *mail = [self.customerMail stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (mail.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"Failed")];
|
||||
return;
|
||||
}
|
||||
UIPasteboard.generalPasteboard.string = mail;
|
||||
[KBHUD showInfo:KBLocalized(@"Email Copy Success")];
|
||||
}
|
||||
|
||||
#pragma mark - UITableView
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return self.data.count; }
|
||||
@@ -185,7 +215,7 @@
|
||||
[self.navigationController pushViewController:[KBFeedBackVC new] animated:true];
|
||||
|
||||
}else if ([itemID isEqualToString:@"4"]){
|
||||
|
||||
[self handleEmailCopy];
|
||||
}else if ([itemID isEqualToString:@"5"]){
|
||||
|
||||
}else if ([itemID isEqualToString:@"6"]){
|
||||
|
||||
Reference in New Issue
Block a user