mineViewController.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. //
  2. // mineViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/6/21.
  6. //
  7. #import "mineViewController.h"
  8. #import "MineCommonUsedView.h"
  9. #import "privacyModeViewController.h"
  10. #import "TipsQRCodeForChangeDeviceViewController.h"
  11. #import "AboutViewController.h"
  12. #import "clearCacheAlretViewController.h"
  13. #import "inputPWDViewController.h"
  14. #import "customerServiceViewController.h"
  15. #import "customDownloadCacheManager.h"
  16. #import "CustomerWebViewController.h"
  17. #import "audioPlayingView.h"
  18. #import "DFPlayer.h"
  19. #import "audioPlayerViewController.h"
  20. #import "scanToPCLoginViewController.h"
  21. #import "PCLoginViewController.h"
  22. @interface mineViewController ()
  23. @property(nonatomic,strong)UIButton *netButton;
  24. @property(nonatomic,strong)UILabel *snLabel;
  25. @property(nonatomic,strong)MineCommonUsedView *MineCommonUsedV;
  26. @end
  27. @implementation mineViewController
  28. - (void)viewDidLoad {
  29. [super viewDidLoad];
  30. // Do any additional setup after loading the view.
  31. [self.view setBackgroundColor:HWF5F7FAColor];
  32. [self.toolBar setHidden:YES];
  33. [self.navigationBar setHidden:YES];
  34. [self.navBarBGView setHidden:YES];
  35. [self drawAnyView];
  36. }
  37. - (void)drawAnyView{
  38. //顶底底部图片
  39. UIImageView *topImageV = [UIImageView new];
  40. topImageV.image = [UIImage imageNamed:@"Nas_top_img"];
  41. [self.view addSubview:topImageV];
  42. [topImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.top.mas_equalTo(0);
  44. make.left.mas_equalTo(0);
  45. make.right.mas_equalTo(0);
  46. make.height.mas_equalTo(280.0*AUTOSCALE);
  47. }];
  48. UIButton *pcScanButton = [[UIButton alloc] init];
  49. [pcScanButton setImage:[UIImage imageNamed:@"pc_scan_icon"] forState:UIControlStateNormal];
  50. pcScanButton.tag = 100;
  51. [pcScanButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  52. [self.view addSubview:pcScanButton];
  53. [pcScanButton mas_makeConstraints:^(MASConstraintMaker *make) {
  54. make.top.mas_equalTo(50);
  55. make.right.mas_equalTo(-15);
  56. make.width.mas_equalTo(40);
  57. make.height.mas_equalTo(40);
  58. }];
  59. CGFloat tipImageTop = 50 + 40;
  60. //商标图片
  61. UIImageView *TipImageV = [UIImageView new];
  62. TipImageV.image = [UIImage imageNamed:@"mine_head_icon"];
  63. [self.view addSubview:TipImageV];
  64. [TipImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.top.mas_equalTo(tipImageTop);
  66. make.left.mas_equalTo(16);
  67. make.width.mas_equalTo(48);
  68. make.height.mas_equalTo(48);
  69. }];
  70. _snLabel = [[UILabel alloc] init];
  71. _snLabel.font = [UIFont boldSystemFontOfSize:14.0];
  72. _snLabel.textColor = [UIColor hwColor:@"#0A132B"];
  73. //_fileNamelabel.backgroundColor = [UIColor greenColor];
  74. [self.view addSubview:_snLabel];
  75. [_snLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  76. make.left.equalTo(TipImageV.mas_right).offset(5);
  77. make.right.mas_equalTo(-16);
  78. //make.centerY.mas_equalTo(TipImageV.mas_centerY).offset(0);
  79. make.top.mas_equalTo(TipImageV.mas_top).offset(0);
  80. make.height.mas_equalTo(20);
  81. }];
  82. _netButton = [[UIButton alloc] init];
  83. [_netButton setImage:[UIImage imageNamed:@"mine_net_icon"] forState:UIControlStateNormal];
  84. [_netButton setTitleColor:[UIColor hwColor:@"#058DFB"] forState:UIControlStateNormal];
  85. _netButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
  86. //_netButton.tag = 1;
  87. //[_netButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  88. _netButton.userInteractionEnabled = NO;
  89. [self.view addSubview:_netButton];
  90. _netButton.layer.cornerRadius = 12;
  91. _netButton.layer.borderWidth = 1.5;
  92. _netButton.layer.borderColor = [UIColor hwColor:@"#058DFB"].CGColor;
  93. _netButton.layer.masksToBounds = YES;
  94. [_netButton mas_makeConstraints:^(MASConstraintMaker *make) {
  95. //make.width.mas_equalTo(58);
  96. make.width.mas_equalTo(70);
  97. make.height.mas_equalTo(24);
  98. make.left.equalTo(TipImageV.mas_right).offset(5);
  99. make.bottom.mas_equalTo(TipImageV.mas_bottom).offset(0);
  100. }];
  101. //常用功能
  102. _MineCommonUsedV = [[MineCommonUsedView alloc] init];
  103. [self.view addSubview:_MineCommonUsedV];
  104. [_MineCommonUsedV mas_makeConstraints:^(MASConstraintMaker *make) {
  105. make.top.equalTo(TipImageV.mas_bottom).offset(15);
  106. make.left.mas_equalTo(0);
  107. make.right.mas_equalTo(0);
  108. make.height.mas_equalTo(210);
  109. }];
  110. KWeakSelf
  111. _MineCommonUsedV.didClickButtonFun = ^(NSInteger tag) {
  112. [weakSelf didClickCommonUsedFunBy:tag];
  113. };
  114. }
  115. #pragma mark 点击常用模块模块
  116. - (void)didClickCommonUsedFunBy:(NSInteger)tag
  117. {
  118. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  119. {
  120. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  121. return;
  122. }
  123. switch (tag)
  124. {
  125. case 10:{
  126. inputPWDViewController *nextVC = [inputPWDViewController new];
  127. nextVC.isCheckPwdType = YES;
  128. [self pushViewController:nextVC animated:YES];
  129. KWeakSelf
  130. nextVC.didInputRightPwdFun = ^{
  131. [weakSelf gotoPrivacyModeVCFun];
  132. };
  133. }
  134. break;
  135. case 11:{
  136. TipsQRCodeForChangeDeviceViewController *nextVC = [TipsQRCodeForChangeDeviceViewController new];
  137. [self pushViewController:nextVC animated:YES];
  138. }
  139. break;
  140. case 12:{
  141. CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
  142. vc.titleStr = NSLocalizedString(@"mine_help_title",nil);
  143. // NSString *url = @"http://testprivacy.phone.armclouding.com:1801/problemFeedback/#/pages/fileSharing/problem/index?sn=";
  144. // if([CloudService rangeOfString:@"hiboxde.armclouding.com"].location != NSNotFound){
  145. // //url = @"http://hiboxde.armclouding.com:7780/h5/rule.html";;
  146. // }
  147. NSString *url = [[NSString alloc] initWithFormat:@"%@/problemFeedback/#/pages/fileSharing/problem/index?sn=",CloudService];
  148. vc.webUrl = [[NSString alloc] initWithFormat:@"%@%@",url,[connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn];
  149. [self pushViewController:vc animated:YES];
  150. //数据埋点
  151. [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Help_feedback"];
  152. }
  153. break;
  154. case 13:{
  155. customerServiceViewController *vc = [customerServiceViewController new];
  156. [self pushViewController:vc animated:YES];
  157. }
  158. break;
  159. case 14:{
  160. CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
  161. vc.titleStr = NSLocalizedString(@"mine_newuser_title",nil);
  162. // NSString *url = @"http://testprivacy.phone.androidscloud.com:1801/warrantyService/index.html#/novice";
  163. // if([CloudService rangeOfString:@"hiboxde.armclouding.com"].location != NSNotFound){
  164. // //url = @"http://hiboxde.armclouding.com:7780/h5/rule.html";;
  165. // }
  166. NSString *url = [[NSString alloc] initWithFormat:@"%@/warrantyService/index.html#/novice",CloudService];
  167. vc.webUrl = url;
  168. [self pushViewController:vc animated:YES];
  169. }
  170. break;
  171. case 15:{
  172. [self clickClearCacheButtonFun];
  173. }
  174. break;
  175. case 16:{
  176. AboutViewController *nextVC = [[AboutViewController alloc] init];
  177. nextVC.getSysInfo = ^{
  178. [[webSocketManager shareInstance] getSysInfoFun];
  179. };
  180. [self pushViewController:nextVC animated:YES];
  181. }
  182. break;
  183. case 17:{
  184. [[iToast makeText:@"点击了注销"] show];
  185. }
  186. break;
  187. default:
  188. break;
  189. }
  190. }
  191. #pragma mark 去设置隐私
  192. - (void)gotoPrivacyModeVCFun
  193. {
  194. privacyModeViewController *nextVC = [[privacyModeViewController alloc] init];
  195. [self pushViewController:nextVC animated:YES];
  196. }
  197. #pragma mark 清理缓存相关
  198. - (void)clickClearCacheButtonFun
  199. {
  200. KWeakSelf
  201. /*弹窗提示清除缓存*/
  202. clearCacheAlretViewController *nextVC = [[clearCacheAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_clear_cache",nil)
  203. msg:NSLocalizedString(@"clear_cache_tip",nil)
  204. imageStr:nil
  205. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  206. okTitle:NSLocalizedString(@"other_clear",nil) isOkBtnHighlight:YES
  207. didClickOk:^(BOOL isSelect) {
  208. [weakSelf handleClearCacheFunWith:isSelect];
  209. } didClickCancel:^{
  210. }];
  211. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  212. [self presentViewController:nextVC animated:YES completion:^{
  213. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  214. }];
  215. }
  216. - (void)handleClearCacheFunWith:(BOOL)isSelectFileTransfer
  217. {
  218. [self ClearCommonCacheFun:isSelectFileTransfer];
  219. //数据埋点
  220. [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Clear_cache"];
  221. }
  222. - (void)ClearCommonCacheFun:(BOOL)isSelectFileTransfer
  223. {
  224. NSString *ruiyunLogPath = [NSString stringWithFormat:@"%@/logs/debug_0.log",CachesPatch];
  225. long logSize1 = [iTools fileSizeAtPath:ruiyunLogPath];
  226. [[NSFileManager defaultManager] removeItemAtPath:ruiyunLogPath error:nil];
  227. NSString *appLogPath = [NSString stringWithFormat:@"%@/logs/app.log",CachesPatch];
  228. long logSize2 = [iTools fileSizeAtPath:appLogPath];
  229. [[NSFileManager defaultManager] removeItemAtPath:appLogPath error:nil];
  230. //
  231. NSString *downLoadThumbnailPath = [NSString stringWithFormat:@"%@/DownLoadThumbnail",CachesPatch];
  232. long logSize3 = [iTools folderSizeAtPath:downLoadThumbnailPath];
  233. [[NSFileManager defaultManager] removeItemAtPath:downLoadThumbnailPath error:nil];
  234. NSString *downLoadNasDowmPath = [customDownloadCacheManager getFullDirector];
  235. long logSize4 = [iTools folderSizeAtPath:downLoadNasDowmPath];
  236. [[NSFileManager defaultManager] removeItemAtPath:downLoadNasDowmPath error:nil];
  237. long clearTotal = logSize1 + logSize2 + logSize3 +logSize4 ;
  238. if(isSelectFileTransfer){
  239. [self clearCacheByFileTransferFun:clearTotal];
  240. }
  241. else{
  242. [self showClearAllTipBy:clearTotal];
  243. }
  244. }
  245. - (void)showClearAllTipBy:(long)clearTotal
  246. {
  247. long clearTotalK = clearTotal /1024;
  248. NSString *tipStr1 = NSLocalizedString(@"my_set_no_clear_finish",nil);
  249. NSString *tipStr2 = @"";
  250. if(clearTotalK > 1024*1024){
  251. tipStr2 = [[NSString alloc] initWithFormat:@"%.02fGB",clearTotalK/1024.0/1024.0];
  252. }
  253. else if(clearTotalK > 1024){
  254. tipStr2 = [[NSString alloc] initWithFormat:@"%.02fMB",clearTotalK/1024.0];
  255. }
  256. else //if(clearTotalK > 0)
  257. {
  258. tipStr2 = [[NSString alloc] initWithFormat:@"%ldKB",clearTotalK];
  259. }
  260. NSString *tipfullStr = [[NSString alloc] initWithFormat:@"%@%@",tipStr1,tipStr2];
  261. //提示语
  262. [[iToast makeText:tipfullStr] show];
  263. }
  264. - (void)clearCacheByFileTransferFun:(long)clearTotal
  265. {
  266. //清理图片
  267. BOOL needReUploadingType = NO;
  268. NSString *ImagePath = [NSString stringWithFormat:@"%@/Image",CachesPatch];
  269. long imageAllSize = [iTools folderSizeAtPath:ImagePath];
  270. // if([uploadFileManager shareInstance].curUploadFileDataModel
  271. // && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeImage
  272. // && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType == uploadStateUploading){
  273. //
  274. // [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateSuspend;
  275. // needReUploadingType = YES;
  276. // }
  277. [[NSFileManager defaultManager] removeItemAtPath:ImagePath error:nil];
  278. // if(needReUploadingType){
  279. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  280. // [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType = uploadStateUploading;
  281. // });
  282. // }
  283. //清理视频文件
  284. NSString *videoPath = [NSString stringWithFormat:@"%@/Video",CachesPatch];
  285. long vide0AllSizeBeforeClear = [iTools folderSizeAtPath:videoPath];
  286. NSString *backupsingVideoName = nil;
  287. if([nasBackupsManager shareInstance].curPhotosBackupsTaskMod
  288. && [nasBackupsManager shareInstance].curPhotosBackupsTaskMod.curUploadFileType == uploadFileTypeVideo){
  289. backupsingVideoName = [nasBackupsManager shareInstance].curPhotosBackupsTaskMod.filename;
  290. }
  291. NSString *uploadingVideoName = nil;
  292. // if([uploadFileManager shareInstance].curUploadFileDataModel
  293. // && [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeVideo){
  294. // uploadingVideoName = [uploadFileManager shareInstance].curUploadFileDataModel.filename;
  295. // }
  296. if(backupsingVideoName || uploadingVideoName){
  297. NSMutableString *fileName = [NSMutableString new];
  298. if(backupsingVideoName){
  299. [fileName appendString:backupsingVideoName];
  300. }
  301. if(uploadingVideoName){
  302. if(fileName.length > 0){
  303. [fileName appendString:@"|"];
  304. }
  305. [fileName appendString:uploadingVideoName];
  306. }
  307. [self deleteFilesInDirectoryAtPath:videoPath withOutFileName:fileName];
  308. }
  309. else{
  310. [[NSFileManager defaultManager] removeItemAtPath:videoPath error:nil];
  311. }
  312. long vide0AllSizeAfterClear = [iTools folderSizeAtPath:videoPath];
  313. //清理下载中
  314. NSString *downLoadingPath = [NSString stringWithFormat:@"%@/DownLoadFlie",CachesPatch];
  315. long downLoadingSizeBeforeClear = [iTools folderSizeAtPath:downLoadingPath];
  316. NSString *downLoadingFileName = nil;
  317. if([downloadManager shareInstance].curDownloadFileModel
  318. && ([downloadManager shareInstance].curDownloadFileModel.curDownloadStateType == downloadStateUploading
  319. ||[downloadManager shareInstance].curDownloadFileModel.curDownloadStateType == downloadStateSuspend)){
  320. downLoadingFileName = [[downloadManager shareInstance].curDownloadFileModel getFileNameFun];
  321. [self deleteFilesInDirectoryAtPath:downLoadingPath withOutFileName:downLoadingFileName];
  322. }
  323. else{
  324. [[NSFileManager defaultManager] removeItemAtPath:downLoadingPath error:nil];
  325. }
  326. long downLoadingSizeAfterClear = [iTools folderSizeAtPath:downLoadingPath];
  327. //清理数据库表 完成的
  328. //下载完成
  329. NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
  330. NSString *curStr = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateDone]),bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateFail])];
  331. [where appendString:curStr];
  332. [couldPhoneFileModel bg_deleteAsync:download_tableName where:where complete:^(BOOL isSuccess) {
  333. }];
  334. //上传完成
  335. NSMutableString* where2 = [[NSMutableString alloc] initWithString:@"where "];
  336. NSString *curStr2 = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateDone]),
  337. bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateFail])];
  338. [where2 appendString:curStr2];
  339. [uploadFileDataModel bg_deleteAsync:upLoadFile_image_tableName where:where2 complete:^(BOOL isSuccess) {
  340. }];
  341. //清理音频播放缓存
  342. NSString *audioPlayPath = [NSString stringWithFormat:@"%@/%@",DocumentPath,@"playAudioCache"];;
  343. long audioPlayAllSize = [iTools folderSizeAtPath:audioPlayPath];
  344. [[NSFileManager defaultManager] removeItemAtPath:audioPlayPath error:nil];
  345. long curTotolSize = (downLoadingSizeBeforeClear - downLoadingSizeAfterClear) + (vide0AllSizeBeforeClear - vide0AllSizeAfterClear) + imageAllSize + clearTotal + audioPlayAllSize;
  346. [self showClearAllTipBy:curTotolSize];
  347. }
  348. - (BOOL)deleteFilesInDirectoryAtPath:(NSString *)path withOutFileName:(NSString*)fileNames {
  349. NSFileManager *fileManager = [NSFileManager defaultManager];
  350. NSArray *fileNameArr = [fileNames componentsSeparatedByString:@"|"];
  351. // 使用NSDirectoryEnumerator遍历目录
  352. NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:path];
  353. NSString *fileName;
  354. while ((fileName = [directoryEnumerator nextObject])) {
  355. BOOL canDelType = YES;
  356. for (NSString*noDelfileName in fileNameArr) {
  357. if([noDelfileName isEqualToString:fileName]){
  358. canDelType = NO;
  359. break;
  360. }
  361. }
  362. if(canDelType){
  363. NSString *filePath = [path stringByAppendingPathComponent:fileName];
  364. // 如果是文件,则删除它
  365. if ([fileManager fileExistsAtPath:filePath]) {
  366. BOOL success = [fileManager removeItemAtPath:filePath error:nil];
  367. if (!success) {
  368. // 如果删除失败,返回NO并处理错误
  369. return NO;
  370. }
  371. }
  372. }
  373. }
  374. // 所有文件都成功删除,返回YES
  375. return YES;
  376. }
  377. #pragma mark 数据设置
  378. - (void)setDataFun
  379. {
  380. NSString *fullSNStr = [[NSString alloc] initWithFormat:@"SN:%@",[connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn];
  381. _snLabel.text = fullSNStr;
  382. NSString *NetButText = NSLocalizedString(@"mine_net_LAN",nil);
  383. if(![connectDeviceManager shareInstance].isPingOk){
  384. NetButText = NSLocalizedString(@"mine_net_WAN",nil);
  385. }
  386. RCSocketCloudPhoneStatus status = [[webSocketManager shareInstance].commandChannelManager rc_socketStatus];
  387. HLog(@"rc_socketStatus:%ld",status)
  388. if(status == RCSocketCloudPhoneStatusFailed
  389. ||status == RCSocketCloudPhoneStatusClosedByServer
  390. ||status == RCSocketCloudPhoneStatusClosedByUser
  391. ||!ksharedAppDelegate.isWebSockLinkOKAginType//断开了
  392. )
  393. {
  394. NetButText = NSLocalizedString(@"mine_net_unLink",nil);
  395. }
  396. [_netButton setTitle:NetButText forState:UIControlStateNormal];
  397. }
  398. - (void)viewWillAppear:(BOOL)animated
  399. {
  400. [super viewWillAppear:animated];
  401. [self setDataFun];
  402. [self handelAudioPlayingViewFun];
  403. }
  404. - (void)viewWillDisappear:(BOOL)animated{
  405. [super viewWillDisappear:animated];
  406. }
  407. - (void)pushViewController:(UIViewController*)vc animated:(BOOL)animated
  408. {
  409. [self.navigationController pushViewController:vc animated:animated];
  410. }
  411. #pragma mark 处理音频播放中的视图状态
  412. - (void)handelAudioPlayingViewFun
  413. {
  414. audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  415. if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
  416. ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying
  417. ||[DFPlayer sharedPlayer].state == DFPlayerStatePause){//播放中
  418. [self showAudioPlayingViewFun];
  419. }
  420. else{
  421. [self hideAudioPlayingViewFun];
  422. }
  423. KWeakSelf
  424. audioPlayingV.didClickButtonFun = ^(NSInteger tag) {
  425. if(tag == 1){
  426. [weakSelf hideAudioPlayingViewFun];
  427. }
  428. else if(tag == 5){
  429. [weakSelf AudioPlayingGotoAudioPlayerVCFun];
  430. }
  431. };
  432. }
  433. - (void)AudioPlayingGotoAudioPlayerVCFun{
  434. audioPlayerViewController *vc = [audioPlayerViewController new];
  435. vc.isfirstEnterType = NO;
  436. [self.navigationController pushViewController:vc animated:YES];
  437. }
  438. #pragma mark 显示音频播放中的视图
  439. - (void)showAudioPlayingViewFun
  440. {
  441. audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  442. [self.view addSubview:audioPlayingV];
  443. [audioPlayingV mas_makeConstraints:^(MASConstraintMaker *make) {
  444. make.height.mas_equalTo(49);
  445. make.left.mas_equalTo(0);
  446. make.right.mas_equalTo(0);
  447. make.bottom.mas_equalTo(-TABBARHEIGHT);
  448. }];
  449. }
  450. #pragma mark 隐藏音频播放中的视图
  451. - (void)hideAudioPlayingViewFun
  452. {
  453. // audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  454. // [audioPlayingV removeFromSuperview];
  455. }
  456. #pragma mark 点击PC 扫码登录
  457. - (void)didClickButtonFun:(UIButton*)but
  458. {
  459. // [self getPCloginFun];
  460. // return;
  461. NSInteger tag = but.tag;
  462. if(tag == 100){
  463. scanToPCLoginViewController *nextVC = [scanToPCLoginViewController new];
  464. [self.navigationController pushViewController:nextVC animated:YES];
  465. }
  466. }
  467. #pragma mark PC 获取码登录
  468. -(void)getPCloginFun
  469. {
  470. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  471. KWeakSelf
  472. [[netWorkManager shareInstance] CommonGetWithCallBackCode:@"/box/login/addAndGetOne" Parameters:paraDict success:^(id _Nonnull responseObject){
  473. // SuperModel *ShareMarkMod = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  474. // if(ShareMarkMod){
  475. // [weakSelf scanToPCloginFunWithID:responseObject[@"data"][@"boxLoginId"]];
  476. // }
  477. } failure:^(NSError * _Nonnull error) {
  478. }];
  479. }
  480. #pragma mark PC 扫码登录
  481. -(void)scanToPCloginFunWithID:(NSString*)idStr
  482. {
  483. NSString *changSN = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
  484. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  485. [paraDict setValue:@1 forKey:@"status"];
  486. [paraDict setValue:idStr forKey:@"boxLoginId"];
  487. [paraDict setValue:changSN forKey:@"sn"];
  488. KWeakSelf
  489. [[netWorkManager shareInstance] CommonPostCallBackCode:updatePCLoginStateFun Parameters:paraDict success:^(id _Nonnull responseObject){
  490. SuperModel *curModel = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  491. if(curModel && curModel.status == 0){
  492. [weakSelf gotoNextVCFunWithID:idStr];
  493. }
  494. else
  495. {
  496. if(curModel.msg){
  497. [[iToast makeText:curModel.msg] show];
  498. }
  499. else{
  500. [[iToast makeText:@"扫码信息错误"] show];
  501. }
  502. [weakSelf.navigationController popViewControllerAnimated:YES];
  503. }
  504. } failure:^(NSError * _Nonnull error) {
  505. //[[iToast makeText:@"扫码信息错误"] show];
  506. [weakSelf.navigationController popViewControllerAnimated:YES];
  507. }];
  508. }
  509. #pragma mark 跳转下个界面
  510. - (void)gotoNextVCFunWithID:(NSString*)idStr
  511. {
  512. PCLoginViewController *nextVC = [PCLoginViewController new];
  513. nextVC.loginIdString = idStr;
  514. [self.navigationController pushViewController:nextVC animated:YES];
  515. }
  516. @end