diff --git a/ln_jq_app/android/app/build.gradle.kts b/ln_jq_app/android/app/build.gradle.kts index 0f2ccc8..c61b44e 100644 --- a/ln_jq_app/android/app/build.gradle.kts +++ b/ln_jq_app/android/app/build.gradle.kts @@ -37,8 +37,8 @@ android { // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion - versionCode = 7 - versionName = "1.2.4" + versionCode = 8 + versionName = "1.2.5" } signingConfigs { diff --git a/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ARoutePlaneController.m b/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ARoutePlaneController.m index 564a930..fdb8654 100644 --- a/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ARoutePlaneController.m +++ b/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ARoutePlaneController.m @@ -74,6 +74,8 @@ /// 加氢规划按钮(用于气泡弹框定位) @property (nonatomic, weak) UIButton *addHBtn; + +@property (nonatomic ,strong)MAAnnotationView * currAnnotionView; @end @implementation ARoutePlaneController @@ -285,7 +287,8 @@ [bottomBar mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.view); - make.bottom.equalTo(self.view).offset(-AMP_TabbarHeight - 10); +// make.bottom.equalTo(self.view).offset(-AMP_TabbarHeight - 13); + make.bottom.equalTo(self.view).offset(0); }]; // ── 兼容旧逻辑:保留 startTf / dstTf 属性(隐藏,不再显示) ── @@ -426,7 +429,7 @@ CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(self.latitude, self.longitude); [_mapView setCenterCoordinate:coord animated:YES]; -// [_mapView setZoomLevel:10 animated:YES]; + [_mapView setZoomLevel:15.0 animated:YES]; } else { // 如果尚未获取到位置,进入跟踪模式等待回调 [_mapView setUserTrackingMode:MAUserTrackingModeFollow animated:YES]; @@ -1018,6 +1021,7 @@ } - (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view { + self.currAnnotionView = view; id pointAnnotation = view.annotation; if ([pointAnnotation isMemberOfClass:ACustomPointAnnotation.class]) { @@ -1041,6 +1045,7 @@ // 同步更新底部栏目的地文字 // self.bottomBarView.destinationText = aoi.name; + self.bottomBarView.destinationText = nil; } } @@ -1052,6 +1057,7 @@ self.dstPoi = nil; self.dstTf.text = nil; self.bottomBarView.destinationText = nil; + self.currAnnotionView = nil; } } @@ -1199,6 +1205,10 @@ #pragma mark - ABottomBarViewDelegate - (void)bottomBarViewDidTapCalRoute:(ABottomBarView *)barView { + if (self.currAnnotionView) { + [self.mapView deselectAnnotation:self.currAnnotionView.annotation animated:NO]; + self.currAnnotionView = nil; + } //详情弹框 [self willRequestTJDInfo]; @@ -1209,6 +1219,11 @@ ///清除上一次数据影响 self.tjdPathInfoModel = nil; + if (self.currAnnotionView) { + [self.mapView deselectAnnotation:self.currAnnotionView.annotation animated:NO]; + self.currAnnotionView = nil; + } + // 弹出地址搜索页,选中后更新目的地输入框 ASearchAddressController *vc = [[ASearchAddressController alloc] init]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; diff --git a/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ASearchAddressController.m b/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ASearchAddressController.m index ae66567..b35903a 100644 --- a/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ASearchAddressController.m +++ b/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ASearchAddressController.m @@ -12,17 +12,17 @@ #import "AMapNavCommonUtil.h" -@interface ASearchAddressController () +@interface ASearchAddressController () -@property(nonatomic, strong) UITableView *tableView; -@property(nonatomic, strong) UIBarButtonItem *rightItem; -@property(nonatomic, strong) UIButton *backBtn; +@property (nonatomic , strong) UITableView *tableView; +@property (nonatomic , strong) UIBarButtonItem *rightItem; +@property (nonatomic ,strong)UIButton * backBtn; -@property(nonatomic, strong) NSMutableArray *dataArr; +@property (nonatomic , strong) NSMutableArray *dataArr; -@property(nonatomic, strong) UITextField *inputAddressTf; -@property(nonatomic, strong) AMapSearchAPI *search; -@property(nonatomic, assign) NSInteger currPage; +@property (nonatomic, strong) UITextField *inputAddressTf; +@property (nonatomic, strong) AMapSearchAPI *search; +@property (nonatomic,assign)NSInteger currPage; @end @@ -34,50 +34,52 @@ self.title = @"选择地点"; self.currPage = 1; _dataArr = [NSMutableArray array]; - - + + [self initSubview]; - + self.search = [[AMapSearchAPI alloc] init]; self.search.delegate = self; - + #ifdef kAMapSDKDebugFlag self.inputAddressTf.text = @"人民广场"; #endif - + } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - + dispatch_async(dispatch_get_main_queue(), ^{ [self.inputAddressTf becomeFirstResponder]; }); - + } -- (void)initSubview { - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.backBtn]; - - UITextField *inputAddressTf = [[UITextField alloc] init]; +-(void)initSubview { + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.backBtn]; + + UITextField * inputAddressTf = [[UITextField alloc] init]; inputAddressTf.borderStyle = UITextBorderStyleRoundedRect; inputAddressTf.placeholder = @"输入地址"; inputAddressTf.returnKeyType = UIReturnKeySearch; inputAddressTf.tag = 100; inputAddressTf.delegate = self; - + [self.view addSubview:inputAddressTf]; - + [inputAddressTf mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.view).offset(10); + make.right.mas_equalTo(self.view).offset(-10); make.top.mas_equalTo(self.view).offset(kRoutePlanBarHeight + 10); - make.height.mas_equalTo(@30); + make.height.mas_equalTo(@35); }]; - + self.inputAddressTf = inputAddressTf; - - - UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; + + + + UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom]; [btn setTitle:@"当前位置" forState:UIControlStateNormal]; btn.backgroundColor = [UIColor whiteColor]; btn.layer.borderColor = [UIColor blueColor].CGColor; @@ -85,69 +87,56 @@ btn.layer.cornerRadius = 5; btn.titleLabel.font = [UIFont systemFontOfSize:12]; btn.hidden = YES; - + [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; [btn addTarget:self action:@selector(searchBtnAction) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn]; [btn mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(inputAddressTf.mas_right).offset(12); + make.left.equalTo(inputAddressTf.mas_right).offset(12); make.top.mas_equalTo(inputAddressTf); make.right.mas_equalTo(self.view).offset(-10); make.height.mas_equalTo(@30); make.width.mas_equalTo(70); }]; - - + + [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(inputAddressTf.mas_bottom).offset(5); make.left.equalTo(self.view); make.bottom.equalTo(self.view); make.centerX.equalTo(self.view); - + }]; - + [self.tableView reloadData]; } #pragma mark - - -- (nonnull UITableViewCell - -*)tableView:( -nonnull UITableView -*) -tableView cellForRowAtIndexPath -:( -nonnull NSIndexPath -*)indexPath { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; +- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { + UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } - - AMapPOI *m = self.dataArr[indexPath.row]; - cell.textLabel.text = [NSString stringWithFormat:@"%@", m.name]; - + + AMapPOI * m = self.dataArr[indexPath.row]; + cell.textLabel.text = [NSString stringWithFormat:@"%@" , m.name ]; + return cell; } -- (NSInteger)tableView:(nonnull UITableView - -*) -tableView numberOfRowsInSection -:(NSInteger)section { +- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.dataArr.count; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - AMapPOI *m = self.dataArr[indexPath.row]; - + AMapPOI * m = self.dataArr[indexPath.row]; + if (self.selectAddressBlk) { self.selectAddressBlk(m); } - + [self backBtnAction]; // [self.navigationController popViewControllerAnimated:YES]; } @@ -157,27 +146,26 @@ tableView numberOfRowsInSection self.currPage = self.currPage + 1; [self requestAddressWithAddress:self.inputAddressTf.text atPage:self.currPage]; } - + } #pragma mark - - - (UITableView *)tableView { if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; _tableView.delegate = self; _tableView.dataSource = self; } - + return _tableView; } -- (UIButton *)backBtn { +-(UIButton *)backBtn{ if (!_backBtn) { _backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _backBtn.frame = CGRectMake(0, 0, 40, 30); _backBtn.imageEdgeInsets = UIEdgeInsetsMake(2, -5, 2, 5); - + // _backBtn.backgroundColor = UIColor.redColor; [_backBtn setImage:[AMapNavCommonUtil imageWithName:@"icon_fanhui"] forState:UIControlStateNormal]; [_backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside]; @@ -185,105 +173,85 @@ tableView numberOfRowsInSection return _backBtn; } -- (void)backBtnAction { +-(void)backBtnAction { [self dismissViewControllerAnimated:YES completion:^{ - + }]; - + } #pragma mark - Action - -- (void)searchBtnAction { - AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager]; +-(void)searchBtnAction { + AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager]; self.inputAddressTf.text = sdk.locationAddressDetail; - + [self startSearchWithAddress:self.inputAddressTf.text]; } -- (void)startSearchWithAddress:(NSString *)addr { +-(void)startSearchWithAddress:(NSString *)addr { if (!addr) { return; } + + [self requestAddressWithAddress:addr atPage:1]; +} + +-(void)requestAddressWithAddress:(NSString *)addr atPage:(NSInteger)page { AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init]; - - request.keywords = addr; - - AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager]; - request.city = sdk.localCity; - - + + request.keywords = addr; + + AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager]; +// request.city = sdk.localCity; + + // request.types = @"高等院校"; // request.requireExtension = YES; - request.offset = 20; - request.page = 1; - + request.offset =20; + request.page = page; + /* 搜索SDK 3.2.0 中新增加的功能,只搜索本城市的POI。*/ // request.cityLimit = YES; // request.requireSubPOIs = YES; - - [self.search AMapPOIKeywordsSearch:request]; - -} - -- (void)requestAddressWithAddress:(NSString *)addr atPage:(NSInteger)page { - AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init]; - - request.keywords = addr; - - AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager]; - request.city = sdk.localCity; - - -// request.types = @"高等院校"; -// request.requireExtension = YES; - request.offset = 20; - request.page = page; - - /* 搜索SDK 3.2.0 中新增加的功能,只搜索本城市的POI。*/ - request.cityLimit = YES; -// request.requireSubPOIs = YES; - - + [self.search AMapPOIKeywordsSearch:request]; } #pragma mark - - /* POI 搜索回调. */ -- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response { - NSArray *pois = response.pois; - if (pois.count == 0) { +- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response +{ + NSArray * pois = response.pois; + if (pois.count == 0) + { return; } - + //解析response获取POI信息,具体解析见 Demo - + [self.dataArr addObjectsFromArray:pois]; - + [self.tableView reloadData]; - + } + - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; [self.dataArr removeAllObjects]; self.currPage = 1; - + [self startSearchWithAddress:textField.text]; - + return YES; } -- (void)touchesBegan:(NSSet - *) -touches withEvent -:(UIEvent *)event { +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.inputAddressTf resignFirstResponder]; } @end diff --git a/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/ABottomBarView.m b/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/ABottomBarView.m index 728f4fa..4a6436e 100644 --- a/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/ABottomBarView.m +++ b/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/ABottomBarView.m @@ -173,7 +173,7 @@ static inline UIColor *ABottomBarThemeGreen(void) { make.left.equalTo(card).offset(16); make.right.equalTo(card).offset(-16); make.height.mas_equalTo(48); - make.bottom.equalTo(card).offset(-40); + make.bottom.equalTo(card).offset(-40 + (-AMP_TabbarHeight - 13)); }]; } diff --git a/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/AStationDetailPopupView.m b/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/AStationDetailPopupView.m index e2cf93c..b3945e8 100644 --- a/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/AStationDetailPopupView.m +++ b/ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/AStationDetailPopupView.m @@ -68,9 +68,6 @@ static inline UIColor *AStationThemeGreen(void) { @property (nonatomic, strong) UIImageView *phoneIconView; @property (nonatomic, strong) UILabel *phoneLabel; -/// 卡片 bottom constraint(动画用) -@property (nonatomic, strong) MASConstraint *cardBottomConstraint; - @end @implementation AStationDetailPopupView @@ -81,277 +78,43 @@ static inline UIColor *AStationThemeGreen(void) { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; - [self _buildUI]; - [self _setupMasonryConstraints]; - [self _updateUI]; + [self setupUI]; } return self; } -#pragma mark - Public +#pragma mark - Setup UI -- (void)showInView:(UIView *)parentView { - self.alpha = 0; - self.maskControl.alpha = 0; - [parentView addSubview:self]; - [self mas_remakeConstraints:^(MASConstraintMaker *make) { -// make.edges.equalTo(parentView); - make.top.left.right.equalTo(parentView); - make.bottom.equalTo(parentView).offset((-AMP_TabbarSafeBottomMargin - 35)); - }]; - [self _playShowAnimation]; -} +- (void)setupUI { + [self addSubview:self.maskControl]; + [self.cardView addSubview:self.closeButton]; + [self.cardView addSubview:self.stationNameLabel]; + [self.cardView addSubview:self.costLabel]; + [self.cardView addSubview:self.businessHoursLabel]; + [self.cardView addSubview:self.addressLabel]; + [self.cardView addSubview:self.costIconView]; + [self.cardView addSubview:self.separator]; + [self.cardView addSubview:self.timeIconView]; + [self.cardView addSubview:self.timeLabel]; + [self.cardView addSubview:self.distanceIconView]; + [self.cardView addSubview:self.distanceLabel]; + [self.cardView addSubview:self.tollIconView]; + [self.cardView addSubview:self.tollLabel]; + [self.cardView addSubview:self.contactPersonIconView]; + [self.cardView addSubview:self.contactPersonLabel]; + [self.cardView addSubview:self.priceIconView]; + [self.cardView addSubview:self.priceLabel]; + [self.cardView addSubview:self.phoneIconView]; + [self.cardView addSubview:self.phoneLabel]; + [self.cardView addSubview:self.startNaviButton]; -- (void)hide { - [self hideWithCompletion:nil]; -} - -- (void)hideWithCompletion:(void(^)(void))completion { - [self _playDismissAnimationWithCompletion:^{ - [self removeFromSuperview]; - if (completion) { - completion(); - } - }]; -} - -#pragma mark - Setter Override(弹出前赋值 或 弹出后动态更新) - -- (void)setPointModel:(ANavPointModel *)pointModel { - _pointModel = pointModel; - [self _updateUI]; -} - -- (void)setEstimatedCost:(NSString *)estimatedCost { - _estimatedCost = [estimatedCost copy]; - [self _updateUI]; -} - -- (void)setEstimatedTime:(NSString *)estimatedTime { - _estimatedTime = [estimatedTime copy]; - [self _updateUI]; -} - -- (void)setDriveDistance:(NSString *)driveDistance { - _driveDistance = [driveDistance copy]; - [self _updateUI]; -} - -- (void)setTollFee:(NSString *)tollFee { - _tollFee = [tollFee copy]; - [self _updateUI]; -} - -- (void)setBusinessHours:(NSString *)businessHours { - _businessHours = [businessHours copy]; - [self _updateUI]; -} - -- (void)setContactName:(NSString *)contactName { - _contactName = [contactName copy]; - [self _updateUI]; -} - -- (void)setContactPhone:(NSString *)contactPhone { - _contactPhone = [contactPhone copy]; - [self _updateUI]; -} - -- (void)setHydrogenPrice:(NSString *)hydrogenPrice { - _hydrogenPrice = [hydrogenPrice copy]; - [self _updateUI]; -} - -#pragma mark - Build UI - -/** - 卡片结构: - ┌──────────────────────────────────── [✕] ┐ - │ 站点名称(加粗) 预计加氢费用:--元 │ ← 同行,间距20pt - │ 地址(灰色小字,多行) │ - │ ──────────────────────────────────────── │ - │ [icon] 预计时间:-- 分钟 │ - │ [icon] 行驶里程:-- 公里 [icon] 过路费:-- 元 │ - │ ╔════════════════════════════════════╗ │ - │ ║ 开始导航 ║ │ - │ ╚════════════════════════════════════╝ │ - │ (距底部30pt) │ - └─────────────────────────────────────────┘ -*/ -- (void)_buildUI { - // ── 蒙层 ── - UIControl *mask = [[UIControl alloc] init]; - mask.backgroundColor = [UIColor colorWithWhite:0 alpha:0]; - [mask addTarget:self action:@selector(_onMaskTapped) forControlEvents:UIControlEventTouchUpInside]; - [self addSubview:mask]; - self.maskControl = mask; - - // ── 卡片 ── - UIView *card = [[UIView alloc] init]; - card.backgroundColor = [UIColor whiteColor]; - card.layer.cornerRadius = 16; - card.layer.masksToBounds = NO; - card.layer.shadowColor = [UIColor blackColor].CGColor; - card.layer.shadowOpacity = 0.15; - card.layer.shadowRadius = 12; - card.layer.shadowOffset = CGSizeMake(0, -4); - [self addSubview:card]; - self.cardView = card; - - // ── 关闭按钮 ── - UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; - [closeBtn setImage:[AMapNavCommonUtil imageWithName:@"icon_close"] forState:UIControlStateNormal]; - [closeBtn setTitleColor:[UIColor colorWithWhite:0.5 alpha:1] forState:UIControlStateNormal]; - closeBtn.titleLabel.font = [UIFont systemFontOfSize:16]; - [closeBtn addTarget:self action:@selector(_onCloseTapped) forControlEvents:UIControlEventTouchUpInside]; - [card addSubview:closeBtn]; - self.closeButton = closeBtn; - - UIColor *headTextColor = [UIColor hp_colorWithRGBHex:0x1D2129]; - UIFont *headTextFont = [UIFont hp_pingFangMedium:14]; - - // ── 站点名称 ── - UILabel *nameLabel = [[UILabel alloc] init]; - nameLabel.font = [UIFont hp_pingFangMedium:18]; - nameLabel.textColor = headTextColor; - nameLabel.numberOfLines = 2; - nameLabel.minimumScaleFactor = 0.8; - [card addSubview:nameLabel]; - self.stationNameLabel = nameLabel; - - // ── 预计加氢费用(名称右侧,间距20pt) ── - UILabel *costLabel = [[UILabel alloc] init]; - costLabel.font = headTextFont; - costLabel.textColor = headTextColor; - costLabel.numberOfLines = 1; - costLabel.textAlignment = NSTextAlignmentLeft; - [card addSubview:costLabel]; - self.costLabel = costLabel; - - // ── 营业时间(站点名称下方,4pt间距,浅灰色小字) ── - UILabel *bizHoursLabel = [[UILabel alloc] init]; - bizHoursLabel.font = [UIFont hp_pingFangRegular:14]; - bizHoursLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; - bizHoursLabel.numberOfLines = 1; - [card addSubview:bizHoursLabel]; - self.businessHoursLabel = bizHoursLabel; - - // ── 地址 ── - UILabel *addrLabel = [[UILabel alloc] init]; - addrLabel.font = [UIFont hp_pingFangRegular:14]; - addrLabel.textColor = [UIColor hp_colorWithRGBHex:0x86909C]; - addrLabel.numberOfLines = 2; - [card addSubview:addrLabel]; - self.addressLabel = addrLabel; - - UIImageView *costIcon = [[UIImageView alloc] init]; - costIcon.contentMode = UIViewContentModeScaleAspectFit; - costIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_fuel"]; - [card addSubview:costIcon]; - self.costIconView = costIcon; - - // ── 分割线 ── - UIView *sep = [[UIView alloc] init]; - sep.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1]; - [card addSubview:sep]; - self.separator = sep; - - // ── 预计时间图标 ── - UIImageView *timeIcon = [[UIImageView alloc] init]; - timeIcon.contentMode = UIViewContentModeScaleAspectFit; - timeIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_time"]; - [card addSubview:timeIcon]; - self.timeIconView = timeIcon; - - // ── 预计时间文字 ── - UILabel *timeLabel = [[UILabel alloc] init]; - timeLabel.font = headTextFont; - timeLabel.textColor = headTextColor; - [card addSubview:timeLabel]; - self.timeLabel = timeLabel; - - // ── 行驶里程图标 ── - UIImageView *distIcon = [[UIImageView alloc] init]; - distIcon.contentMode = UIViewContentModeScaleAspectFit; - distIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_mileage"]; - [card addSubview:distIcon]; - self.distanceIconView = distIcon; - - // ── 行驶里程文字 ── - UILabel *distLabel = [[UILabel alloc] init]; - distLabel.font = headTextFont; - distLabel.textColor = headTextColor; - [card addSubview:distLabel]; - self.distanceLabel = distLabel; - - // ── 过路费图标 ── - UIImageView *tollIcon = [[UIImageView alloc] init]; - tollIcon.contentMode = UIViewContentModeScaleAspectFit; - tollIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_toll"]; - [card addSubview:tollIcon]; - self.tollIconView = tollIcon; - - // ── 过路费文字 ── - UILabel *tollLabel = [[UILabel alloc] init]; - tollLabel.font = headTextFont; - tollLabel.textColor = headTextColor; - [card addSubview:tollLabel]; - self.tollLabel = tollLabel; - - // ── 站点联系人图标 & 文字 ── - UIImageView *personIcon = [[UIImageView alloc] init]; - personIcon.contentMode = UIViewContentModeScaleAspectFit; - personIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_person"]; - [card addSubview:personIcon]; - self.contactPersonIconView = personIcon; - - UILabel *personLabel = [[UILabel alloc] init]; - personLabel.font = headTextFont; - personLabel.textColor = headTextColor; - [card addSubview:personLabel]; - self.contactPersonLabel = personLabel; - - // ── 加氢价格图标 & 文字 ── - UIImageView *priceIcon = [[UIImageView alloc] init]; - priceIcon.contentMode = UIViewContentModeScaleAspectFit; - priceIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_price"]; - [card addSubview:priceIcon]; - self.priceIconView = priceIcon; - - UILabel *priceLabel = [[UILabel alloc] init]; - priceLabel.font = headTextFont; - priceLabel.textColor = headTextColor; - [card addSubview:priceLabel]; - self.priceLabel = priceLabel; - - // ── 联系方式图标 & 文字 ── - UIImageView *phoneIcon = [[UIImageView alloc] init]; - phoneIcon.contentMode = UIViewContentModeScaleAspectFit; - phoneIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_phone"]; - [card addSubview:phoneIcon]; - self.phoneIconView = phoneIcon; - - UILabel *phoneLabel = [[UILabel alloc] init]; - phoneLabel.font = headTextFont; - phoneLabel.textColor = headTextColor; - [card addSubview:phoneLabel]; - self.phoneLabel = phoneLabel; - - // ── 开始导航按钮 ── - UIButton *naviBtn = [UIButton buttonWithType:UIButtonTypeCustom]; - [naviBtn setTitle:@"开始导航" forState:UIControlStateNormal]; - [naviBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - naviBtn.titleLabel.font = [UIFont boldSystemFontOfSize:17]; - naviBtn.backgroundColor = AStationThemeGreen(); - naviBtn.layer.cornerRadius = 24; - [naviBtn addTarget:self action:@selector(_onStartNaviTapped) forControlEvents:UIControlEventTouchUpInside]; - [card addSubview:naviBtn]; - self.startNaviButton = naviBtn; + [self setupConstraints]; + [self updateUI]; } #pragma mark - Masonry Constraints -- (void)_setupMasonryConstraints { +- (void)setupConstraints { UIView *card = self.cardView; CGFloat iconSize = 16; @@ -507,13 +270,85 @@ static inline UIColor *AStationThemeGreen(void) { make.left.equalTo(card).offset(16); make.right.equalTo(card).offset(-16); make.height.mas_equalTo(48); - make.bottom.equalTo(card).offset(-AMP_TabbarSafeBottomMargin); + make.bottom.equalTo(card).offset(-AMP_TabbarSafeBottomMargin + (-AMP_TabbarHeight - 13)); }]; } +#pragma mark - Public + +- (void)showInView:(UIView *)parentView { + self.alpha = 0; + self.maskControl.alpha = 0; + [parentView addSubview:self]; + [self mas_remakeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(parentView); + }]; + [self playShowAnimation]; +} + +- (void)hide { + [self hideWithCompletion:nil]; +} + +- (void)hideWithCompletion:(void(^)(void))completion { + [self playDismissAnimationWithCompletion:^{ + [self removeFromSuperview]; + if (completion) { + completion(); + } + }]; +} + +#pragma mark - Setter Override(弹出前赋值 或 弹出后动态更新) + +- (void)setPointModel:(ANavPointModel *)pointModel { + _pointModel = pointModel; + [self updateUI]; +} + +- (void)setEstimatedCost:(NSString *)estimatedCost { + _estimatedCost = [estimatedCost copy]; + [self updateUI]; +} + +- (void)setEstimatedTime:(NSString *)estimatedTime { + _estimatedTime = [estimatedTime copy]; + [self updateUI]; +} + +- (void)setDriveDistance:(NSString *)driveDistance { + _driveDistance = [driveDistance copy]; + [self updateUI]; +} + +- (void)setTollFee:(NSString *)tollFee { + _tollFee = [tollFee copy]; + [self updateUI]; +} + +- (void)setBusinessHours:(NSString *)businessHours { + _businessHours = [businessHours copy]; + [self updateUI]; +} + +- (void)setContactName:(NSString *)contactName { + _contactName = [contactName copy]; + [self updateUI]; +} + +- (void)setContactPhone:(NSString *)contactPhone { + _contactPhone = [contactPhone copy]; + [self updateUI]; +} + +- (void)setHydrogenPrice:(NSString *)hydrogenPrice { + _hydrogenPrice = [hydrogenPrice copy]; + [self updateUI]; +} + #pragma mark - Data Update -- (void)_updateUI { +- (void)updateUI { self.stationNameLabel.text = (self.pointModel.name.length > 0) ? self.pointModel.name : @"-"; @@ -522,7 +357,7 @@ static inline UIColor *AStationThemeGreen(void) { ? [NSString stringWithFormat:@"营业时间:%@", self.businessHours] : @"营业时间:-"; - self.costLabel.text = (self.estimatedCost.length > 0) + self.costLabel.text = ((self.estimatedCost.length > 0) && [self.estimatedCost doubleValue]) ? [NSString stringWithFormat:@"预计加氢费用:%@元", self.estimatedCost] : @"预计加氢费用:-"; @@ -530,12 +365,12 @@ static inline UIColor *AStationThemeGreen(void) { ? self.pointModel.address : @"-"; // ── 预计时间(始终显示,无值显示"-- 分钟") ── - self.timeLabel.text = (self.estimatedTime.length > 0) + self.timeLabel.text = ((self.estimatedTime.length > 0) && [self.estimatedTime doubleValue] > 0) ? [NSString stringWithFormat:@"预计时间:%@分钟", self.estimatedTime] : @"预计时间:-"; // ── 行驶里程(始终显示,无值显示"-- 公里") ── - self.distanceLabel.text = (self.driveDistance.length > 0) + self.distanceLabel.text = ((self.driveDistance.length > 0) && [self.driveDistance doubleValue] > 0) ? [NSString stringWithFormat:@"行驶里程:%@公里", self.driveDistance] : @"行驶里程:-"; @@ -560,7 +395,6 @@ static inline UIColor *AStationThemeGreen(void) { : @"联系方式:-"; } -// 重置 UI 状态 - (void)resetUI { self.stationNameLabel.text = @"-"; self.businessHoursLabel.text = @"营业时间:-"; @@ -579,7 +413,7 @@ static inline UIColor *AStationThemeGreen(void) { /** 弹入动画 */ -- (void)_playShowAnimation { +- (void)playShowAnimation { // 初始状态:卡片在屏幕下方(完全隐藏在屏幕外) [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(0); @@ -593,7 +427,7 @@ static inline UIColor *AStationThemeGreen(void) { [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(0); make.right.equalTo(self).offset(-0); - make.bottom.equalTo(self).offset(-AMP_TabbarSafeBottomMargin); + make.bottom.equalTo(self).offset(0); }]; [UIView animateWithDuration:0.36 @@ -608,7 +442,7 @@ static inline UIColor *AStationThemeGreen(void) { } completion:nil]; } -- (void)_playDismissAnimationWithCompletion:(void(^)(void))completion { +- (void)playDismissAnimationWithCompletion:(void(^)(void))completion { [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(0); make.right.equalTo(self).offset(-0); @@ -628,21 +462,21 @@ static inline UIColor *AStationThemeGreen(void) { #pragma mark - Actions -- (void)_onMaskTapped { +- (void)onMaskTapped { if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) { [self.delegate stationDetailPopupViewDidTapClose:self]; } [self hide]; } -- (void)_onCloseTapped { +- (void)onCloseTapped { if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) { [self.delegate stationDetailPopupViewDidTapClose:self]; } [self hide]; } -- (void)_onStartNaviTapped { +- (void)onStartNaviTapped { __weak typeof(self) weakSelf = self; [self hideWithCompletion:^{ __strong typeof(weakSelf) strongSelf = weakSelf; @@ -652,4 +486,222 @@ static inline UIColor *AStationThemeGreen(void) { }]; } +#pragma mark - Lazy Load + +- (UIControl *)maskControl { + if (!_maskControl) { + _maskControl = [[UIControl alloc] init]; + _maskControl.backgroundColor = [UIColor colorWithWhite:0 alpha:0]; + [_maskControl addTarget:self action:@selector(onMaskTapped) forControlEvents:UIControlEventTouchUpInside]; + } + return _maskControl; +} + +- (UIView *)cardView { + if (!_cardView) { + _cardView = [[UIView alloc] init]; + _cardView.backgroundColor = [UIColor whiteColor]; + _cardView.layer.cornerRadius = 16; + _cardView.layer.masksToBounds = NO; + _cardView.layer.shadowColor = [UIColor blackColor].CGColor; + _cardView.layer.shadowOpacity = 0.15; + _cardView.layer.shadowRadius = 12; + _cardView.layer.shadowOffset = CGSizeMake(0, -4); + [self addSubview:_cardView]; + } + return _cardView; +} + +- (UIButton *)closeButton { + if (!_closeButton) { + _closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_closeButton setImage:[AMapNavCommonUtil imageWithName:@"icon_close"] forState:UIControlStateNormal]; + [_closeButton setTitleColor:[UIColor colorWithWhite:0.5 alpha:1] forState:UIControlStateNormal]; + _closeButton.titleLabel.font = [UIFont systemFontOfSize:16]; + [_closeButton addTarget:self action:@selector(onCloseTapped) forControlEvents:UIControlEventTouchUpInside]; + } + return _closeButton; +} + +- (UILabel *)stationNameLabel { + if (!_stationNameLabel) { + _stationNameLabel = [[UILabel alloc] init]; + _stationNameLabel.font = [UIFont hp_pingFangMedium:18]; + _stationNameLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + _stationNameLabel.numberOfLines = 2; + _stationNameLabel.minimumScaleFactor = 0.8; + } + return _stationNameLabel; +} + +- (UILabel *)costLabel { + if (!_costLabel) { + _costLabel = [[UILabel alloc] init]; + _costLabel.font = [UIFont hp_pingFangMedium:14]; + _costLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + _costLabel.numberOfLines = 1; + _costLabel.textAlignment = NSTextAlignmentLeft; + } + return _costLabel; +} + +- (UILabel *)businessHoursLabel { + if (!_businessHoursLabel) { + _businessHoursLabel = [[UILabel alloc] init]; + _businessHoursLabel.font = [UIFont hp_pingFangRegular:14]; + _businessHoursLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + _businessHoursLabel.numberOfLines = 1; + } + return _businessHoursLabel; +} + +- (UILabel *)addressLabel { + if (!_addressLabel) { + _addressLabel = [[UILabel alloc] init]; + _addressLabel.font = [UIFont hp_pingFangRegular:14]; + _addressLabel.textColor = [UIColor hp_colorWithRGBHex:0x86909C]; + _addressLabel.numberOfLines = 2; + } + return _addressLabel; +} + +- (UIImageView *)costIconView { + if (!_costIconView) { + _costIconView = [[UIImageView alloc] init]; + _costIconView.contentMode = UIViewContentModeScaleAspectFit; + _costIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_fuel"]; + } + return _costIconView; +} + +- (UIView *)separator { + if (!_separator) { + _separator = [[UIView alloc] init]; + _separator.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1]; + _separator.hidden = YES; + } + return _separator; +} + +- (UIImageView *)timeIconView { + if (!_timeIconView) { + _timeIconView = [[UIImageView alloc] init]; + _timeIconView.contentMode = UIViewContentModeScaleAspectFit; + _timeIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_time"]; + } + return _timeIconView; +} + +- (UILabel *)timeLabel { + if (!_timeLabel) { + _timeLabel = [[UILabel alloc] init]; + _timeLabel.font = [UIFont hp_pingFangMedium:14]; + _timeLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + } + return _timeLabel; +} + +- (UIImageView *)distanceIconView { + if (!_distanceIconView) { + _distanceIconView = [[UIImageView alloc] init]; + _distanceIconView.contentMode = UIViewContentModeScaleAspectFit; + _distanceIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_mileage"]; + } + return _distanceIconView; +} + +- (UILabel *)distanceLabel { + if (!_distanceLabel) { + _distanceLabel = [[UILabel alloc] init]; + _distanceLabel.font = [UIFont hp_pingFangMedium:14]; + _distanceLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + } + return _distanceLabel; +} + +- (UIImageView *)tollIconView { + if (!_tollIconView) { + _tollIconView = [[UIImageView alloc] init]; + _tollIconView.contentMode = UIViewContentModeScaleAspectFit; + _tollIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_toll"]; + } + return _tollIconView; +} + +- (UILabel *)tollLabel { + if (!_tollLabel) { + _tollLabel = [[UILabel alloc] init]; + _tollLabel.font = [UIFont hp_pingFangMedium:14]; + _tollLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + } + return _tollLabel; +} + +- (UIImageView *)contactPersonIconView { + if (!_contactPersonIconView) { + _contactPersonIconView = [[UIImageView alloc] init]; + _contactPersonIconView.contentMode = UIViewContentModeScaleAspectFit; + _contactPersonIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_person"]; + } + return _contactPersonIconView; +} + +- (UILabel *)contactPersonLabel { + if (!_contactPersonLabel) { + _contactPersonLabel = [[UILabel alloc] init]; + _contactPersonLabel.font = [UIFont hp_pingFangMedium:14]; + _contactPersonLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + } + return _contactPersonLabel; +} + +- (UIImageView *)priceIconView { + if (!_priceIconView) { + _priceIconView = [[UIImageView alloc] init]; + _priceIconView.contentMode = UIViewContentModeScaleAspectFit; + _priceIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_price"]; + } + return _priceIconView; +} + +- (UILabel *)priceLabel { + if (!_priceLabel) { + _priceLabel = [[UILabel alloc] init]; + _priceLabel.font = [UIFont hp_pingFangMedium:14]; + _priceLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + } + return _priceLabel; +} + +- (UIImageView *)phoneIconView { + if (!_phoneIconView) { + _phoneIconView = [[UIImageView alloc] init]; + _phoneIconView.contentMode = UIViewContentModeScaleAspectFit; + _phoneIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_phone"]; + } + return _phoneIconView; +} + +- (UILabel *)phoneLabel { + if (!_phoneLabel) { + _phoneLabel = [[UILabel alloc] init]; + _phoneLabel.font = [UIFont hp_pingFangMedium:14]; + _phoneLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129]; + } + return _phoneLabel; +} + +- (UIButton *)startNaviButton { + if (!_startNaviButton) { + _startNaviButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_startNaviButton setTitle:@"开始导航" forState:UIControlStateNormal]; + [_startNaviButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + _startNaviButton.titleLabel.font = [UIFont boldSystemFontOfSize:17]; + _startNaviButton.backgroundColor = AStationThemeGreen(); + _startNaviButton.layer.cornerRadius = 24; + [_startNaviButton addTarget:self action:@selector(onStartNaviTapped) forControlEvents:UIControlEventTouchUpInside]; + } + return _startNaviButton; +} + @end diff --git a/ln_jq_app/pubspec.yaml b/ln_jq_app/pubspec.yaml index 0ce56da..5f5116d 100644 --- a/ln_jq_app/pubspec.yaml +++ b/ln_jq_app/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.2.4+7 +version: 1.2.5+8 environment: sdk: ^3.9.0