Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 联系人详情页面 #26

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@

###### 🏳️‍🌈 通讯录模块

| ![](https://github.com/CoderMikeHe/WeChat_Resource/blob/master/snapshots/contacts/ios_contacts_page_0.png) | ![](https://github.com/CoderMikeHe/WeChat_Resource/blob/master/snapshots/contacts/ios_contacts_page_1.png) | 虚位以待 | 虚位以待 |
| ![](https://github.com/CoderMikeHe/WeChat_Resource/blob/master/snapshots/contacts/ios_contacts_page_0.png) | ![](https://github.com/CoderMikeHe/WeChat_Resource/blob/master/snapshots/contacts/ios_contacts_page_1.png) | ![](./WeChat/SnapShot/contactInfo.png) | 虚位以待 |
| :--------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | :------: | :------: |


Expand Down
Binary file added WeChat/SnapShot/contactInfo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions WeChat/WeChat.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Contact_Female_18x18.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Contact_Male_18x18.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 3 additions & 3 deletions WeChat/WeChat/Assets.xcassets/Contacts/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
12 changes: 12 additions & 0 deletions WeChat/WeChat/Resource/Pictures/Contact/icons_outlined_chats.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions WeChat/WeChat/Utils/Router/MHRouter.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ - (NSDictionary *)viewModelViewMappings {
@"MHMoreInfoViewModel":@"MHMoreInfoViewController",
@"MHFeatureSignatureViewModel":@"MHFeatureSignatureViewController",
@"MHAddFriendsViewModel":@"MHAddFriendsViewController",
@"MHContactInfoViewModel":@"MHContactInfoViewController",
@"MHSearchFriendsViewModel":@"MHSearchFriendsViewController",
@"MHAccountLoginViewModel":@"MHAccountLoginViewController",
@"MHBootLoginViewModel":@"MHBootLoginViewController",
Expand Down
21 changes: 21 additions & 0 deletions WeChat/WeChat/View/Contacts/ContactInfo/MHContactInfoContactCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// MHContactInfoContactCell.h
// WeChat
//
// Created by zhangguangqun on 2021/4/16.
// Copyright © 2021 CoderMikeHe. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface MHContactInfoContactCell : UITableViewCell<MHReactiveView>
/// 初始化
+ (instancetype)cellWithTableView:(UITableView *)tableView;

/// 空操作
- (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows;
@end

NS_ASSUME_NONNULL_END
48 changes: 48 additions & 0 deletions WeChat/WeChat/View/Contacts/ContactInfo/MHContactInfoContactCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// MHContactInfoContactCell.m
// WeChat
//
// Created by zhangguangqun on 2021/4/16.
// Copyright © 2021 CoderMikeHe. All rights reserved.
//

#import "MHContactInfoContactCell.h"
#import "MHContactInfoContactItemViewModel.h"

@interface MHContactInfoContactCell ()
@property (weak, nonatomic) IBOutlet UIImageView *iconImage;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

/// viewModel
@property (nonatomic, readwrite, strong) MHContactInfoContactItemViewModel *viewModel;
@end


@implementation MHContactInfoContactCell

+ (instancetype)cellWithTableView:(UITableView *)tableView {
static NSString *ID = @"ContactInfoContactCell";
MHContactInfoContactCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
if (!cell) cell = [self mh_viewFromXib];
return cell;
}

- (void)bindViewModel:(MHContactInfoContactItemViewModel *)viewModel{
self.viewModel = viewModel;
self.iconImage.image = [UIImage mh_svgImageNamed:self.viewModel.iconName targetSize:CGSizeMake(25.0, 25.0) tintColor:MHColorFromHexString(@"#586C95")];
self.titleLabel.text = self.viewModel.labelString;
}

- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}

/// 防止Crash
- (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows{}
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="55" id="KGk-i7-Jjw" customClass="MHContactInfoContactCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="55"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="55"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="JlJ-pt-Dua">
<rect key="frame" x="117.5" y="15" width="85" height="25"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Iel-sg-x9c">
<rect key="frame" x="0.0" y="0.0" width="25" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="25" id="3kN-67-YgV"/>
<constraint firstAttribute="height" constant="25" id="HMK-ts-rrQ"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="发消息" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lJr-qc-fqK">
<rect key="frame" x="33" y="0.0" width="52" height="25"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.34509803921568627" green="0.42352941176470588" blue="0.58431372549019611" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1M6-lM-0qH" userLabel="分割线">
<rect key="frame" x="0.0" y="53.5" width="320" height="0.5"/>
<color key="backgroundColor" red="0.90196078431372551" green="0.90196078431372551" blue="0.90196078431372551" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="h8O-mi-39s"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="1M6-lM-0qH" secondAttribute="trailing" id="7vO-XP-xLh"/>
<constraint firstItem="JlJ-pt-Dua" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="aWW-9h-WEy"/>
<constraint firstItem="1M6-lM-0qH" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="cdA-e9-uBq"/>
<constraint firstAttribute="bottom" secondItem="1M6-lM-0qH" secondAttribute="bottom" constant="1" id="rWC-bu-Sep"/>
<constraint firstItem="JlJ-pt-Dua" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="uAS-aq-dwH"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="iconImage" destination="Iel-sg-x9c" id="iaQ-Cf-5aN"/>
<outlet property="titleLabel" destination="lJr-qc-fqK" id="VKF-mv-79i"/>
</connections>
<point key="canvasLocation" x="140.57971014492756" y="60.602678571428569"/>
</tableViewCell>
</objects>
</document>
21 changes: 21 additions & 0 deletions WeChat/WeChat/View/Contacts/ContactInfo/MHContactInfoHeaderCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// MHContactInfoCell.h
// WeChat
//
// Created by zhangguangqun on 2021/4/15.
// Copyright © 2021 CoderMikeHe. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface MHContactInfoHeaderCell : UITableViewCell<MHReactiveView>
/// 初始化
+ (instancetype)cellWithTableView:(UITableView *)tableView;

/// 空操作
- (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows;
@end

NS_ASSUME_NONNULL_END
57 changes: 57 additions & 0 deletions WeChat/WeChat/View/Contacts/ContactInfo/MHContactInfoHeaderCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// MHContactInfoCell.m
// WeChat
//
// Created by zhangguangqun on 2021/4/15.
// Copyright © 2021 CoderMikeHe. All rights reserved.
//

#import "MHContactInfoHeaderCell.h"
#import "MHContactInfoHeaderViewModel.h"

@interface MHContactInfoHeaderCell ()
@property (weak, nonatomic) IBOutlet UIImageView *avatarImageView;

@property (weak, nonatomic) IBOutlet UILabel *nameCommentLabel;

@property (weak, nonatomic) IBOutlet UILabel *nickNameLabel;

@property (weak, nonatomic) IBOutlet UILabel *wechatIdLabel;

@property (weak, nonatomic) IBOutlet UIImageView *genderImage;

/// viewModel
@property (nonatomic, readwrite, strong) MHContactInfoHeaderViewModel *viewModel;
@end

@implementation MHContactInfoHeaderCell

- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}

+ (instancetype)cellWithTableView:(UITableView *)tableView {
static NSString *ID = @"ContactInfoHeaderCell";
MHContactInfoHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
if (!cell) cell = [self mh_viewFromXib];
return cell;
}

- (void)bindViewModel:(MHContactInfoHeaderViewModel *)viewModel{
self.viewModel = viewModel;
self.nickNameLabel.text = self.viewModel.user.screenName;
self.wechatIdLabel.text = self.viewModel.user.wechatId;
self.nameCommentLabel.text = self.viewModel.user.screenName;
[self.avatarImageView yy_setImageWithURL:self.viewModel.user.profileImageUrl placeholder:MHWebAvatarImagePlaceholder() options:MHWebImageOptionAutomatic completion:NULL];
self.genderImage.image = self.viewModel.user.gender == 0?MHImageNamed(@"Contact_Male_18x18.png"):MHImageNamed(@"Contact_Female_18x18.png");
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}

/// 防止Crash
- (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows{}

@end
Loading