SPSBHomeViewController.m 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518
  1. //
  2. // SPSBHomeViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/4/20.
  6. //
  7. #import "SPSBHomeViewController.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. #import "UIViewController+SPSBInitialization.h"
  10. #import "UIViewController+SPSBNavigationBar.h"
  11. #import "UIViewController+SPSBNetworkManager.h"
  12. #import "SPSBNotificationDelegateManager.h"
  13. #import "SPSBHtmlViewController.h"
  14. #import "WXApi.h"
  15. #import "SPSBAdvertisementBannerScrollView.h"
  16. #import "SPSBKeyProfile.h"
  17. #import "SPSBUMEventAnalysis.h"
  18. #import "SPSBBusinessManager.h"
  19. #import "SPSBHomeViewADModel.h"
  20. #import <CALayer+JXHShadow.h>
  21. #import <UIImageView+WebCache.h>
  22. #import "SPSBMyPurchaseOrder.h"
  23. #import "SPSBRouteManager.h"
  24. #import "SPSBCustomerServiceManager.h"
  25. #import <BMKLocationKit/BMKLocationManager.h>
  26. #import "SPSBSQLProfile.h"
  27. #import "SPSBPurchaseGJJDetailsViewController.h"
  28. #import "SPSBPurchaseSBDetailsViewController.h"
  29. #import "SPSBTransferDetailsViewController.h"
  30. #import "SPSBHomeViewButtonsModel.h"
  31. #define spsb_navigationButtonTag 2000
  32. #define spsb_buttonViewButtonTag 3000
  33. #define spsb_calculateButtonTag 4000
  34. #define spsb_adsViewButtonTag 3000
  35. #define spsb_adsViewButtonIconTag 10000
  36. #define spsb_adsViewButtonTitleTag 10001
  37. #define spsb_adsViewButtonContentTag 10002
  38. #define spsb_adsViewHotTag 4000
  39. #define spsb_adsViewScrollButtonTag 5000
  40. #define spsb_strategyViewButtonTag 3000
  41. #define spsb_policyViewButtonTag 6000
  42. typedef NS_ENUM(NSUInteger, SPSBPurchaseButtonType) {
  43. SPSBPurchaseButtonTypeSBPurchase,
  44. SPSBPurchaseButtonTypeGJJPurchase,
  45. SPSBPurchaseButtonTypeSBSupplementary,
  46. SPSBPurchaseButtonTypeGJJSupplementary,
  47. SPSBPurchaseButtonTypeSBTransfer,
  48. SPSBPurchaseButtonTypeGJJTransfer
  49. };
  50. typedef struct SPSBBannerResult {
  51. NSArray *spsb_images;
  52. NSArray *spsb_names;
  53. NSArray *spsb_actions;
  54. NSArray *spsb_path;
  55. } SPSBBannerResult;
  56. @interface SPSBHomeViewController ()<UIScrollViewDelegate, SPSBNotificationDelegate, SPSBAdvertisementBannerPorotocol> {
  57. UIScrollView *_bgView;
  58. UIView *_navigationContentView;
  59. UIImageView *_imageView;
  60. UIView *_buttonView;
  61. NSUInteger _buttonCount;
  62. UIScrollView *_buttonScrollView;
  63. UIView *_prossView;
  64. UIView *_choseProssLine;
  65. UIStackView *_middleView;
  66. UIView *_bannerView;
  67. SPSBAdvertisementBannerScrollView *_banner;
  68. UIView *_adsView;
  69. UIView *_adsButtonView;
  70. UIButton *_adsChangeButton;
  71. NSInteger _adsEndIndex;
  72. NSInteger _adsScrollTimes;
  73. UIView *_adsScrollView;
  74. NSMutableArray<SPSBHomeViewADModel *> *_adsArray;
  75. UIView *_featureView;
  76. UIView *_policyView;
  77. UIView *_strategyView;
  78. NSArray<UIImage *> *_bannerImages;
  79. NSArray *_bannerActions;
  80. bool _isFirstLoad;
  81. BMKLocationManager *_locationManager;
  82. UIView *_navigationBarButtonView;
  83. }
  84. @end
  85. @implementation SPSBHomeViewController
  86. - (instancetype)init {
  87. self = [super init];
  88. if (!self) return nil;
  89. self.spsb_isLightContent = true;
  90. _isFirstLoad = true;
  91. _buttonCount = 0;
  92. spsb_setNotificationKeys(@[SPSBAppStatusNotificationKey, SPSBPurchaseNotificationKey]);
  93. debugLog(@"微信版本----%@", [WXApi getApiVersion]);
  94. return self;
  95. }
  96. - (void)dealloc {
  97. spsb_removeNotificationKeys(@[SPSBAppStatusNotificationKey, SPSBPurchaseNotificationKey]);
  98. }
  99. - (UIStatusBarStyle)preferredStatusBarStyle {
  100. return self.spsb_statusBarStyle;
  101. }
  102. - (void)viewDidLoad {
  103. [super viewDidLoad];
  104. [self setupUI];
  105. [self getLocation];
  106. }
  107. - (void)viewDidAppear:(BOOL)animated {
  108. [super viewDidAppear:animated];
  109. UIView *view = [_adsButtonView viewWithTag:spsb_adsViewHotTag];
  110. if (view) {
  111. [self adsHotAnimation:true view:view];
  112. }
  113. if (_isFirstLoad) {
  114. _isFirstLoad = false;
  115. if (spsb_customerServiceManager().spsb_isClickNotification) {
  116. [spsb_customerServiceManager() delayToOnlineContact];
  117. } else {
  118. [spsb_customerServiceManager() checkSobot];
  119. }
  120. }
  121. }
  122. #pragma mark - 定位
  123. - (void)getLocation {
  124. _locationManager = [[BMKLocationManager alloc] init];
  125. [_locationManager requestLocationWithReGeocode:true withNetworkState:false completionBlock:^(BMKLocation * _Nullable location, BMKLocationNetworkState state, NSError * _Nullable error) {
  126. if (location.location) {
  127. debugLog(@"------------%@", location.rgcData.city);
  128. spsb_setCoordinate(location.location.coordinate);
  129. NSString *locationCity = location.rgcData.city;
  130. for (NSInteger i = 0; i < locationCity.length; i ++) {
  131. debugLog(@"----%@", [locationCity substringToIndex:i + 1]);
  132. NSArray *array = [JXHFMDBManager searchWithPath:SPSBShanpQueryCitySQL backKey:@"city_name" condition:^id(FMDatabase *database) {
  133. return [database executeQuery:@"select * from t_sp_query_city where city_name = ?", [locationCity substringToIndex:i + 1]];
  134. }];
  135. if (array.count > 0) {
  136. spsb_setLocationCheckPublicDataCity(array[0]);
  137. break;
  138. }
  139. }
  140. return;
  141. }
  142. if (spsb_lastCheckPublicDataCity().length > 0) {
  143. spsb_setLocationCheckPublicDataCity(spsb_lastCheckPublicDataCity());
  144. } else {
  145. NSArray *array = [JXHFMDBManager searchWithPath:SPSBShanpQueryCitySQL backKey:@"city_name" condition:^id(FMDatabase *database) {
  146. return [database executeQuery:@"select * from t_sp_query_city LIMIT 1"];
  147. }];
  148. if (array.count > 0) {
  149. spsb_setLocationCheckPublicDataCity(array[0]);
  150. } else {
  151. spsb_setLocationCheckPublicDataCity(@"北京");
  152. }
  153. }
  154. }];
  155. }
  156. #pragma mark - Action
  157. - (void)topAction {
  158. [_bgView setContentOffset:(CGPoint){0, 0} animated:true];
  159. }
  160. - (void)strategyAction:(UIButton *)sender {
  161. SPSBHtmlViewController *vc = SPSBHtmlViewController.new;
  162. switch (sender.tag - spsb_strategyViewButtonTag) {
  163. case 0: {
  164. vc.spsb_url = SPSBWhyToPayLink;
  165. vc.title = @"缴五险一金的好处";
  166. }
  167. break;
  168. case 1: {
  169. vc.spsb_url = SPSBHowToPayLink;
  170. vc.title = @"服务指南";
  171. }
  172. break;
  173. case 2: {
  174. vc.spsb_url = SPSBQueryAnytimeLink;
  175. vc.title = @"查询指引";
  176. }
  177. break;
  178. default:
  179. break;
  180. }
  181. [self.navigationController pushViewController:vc animated:true];
  182. }
  183. - (void)featureAction {
  184. SPSBHtmlViewController *vc = SPSBHtmlViewController.new;
  185. vc.spsb_url = SPSBServiceForEnterpriseLink;
  186. vc.spsb_isJsMethod = true;
  187. vc.spsb_jsString = @""
  188. "var app = {\n"
  189. "\n"
  190. " entReturn : function()\n"
  191. " {\n"
  192. " var url = \"iOSvsJS:backAction\";\n"
  193. " document.location = url;\n"
  194. " }\n"
  195. "}";
  196. [self.navigationController pushViewController:vc animated:true];
  197. }
  198. - (void)purchaseViewAction:(UIButton *)sender {
  199. SPSBPurchaseButtonType type = sender.tag - spsb_buttonViewButtonTag;
  200. if (type <= SPSBPurchaseButtonTypeGJJSupplementary) {
  201. spsb_setMyPurchaseOrder(SPSBMyPurchaseOrder.new);
  202. switch (type) {
  203. case SPSBPurchaseButtonTypeSBPurchase: {
  204. [SPSBUMEventAnalysis analyseEventWithId:@"ShebaoPurchase"];
  205. spsb_myPurchaseOrder().spsb_isSupplementaryPay = false;
  206. [self.navigationController pushViewController:SPSBPurchaseSBDetailsViewController.new animated:true];
  207. }
  208. break;
  209. case SPSBPurchaseButtonTypeGJJPurchase: {
  210. [SPSBUMEventAnalysis analyseEventWithId:@"GongjijinPurchase"];
  211. spsb_myPurchaseOrder().spsb_isSupplementaryPay = false;
  212. [self.navigationController pushViewController:SPSBPurchaseGJJDetailsViewController.new animated:true];
  213. }
  214. break;
  215. case SPSBPurchaseButtonTypeSBSupplementary: {
  216. [SPSBUMEventAnalysis analyseEventWithId:@"ShebaoPurchase"];
  217. spsb_myPurchaseOrder().spsb_isSupplementaryPay = true;
  218. [self.navigationController pushViewController:SPSBPurchaseSBDetailsViewController.new animated:true];
  219. }
  220. break;
  221. case SPSBPurchaseButtonTypeGJJSupplementary: {
  222. [SPSBUMEventAnalysis analyseEventWithId:@"GongjijinPurchase"];
  223. spsb_myPurchaseOrder().spsb_isSupplementaryPay = true;
  224. [self.navigationController pushViewController:SPSBPurchaseGJJDetailsViewController.new animated:true];
  225. }
  226. break;
  227. default:
  228. break;
  229. }
  230. } else {
  231. SPSBTransferDetailsViewController *vc = SPSBTransferDetailsViewController.new;
  232. vc.spsb_type = type == SPSBPurchaseButtonTypeSBTransfer ? SPSBSocialInsuranceTransfer : SPSBAccumulationFundTransfer;
  233. [self.navigationController pushViewController:vc animated:true];
  234. }
  235. }
  236. - (void)navigationPurchaseAction:(UIButton *)sender {
  237. spsb_setMyPurchaseOrder(SPSBMyPurchaseOrder.new);
  238. switch (sender.tag - spsb_navigationButtonTag) {
  239. case SPSBPurchaseButtonTypeSBPurchase: {
  240. spsb_myPurchaseOrder().spsb_isSupplementaryPay = false;
  241. [self.navigationController pushViewController:SPSBPurchaseSBDetailsViewController.new animated:true];
  242. }
  243. break;
  244. case SPSBPurchaseButtonTypeGJJPurchase: {
  245. spsb_myPurchaseOrder().spsb_isSupplementaryPay = false;
  246. [self.navigationController pushViewController:SPSBPurchaseGJJDetailsViewController.new animated:true];
  247. }
  248. break;
  249. case SPSBPurchaseButtonTypeSBSupplementary: {
  250. spsb_myPurchaseOrder().spsb_isSupplementaryPay = true;
  251. [self.navigationController pushViewController:SPSBPurchaseSBDetailsViewController.new animated:true];
  252. }
  253. break;
  254. case SPSBPurchaseButtonTypeGJJSupplementary: {
  255. spsb_myPurchaseOrder().spsb_isSupplementaryPay = true;
  256. [self.navigationController pushViewController:SPSBPurchaseGJJDetailsViewController.new animated:true];
  257. }
  258. break;
  259. default:
  260. break;
  261. }
  262. }
  263. - (void)calculateAction:(UIButton *)sender {
  264. if (sender.tag == spsb_calculateButtonTag) {
  265. SPSBHtmlViewController *explainViewController = [[SPSBHtmlViewController alloc] init];
  266. explainViewController.spsb_url = SPSBHomeSocialSecurityCalculatorLink;
  267. [self.navigationController pushViewController:explainViewController animated:true];
  268. } else if (sender.tag == spsb_calculateButtonTag + 1) {
  269. WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object];
  270. launchMiniProgramReq.userName = @"gh_e7ef692d1516"; //拉起的小程序的username
  271. launchMiniProgramReq.miniProgramType = WXMiniProgramTypeRelease; //拉起小程序的类型
  272. [WXApi sendReq:launchMiniProgramReq completion:^(BOOL success) {
  273. }];
  274. }
  275. }
  276. - (void)getBannerImagesSuccess:(SPSBBannerResult)result {
  277. NSArray *oldImages = [jxh_userDefaults() objectForKey:SPSBBarImageList];
  278. [jxh_userDefaults() setObject:result.spsb_path forKey:SPSBBarImageList];
  279. [jxh_userDefaults() setObject:result.spsb_actions forKey:SPSBBarImageAction];
  280. [jxh_userDefaults() synchronize];
  281. _bannerImages = result.spsb_images;
  282. _bannerActions = result.spsb_actions;
  283. if (_banner && _banner.superview) {
  284. [self judgeBannerView];
  285. }
  286. dispatch_async(dispatch_get_global_queue(0, 0), ^{
  287. for (NSString *old in oldImages) {
  288. if (![(result.spsb_names) containsObject:old]) {
  289. NSMutableString *str = [NSMutableString stringWithString:old];
  290. [str replaceOccurrencesOfString:@"/" withString:@"" options:NSLiteralSearch range:NSMakeRange(0, str.length)];
  291. jxh_deleteFileInCache(SPSBBarImageList, str);
  292. }
  293. }
  294. });
  295. }
  296. - (void)adsAction:(UIButton *)sender {
  297. NSInteger i = sender.tag - spsb_adsViewButtonTag;
  298. if (_adsArray.count > i) {
  299. [self countAdsTouchActionWithIndex:i];
  300. SPSBHtmlViewController *vc = SPSBHtmlViewController.new;
  301. vc.spsb_url = _adsArray[i].spsb_link;
  302. [self.navigationController pushViewController:vc animated:true];
  303. }
  304. }
  305. - (void)policyViewAction:(UIButton *)sender {
  306. NSInteger i = sender.tag - spsb_policyViewButtonTag;
  307. if (spsb_policyArray().count > i) {
  308. SPSBHtmlViewController *vc = SPSBHtmlViewController.new;
  309. vc.spsb_url = spsb_policyArray()[i].spsb_link;
  310. [self.navigationController pushViewController:vc animated:true];
  311. }
  312. }
  313. - (void)countAdsTouchActionWithIndex:(NSUInteger)index {
  314. NSMutableString *actionId = [_adsArray[index].spsb_img mutableCopy];
  315. [actionId replaceOccurrencesOfString:@"." withString:@"" options:NSLiteralSearch range:NSMakeRange(0, actionId.length)];
  316. [actionId replaceOccurrencesOfString:@"/" withString:@"" options:NSLiteralSearch range:NSMakeRange(0, actionId.length)];
  317. [SPSBUMEventAnalysis analyseEventWithId:actionId];
  318. }
  319. - (void)changeAds {
  320. [SPSBUMEventAnalysis analyseEventWithId:@"more"];
  321. [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(scrollAdsView) object:nil];
  322. _adsScrollView.hidden = true;
  323. [_adsArray removeAllObjects];
  324. NSArray *ads = spsb_adsArray();
  325. for (NSInteger i = 0; i < 6; i ++) {
  326. _adsEndIndex ++;
  327. if (_adsEndIndex > ads.count - 1) {
  328. _adsEndIndex = 0;
  329. }
  330. SPSBHomeViewADModel *model = ads[_adsEndIndex];
  331. UIButton *button = [_adsView viewWithTag:spsb_adsViewButtonTag + i];
  332. button.hidden = false;//防止切换时刚好在做动画
  333. UIImageView *icon = [button viewWithTag:spsb_adsViewButtonIconTag];
  334. UILabel *title = [button viewWithTag:spsb_adsViewButtonTitleTag];
  335. UILabel *content = [button viewWithTag:spsb_adsViewButtonContentTag];
  336. [icon sd_setImageWithURL:spsb_fileURL(model.spsb_img)];
  337. title.text = model.spsb_title;
  338. content.text = model.spsb_notes;
  339. UIImageView *hot = [button viewWithTag:spsb_adsViewHotTag];
  340. if (hot) {
  341. hot.hidden = true;
  342. }
  343. [_adsArray addObject:model];
  344. }
  345. _adsScrollTimes = 1;
  346. [self performSelector:@selector(scrollAdsView) withObject:nil afterDelay:2];
  347. }
  348. - (void)scrollAdsView {
  349. NSArray *ads = spsb_adsArray();
  350. NSInteger lastIndex = _adsEndIndex + _adsScrollTimes - 1;
  351. if (lastIndex > ads.count - 1) {
  352. lastIndex = lastIndex - ads.count;
  353. }
  354. if (_adsScrollTimes > 2) {
  355. _adsScrollTimes = 0;
  356. } else if (_adsScrollTimes + 6 > ads.count) {
  357. _adsScrollTimes = 0;
  358. }
  359. NSInteger nextIndex = _adsEndIndex + _adsScrollTimes;
  360. if (nextIndex > ads.count - 1) {
  361. nextIndex = nextIndex - ads.count;
  362. }
  363. if (ads.count <= lastIndex || ads.count <= nextIndex) return;
  364. SPSBHomeViewADModel *model = ads[lastIndex];
  365. UIButton *firstButton = [_adsScrollView viewWithTag:spsb_adsViewScrollButtonTag];
  366. UIImageView *icon = [firstButton viewWithTag:spsb_adsViewButtonIconTag];
  367. UILabel *title = [firstButton viewWithTag:spsb_adsViewButtonTitleTag];
  368. UILabel *content = [firstButton viewWithTag:spsb_adsViewButtonContentTag];
  369. [icon sd_setImageWithURL:spsb_fileURL(model.spsb_img)];
  370. title.text = model.spsb_title;
  371. content.text = model.spsb_notes;
  372. [firstButton makeConstraints:^(JXHConstraintMaker *make) {
  373. make.top.update(0);
  374. }];
  375. model = ads[nextIndex];
  376. UIButton *secondButton = [_adsScrollView viewWithTag:spsb_adsViewScrollButtonTag + 1];
  377. icon = [secondButton viewWithTag:spsb_adsViewButtonIconTag];
  378. title = [secondButton viewWithTag:spsb_adsViewButtonTitleTag];
  379. content = [secondButton viewWithTag:spsb_adsViewButtonContentTag];
  380. [icon sd_setImageWithURL:spsb_fileURL(model.spsb_img)];
  381. title.text = model.spsb_title;
  382. content.text = model.spsb_notes;
  383. [secondButton makeConstraints:^(JXHConstraintMaker *make) {
  384. make.top.update(66);
  385. }];
  386. [_adsScrollView layoutSubviews];
  387. _adsScrollView.hidden = false;
  388. UIButton *button = [_adsView viewWithTag:spsb_adsViewButtonTag + 5];//正常的button
  389. icon = [button viewWithTag:spsb_adsViewButtonIconTag];
  390. title = [button viewWithTag:spsb_adsViewButtonTitleTag];
  391. content = [button viewWithTag:spsb_adsViewButtonContentTag];
  392. [icon sd_setImageWithURL:spsb_fileURL(model.spsb_img)];
  393. title.text = model.spsb_title;
  394. content.text = model.spsb_notes;
  395. _adsArray[5] = model;
  396. button.hidden = true;
  397. [firstButton makeConstraints:^(JXHConstraintMaker *make) {
  398. make.top.update(-66);
  399. }];
  400. [secondButton makeConstraints:^(JXHConstraintMaker *make) {
  401. make.top.update(0);
  402. }];
  403. [UIView animateWithDuration:0.5 animations:^{
  404. [self->_adsScrollView layoutSubviews];
  405. } completion:^(BOOL finished) {
  406. button.hidden = false;
  407. if (!self->_adsScrollView.hidden) {
  408. self->_adsScrollView.hidden = true;
  409. self->_adsScrollTimes ++;
  410. [self performSelector:@selector(scrollAdsView) withObject:nil afterDelay:2];
  411. }
  412. }];
  413. }
  414. - (void)adsHotAnimation:(bool)big view:(UIView *)view {
  415. if (view.hidden) {
  416. return;
  417. }
  418. if (!self.view.window) {
  419. return;
  420. }
  421. CGFloat scale = big ? 1.2 : 1;
  422. [UIView animateWithDuration:0.45 animations:^{
  423. view.transform = CGAffineTransformMakeScale(scale, scale);
  424. } completion:^(BOOL finished) {
  425. [self adsHotAnimation:!big view:view];
  426. }];
  427. }
  428. #pragma mark - Network Action
  429. #pragma mark - SPSBAdvertisementBannerPorotocol
  430. - (void)advertisementView:(SPSBAdvertisementBannerScrollView *)advertisementView selectImageWithIndex:(NSInteger)index {
  431. if (_bannerActions && _bannerActions.count > index) {
  432. [self countBannerTouchActionWithIndex:index];
  433. if ([_bannerActions[index] isEqualToString:@""]) {
  434. debugLog(@"无跳转");
  435. return;
  436. }
  437. if ([_bannerActions[index] hasPrefix:@"/"]) {
  438. debugLog(@"跳转H5");
  439. SPSBHtmlViewController *explainViewController = SPSBHtmlViewController.new;
  440. explainViewController.spsb_url = spsb_fileUrl(_bannerActions[index]);
  441. explainViewController.spsb_jsString = @""
  442. "var app = {\n"
  443. "\n"
  444. " entReturn : function()\n"
  445. " {\n"
  446. " var url = \"iOSvsJS:backAction\";\n"
  447. " document.location = url;\n"
  448. " }\n"
  449. "}";
  450. explainViewController.spsb_isJsMethod = true;
  451. [self.navigationController pushViewController:explainViewController animated:true];
  452. return;
  453. }
  454. if ([_bannerActions[index] hasPrefix:@"http"]) {
  455. debugLog(@"跳转外链H5");
  456. SPSBHtmlViewController *explainViewController = SPSBHtmlViewController.new;
  457. explainViewController.spsb_url = _bannerActions[index];
  458. [self.navigationController pushViewController:explainViewController animated:true];
  459. return;
  460. }
  461. debugLog(@"跳转页面");
  462. NSDictionary *dict = jxh_jsonToDictionary(_bannerActions[index]);
  463. if (dict.count > 0) {
  464. NSString *className = [dict allKeys][0];
  465. Class targetClass = NSClassFromString(className);
  466. if (targetClass) {
  467. id target = [[targetClass alloc] init];
  468. if ([dict[className] isKindOfClass:[NSDictionary class]]) {
  469. [dict[className] enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
  470. [target setValue:obj forKey:key];
  471. }];
  472. }
  473. [self.navigationController pushViewController:target animated:true];
  474. }
  475. }
  476. }
  477. }
  478. - (void)countBannerTouchActionWithIndex:(NSUInteger)index {
  479. NSArray *barImageArray = [jxh_userDefaults() objectForKey:SPSBBarImageList];
  480. NSMutableString *actionId = [barImageArray[index] mutableCopy];
  481. [actionId replaceOccurrencesOfString:@"." withString:@"" options:NSLiteralSearch range:NSMakeRange(0, actionId.length)];
  482. [actionId replaceOccurrencesOfString:@"/" withString:@"" options:NSLiteralSearch range:NSMakeRange(0, actionId.length)];
  483. [SPSBUMEventAnalysis analyseEventWithId:actionId];
  484. }
  485. #pragma mark - SPSBNotificationDelegate
  486. - (void)spsb_appNeedRefreshBannerImages:(NSArray *)images actions:(NSArray *)actions {
  487. __block SPSBBannerResult result;
  488. if (images.count == 0) {
  489. result.spsb_names = @[];
  490. result.spsb_path = @[];
  491. result.spsb_actions = @[];
  492. result.spsb_images = @[];
  493. [self getBannerImagesSuccess:result];
  494. return;
  495. }
  496. __block NSInteger num = 0;
  497. __block NSMutableArray *imageArray = NSMutableArray.new;
  498. __block NSMutableArray *imageNameArray = NSMutableArray.new;
  499. __block NSMutableArray *actionArray = NSMutableArray.new;
  500. __block NSArray *pathArrayCopy = images.copy;//把pathArray复制进block防止pathArray提前释放
  501. __block NSArray *barImageActionArray = actions.copy;
  502. for (NSInteger i = 0; i < pathArrayCopy.count; i ++) {
  503. if ([pathArrayCopy[i] isKindOfClass:[NSString class]]) {
  504. NSMutableString *str = [NSMutableString stringWithString:pathArrayCopy[i]];
  505. [str replaceOccurrencesOfString:@"/" withString:@"" options:NSLiteralSearch range:NSMakeRange(0, str.length)];
  506. UIImage *tempImage = [UIImage imageWithData:jxh_loadImageData(SPSBBarImageList, str)];
  507. if (tempImage) {
  508. [imageArray addObject:tempImage];
  509. [imageNameArray addObject:pathArrayCopy[i]];
  510. if (barImageActionArray) {
  511. [actionArray addObject:barImageActionArray[i]];
  512. }
  513. num ++;
  514. if (num == pathArrayCopy.count) {
  515. result.spsb_names = imageNameArray;
  516. result.spsb_path = pathArrayCopy;
  517. result.spsb_actions = actionArray;
  518. result.spsb_images = imageArray;
  519. [self getBannerImagesSuccess:result];
  520. }
  521. continue;
  522. }
  523. __block NSInteger index = i;
  524. @weakify(self)
  525. [self.spsb_networkManager networkDownloadImageWithUrl:spsb_fileUrl(pathArrayCopy[index]) key:pathArrayCopy[index] completion:^(NSError * _Nonnull error, id _Nullable data) {
  526. @strongify(self)
  527. num ++;
  528. if (error.code == SPSBNetworkErrorCodeSuccess && data[@"image"]) {
  529. [imageArray addObject:data[@"image"]];
  530. [imageNameArray addObject:pathArrayCopy[index]];
  531. if (barImageActionArray) {
  532. [actionArray addObject:barImageActionArray[index]];
  533. }
  534. NSMutableString *str = [NSMutableString stringWithString:pathArrayCopy[index]];
  535. [str replaceOccurrencesOfString:@"/" withString:@"" options:NSLiteralSearch range:NSMakeRange(0, str.length)];
  536. jxh_saveImageToCacheDir(SPSBBarImageList, data[@"image"], str);
  537. }
  538. if (num == pathArrayCopy.count) {
  539. result.spsb_names = imageNameArray;
  540. result.spsb_path = pathArrayCopy;
  541. result.spsb_actions = actionArray;
  542. result.spsb_images = imageArray;
  543. [self getBannerImagesSuccess:result];
  544. }
  545. }];
  546. } else {
  547. num ++;
  548. if (num == pathArrayCopy.count) {
  549. result.spsb_names = imageNameArray;
  550. result.spsb_path = pathArrayCopy;
  551. result.spsb_actions = actionArray;
  552. result.spsb_images = imageArray;
  553. [self getBannerImagesSuccess:result];
  554. }
  555. }
  556. }
  557. }
  558. - (void)spsb_appNeedRefreshHomeViewAds {
  559. if (_adsView && _adsView.superview) {
  560. [self judgeAdsView];
  561. }
  562. }
  563. - (void)spsb_appNeedRefreshHomeViewPolicy {
  564. if (_policyView && _policyView.superview) {
  565. [self judgePolicyView];
  566. }
  567. }
  568. - (void)spsb_appNeedRefreshHomeViewButtons {
  569. if (_prossView && _prossView.superview) {
  570. [self judgeButtonView];
  571. }
  572. }
  573. - (void)spsb_shouldRefreshPurchaseStatus {
  574. if (spsb_myPurchaseOrder() && !spsb_myPurchaseOrder().spsb_isSupplementaryPay) {
  575. [jxh_keyWindow() dismissToast];
  576. [SPSBRouteManager navigationBackRoot];
  577. }
  578. }
  579. - (void)spsb_shouldRefreshSupplementaryPayStatus {
  580. if (spsb_myPurchaseOrder() && spsb_myPurchaseOrder().spsb_isSupplementaryPay) {
  581. [jxh_keyWindow() dismissToast];
  582. [SPSBRouteManager navigationBackRoot];
  583. }
  584. }
  585. #pragma mark - UIScrollViewDelegate
  586. - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
  587. if (scrollView == _buttonScrollView) {
  588. if (_buttonCount < 5) return;
  589. if ((*targetContentOffset).x > jxh_screenWidth() / 4) {
  590. *targetContentOffset = CGPointMake(jxh_screenWidth() + jxh_screenWidth() / 4 * (_buttonCount - 4), 0);
  591. [_choseProssLine makeConstraints:^(JXHConstraintMaker *make) {
  592. make.leading.update(20);
  593. }];
  594. } else {
  595. *targetContentOffset = CGPointMake(0, 0);
  596. [_choseProssLine makeConstraints:^(JXHConstraintMaker *make) {
  597. make.leading.update(0);
  598. }];
  599. }
  600. [UIView animateWithDuration:0.3 animations:^{
  601. [self->_choseProssLine.superview layoutSubviews];
  602. }];
  603. }
  604. }
  605. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  606. if (scrollView == _bgView) {
  607. self.spsb_navigationBar.alpha = (scrollView.contentOffset.y) * 0.025;
  608. if (self.spsb_navigationBar.alpha > 0.5) {
  609. self.spsb_isLightContent = false;
  610. } else {
  611. self.spsb_isLightContent = true;
  612. }
  613. _navigationContentView.alpha = ((scrollView.contentOffset.y - 200 + jxh_viewHeight(self.spsb_navigationBar)) * 0.025);
  614. }
  615. }
  616. #pragma mark - UI
  617. - (void)setupUI {
  618. //取消返回按钮
  619. self.navigationItem.leftBarButtonItem = nil;
  620. self.spsb_isHiddenNavigationBar = true;
  621. [self createNavigationBar];
  622. [self createBgView];
  623. [self setNavigationBar];
  624. [self createImageView];
  625. [self createButtonView];
  626. [self createMiddleView];
  627. [self createBannerView];
  628. [self createAdsView];
  629. [self createFeatureView];
  630. [self createPolicyView];
  631. [self createStrategyView];
  632. }
  633. - (void)createStrategyView {
  634. _strategyView = UIView.new;
  635. _strategyView.backgroundColor = spsb_FFFFFF_color(1.f);
  636. [_bgView addSubview:_strategyView];
  637. [_strategyView makeConstraints:^(JXHConstraintMaker *make) {
  638. make.top.equalTo(self->_policyView.bottom);
  639. make.leading.and.trailing.equalTo(0);
  640. make.bottom.equalTo(0);
  641. }];
  642. UIView *topView = UIView.new;
  643. [_strategyView addSubview:topView];
  644. [topView makeConstraints:^(JXHConstraintMaker *make) {
  645. make.top.and.leading.and.trailing.equalTo(0);
  646. make.height.equalTo(45);
  647. }];
  648. UILabel *title = [UILabel convenienceWithFont:spsb_semiboldFont(18) text:@"新手指南" textColor:spsb_333333_color()];
  649. [topView addSubview:title];
  650. [title makeConstraints:^(JXHConstraintMaker *make) {
  651. make.top.and.bottom.equalTo(0);
  652. make.leading.equalTo(30);
  653. }];
  654. UIView *icon = UIView.new;
  655. icon.backgroundColor = spsb_3296FB_color();
  656. [icon setLayerCornerRadius:2 clipToBounds:false];
  657. [topView addSubview:icon];
  658. [icon makeConstraints:^(JXHConstraintMaker *make) {
  659. make.centerY.equalTo(topView);
  660. make.leading.equalTo(16);
  661. make.size.equalTo(CGSizeMake(4, 17));
  662. }];
  663. NSArray *contentArray = @[@"haochu", @"buy", @"chaxun", @"缴五险一金的好处", @"服务指南", @"查询指引", @"解决就读、买房买车等囧况", @"操作流程简单,方便快捷", @"缴费明细,随时知晓",];
  664. UIButton *tempButton;
  665. for (NSInteger i = 0; i < 3; i ++) {
  666. if (i == 0) continue;
  667. UIButton *button = [UIButton convenienceWithTarget:self action:@selector(strategyAction:)];
  668. button.tag = spsb_strategyViewButtonTag + i;
  669. [_strategyView addSubview:button];
  670. [button makeConstraints:^(JXHConstraintMaker *make) {
  671. if (tempButton) {
  672. make.top.equalTo(tempButton.bottom);
  673. } else {
  674. make.top.equalTo(topView.bottom);
  675. }
  676. make.leading.and.trailing.equalTo(0);
  677. make.height.equalTo(76);
  678. }];
  679. UIImageView *icon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:contentArray[i]]];
  680. [button addSubview:icon];
  681. [icon makeConstraints:^(JXHConstraintMaker *make) {
  682. make.leading.equalTo(16);
  683. make.top.equalTo(16);
  684. make.size.equalTo(CGSizeMake(24, 24));
  685. }];
  686. UILabel *firstLine = [UILabel convenienceWithFont:spsb_font(16) text:contentArray[i + 3] textColor:spsb_333333_color()];
  687. [button addSubview:firstLine];
  688. [firstLine makeConstraints:^(JXHConstraintMaker *make) {
  689. make.leading.equalTo(56);
  690. make.top.equalTo(16);
  691. }];
  692. UILabel *secondLine = [UILabel convenienceWithFont:spsb_font(13) text:contentArray[i + 6] textColor:spsb_999999_color()];
  693. [button addSubview:secondLine];
  694. [secondLine makeConstraints:^(JXHConstraintMaker *make) {
  695. make.leading.equalTo(56);
  696. make.bottom.equalTo(-15);
  697. }];
  698. UIImageView *arrowView = [[UIImageView alloc] initWithImage:jxh_getImage(list_arrow)];
  699. [button addSubview:arrowView];
  700. [arrowView makeConstraints:^(JXHConstraintMaker *make) {
  701. make.trailing.equalTo(-16);
  702. make.centerY.equalTo(firstLine);
  703. }];
  704. if (i < 2) {
  705. [button createLineWithLocation:JXHLineLocationBottom headOffset:54 footOffset:0];
  706. }
  707. tempButton = button;
  708. }
  709. UIView *bottomView = [[UIView alloc] init];
  710. bottomView.backgroundColor = spsb_F5F5F5_color();
  711. [_strategyView addSubview:bottomView];
  712. [bottomView makeConstraints:^(JXHConstraintMaker *make) {
  713. make.leading.and.trailing.and.bottom.equalTo(0);
  714. make.top.equalTo(tempButton.bottom).offset(16);
  715. make.height.equalTo(78);
  716. }];
  717. UIImageView *bottom = [[UIImageView alloc] initWithImage:jxh_getImage(home_footer)];
  718. [bottomView addSubview:bottom];
  719. [bottom makeConstraints:^(JXHConstraintMaker *make) {
  720. make.center.equalTo(bottomView);
  721. make.size.equalTo(CGSizeMake(18 * 8.45, 18));
  722. }];
  723. }
  724. - (void)createFeatureView {
  725. _featureView = UIView.new;
  726. _featureView.backgroundColor = spsb_FFFFFF_color(1.f);
  727. [_bgView addSubview:_featureView];
  728. [_featureView makeConstraints:^(JXHConstraintMaker *make) {
  729. make.top.equalTo(self->_middleView.bottom);
  730. make.leading.and.trailing.equalTo(0);
  731. }];
  732. UIButton *bottomButton = [UIButton convenienceWithTarget:self action:@selector(featureAction)];
  733. [bottomButton setBackgroundImage:jxh_getImage(qiye) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
  734. [_featureView addSubview:bottomButton];
  735. [bottomButton makeConstraints:^(JXHConstraintMaker *make) {
  736. make.leading.equalTo(16);
  737. make.trailing.equalTo(-16);
  738. make.top.equalTo(16);
  739. make.size.equalTo(CGSizeMake(jxh_screenWidth() - 32, (jxh_screenWidth() - 32) *0.2857));
  740. make.bottom.equalTo(-16);
  741. }];
  742. }
  743. - (void)createPolicyView {
  744. _policyView = UIView.new;
  745. _policyView.backgroundColor = spsb_FFFFFF_color(1.f);
  746. _policyView.hidden = true;
  747. [_bgView addSubview:_policyView];
  748. [_policyView makeConstraints:^(JXHConstraintMaker *make) {
  749. make.top.equalTo(self->_featureView.bottom);
  750. make.leading.and.trailing.equalTo(0);
  751. make.height.equalTo(0);
  752. }];
  753. [self judgePolicyView];
  754. }
  755. - (void)judgePolicyView {
  756. for (UIView *view in _policyView.subviews) {
  757. [view removeFromSuperview];
  758. }
  759. NSArray<SPSBHomeViewADModel *> *policy = spsb_policyArray();
  760. if (policy.count == 0) {
  761. [_policyView makeConstraints:^(JXHConstraintMaker *make) {
  762. make.height.update(0);
  763. }];
  764. _policyView.hidden = true;
  765. return;
  766. }
  767. _policyView.hidden = false;
  768. [_policyView makeConstraints:^(JXHConstraintMaker *make) {
  769. make.height.update(45 + policy.count * 76 + 10);
  770. }];
  771. UIView *topView = UIView.new;
  772. [_policyView addSubview:topView];
  773. [topView makeConstraints:^(JXHConstraintMaker *make) {
  774. make.top.and.leading.and.trailing.equalTo(0);
  775. make.height.equalTo(45);
  776. }];
  777. UILabel *title = [UILabel convenienceWithFont:spsb_semiboldFont(18) text:@"政策解读" textColor:spsb_333333_color()];
  778. [topView addSubview:title];
  779. [title makeConstraints:^(JXHConstraintMaker *make) {
  780. make.top.and.bottom.equalTo(0);
  781. make.leading.equalTo(30);
  782. }];
  783. UIView *icon = UIView.new;
  784. icon.backgroundColor = spsb_3296FB_color();
  785. [icon setLayerCornerRadius:2 clipToBounds:false];
  786. [topView addSubview:icon];
  787. [icon makeConstraints:^(JXHConstraintMaker *make) {
  788. make.centerY.equalTo(topView);
  789. make.leading.equalTo(16);
  790. make.size.equalTo(CGSizeMake(4, 17));
  791. }];
  792. UIButton *tempButton = nil;
  793. for (NSInteger i = 0; i < policy.count; i ++) {
  794. SPSBHomeViewADModel *model = policy[i];
  795. UIButton *button = [UIButton convenienceWithTarget:self action:@selector(policyViewAction:)];
  796. button.tag = spsb_policyViewButtonTag + i;
  797. [_policyView addSubview:button];
  798. [button makeConstraints:^(JXHConstraintMaker *make) {
  799. if (!tempButton) {
  800. make.top.equalTo(45);
  801. } else {
  802. make.top.equalTo(tempButton.bottom);
  803. }
  804. make.leading.and.trailing.equalTo(0);
  805. make.height.equalTo(76);
  806. }];
  807. UIImageView *icon = UIImageView.new;
  808. [icon sd_setImageWithURL:spsb_fileURL(model.spsb_img)];
  809. [button addSubview:icon];
  810. [icon makeConstraints:^(JXHConstraintMaker *make) {
  811. make.leading.equalTo(16);
  812. make.top.equalTo(16);
  813. make.size.equalTo(CGSizeMake(24, 24));
  814. }];
  815. UILabel *firstLine = [UILabel convenienceWithFont:spsb_font(16) text:model.spsb_title textColor:spsb_333333_color()];
  816. [button addSubview:firstLine];
  817. [firstLine makeConstraints:^(JXHConstraintMaker *make) {
  818. make.leading.equalTo(56);
  819. make.top.equalTo(16);
  820. }];
  821. UILabel *secondLine = [UILabel convenienceWithFont:spsb_font(13) text:model.spsb_notes textColor:spsb_999999_color()];
  822. [button addSubview:secondLine];
  823. [secondLine makeConstraints:^(JXHConstraintMaker *make) {
  824. make.leading.equalTo(56);
  825. make.bottom.equalTo(-15);
  826. }];
  827. UIImageView *arrowView = [[UIImageView alloc] initWithImage:jxh_getImage(list_arrow)];
  828. [button addSubview:arrowView];
  829. [arrowView makeConstraints:^(JXHConstraintMaker *make) {
  830. make.trailing.equalTo(-16);
  831. make.centerY.equalTo(firstLine);
  832. }];
  833. if (i < policy.count - 1) {
  834. [button createLineWithLocation:JXHLineLocationBottom headOffset:54 footOffset:0];
  835. }
  836. tempButton = button;
  837. }
  838. }
  839. - (void)createAdsView {
  840. _adsView = UIView.new;
  841. _adsView.backgroundColor = spsb_FFFFFF_color(1.f);
  842. _adsView.clipsToBounds = true;
  843. [_middleView addArrangedSubview:_adsView];
  844. [_adsView makeConstraints:^(JXHConstraintMaker *make) {
  845. make.height.equalTo(0);
  846. }];
  847. UIView *topView = UIView.new;
  848. [_adsView addSubview:topView];
  849. [topView makeConstraints:^(JXHConstraintMaker *make) {
  850. make.top.and.leading.and.trailing.equalTo(0);
  851. make.height.equalTo(45);
  852. }];
  853. UILabel *title = [UILabel convenienceWithFont:spsb_semiboldFont(18) text:@"新鲜服务" textColor:spsb_333333_color()];
  854. [topView addSubview:title];
  855. [title makeConstraints:^(JXHConstraintMaker *make) {
  856. make.top.and.bottom.equalTo(0);
  857. make.leading.equalTo(30);
  858. }];
  859. UIView *icon = UIView.new;
  860. icon.backgroundColor = spsb_3296FB_color();
  861. [icon setLayerCornerRadius:2 clipToBounds:false];
  862. [topView addSubview:icon];
  863. [icon makeConstraints:^(JXHConstraintMaker *make) {
  864. make.centerY.equalTo(topView);
  865. make.leading.equalTo(16);
  866. make.size.equalTo(CGSizeMake(4, 17));
  867. }];
  868. _adsButtonView = UIView.new;
  869. [_adsView addSubview:_adsButtonView];
  870. [_adsButtonView makeConstraints:^(JXHConstraintMaker *make) {
  871. make.leading.and.trailing.equalTo(0);
  872. make.top.equalTo(45);
  873. make.bottom.equalTo(0);
  874. }];
  875. _adsChangeButton = [UIButton convenienceWithFont:spsb_font(13) target:self action:@selector(changeAds)];
  876. [_adsChangeButton setTitle:@"换一换" titleColor:spsb_3296FB_color() state:JXHButtonControlStateNormal];
  877. [_adsView addSubview:_adsChangeButton];
  878. [_adsChangeButton makeConstraints:^(JXHConstraintMaker *make) {
  879. make.trailing.equalTo(-16);
  880. make.top.equalTo(0);
  881. make.height.equalTo(45);
  882. }];
  883. [self judgeAdsView];
  884. }
  885. - (void)judgeAdsView {
  886. NSArray<SPSBHomeViewADModel *> *ads = spsb_adsArray();
  887. if (ads.count == 0) {
  888. _adsView.hidden = true;
  889. [self judgeMiddleViewIntervalView];
  890. return;
  891. }
  892. CGFloat adsHeight = 2 + ads.count / 2 * 66 + ads.count % 2 * 66 + 45;
  893. if (adsHeight > 210 + 45) {
  894. adsHeight = 210 + 45;
  895. }
  896. [_adsView makeConstraints:^(JXHConstraintMaker *make) {
  897. make.height.update(adsHeight);
  898. }];
  899. for (UIView *view in _adsButtonView.subviews) {
  900. [view removeFromSuperview];
  901. }
  902. [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(scrollAdsView) object:nil];
  903. _adsView.hidden = false;
  904. [self judgeMiddleViewIntervalView];
  905. _adsEndIndex = -1;
  906. CGSize buttonSize = (CGSize){(jxh_screenWidth() - 24) / 2 - 16, 66};
  907. if (adsHeight > 0) {
  908. _adsArray = NSMutableArray.new;
  909. UIView *tempView = nil;
  910. for (NSInteger i = 0; i < 6; i ++) {
  911. if (i >= ads.count) {
  912. break;
  913. }
  914. SPSBHomeViewADModel *model = ads[i];
  915. [_adsArray addObject:model];
  916. UIButton *button = [self createAdsViewButtonWithIconImage:nil iconUrl:model.spsb_img title:model.spsb_title content:model.spsb_notes action:@selector(adsAction:) target:self isMore:false];
  917. button.tag = spsb_adsViewButtonTag + i;
  918. [_adsButtonView addSubview:button];
  919. [button makeConstraints:^(JXHConstraintMaker *make) {
  920. if (i % 2 == 0) {
  921. if (tempView) {
  922. make.top.equalTo(tempView.bottom);
  923. } else {
  924. make.top.equalTo(2);
  925. }
  926. make.leading.equalTo(16);
  927. } else {
  928. make.top.equalTo(tempView.top);
  929. make.leading.equalTo(tempView.trailing).offset(24);
  930. make.trailing.equalTo(-16);
  931. }
  932. make.size.equalTo(buttonSize);
  933. }];
  934. if (i == 0) {
  935. UILabel *titleLabel = [button viewWithTag:spsb_adsViewButtonTitleTag];
  936. UIImageView *hot = [[UIImageView alloc] initWithImage:jxh_getImage(hot)];
  937. hot.tag = spsb_adsViewHotTag;
  938. [button addSubview:hot];
  939. [hot makeConstraints:^(JXHConstraintMaker *make) {
  940. make.leading.equalTo(titleLabel.trailing).offset(6);
  941. make.top.equalTo(titleLabel.top).offset(-2);
  942. }];
  943. [self adsHotAnimation:true view:hot];
  944. }
  945. _adsEndIndex ++;
  946. tempView = button;
  947. }
  948. UIImageView *hot = [_adsButtonView viewWithTag:spsb_adsViewHotTag];
  949. [_adsButtonView bringSubviewToFront:hot.superview];
  950. if (tempView) {
  951. if (ads.count < 6 && ads.count % 2 == 1) {
  952. UIButton *button = [self createAdsViewButtonWithIconImage:jxh_getImage(tibu) iconUrl:nil title:@"更多服务" content:@"敬请期待" action:nil target:nil isMore:true];
  953. [_adsButtonView addSubview:button];
  954. [button makeConstraints:^(JXHConstraintMaker *make) {
  955. make.top.equalTo(tempView.top);
  956. make.leading.equalTo(tempView.trailing).offset(24);
  957. make.trailing.equalTo(-16);
  958. make.size.equalTo(buttonSize);
  959. }];
  960. }
  961. }
  962. if (ads.count > 6) {
  963. _adsScrollTimes = 1;
  964. _adsScrollView = UIView.new;
  965. _adsScrollView.backgroundColor = [UIColor whiteColor];
  966. _adsScrollView.hidden = true;
  967. _adsScrollView.clipsToBounds = true;
  968. [_adsButtonView addSubview:_adsScrollView];
  969. [_adsScrollView makeConstraints:^(JXHConstraintMaker *make) {
  970. make.top.and.leading.equalTo(tempView);
  971. make.trailing.equalTo(0);
  972. make.height.equalTo(buttonSize.height);
  973. }];
  974. SPSBHomeViewADModel *model = ads[_adsEndIndex];
  975. UIButton *firshtbutton = [self createAdsViewButtonWithIconImage:nil iconUrl:model.spsb_img title:model.spsb_title content:model.spsb_notes action:nil target:nil isMore:false];
  976. firshtbutton.tag = spsb_adsViewScrollButtonTag;
  977. [_adsScrollView addSubview:firshtbutton];
  978. [firshtbutton makeConstraints:^(JXHConstraintMaker *make) {
  979. make.top.equalTo(0);
  980. make.leading.equalTo(0);
  981. make.size.equalTo(buttonSize);
  982. }];
  983. UIButton *secondbutton = [self createAdsViewButtonWithIconImage:nil iconUrl:model.spsb_img title:model.spsb_title content:model.spsb_notes action:nil target:nil isMore:false];
  984. secondbutton.tag = spsb_adsViewScrollButtonTag + 1;
  985. [_adsScrollView addSubview:secondbutton];
  986. [secondbutton makeConstraints:^(JXHConstraintMaker *make) {
  987. make.top.equalTo(66);
  988. make.leading.equalTo(0);
  989. make.size.equalTo(buttonSize);
  990. }];
  991. [self performSelector:@selector(scrollAdsView) withObject:nil afterDelay:2];
  992. }
  993. if (ads.count > 7) {
  994. _adsChangeButton.hidden = false;
  995. } else {
  996. _adsChangeButton.hidden = true;
  997. }
  998. }
  999. }
  1000. - (UIButton *)createAdsViewButtonWithIconImage:(UIImage *)iconImage iconUrl:(NSString *)iconUrl title:(NSString *)title content:(NSString *)content action:(SEL)action target:(id)target isMore:(bool)isMore {
  1001. UIButton *button = [UIButton convenienceWithTarget:target action:action];
  1002. UIView *iconBg = UIView.new;
  1003. iconBg.userInteractionEnabled = false;
  1004. iconBg.backgroundColor = spsb_FFFFFF_color(1.f);
  1005. [iconBg.layer setShadowWithOffset:(CGSize){0, 4} alpha:0.1 blur:12 spread:0 color:spsb_3296FB_color() cornerRadius:20 pathRect:(CGRect){0, 0, 40, 40}];
  1006. UIImageView *icon = UIImageView.new;
  1007. icon.tag = spsb_adsViewButtonIconTag;
  1008. if (iconImage) {
  1009. icon.image = iconImage;
  1010. } else if (iconUrl) {
  1011. [icon sd_setImageWithURL:spsb_fileURL(iconUrl)];
  1012. }
  1013. [iconBg addSubview:icon];
  1014. [icon makeConstraints:^(JXHConstraintMaker *make) {
  1015. make.size.equalTo(CGSizeMake(20, 20));
  1016. make.center.equalTo(iconBg);
  1017. }];
  1018. [button addSubview:iconBg];
  1019. [iconBg makeConstraints:^(JXHConstraintMaker *make) {
  1020. make.leading.equalTo(0);
  1021. make.centerY.equalTo(button);
  1022. make.size.equalTo(CGSizeMake(40, 40));
  1023. }];
  1024. UILabel *titleLabel = [UILabel convenienceWithFont:spsb_semiboldFont(15) text:title textColor:spsb_333333_color()];
  1025. titleLabel.tag = spsb_adsViewButtonTitleTag;
  1026. [button addSubview:titleLabel];
  1027. [titleLabel makeConstraints:^(JXHConstraintMaker *make) {
  1028. make.leading.equalTo(50);
  1029. make.top.equalTo(iconBg.top).offset(2);
  1030. }];
  1031. UILabel *contentLabel = [UILabel convenienceWithFont:spsb_font(12) text:content textColor:spsb_999999_color()];
  1032. contentLabel.tag = spsb_adsViewButtonContentTag;
  1033. [button addSubview:contentLabel];
  1034. [contentLabel makeConstraints:^(JXHConstraintMaker *make) {
  1035. make.leading.equalTo(50);
  1036. make.trailing.equalTo(0);
  1037. make.bottom.equalTo(iconBg.bottom).offset(-2);
  1038. }];
  1039. if (isMore) {
  1040. titleLabel.textColor =
  1041. contentLabel.textColor = spsb_ADADAD_color();
  1042. }
  1043. return button;
  1044. }
  1045. - (void)createBannerView {
  1046. _bannerView = UIView.new;
  1047. _bannerView.backgroundColor = spsb_FFFFFF_color(1.f);
  1048. _bannerView.hidden = true;
  1049. [_middleView addArrangedSubview:_bannerView];
  1050. _banner = SPSBAdvertisementBannerScrollView.new;
  1051. _banner.spsb_advertisementViewDelegate = self;
  1052. [_banner setLayerCornerRadius:4 clipToBounds:true];
  1053. [_bannerView addSubview:_banner];
  1054. [_banner makeConstraints:^(JXHConstraintMaker *make) {
  1055. make.top.equalTo(14);
  1056. make.centerX.equalTo(self->_bannerView);
  1057. make.height.equalTo(0);
  1058. make.bottom.equalTo(-20);
  1059. }];
  1060. if (_bannerImages) {
  1061. [self judgeBannerView];
  1062. }
  1063. }
  1064. - (void)judgeBannerView {
  1065. if (_bannerImages.count > 0) {
  1066. [_banner reloadDataWithArray:_bannerImages];
  1067. [_banner makeConstraints:^(JXHConstraintMaker *make) {
  1068. make.height.update(self->_banner.spsb_height);
  1069. }];
  1070. _bannerView.hidden = false;
  1071. } else {
  1072. _bannerView.hidden = true;
  1073. }
  1074. [self judgeMiddleViewIntervalView];
  1075. }
  1076. - (void)createMiddleView {
  1077. _middleView = [UIStackView convenienceWithAxis:UILayoutConstraintAxisVertical alignment:UIStackViewAlignmentFill distribution:UIStackViewDistributionEqualSpacing spacing:0];
  1078. [_bgView addSubview:_middleView];
  1079. [_middleView makeConstraints:^(JXHConstraintMaker *make) {
  1080. make.leading.and.trailing.equalTo(0);
  1081. make.top.equalTo(self->_buttonView.bottom).offset(8);
  1082. }];
  1083. UIView *intervalView = [[UIView alloc] init];
  1084. intervalView.backgroundColor = spsb_FFFFFF_color(1.f);
  1085. intervalView.hidden = true;
  1086. [_middleView addArrangedSubview:intervalView];
  1087. [intervalView makeConstraints:^(JXHConstraintMaker *make) {
  1088. make.height.equalTo(5);
  1089. }];
  1090. }
  1091. - (void)judgeMiddleViewIntervalView {
  1092. _middleView.arrangedSubviews[0].hidden = _bannerView.hidden && _adsView.hidden;
  1093. }
  1094. - (void)setNavigationBar {
  1095. self.spsb_navigationBar.backgroundColor = spsb_FFFFFF_color(1.f);
  1096. [self.view bringSubviewToFront:self.spsb_navigationBar];
  1097. self.spsb_titleLabel.hidden = true;
  1098. self.spsb_barBackButton.hidden = true;
  1099. self.spsb_navigationBar.alpha = 0;
  1100. _navigationContentView = UIView.new;
  1101. _navigationContentView.backgroundColor = [UIColor whiteColor];
  1102. [self.spsb_navigationBar addSubview:_navigationContentView];
  1103. [_navigationContentView makeConstraints:^(JXHConstraintMaker *make) {
  1104. make.leading.and.trailing.and.bottom.equalTo(0);
  1105. make.height.equalTo(jxh_navigationViewHeight());
  1106. }];
  1107. _navigationContentView.alpha = 0;
  1108. UILabel *title = [UILabel convenienceWithFont:spsb_semiboldFont(18) text:SPSBAppName textColor:spsb_222222_color()];
  1109. [self.spsb_navigationBar addSubview:title];
  1110. [title setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  1111. [title makeConstraints:^(JXHConstraintMaker *make) {
  1112. make.leading.equalTo(15);
  1113. make.centerY.equalTo(self->_navigationContentView);
  1114. }];
  1115. JXHCenterButton *topButton = [JXHCenterButton convenienceWithAxis:JXHCenterButtonAxisVertical interval:4 font:spsb_font(10) target:self action:@selector(topAction)];
  1116. [topButton setTitle:@"回顶部" titleColor:spsb_222222_color() image:jxh_getImage(home_top_arrow) backgroundImage:nil state:JXHButtonControlStateNormal];
  1117. [_navigationContentView addSubview:topButton];
  1118. [topButton makeConstraints:^(JXHConstraintMaker *make) {
  1119. make.top.and.bottom.and.trailing.equalTo(0);
  1120. make.width.equalTo(74);
  1121. }];
  1122. _navigationBarButtonView = UIView.new;
  1123. _navigationBarButtonView.backgroundColor = [UIColor whiteColor];
  1124. [_navigationContentView addSubview:_navigationBarButtonView];
  1125. [_navigationBarButtonView makeConstraints:^(JXHConstraintMaker *make) {
  1126. make.leading.equalTo(107);
  1127. make.trailing.equalTo(-72);
  1128. make.top.and.bottom.equalTo(0);
  1129. }];
  1130. }
  1131. - (void)createBgView {
  1132. _bgView = [UIScrollView convenienceWithBackgroundColor:spsb_F5F5F5_color()];
  1133. if (@available(iOS 11.0, *)) {
  1134. _bgView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  1135. }
  1136. _bgView.bounces = false;
  1137. _bgView.delegate = self;
  1138. [self.view addSubview:_bgView];
  1139. [_bgView makeConstraints:^(JXHConstraintMaker *make) {
  1140. make.top.and.leading.and.trailing.equalTo(0);
  1141. make.bottom.equalTo(self.view.safebottom).offset(-SPSBTabBarHeight);
  1142. }];
  1143. }
  1144. - (void)createImageView {
  1145. CGFloat height = jxh_screenWidth() * 0.352;
  1146. _imageView = [[UIImageView alloc] initWithImage:jxh_getImage(home_banner)];
  1147. // _imageView.userInteractionEnabled = true;
  1148. // UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageViewAction)];
  1149. // [_imageView addGestureRecognizer:tap];
  1150. [_bgView addSubview:_imageView];
  1151. [_imageView makeConstraints:^(JXHConstraintMaker *make) {
  1152. if (@available(iOS 11.0, *)) {
  1153. make.top.equalTo(0);
  1154. } else {
  1155. if (jxh_statusBarHeight() > 20) {
  1156. make.top.equalTo(0);
  1157. } else {
  1158. make.top.equalTo(-20);
  1159. }
  1160. }
  1161. make.leading.and.trailing.equalTo(0);
  1162. make.size.equalTo((CGSize){jxh_screenWidth(), height});
  1163. }];
  1164. }
  1165. - (void)createButtonView {
  1166. _buttonView = UIView.new;
  1167. _buttonView.backgroundColor = spsb_FFFFFF_color(1.f);
  1168. [_bgView addSubview:_buttonView];
  1169. [_buttonView makeConstraints:^(JXHConstraintMaker *make) {
  1170. make.leading.and.trailing.equalTo(0);
  1171. make.top.equalTo(self->_imageView.bottom);
  1172. }];
  1173. UIStackView *stackView = [UIStackView convenienceWithAxis:UILayoutConstraintAxisVertical alignment:UIStackViewAlignmentFill distribution:UIStackViewDistributionEqualSpacing spacing:0];
  1174. [_buttonView addSubview:stackView];
  1175. [stackView makeConstraints:^(JXHConstraintMaker *make) {
  1176. make.edges.equalTo(self->_buttonView);
  1177. }];
  1178. _buttonScrollView = [UIScrollView convenienceWithBackgroundColor:spsb_FFFFFF_color(1.f)];
  1179. _buttonScrollView.scrollsToTop = false;
  1180. _buttonScrollView.bounces = false;
  1181. _buttonScrollView.delegate = self;
  1182. if (@available(iOS 11.0, *)) {
  1183. _buttonScrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  1184. } else {
  1185. // Fallback on earlier versions
  1186. }
  1187. [stackView addArrangedSubview:_buttonScrollView];
  1188. [_buttonScrollView makeConstraints:^(JXHConstraintMaker *make) {
  1189. make.height.equalTo(114);
  1190. }];
  1191. _buttonScrollView.hidden = true;
  1192. _prossView = UIView.new;
  1193. [stackView addArrangedSubview:_prossView];
  1194. [_prossView makeConstraints:^(JXHConstraintMaker *make) {
  1195. make.height.equalTo(3);
  1196. }];
  1197. UIView *prossLine = UIView.new;
  1198. prossLine.backgroundColor = spsb_EFEFF4_color();
  1199. [_prossView addSubview:prossLine];
  1200. [prossLine makeConstraints:^(JXHConstraintMaker *make) {
  1201. make.top.equalTo(0);
  1202. make.centerX.equalTo(self->_prossView);
  1203. make.size.equalTo(CGSizeMake(40, 3));
  1204. }];
  1205. _choseProssLine = UIView.new;
  1206. _choseProssLine.backgroundColor = spsb_3296FB_color();
  1207. [prossLine addSubview:_choseProssLine];
  1208. [_choseProssLine makeConstraints:^(JXHConstraintMaker *make) {
  1209. make.top.equalTo(prossLine);
  1210. make.leading.equalTo(prossLine);
  1211. make.size.equalTo(CGSizeMake(20, 3));
  1212. }];
  1213. _prossView.hidden = true;
  1214. [self judgeButtonView];
  1215. CGFloat featureWidth = (jxh_screenWidth() - 32 - 13) / 2;
  1216. CGFloat featureHeight = featureWidth * 0.39;
  1217. UIView *featureView = UIView.new;
  1218. [stackView addArrangedSubview:featureView];
  1219. [featureView makeConstraints:^(JXHConstraintMaker *make) {
  1220. make.height.equalTo(featureHeight + 18 + 16);
  1221. }];
  1222. UIButton *leftButton = [UIButton convenienceWithTarget:self action:@selector(calculateAction:)];
  1223. [leftButton setBackgroundImage:jxh_getImage(jisuanqi_1) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
  1224. leftButton.tag = spsb_calculateButtonTag;
  1225. [featureView addSubview:leftButton];
  1226. [leftButton makeConstraints:^(JXHConstraintMaker *make) {
  1227. make.leading.equalTo(16);
  1228. make.size.equalTo(CGSizeMake(featureWidth, featureHeight));
  1229. make.bottom.equalTo(-18);
  1230. }];
  1231. UIButton *rightButton = [UIButton convenienceWithTarget:self action:@selector(calculateAction:)];
  1232. [rightButton setBackgroundImage:jxh_getImage(jisuanqi_2) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
  1233. rightButton.tag = spsb_calculateButtonTag + 1;
  1234. [featureView addSubview:rightButton];
  1235. [rightButton makeConstraints:^(JXHConstraintMaker *make) {
  1236. make.trailing.equalTo(-16);
  1237. make.size.equalTo(CGSizeMake(featureWidth, featureHeight));
  1238. make.bottom.equalTo(-18);
  1239. }];
  1240. }
  1241. - (void)judgeButtonView {
  1242. if (nil == spsb_homeViewButtons()) return;
  1243. for (UIView *view in _buttonScrollView.subviews) {
  1244. [view removeFromSuperview];
  1245. }
  1246. SPSBHomeViewButtonsModel *model = spsb_homeViewButtons();
  1247. NSArray *judgeArray = @[model.spsb_buyShebao, model.spsb_buyFund, model.spsb_shebaoAdded, model.spsb_fundAdded, model.spsb_shebaoMove, model.spsb_fundMove];
  1248. _buttonCount = 0;
  1249. NSArray *titleArray = @[@"社保服务", @"公积金服务", @"社保补缴", @"公积金补缴", @"社保转移", @"公积金转移"];
  1250. NSArray *imageArray = @[jxh_getImage(shebao_jiao),
  1251. jxh_getImage(gjj_jiao),
  1252. jxh_getImage(shebao_bu),
  1253. jxh_getImage(gjj_bu),
  1254. jxh_getImage(shebao_zhuanyi),
  1255. jxh_getImage(gjj_zhuanyi)];
  1256. CGFloat width = jxh_screenWidth() / 4;
  1257. UIButton *tempButton = nil;
  1258. for (NSInteger i = 0; i < 6; i ++) {
  1259. if (![judgeArray[i] boolValue]) continue;
  1260. _buttonCount ++;
  1261. UIButton *button = [UIButton convenienceWithTarget:self action:@selector(purchaseViewAction:)];
  1262. button.tag = spsb_buttonViewButtonTag + i;
  1263. [_buttonScrollView addSubview:button];
  1264. [button makeConstraints:^(JXHConstraintMaker *make) {
  1265. if (!tempButton) {
  1266. make.leading.equalTo(0);
  1267. } else {
  1268. make.leading.equalTo(tempButton.trailing);
  1269. }
  1270. make.top.and.bottom.equalTo(0);
  1271. make.height.equalTo(114);
  1272. make.width.equalTo(width);
  1273. if (i == 5) {
  1274. make.trailing.equalTo(0);
  1275. }
  1276. }];
  1277. UIImageView *imageView = [[UIImageView alloc] initWithImage:imageArray[i]];
  1278. [button addSubview:imageView];
  1279. [imageView makeConstraints:^(JXHConstraintMaker *make) {
  1280. make.top.equalTo(20);
  1281. make.centerX.equalTo(button);
  1282. make.size.equalTo(CGSizeMake(50, 50));
  1283. }];
  1284. UILabel *titleLabel = [UILabel convenienceWithFont:spsb_semiboldFont(14) text:titleArray[i] textColor:spsb_333333_color() textAlignment:NSTextAlignmentCenter];
  1285. [button addSubview:titleLabel];
  1286. [titleLabel makeConstraints:^(JXHConstraintMaker *make) {
  1287. make.top.equalTo(80);
  1288. make.centerX.equalTo(button);
  1289. }];
  1290. tempButton = button;
  1291. }
  1292. if (_buttonCount == 0) {
  1293. _buttonScrollView.hidden =
  1294. _prossView.hidden =
  1295. _navigationBarButtonView.hidden = true;
  1296. return;
  1297. }
  1298. _buttonScrollView.hidden =
  1299. _navigationBarButtonView.hidden = false;
  1300. if (_buttonCount > 4) {
  1301. _prossView.hidden = false;
  1302. [_choseProssLine makeConstraints:^(JXHConstraintMaker *make) {
  1303. make.leading.update(0);
  1304. }];
  1305. [_choseProssLine.superview layoutSubviews];
  1306. } else {
  1307. _prossView.hidden = true;
  1308. }
  1309. for (UIView *view in _navigationBarButtonView.subviews) {
  1310. [view removeFromSuperview];
  1311. }
  1312. width = (jxh_screenWidth() - 107 - 72) / 4;
  1313. imageArray = @[jxh_getImage(shebao_jiao), jxh_getImage(gjj_jiao), jxh_getImage(shebao_bu), jxh_getImage(gjj_bu)];
  1314. tempButton = nil;
  1315. for (NSInteger i = 0; i < 4; i ++) {
  1316. if (![judgeArray[i] boolValue]) continue;
  1317. UIButton *button = [UIButton convenienceWithTarget:self action:@selector(navigationPurchaseAction:)];
  1318. button.tag = spsb_navigationButtonTag + i;
  1319. [_navigationBarButtonView addSubview:button];
  1320. [button makeConstraints:^(JXHConstraintMaker *make) {
  1321. if (!tempButton) {
  1322. make.leading.equalTo(0);
  1323. } else {
  1324. make.leading.equalTo(tempButton.trailing);
  1325. }
  1326. make.width.equalTo(width);
  1327. make.top.and.bottom.equalTo(0);
  1328. }];
  1329. UIImageView *imageView = [[UIImageView alloc] initWithImage:imageArray[i]];
  1330. [button addSubview:imageView];
  1331. [imageView makeConstraints:^(JXHConstraintMaker *make) {
  1332. make.center.equalTo(button);
  1333. make.size.equalTo(CGSizeMake(32, 32));
  1334. }];
  1335. tempButton = button;
  1336. }
  1337. }
  1338. - (void)viewDidLayoutSubviews {
  1339. [super viewDidLayoutSubviews];
  1340. if (@available(iOS 11.0, *)) {
  1341. [_imageView makeConstraints:^(JXHConstraintMaker *make) {
  1342. if (jxh_safeInsets(self.view).top > 20) {
  1343. make.top.update(0);
  1344. } else {
  1345. make.top.update(-20);
  1346. }
  1347. }];
  1348. }
  1349. }
  1350. @end
  1351. #undef spsb_navigationButtonTag
  1352. #undef spsb_buttonViewButtonTag
  1353. #undef spsb_calculateButtonTag
  1354. #undef spsb_adsViewButtonTag
  1355. #undef spsb_adsViewButtonIconTag
  1356. #undef spsb_adsViewButtonTitleTag
  1357. #undef spsb_adsViewButtonContentTag
  1358. #undef spsb_adsViewHotTag
  1359. #undef spsb_adsViewScrollButtonTag
  1360. #undef spsb_strategyViewButtonTag
  1361. #undef spsb_policyViewButtonTag