mineViewController.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  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,ksharedAppDelegate.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. [[webRtcManager shareManager] 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. //
  322. // [self deleteFilesInDirectoryAtPath:downLoadingPath withOutFileName:downLoadingFileName];
  323. // }
  324. // else{
  325. // [[NSFileManager defaultManager] removeItemAtPath:downLoadingPath error:nil];
  326. // }
  327. [[NSFileManager defaultManager] removeItemAtPath:downLoadingPath error:nil];
  328. long downLoadingSizeAfterClear = [iTools folderSizeAtPath:downLoadingPath];
  329. //清理数据库表 完成的
  330. //下载完成
  331. NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
  332. NSString *curStr = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateDone]),bg_sqlKey(@"curDownloadStateType"),bg_sqlValue([NSNumber numberWithInt:downloadStateFail])];
  333. [where appendString:curStr];
  334. [couldPhoneFileModel bg_deleteAsync:download_tableName where:where complete:^(BOOL isSuccess) {
  335. }];
  336. //上传完成
  337. NSMutableString* where2 = [[NSMutableString alloc] initWithString:@"where "];
  338. NSString *curStr2 = [NSString stringWithFormat:@"%@=%@ or %@=%@ ",bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateDone]),
  339. bg_sqlKey(@"curUploadStateType"),bg_sqlValue([NSNumber numberWithInt:uploadStateFail])];
  340. [where2 appendString:curStr2];
  341. [uploadFileDataModel bg_deleteAsync:upLoadFile_image_tableName where:where2 complete:^(BOOL isSuccess) {
  342. }];
  343. //清理音频播放缓存
  344. NSString *audioPlayPath = [NSString stringWithFormat:@"%@/%@",DocumentPath,@"playAudioCache"];;
  345. long audioPlayAllSize = [iTools folderSizeAtPath:audioPlayPath];
  346. [[NSFileManager defaultManager] removeItemAtPath:audioPlayPath error:nil];
  347. long curTotolSize = (downLoadingSizeBeforeClear - downLoadingSizeAfterClear) + (vide0AllSizeBeforeClear - vide0AllSizeAfterClear) + imageAllSize + clearTotal + audioPlayAllSize;
  348. [self showClearAllTipBy:curTotolSize];
  349. }
  350. - (BOOL)deleteFilesInDirectoryAtPath:(NSString *)path withOutFileName:(NSString*)fileNames {
  351. NSFileManager *fileManager = [NSFileManager defaultManager];
  352. NSArray *fileNameArr = [fileNames componentsSeparatedByString:@"|"];
  353. // 使用NSDirectoryEnumerator遍历目录
  354. NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:path];
  355. NSString *fileName;
  356. while ((fileName = [directoryEnumerator nextObject])) {
  357. BOOL canDelType = YES;
  358. for (NSString*noDelfileName in fileNameArr) {
  359. if([noDelfileName isEqualToString:fileName]){
  360. canDelType = NO;
  361. break;
  362. }
  363. }
  364. if(canDelType){
  365. NSString *filePath = [path stringByAppendingPathComponent:fileName];
  366. // 如果是文件,则删除它
  367. if ([fileManager fileExistsAtPath:filePath]) {
  368. BOOL success = [fileManager removeItemAtPath:filePath error:nil];
  369. if (!success) {
  370. // 如果删除失败,返回NO并处理错误
  371. return NO;
  372. }
  373. }
  374. }
  375. }
  376. // 所有文件都成功删除,返回YES
  377. return YES;
  378. }
  379. #pragma mark 数据设置
  380. - (void)setDataFun
  381. {
  382. NSString *fullSNStr = [[NSString alloc] initWithFormat:@"SN:%@",ksharedAppDelegate.DeviceThirdIdMod.data.changeSn];
  383. _snLabel.text = fullSNStr;
  384. NSString *NetButText = NSLocalizedString(@"mine_net_LAN",nil);
  385. if(![pingManager shareManager].isPingOk){
  386. NetButText = NSLocalizedString(@"mine_net_WAN",nil);
  387. }
  388. RTCDataChannelState state = [webRtcManager shareManager].channelState;
  389. if(state != RTCDataChannelStateOpen
  390. ||!ksharedAppDelegate.isWebSockLinkOKAginType//断开了
  391. )
  392. {
  393. NetButText = NSLocalizedString(@"mine_net_unLink",nil);
  394. }
  395. [_netButton setTitle:NetButText forState:UIControlStateNormal];
  396. }
  397. - (void)viewWillAppear:(BOOL)animated
  398. {
  399. [super viewWillAppear:animated];
  400. [self setDataFun];
  401. [self handelAudioPlayingViewFun];
  402. }
  403. - (void)viewWillDisappear:(BOOL)animated{
  404. [super viewWillDisappear:animated];
  405. }
  406. - (void)pushViewController:(UIViewController*)vc animated:(BOOL)animated
  407. {
  408. [self.navigationController pushViewController:vc animated:animated];
  409. }
  410. #pragma mark 处理音频播放中的视图状态
  411. - (void)handelAudioPlayingViewFun
  412. {
  413. audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  414. if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
  415. ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying
  416. ||[DFPlayer sharedPlayer].state == DFPlayerStatePause){//播放中
  417. [self showAudioPlayingViewFun];
  418. }
  419. else{
  420. [self hideAudioPlayingViewFun];
  421. }
  422. KWeakSelf
  423. audioPlayingV.didClickButtonFun = ^(NSInteger tag) {
  424. if(tag == 1){
  425. [weakSelf hideAudioPlayingViewFun];
  426. }
  427. else if(tag == 5){
  428. [weakSelf AudioPlayingGotoAudioPlayerVCFun];
  429. }
  430. };
  431. }
  432. - (void)AudioPlayingGotoAudioPlayerVCFun{
  433. audioPlayerViewController *vc = [audioPlayerViewController new];
  434. vc.isfirstEnterType = NO;
  435. [self.navigationController pushViewController:vc animated:YES];
  436. }
  437. #pragma mark 显示音频播放中的视图
  438. - (void)showAudioPlayingViewFun
  439. {
  440. audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  441. [self.view addSubview:audioPlayingV];
  442. [audioPlayingV mas_makeConstraints:^(MASConstraintMaker *make) {
  443. make.height.mas_equalTo(49);
  444. make.left.mas_equalTo(0);
  445. make.right.mas_equalTo(0);
  446. make.bottom.mas_equalTo(-TABBARHEIGHT);
  447. }];
  448. }
  449. #pragma mark 隐藏音频播放中的视图
  450. - (void)hideAudioPlayingViewFun
  451. {
  452. // audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  453. // [audioPlayingV removeFromSuperview];
  454. }
  455. #pragma mark 点击PC 扫码登录
  456. - (void)didClickButtonFun:(UIButton*)but
  457. {
  458. // [self getPCloginFun];
  459. // return;
  460. NSInteger tag = but.tag;
  461. if(tag == 100){
  462. scanToPCLoginViewController *nextVC = [scanToPCLoginViewController new];
  463. [self.navigationController pushViewController:nextVC animated:YES];
  464. }
  465. }
  466. #pragma mark PC 获取码登录
  467. -(void)getPCloginFun
  468. {
  469. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  470. KWeakSelf
  471. [[netWorkManager shareInstance] CommonGetWithCallBackCode:@"/box/login/addAndGetOne" Parameters:paraDict success:^(id _Nonnull responseObject){
  472. // SuperModel *ShareMarkMod = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  473. // if(ShareMarkMod){
  474. // [weakSelf scanToPCloginFunWithID:responseObject[@"data"][@"boxLoginId"]];
  475. // }
  476. } failure:^(NSError * _Nonnull error) {
  477. }];
  478. }
  479. #pragma mark PC 扫码登录
  480. -(void)scanToPCloginFunWithID:(NSString*)idStr
  481. {
  482. NSString *changSN = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
  483. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  484. [paraDict setValue:@1 forKey:@"status"];
  485. [paraDict setValue:idStr forKey:@"boxLoginId"];
  486. [paraDict setValue:changSN forKey:@"sn"];
  487. KWeakSelf
  488. [[netWorkManager shareInstance] CommonPostCallBackCode:updatePCLoginStateFun Parameters:paraDict success:^(id _Nonnull responseObject){
  489. SuperModel *curModel = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  490. if(curModel && curModel.status == 0){
  491. [weakSelf gotoNextVCFunWithID:idStr];
  492. }
  493. else
  494. {
  495. if(curModel.msg){
  496. [[iToast makeText:curModel.msg] show];
  497. }
  498. else{
  499. [[iToast makeText:@"扫码信息错误"] show];
  500. }
  501. [weakSelf.navigationController popViewControllerAnimated:YES];
  502. }
  503. } failure:^(NSError * _Nonnull error) {
  504. //[[iToast makeText:@"扫码信息错误"] show];
  505. [weakSelf.navigationController popViewControllerAnimated:YES];
  506. }];
  507. }
  508. #pragma mark 跳转下个界面
  509. - (void)gotoNextVCFunWithID:(NSString*)idStr
  510. {
  511. PCLoginViewController *nextVC = [PCLoginViewController new];
  512. nextVC.loginIdString = idStr;
  513. [self.navigationController pushViewController:nextVC animated:YES];
  514. }
  515. @end