首次提交

This commit is contained in:
启星
2025-09-22 18:48:29 +08:00
parent 28ae935e93
commit ae9be0b58e
8941 changed files with 999209 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
//
// QXDayTaskRuleView.h
// QXLive
//
// Created by 启星 on 2025/6/6.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXDayTaskRuleView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,138 @@
//
// QXDayTaskRuleView.m
// QXLive
//
// Created by on 2025/6/6.
//
#import "QXDayTaskRuleView.h"
#import <WebKit/WebKit.h>
static void *WKWebBrowserContext = &WKWebBrowserContext;
@interface QXDayTaskRuleView()<WKNavigationDelegate,WKUIDelegate>
@property(nonatomic,strong)WKWebView *contentWebView;
@property(nonatomic,strong)UIProgressView *progressView;
@property(nonatomic,strong)UIButton* closeBtn;
@end
@implementation QXDayTaskRuleView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
[self addSubview:self.contentWebView];
[self addSubview:self.progressView];
[self loadData];
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake((self.width-30)/2, self.contentWebView.bottom+10, 30, 30)];
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.closeBtn];
}
-(void)closeAction{
[self removeFromSuperview];
}
- (void)loadData {
NSString *urlStr = [NSString stringWithFormat:@"%@web/index.html#/pages/other/taskDesc",H5ServerUrl];
NSURL* url=[NSURL URLWithString:urlStr];
NSURLRequest *request =[NSURLRequest requestWithURL:url];
[self.contentWebView loadRequest:request];
}
//
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
}
//KVO
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([keyPath isEqualToString:NSStringFromSelector(@selector(estimatedProgress))] && object == self.contentWebView) {
[self.progressView setAlpha:1.0f];
BOOL animated = self.contentWebView.estimatedProgress > self.progressView.progress;
[self.progressView setProgress:self.contentWebView.estimatedProgress animated:animated];
// Once complete, fade out UIProgressView
if(self.contentWebView.estimatedProgress >= 1.0f) {
[UIView animateWithDuration:0.3f delay:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
[self.progressView setAlpha:0.0f];
} completion:^(BOOL finished) {
[self.progressView setProgress:0.0f animated:NO];
}];
}
}
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
#pragma mark - getters and setters
- (WKWebView *)contentWebView {
if (!_contentWebView) {
//
WKWebViewConfiguration * configuration = [[WKWebViewConfiguration alloc]init];
//
configuration.selectionGranularity = YES;
// webpr
configuration.processPool = [[WKProcessPool alloc] init];
//, jsoc(OCURL)
WKUserContentController * UserContentController = [[WKUserContentController alloc]init];
//
configuration.suppressesIncrementalRendering = NO;
//
configuration.preferences.javaScriptEnabled = YES;
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
configuration.userContentController = UserContentController;
// iOS9iOS8
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
//
configuration.allowsAirPlayForMediaPlayback = YES;
// 线
configuration.allowsInlineMediaPlayback = YES;
// NOios8
_contentWebView.allowsBackForwardNavigationGestures = YES;
}
_contentWebView = [[WKWebView alloc] initWithFrame:CGRectMake(25, NavContentHeight+40, self.width-25*2, self.height-(NavContentHeight+40)*2-30) configuration:configuration];
_contentWebView.backgroundColor = [UIColor clearColor];
[_contentWebView addRoundedCornersWithRadius:16];
_contentWebView.opaque = NO;
//
[_contentWebView sizeToFit];
_contentWebView.scrollView.showsVerticalScrollIndicator = NO;
_contentWebView.scrollView.backgroundColor = [UIColor clearColor];
_contentWebView.scrollView.bounces = NO;
//
_contentWebView.navigationDelegate = self;
//kvo
[_contentWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:WKWebBrowserContext];
}
return _contentWebView;
}
- (UIProgressView *)progressView {
if (!_progressView) {
_progressView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
_progressView.frame = CGRectMake(self.contentWebView.left+16, self.contentWebView.top, self.contentWebView.width-32, 2);
[_progressView setTrackTintColor:[UIColor colorWithRed:240.0/255 green:240.0/255 blue:240.0/255 alpha:1.0]];
_progressView.progressTintColor = QXConfig.themeColor;
}
return _progressView;
}
-(void)setProgressColor:(UIColor *)progressColor{
_progressView.progressTintColor = progressColor;
}
// dealloc
- (void)dealloc {
if (self) {
[self.contentWebView removeObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress))];
}
}
@end

View File

@@ -0,0 +1,19 @@
//
// QXUserDynamicView.h
// QXLive
//
// Created by 启星 on 2025/5/21.
//
#import <UIKit/UIKit.h>
#import "JXPagerView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXUserDynamicView : UIView<JXPagerViewListViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic,strong)NSString *user_id;
@property (nonatomic, copy) void(^listScrollCallback)(UIScrollView *scrollView);
- (instancetype)initWithOffsetY:(CGFloat)offsety;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,138 @@
//
// QXUserDynamicView.m
// QXLive
//
// Created by on 2025/5/21.
//
#import "QXUserDynamicView.h"
#import "QXDynamicListCell.h"
#import "QXMineNetwork.h"
#import "QXDynamicDetailViewController.h"
@interface QXUserDynamicView() <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, strong) NSMutableArray* dataArray;
@end
@implementation QXUserDynamicView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.page = 1;
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.tableFooterView = [UIView new];
self.tableView.dataSource = self;
self.tableView.delegate = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerNib:[UINib nibWithNibName:@"QXDynamicListCell" bundle:nil] forCellReuseIdentifier:@"QXDynamicListCell"];
self.tableView.rowHeight = UITableViewAutomaticDimension;
// self.tableView.estimatedRowHeight = 152;
[self addSubview:self.tableView];
MJWeakSelf
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getList];
}];
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getList];
}];
}
return self;
}
- (instancetype)initWithOffsetY:(CGFloat)offsety {
self = [self initWithFrame:CGRectZero];
self.tableView.contentOffset = CGPointMake(0, offsety);
return self;
}
-(void)setUser_id:(NSString *)user_id{
_user_id = user_id;
[self getList];
}
-(void)getList{
MJWeakSelf
[QXMineNetwork userDynamicWithUserId:self.user_id
page:self.page successBlock:^(NSArray<QXDynamicModel *> * _Nonnull hotos) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:hotos];
[weakSelf.tableView.mj_header endRefreshing];
if (hotos.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView.mj_footer endRefreshing];
}];
}
- (void)layoutSubviews {
[super layoutSubviews];
self.tableView.frame = self.bounds;
}
#pragma mark - UITableViewDataSource, UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
QXDynamicListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QXDynamicListCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
cell.cellType = QXDynamicListCellHomePage;
cell.model = self.dataArray[indexPath.row];
// cell.imgs = @[@"user_header_placehoulder",@"user_header_placehoulder"];
// SPTrendListModel *model = self.dataArray[indexPath.row];
// cell.model = model;
// WEAK_SELF
// cell.onDeleteBlock = ^{
// [weakSelf onDeleteWith:indexPath.row];
// };
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXDynamicDetailViewController *vc = [[QXDynamicDetailViewController alloc] init];
vc.model = self.dataArray[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (self.scrollCallback != nil) {
self.scrollCallback(scrollView);
}
if (self.listScrollCallback != nil) {
self.listScrollCallback(scrollView);
}
}
#pragma mark - JXPagingViewListViewDelegate
- (UIScrollView *)listScrollView {
return self.tableView;
}
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
self.scrollCallback = callback;
}
- (UIView *)listView {
return self;
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end

View File

@@ -0,0 +1,18 @@
//
// QXUserGiftWallView.h
// QXLive
//
// Created by 启星 on 2025/5/21.
//
#import <UIKit/UIKit.h>
#import "JXPagerView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXUserGiftWallView : UIView<JXPagerViewListViewDelegate>
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, copy) void(^listScrollCallback)(UIScrollView *scrollView);
@property (nonatomic,strong)NSString *user_id;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,112 @@
//
// QXUserGiftWallView.m
// QXLive
//
// Created by on 2025/5/21.
//
#import "QXUserGiftWallView.h"
#import "QXGiftCell.h"
#import "QXMineNetwork.h"
@interface QXUserGiftWallView()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
@property (nonatomic, strong) NSMutableArray* dataArray;
@end
@implementation QXUserGiftWallView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*2-12*3)/4, ScaleWidth(119));
layout.minimumLineSpacing = 12;
layout.minimumInteritemSpacing = 12;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[self.collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.bounces = NO;
self.collectionView.pagingEnabled = NO;
self.collectionView.backgroundColor = RGB16(0xf6f6f6);
[self addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(12);
make.top.mas_equalTo(12);
make.height.mas_equalTo(ScaleWidth(76));
make.right.mas_equalTo(-12);
}];
}
return self;
}
- (instancetype)initWithOffsetY:(CGFloat)offsety {
self = [self initWithFrame:CGRectZero];
self.collectionView.contentOffset = CGPointMake(0, offsety);
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.collectionView.frame = self.bounds;
}
-(void)setUser_id:(NSString *)user_id{
_user_id = user_id;
[self getGiftWall];
}
-(void)getGiftWall{
MJWeakSelf
[QXMineNetwork userGiftWallithUserId:self.user_id successBlock:^(NSArray<QXUserGiftWallModel *> * _Nonnull lightList, NSArray<QXUserGiftWallModel *> * _Nonnull grayList) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:lightList];
[weakSelf.dataArray addObjectsFromArray:grayList];
[weakSelf.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
#pragma mark - UITableViewDataSource, UITableViewDelegate
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
cell.cellType = QXGiftCellTypeGiftWall;
cell.giftWall = self.dataArray[indexPath.row];
return cell;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (self.scrollCallback != nil) {
self.scrollCallback(scrollView);
}
if (self.listScrollCallback != nil) {
self.listScrollCallback(scrollView);
}
}
#pragma mark - JXPagingViewListViewDelegate
- (UIScrollView *)listScrollView {
return self.collectionView;
}
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
self.scrollCallback = callback;
}
- (UIView *)listView {
return self;
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end

View File

@@ -0,0 +1,21 @@
//
// QXUserHomeHeaderView.h
// QXLive
//
// Created by 启星 on 2025/5/20.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXUserHomeHeaderView : UIView
@property (nonatomic,strong)QXUserHomeModel *model;
@end
@interface QXTagImageCell : UICollectionViewCell
@property (nonatomic,strong)NSString *imageUrl;
@property (nonatomic,strong)UIImageView *imageView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,349 @@
//
// QXUserHomeHeaderView.m
// QXLive
//
// Created by on 2025/5/20.
//
#import "QXUserHomeHeaderView.h"
#import "QXSeatHeaderView.h"
#import "QXSearchCell.h"
#import "NSDate+BRPickerView.h"
#import "NSString+QX.h"
#import "QXDynamicNetwork.h"
#import "QXChatViewController.h"
@interface QXUserHomeHeaderView()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong) QXSeatHeaderView* headerView;
@property (nonatomic,strong) UIView * whiteBgView;
@property (nonatomic,strong) UIView * grayBgView;
@property (nonatomic,strong) UILabel * nameLabel;
@property (nonatomic,strong) UILabel * idLabel;
@property (nonatomic,strong) UILabel * ageLabel;
@property (nonatomic,strong) UILabel * guildLabel;
@property (nonatomic,strong) UICollectionView * collectionView;
@property (nonatomic,strong) NSMutableArray * tagArray;
@property (nonatomic,strong) UILabel *introduceLabel;
@property (nonatomic,strong) UICollectionView *inCollectionView;
@property (nonatomic, strong) UIImageView *useCodeImageView;
@property (nonatomic, strong)UIImageView *sexImageView;
@property (nonatomic,strong) UIButton *followBtn;
@property (nonatomic,strong) UIButton *playBtn;
@end
@implementation QXUserHomeHeaderView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor clearColor];
self.headerView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(32, 46, 70, 70)];
[self.headerView addRoundedCornersWithRadius:35];
[self addSubview:self.headerView];
[self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(32);
make.height.width.mas_equalTo(70);
make.top.mas_equalTo(26);
}];
self.sexImageView = [[UIImageView alloc] init];
[self addSubview:self.sexImageView];
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.equalTo(self.headerView);
make.height.width.mas_equalTo(16);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = QXConfig.textColor;
self.nameLabel.font = [UIFont boldSystemFontOfSize:16];
[self addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.height.mas_equalTo(24);
make.top.equalTo(self.headerView.mas_bottom).offset(4);
}];
self.idLabel = [[UILabel alloc] init];
self.idLabel.textColor = RGB16(0x999999);
self.idLabel.font = [UIFont boldSystemFontOfSize:12];
[self addSubview:self.idLabel];
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel.mas_right).offset(12);
make.height.mas_equalTo(24);
make.centerY.equalTo(self.nameLabel);
}];
self.useCodeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_usercode_isLiang"]];
self.useCodeImageView.hidden = YES;
[self addSubview:self.useCodeImageView];
[self.useCodeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.idLabel.mas_right).offset(5);
make.height.mas_equalTo(11);
make.width.mas_equalTo(31);
make.centerY.equalTo(self.idLabel);
}];
self.ageLabel = [[UILabel alloc] init];
self.ageLabel.textColor = RGB16(0x999999);
self.ageLabel.font = [UIFont boldSystemFontOfSize:12];
[self addSubview:self.ageLabel];
[self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.height.mas_equalTo(18);
make.top.equalTo(self.nameLabel.mas_bottom).offset(8);
make.width.mas_greaterThanOrEqualTo(35);
}];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(42, 16);
layout.minimumLineSpacing = 7;
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.backgroundColor = UIColor.clearColor;
[self.collectionView registerClass:[QXTagImageCell class] forCellWithReuseIdentifier:@"QXTagImageCell"];
[self addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.ageLabel.mas_right).offset(8);
make.height.mas_equalTo(18);
make.centerY.equalTo(self.ageLabel);
make.width.mas_equalTo(300);
}];
self.guildLabel = [[UILabel alloc] init];
self.guildLabel.textColor = RGB16(0x999999);
self.guildLabel.text = @"所属公会";
self.guildLabel.font = [UIFont boldSystemFontOfSize:12];
[self addSubview:self.guildLabel];
[self.guildLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.height.mas_equalTo(18);
make.top.equalTo(self.ageLabel.mas_bottom).offset(8);
make.width.mas_greaterThanOrEqualTo(35);
}];
self.introduceLabel = [[UILabel alloc] init];
self.introduceLabel.textColor = QXConfig.textColor;
self.introduceLabel.font = [UIFont systemFontOfSize:14];
self.introduceLabel.numberOfLines = 0;
[self addSubview:self.introduceLabel];
[self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.top.equalTo(self.guildLabel.mas_bottom).offset(4);
make.width.mas_equalTo(SCREEN_WIDTH-64);
make.height.mas_greaterThanOrEqualTo(22);
}];
UICollectionViewFlowLayout *inlayout = [[UICollectionViewFlowLayout alloc] init];
inlayout.itemSize = CGSizeMake(77, 22);
inlayout.minimumLineSpacing = 12;
inlayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.inCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:inlayout];
self.inCollectionView.delegate = self;
self.inCollectionView.dataSource = self;
self.inCollectionView.showsHorizontalScrollIndicator = NO;
self.inCollectionView.backgroundColor = UIColor.clearColor;
[self.inCollectionView registerClass:[QXSearchCell class] forCellWithReuseIdentifier:@"QXSearchCell"];
[self addSubview:self.inCollectionView];
[self.inCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerView);
make.height.mas_equalTo(22);
make.top.equalTo(self.introduceLabel.mas_bottom).offset(4);
make.width.mas_equalTo(SCREEN_WIDTH-64);
}];
self.whiteBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 46, self.width, 167)];
self.whiteBgView.backgroundColor = [UIColor whiteColor];
[self.whiteBgView addRoundedCornersWithRadius:16];
[self insertSubview:self.whiteBgView belowSubview:self.headerView];
[self.whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.width.mas_equalTo(SCREEN_WIDTH-32);
make.top.equalTo(self.headerView.mas_top).offset(20);
make.bottom.equalTo(self);
}];
self.grayBgView = [[UIView alloc] initWithFrame:CGRectMake(0, self.whiteBgView.top+75, self.width, 92)];
self.grayBgView.backgroundColor = RGB16(0xF6F6F6);
[self.grayBgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self insertSubview:self.grayBgView belowSubview:self.whiteBgView];
[self.grayBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.height.mas_equalTo(92);
make.bottom.equalTo(self.whiteBgView);
}];
self.playBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 35)];
// [self.playBtn setTitle:QXText(@"私信") forState:(UIControlStateNormal)];
// [self.playBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
// self.playBtn.backgroundColor = RGB16(0x333333);
self.playBtn.hidden = YES;
self.playBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.playBtn addRoundedCornersWithRadius:17.5];
[self.playBtn addTarget:self action:@selector(playAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.playBtn];
[self.playBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-27);
make.width.mas_equalTo(91);
make.height.mas_equalTo(35);
make.top.equalTo(self.whiteBgView).offset(10);
}];
self.followBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 35)];
[self.followBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)];
[self.followBtn setTitle:QXText(@"已关注") forState:(UIControlStateSelected)];
[self.followBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.followBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateSelected)];
[self.followBtn setBackgroundImage:[UIImage imageWithColor:QXConfig.themeColor] forState:UIControlStateNormal];
[self.followBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xF1F2F3)] forState:UIControlStateSelected];
self.followBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.followBtn addRoundedCornersWithRadius:17.5];
self.followBtn.hidden = YES;
[self.followBtn addTarget:self action:@selector(followAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.followBtn];
[self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.playBtn.mas_left).offset(-6);
make.width.mas_equalTo(91);
make.height.mas_equalTo(35);
make.centerY.equalTo(self.playBtn);
}];
// self.nameLabel.text = @"张三";
// self.idLabel.text = @"313213213";
// self.ageLabel.text = @"36岁";
// self.introduceLabel.text = @"个人简介个人简介个人简介个人简个人简介";
[self.inCollectionView reloadData];
}
-(void)followAction{
MJWeakSelf
[QXDynamicNetwork followWithUserId:self.model.user_id type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
weakSelf.followBtn.selected = !weakSelf.followBtn.selected;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)playAction{
if (self.model.room_id.intValue > 0) {
//
[[QXGlobal shareGlobal] joinRoomWithRoomId:self.model.room_id isRejoin:NO navagationController:self.navigationController];
}else{
//
[[QXGlobal shareGlobal] chatWithUserID:self.model.user_id nickname:self.model.nickname avatar:self.model.avatar navagationController:self.navigationController];
}
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
if (collectionView == self.collectionView) {
return self.model.icon.count;
}else{
return self.model.tag_list.count;
}
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
if (collectionView == self.collectionView) {
QXTagImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXTagImageCell" forIndexPath:indexPath];
cell.imageUrl = self.model.icon[indexPath.row];
return cell;
}else{
QXSearchCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSearchCell" forIndexPath:indexPath];
cell.cellType = QXSearchCellTypeIntroduce;
cell.userTag = self.model.tag_list[indexPath.row];
return cell;
}
}
-(void)setModel:(QXUserHomeModel *)model{
_model = model;
[self.headerView setHeadIcon:model.avatar dress:model.dress];
self.nameLabel.text = model.nickname;
self.idLabel.text = [NSString stringWithFormat:@"ID:%@",model.user_code];
self.ageLabel.text = [NSString stringWithFormat:@"%@|%ld岁",model.sex.intValue==1?QXText(@"男"):QXText(@"女"),[model.birthday ageWithDateOfBirth]];
self.introduceLabel.text = model.profile;
[self.inCollectionView reloadData];
[self.collectionView reloadData];
if ([model.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
self.followBtn.hidden = YES;
self.playBtn.hidden = YES;
}else{
self.followBtn.hidden = NO;
self.playBtn.hidden = NO;
self.followBtn.selected = model.is_follow==0?NO:YES;
if (model.room_id.intValue > 0) {
// [self.playBtn setTitle:QXText(@"跟随") forState:(UIControlStateNormal)];
[self.playBtn setBackgroundImage:[UIImage imageNamed:@"room_user_follow"] forState:(UIControlStateNormal)];
}else{
// [self.playBtn setTitle:QXText(@"私信") forState:(UIControlStateNormal)];
[self.playBtn setBackgroundImage:[UIImage imageNamed:@"expansion_call"] forState:(UIControlStateNormal)];
}
}
if ([model.guild isExist]) {
self.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",model.guild];
}else{
self.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",@"无"];
}
if (model.is_use_code.intValue == 1) {
self.useCodeImageView.hidden = NO;
}else{
self.useCodeImageView.hidden = YES;
}
UIImage *sexImage = [UIImage imageNamed:model.sex.intValue==1?@"user_sex_boy":@"user_sex_girl"];
self.sexImageView.image = sexImage;
}
-(NSMutableArray *)tagArray{
if (!_tagArray) {
_tagArray = [NSMutableArray array];
}
return _tagArray;
}
@end
@implementation QXTagImageCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setImageUrl:(NSString *)imageUrl{
_imageUrl = imageUrl;
if ([imageUrl hasPrefix:@"http"] || [imageUrl hasPrefix:@"https"]) {
[self.imageView sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:nil];
}else{
if ([imageUrl isEqualToString:@"mine_room_cover_add"]) {
self.imageView.image = [UIImage imageNamed:imageUrl];
}else{
NSString *fileUrl =[NSString stringWithFormat:@"https://%@.%@/%@",OSS_BUCKET_NAME,OSSEndPoint,imageUrl];
[self.imageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:nil];
}
}
}
-(void)initSubviews{
self.imageView = [[UIImageView alloc] initWithFrame:self.bounds];
[self.contentView addSubview:self.imageView];
self.imageView.contentMode = UIViewContentModeScaleToFill;
self.imageView.clipsToBounds = YES;
// [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.bottom.left.right.equalTo(self.contentView);
// }];
}
@end

View File

@@ -0,0 +1,21 @@
//
// QXImageCollectionViewCell.h
// QXLive
//
// Created by 启星 on 2025/6/5.
//
#import <UIKit/UIKit.h>
#import "QXPhotoModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXImageCollectionViewCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *imageView;
@property (nonatomic,strong)UIView *selectedBgView;
@property (nonatomic,strong)UIButton *selectedBtn;
@property (nonatomic,strong)QXPhotoModel*model;
@property (nonatomic,assign)NSInteger index;
@property (nonatomic,assign)BOOL selectedState;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,75 @@
//
// QXImageCollectionViewCell.m
// QXLive
//
// Created by on 2025/6/5.
//
#import "QXImageCollectionViewCell.h"
@implementation QXImageCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
//-(void)setImageUrl:(NSString *)imageUrl{
// _imageUrl = imageUrl;
// if ([imageUrl hasPrefix:@"http"] || [imageUrl hasPrefix:@"https"]) {
// [self.imageView sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:nil];
// }else{
// self.imageView.image = [UIImage imageNamed:imageUrl];
// }
//}
-(void)setModel:(QXPhotoModel *)model{
_model = model;
[self.imageView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.selectedBtn.selected = model.isSelected;
}
-(void)setSelectedState:(BOOL)selectedState{
_selectedState = selectedState;
self.selectedBtn.hidden = !selectedState;
self.selectedBgView.hidden = !selectedState;
}
-(void)initSubviews{
self.imageView = [[UIImageView alloc] init];
[self.contentView addSubview:self.imageView];
self.imageView.contentMode = UIViewContentModeScaleAspectFill;
self.imageView.clipsToBounds = YES;
[self.imageView addRoundedCornersWithRadius:10];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.left.right.equalTo(self.contentView);
}];
self.selectedBgView = [[UIView alloc] init];
self.selectedBgView.backgroundColor = RGB16A(0xffffff, 0.2);
[self.selectedBgView addRoundedCornersWithRadius:10];
self.selectedBgView.hidden = YES;
[self.contentView addSubview:self.selectedBgView];
[self.selectedBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.left.right.equalTo(self.contentView);
}];
self.selectedBtn = [[UIButton alloc] init];
self.selectedBtn.userInteractionEnabled = NO;
self.selectedBtn.hidden = YES;
// [self.selectedBtn addTarget:self action:@selector(selectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.selectedBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateSelected)];
[self.selectedBtn setImage:[UIImage imageNamed:@"login_agreement_nor"] forState:(UIControlStateNormal)];
[self.contentView addSubview:self.selectedBtn];
[self.selectedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.equalTo(self);
make.size.mas_equalTo(CGSizeMake(25, 25));
}];
}
//-(void)deleteAction:(UIButton*)sender{
// if (self.delegate && [self.delegate respondsToSelector:@selector(didClickDelete:index:)]) {
// [self.delegate didClickDelete:self.imageUrl index:self.index];
// }
//}
@end

View File

@@ -0,0 +1,22 @@
//
// QXPhotoPasswordView.h
// QXLive
//
// Created by 启星 on 2025/5/29.
//
#import <UIKit/UIKit.h>
#import "QXPhotoModel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol QXPhotoPasswordViewDelegate <NSObject>
@optional
-(void)didClickCommitWithPassword:(NSString*)password model:(QXPhotoModel*)model;
@end
@interface QXPhotoPasswordView : UIView
@property (nonatomic,strong)QXPhotoModel *model;
@property (nonatomic,weak)id<QXPhotoPasswordViewDelegate>delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,99 @@
//
// QXPhotoPasswordView.m
// QXLive
//
// Created by on 2025/5/29.
//
#import "QXPhotoPasswordView.h"
@interface QXPhotoPasswordView()
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *closeBtn;
@property (nonatomic,strong)UILabel *messageLabel;
@property (nonatomic,strong)UIView *textBgView;
@property (nonatomic,strong)UITextField *textField;
@property (nonatomic,strong)UIButton*cancelBtn;
@property (nonatomic,strong)UIButton*commitBtn;
@end
@implementation QXPhotoPasswordView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(200));
self.backgroundColor = [UIColor whiteColor];
[self addRoundedCornersWithRadius:16];
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 12, self.width-80, 24)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.text = QXText(@"温馨提示");
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.titleLabel];
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-40, 0, 40, 40)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)];
[self addSubview:self.closeBtn];
self.messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, self.titleLabel.bottom+12, self.width-24, 21)];
self.messageLabel.font = [UIFont systemFontOfSize:14];
self.messageLabel.textColor = QXConfig.textColor;
self.messageLabel.text = QXText(@"确认开启相册私密吗");
[self addSubview:self.messageLabel];
self.textBgView = [[UIView alloc] initWithFrame:CGRectMake(12, self.messageLabel.bottom+12, self.width-24, 44)];
[self.textBgView addRoundedCornersWithRadius:11];
self.textBgView.backgroundColor = RGB16(0xeff2f8);
[self addSubview:self.textBgView];
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(12, 0, self.textBgView.width-24, 44)];
self.textField.font = [UIFont systemFontOfSize:16];
self.textField.textColor = QXConfig.textColor;
self.textField.placeholder = QXText(@"请输入密码");
[self.textBgView addSubview:self.textField];
CGFloat btnWidth = (self.width-19*2-16) / 2;
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(19, self.textBgView.bottom+23, btnWidth, 42)];
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
[self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
self.cancelBtn.backgroundColor = RGB16(0xf3f3f3);
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.cancelBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.cancelBtn addRoundedCornersWithRadius:21];
[self addSubview:self.cancelBtn];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.cancelBtn.right+16, self.cancelBtn.top, btnWidth, 42)];
[self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.commitBtn addRoundedCornersWithRadius:21];
[self addSubview:self.commitBtn];
}
-(void)setModel:(QXPhotoModel *)model{
_model = model;
}
-(void)closeAction{
[[QXGlobal shareGlobal] hideViewBlock:^{
}];
}
-(void)commitAction{
MJWeakSelf
[[QXGlobal shareGlobal] hideViewBlock:^{
if (weakSelf.delegate && [self.delegate respondsToSelector:@selector(didClickCommitWithPassword:model:)]) {
[weakSelf.delegate didClickCommitWithPassword:weakSelf.textField.text model:self.model];
}
}];
}
@end

View File

@@ -0,0 +1,23 @@
//
// QXPhotosDetailTopView.h
// QXLive
//
// Created by 启星 on 2025/6/5.
//
#import <UIKit/UIKit.h>
#import "QXPhotoModel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol QXPhotosDetailTopViewDelegate <NSObject>
@optional
-(void)didClickEditWith:(QXPhotoDetailModel*)model;
@end
@interface QXPhotosDetailTopView : UIView
@property (nonatomic,assign)BOOL isMe;
@property (nonatomic,weak)id<QXPhotosDetailTopViewDelegate>delegate;
@property (nonatomic,strong)QXPhotoDetailModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,124 @@
//
// QXPhotosDetailTopView.m
// QXLive
//
// Created by on 2025/6/5.
//
#import "QXPhotosDetailTopView.h"
#import "QXMineNetwork.h"
#import "QXCreatPhotosViewController.h"
@interface QXPhotosDetailTopView()
@property (nonatomic,strong)UIImageView*bgImageView;
@property (nonatomic,strong)UIView*coverView;
@property (nonatomic,strong)UILabel*titleLabel;
@property (nonatomic,strong)UIButton*editBtn;
@property (nonatomic,strong)UIButton*countBtn;
@property (nonatomic,strong)UIButton*likeBtn;
@property (nonatomic,strong)UIButton*seeBtn;
@end
@implementation QXPhotosDetailTopView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubview];
}
return self;
}
-(void)initSubview{
self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
self.bgImageView.contentMode = UIViewContentModeScaleAspectFill;
self.bgImageView.clipsToBounds = YES;
[self addSubview:self.bgImageView];
// self.coverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
// self.coverView.backgroundColor = RGB16A(0xffffff, 0.65);
// [self addSubview:self.coverView];
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:effect];
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:effect];
UIVisualEffectView *vibrancyView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
vibrancyView.frame = self.bgImageView.frame;
[blurView.contentView addSubview:vibrancyView];
blurView.frame = self.bgImageView.frame;
[self.bgImageView addSubview:blurView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, (self.height-25)/2, self.width, 25)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
self.titleLabel.textColor = RGB16(0x333333);
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:self.titleLabel];
self.editBtn = [[UIButton alloc] initWithFrame:CGRectMake((self.height-45)/2, 0, 45, 45)];
self.editBtn.centerY = self.titleLabel.centerY;
[self.editBtn setImage:[[UIImage imageNamed:@"photo_eidt"] imageByTintColor:RGB16(0x666666)] forState:(UIControlStateNormal)];
[self.editBtn addTarget:self action:@selector(editAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.editBtn];
self.countBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+2, self.width, 25)];
[self.countBtn setTitleColor:RGB16(0x666666) forState:(UIControlStateNormal)];
[self.countBtn setTitle:[NSString localizedStringWithFormat:QXText(@"%@张照片"),@"0"] forState:(UIControlStateNormal)];
self.countBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self addSubview:self.countBtn];
self.likeBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.height-40-5, self.width/2, 40)];
[self.likeBtn setImage:[UIImage imageNamed:@"photos_like"] forState:(UIControlStateNormal)];
[self.likeBtn setImage:[[UIImage imageNamed:@"photos_like"] imageByTintColor:RGB16(0xFB4344)] forState:(UIControlStateSelected)];
[self.likeBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
self.likeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.likeBtn setTitle:@" 0" forState:(UIControlStateNormal)];
[self.likeBtn addTarget:self action:@selector(likeAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.likeBtn];
self.seeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width/2, self.height-40-5, self.width/2, 40)];
[self.seeBtn setImage:[UIImage imageNamed:@"photos_see"] forState:(UIControlStateNormal)];
[self.seeBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
self.seeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.seeBtn setTitle:@" 0" forState:(UIControlStateNormal)];
[self addSubview:self.seeBtn];
}
-(void)editAction{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickEditWith:)]) {
[self.delegate didClickEditWith:self.model];
}
}
-(void)likeAction{
MJWeakSelf
[QXMineNetwork photosLikeWithAlbumId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
weakSelf.likeBtn.selected = !weakSelf.likeBtn.selected;
if (weakSelf.likeBtn.selected) {
[weakSelf.likeBtn setTitle:[NSString stringWithFormat:@" %ld", weakSelf.likeBtn.titleLabel.text.integerValue+1] forState:UIControlStateNormal];
}else{
[weakSelf.likeBtn setTitle:[NSString stringWithFormat:@" %ld", weakSelf.likeBtn.titleLabel.text.integerValue-1] forState:UIControlStateNormal];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)setIsMe:(BOOL)isMe{
_isMe = isMe;
self.editBtn.hidden = !isMe;
}
-(void)setModel:(QXPhotoDetailModel *)model{
_model = model;
[self.bgImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
self.titleLabel.text = model.name;
self.likeBtn.selected = model.is_like.intValue == 1;
[self.titleLabel sizeToFit];
self.titleLabel.frame = CGRectMake((self.width-self.titleLabel.width)/2, (self.height-25)/2, self.titleLabel.width, 25);
self.editBtn.frame = CGRectMake(self.titleLabel.right, self.titleLabel.top-10, 45, 45);
if (model.pwd.length > 0) {
[self.countBtn setImage:[UIImage imageNamed:@"photos_lock_state"] forState:(UIControlStateNormal)];
}else{
[self.countBtn setImage:nil forState:(UIControlStateNormal)];
}
[self.countBtn setTitle:[NSString localizedStringWithFormat:QXText(@"%@张照片"),model.count] forState:(UIControlStateNormal)];
[self.likeBtn setTitle:[NSString stringWithFormat:@" %@",model.like_num] forState:(UIControlStateNormal)];
[self.seeBtn setTitle:[NSString stringWithFormat:@" %@",model.read_num] forState:(UIControlStateNormal)];
}
@end

View File

@@ -0,0 +1,17 @@
//
// QXPhotosMoveListView.h
// QXLive
//
// Created by 启星 on 2025/6/6.
//
#import <UIKit/UIKit.h>
#import "QXPhotoModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXPhotosMoveListView : UIView
@property (nonatomic,strong)void(^selecctedModelBlock)(QXPhotoModel *model);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,150 @@
//
// QXPhotosMoveListView.m
// QXLive
//
// Created by on 2025/6/6.
//
#import "QXPhotosMoveListView.h"
#import "QXUserPhotosView.h"
#import "QXMineNetwork.h"
@interface QXPhotosMoveListView()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UILabel* titleLabel;
@property (nonatomic,strong)UIButton* cancelBtn;
@property (nonatomic,strong)UIButton* commitBtn;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,assign)NSInteger page;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,assign)NSInteger selectedIndex;
@end
@implementation QXPhotosMoveListView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.selectedIndex = -1;
self.backgroundColor = [UIColor whiteColor];
[self addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-100)/2, 16, 100, 27)];
self.titleLabel.text = QXText(@"选择相册");
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
[self addSubview:self.titleLabel];
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 12, 65, 35)];
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
[self.cancelBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.cancelBtn];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-65, 12, 65, 35)];
[self.commitBtn setTitle:QXText(@"确定") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
// self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn addRoundedCornersWithRadius:17.5];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.commitBtn];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*2-13*3)/4, (SCREEN_WIDTH-16*2-13*3)/4+46);
layout.minimumLineSpacing = 13;
layout.minimumInteritemSpacing = 13;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+8, self.width, self.height-16-self.titleLabel.bottom-8) collectionViewLayout:layout];
[self.collectionView registerClass:[QXUserPhotosCell class] forCellWithReuseIdentifier:@"QXUserPhotosCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.backgroundColor = RGB16(0xf6f6f6);
[self addSubview:self.collectionView];
MJWeakSelf
_collectionView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getPhotoList];
}];
[self getPhotoList];
}
-(void)cancelAction{
[[QXGlobal shareGlobal] hideViewBlock:^{}];
}
-(void)commitAction{
if (self.selectedIndex == -1) {
showToast(@"请选择相册");
return;
}
MJWeakSelf
[[QXGlobal shareGlobal] hideViewBlock:^{
if (weakSelf.selecctedModelBlock) {
weakSelf.selecctedModelBlock(weakSelf.dataArray[self.selectedIndex]);
}
}];
}
-(void)getPhotoList{
MJWeakSelf
[QXMineNetwork photosListWithUserId:[QXGlobal shareGlobal].loginModel.user_id
page:self.page
successBlock:^(NSArray<QXPhotoModel *> * _Nonnull hotos) {
[weakSelf.collectionView.mj_footer endRefreshing];
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:hotos];
if (hotos.count == 0) {
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.collectionView.mj_footer endRefreshing];
}
[weakSelf.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.collectionView.mj_footer endRefreshing];
}];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXUserPhotosCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXUserPhotosCell" forIndexPath:indexPath];
QXPhotoModel *model = self.dataArray[indexPath.row];
[cell.photoImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
cell.titleLabel.text = model.name;
cell.countLabel.text = [NSString stringWithFormat:@"浏览 %@",model.read_num];
cell.isLock = NO;
cell.selectedState = YES;
if (indexPath.row == self.selectedIndex) {
cell.selectedBtn.selected = YES;
}else{
cell.selectedBtn.selected = NO;
}
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
self.selectedIndex = indexPath.row;
[collectionView reloadData];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXPhotosSectionView.h
// QXLive
//
// Created by 启星 on 2025/6/5.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXPhotosSectionView : UICollectionReusableView
@property (nonatomic,strong)UILabel *titleLabel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,26 @@
//
// QXPhotosSectionView.m
// QXLive
//
// Created by on 2025/6/5.
//
#import "QXPhotosSectionView.h"
@implementation QXPhotosSectionView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, self.width-32, self.height)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = QXConfig.textColor;
[self addSubview:self.titleLabel];
}
@end

View File

@@ -0,0 +1,25 @@
//
// QXPhotosToolsView.h
// QXLive
//
// Created by 启星 on 2025/6/5.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger) {
QXPhotosToolsActionShare = 10,
QXPhotosToolsActionMove,
QXPhotosToolsActionDelete,
}QXPhotosToolsActionType;
NS_ASSUME_NONNULL_BEGIN
@protocol QXPhotosToolsViewDelegate <NSObject>
@optional
-(void)didClickActionType:(QXPhotosToolsActionType)type;
@end
@interface QXPhotosToolsView : UIView
@property (nonatomic,weak)id<QXPhotosToolsViewDelegate>delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,54 @@
//
// QXPhotosToolsView.m
// QXLive
//
// Created by on 2025/6/5.
//
#import "QXPhotosToolsView.h"
#import "UIButton+QX.h"
@interface QXPhotosToolsView()
@property (nonatomic,strong)NSArray *toolsTitleArray;
@property (nonatomic,strong)NSArray *toolsImageArray;
@end
@implementation QXPhotosToolsView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 1)];
line.backgroundColor = RGB16(0xE2E2E2);
[self addSubview:line];
self.toolsTitleArray = @[QXText(@"分享"),QXText(@"移动"),QXText(@"删除")];
self.toolsImageArray = @[@"photos_share",@"photos_move",@"photos_delete"];
CGFloat btnWidth = self.width/self.toolsImageArray.count;
for (int i = 0; i < self.toolsTitleArray.count; i++) {
NSString *title = self.toolsTitleArray[i];
NSString *image = self.toolsImageArray[i];
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(i*btnWidth, 1, btnWidth, 49)];
[btn setTitle:title forState:(UIControlStateNormal)];
[btn setTitleColor:QXConfig.textColor forState:(UIControlStateNormal)];
btn.titleLabel.font = [UIFont systemFontOfSize:14];
[btn setImage:[UIImage imageNamed:image] forState:(UIControlStateNormal)];
btn.tag = 10+i;
[btn addTarget:self action:@selector(btnAction:) forControlEvents:(UIControlEventTouchUpInside)];
[btn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleTop) imageTitleSpace:2];
[self addSubview:btn];
}
}
-(void)btnAction:(UIButton*)sender{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickActionType:)]) {
[self.delegate didClickActionType:sender.tag];
}
}
@end

View File

@@ -0,0 +1,31 @@
//
// QXUserPhotosView.h
// QXLive
//
// Created by 启星 on 2025/5/29.
//
#import <UIKit/UIKit.h>
#import "JXPagerView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXUserPhotosView : UIView<JXPagerViewListViewDelegate>
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, copy) void(^listScrollCallback)(UIScrollView *scrollView);
@property (nonatomic,strong)NSString *user_id;
@end
@interface QXUserPhotosCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *photoImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UIImageView *lockImageView;
@property (nonatomic,strong)UIVisualEffectView *blurView;
@property (nonatomic,assign)BOOL isLock;
@property (nonatomic,strong)UIButton *selectedBtn;
@property (nonatomic,strong)UIView *selectedBgView;
@property (nonatomic,assign)BOOL selectedState;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,361 @@
//
// QXUserPhotosView.m
// QXLive
//
// Created by on 2025/5/29.
//
#import "QXUserPhotosView.h"
#import "QXCreatPhotosViewController.h"
#import "QXPhotoPasswordView.h"
#import "QXMineNetwork.h"
#import "QXPhotosDetailVC.h"
@interface QXUserPhotosView()<UICollectionViewDelegate,UICollectionViewDataSource,QXPhotoPasswordViewDelegate>
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
@property (nonatomic, strong) NSMutableArray *dataArray;
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, assign) BOOL isMe;
@end
@implementation QXUserPhotosView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.page = 1;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(photosListReload) name:noticePhotosStatusChange object:nil];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*2-13)/2, (SCREEN_WIDTH-16*2-13)/2+46);
layout.minimumLineSpacing = 13;
layout.minimumInteritemSpacing = 13;
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[self.collectionView registerClass:[QXUserPhotosCell class] forCellWithReuseIdentifier:@"QXUserPhotosCell"];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.backgroundColor = RGB16(0xf6f6f6);
[self addSubview:self.collectionView];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(12);
make.top.mas_equalTo(12);
make.height.mas_equalTo(ScaleWidth(76));
make.right.mas_equalTo(-12);
}];
MJWeakSelf
_collectionView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getPhotos];
}];
}
return self;
}
- (instancetype)initWithOffsetY:(CGFloat)offsety {
self = [self initWithFrame:CGRectZero];
self.collectionView.contentOffset = CGPointMake(0, offsety);
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.collectionView.frame = self.bounds;
}
-(void)setUser_id:(NSString *)user_id{
_user_id = user_id;
if ([user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
self.isMe = YES;
}else{
self.isMe = NO;
}
[self getPhotos];
}
-(void)photosListReload{
self.page = 1;
[self getPhotos];
}
-(void)getPhotos{
MJWeakSelf
[QXMineNetwork photosListWithUserId:self.user_id
page:self.page
successBlock:^(NSArray<QXPhotoModel *> * _Nonnull hotos) {
[weakSelf.collectionView.mj_footer endRefreshing];
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:hotos];
if (hotos.count == 0) {
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.collectionView.mj_footer endRefreshing];
}
[weakSelf.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.collectionView.mj_footer endRefreshing];
}];
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
if (self.isMe) {
return self.dataArray.count+1;
}else{
return self.dataArray.count;
}
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXUserPhotosCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXUserPhotosCell" forIndexPath:indexPath];
if (self.isMe) {
if (indexPath.row == 0) {
cell.photoImageView.image = [UIImage imageNamed:@"user_photos_add"];
cell.titleLabel.text = @"";
cell.countLabel.text = @"";
cell.isLock = NO;
}else{
QXPhotoModel *model = self.dataArray[indexPath.row-1];
[cell.photoImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
cell.titleLabel.text = model.name;
cell.countLabel.text = [NSString stringWithFormat:@"浏览 %@",model.read_num];
if (model.is_pwd.integerValue == 0) {
cell.isLock = NO;
}else{
cell.isLock = YES;
}
}
}else{
QXPhotoModel *model = self.dataArray[indexPath.row];
[cell.photoImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
cell.titleLabel.text = model.name;
cell.countLabel.text = [NSString stringWithFormat:@"浏览 %@",model.read_num];
if (model.is_pwd.integerValue == 0) {
cell.isLock = NO;
}else{
cell.isLock = YES;
}
}
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
MJWeakSelf
if (self.isMe) {
if (indexPath.row == 0) {
QXCreatPhotosViewController *vc = [[QXCreatPhotosViewController alloc] init];
vc.createSuccessBlock = ^{
[weakSelf getPhotos];
};
[self.navigationController pushViewController:vc animated:YES];
}else{
QXPhotoModel *model = self.dataArray[indexPath.row-1];
if (model.is_pwd.integerValue == 0) {
QXPhotosDetailVC *vc = [[QXPhotosDetailVC alloc] init];
vc.albumId = model.id;
vc.name = model.name;
vc.photoList = self.dataArray;
vc.userId = self.user_id;
[self.navigationController pushViewController:vc animated:YES];
}else{
if ([self.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
QXPhotosDetailVC *vc = [[QXPhotosDetailVC alloc] init];
vc.albumId = model.id;
vc.name = model.name;
vc.photoList = self.dataArray;
vc.userId = self.user_id;
vc.pwd = model.pwd;
[self.navigationController pushViewController:vc animated:YES];
}else{
QXPhotoPasswordView *passwordView = [[QXPhotoPasswordView alloc] init];
passwordView.model = model;
passwordView.delegate = self;
[[QXGlobal shareGlobal] showView:passwordView popType:(PopViewTypePopFromCenter) tapDismiss:NO finishBlock:^{
}];
}
}
}
}else{
QXPhotoModel *model = self.dataArray[indexPath.row];
if (model.is_pwd.integerValue == 0) {
QXPhotosDetailVC *vc = [[QXPhotosDetailVC alloc] init];
vc.albumId = model.id;
vc.name = model.name;
vc.photoList = self.dataArray;
vc.userId = self.user_id;
[self.navigationController pushViewController:vc animated:YES];
}else{
if ([self.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
QXPhotosDetailVC *vc = [[QXPhotosDetailVC alloc] init];
vc.albumId = model.id;
vc.name = model.name;
vc.photoList = self.dataArray;
vc.userId = self.user_id;
vc.pwd = model.pwd;
[self.navigationController pushViewController:vc animated:YES];
}else{
QXPhotoPasswordView *passwordView = [[QXPhotoPasswordView alloc] init];
passwordView.model = model;
passwordView.delegate = self;
[[QXGlobal shareGlobal] showView:passwordView popType:(PopViewTypePopFromCenter) tapDismiss:NO finishBlock:^{
}];
}
}
}
}
-(void)didClickCommitWithPassword:(NSString *)password model:(nonnull QXPhotoModel *)model{
QXLOG(@"相册密码为%@",password);
if ([password isEqualToString:model.pwd]) {
QXPhotosDetailVC *vc = [[QXPhotosDetailVC alloc] init];
vc.albumId = model.id;
vc.name = model.name;
vc.photoList = self.dataArray;
vc.userId = self.user_id;
vc.pwd = password;
[self.navigationController pushViewController:vc animated:YES];
}else{
showToast(@"密码错误");
}
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (self.scrollCallback != nil) {
self.scrollCallback(scrollView);
}
if (self.listScrollCallback != nil) {
self.listScrollCallback(scrollView);
}
}
#pragma mark - JXPagingViewListViewDelegate
- (UIScrollView *)listScrollView {
return self.collectionView;
}
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
self.scrollCallback = callback;
}
- (UIView *)listView {
return self;
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray arrayWithCapacity:1];
}
return _dataArray;
}
@end
@implementation QXUserPhotosCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setIsLock:(BOOL)isLock{
_isLock = isLock;
self.lockImageView.hidden = !isLock;
self.blurView.hidden = !isLock;
}
-(void)setSelectedState:(BOOL)selectedState{
_selectedState = selectedState;
self.selectedBtn.hidden = !selectedState;
self.selectedBgView.hidden = !selectedState;
}
-(void)initSubviews{
// user_photos_add
self.photoImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.photoImageView.contentMode = UIViewContentModeScaleAspectFill;
self.photoImageView.clipsToBounds = YES;
[self.photoImageView addRoundedCornersWithRadius:6];
[self.contentView addSubview:self.photoImageView];
[self.photoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self.contentView);
make.height.equalTo(self.photoImageView.mas_width).multipliedBy(1);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleLabel.textColor = QXConfig.textColor;
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.photoImageView.mas_bottom).offset(6);
make.height.mas_equalTo(22);
}];
self.countLabel = [[UILabel alloc] init];
self.countLabel.font = [UIFont systemFontOfSize:14];
self.countLabel.textColor = RGB16(0x999999);
[self.contentView addSubview:self.countLabel];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.titleLabel.mas_bottom);
make.height.mas_equalTo(18);
}];
self.lockImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_photos_lock"]];
self.lockImageView.hidden = YES;
[self.contentView addSubview:self.lockImageView];
[self.lockImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(self.photoImageView);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(22), ScaleWidth(22)));
}];
self.selectedBgView = [[UIView alloc] init];
self.selectedBgView.backgroundColor = RGB16A(0xffffff, 0.2);
[self.selectedBgView addRoundedCornersWithRadius:10];
self.selectedBgView.hidden = YES;
[self.contentView addSubview:self.selectedBgView];
[self.selectedBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.left.right.equalTo(self.contentView);
}];
self.selectedBtn = [[UIButton alloc] init];
self.selectedBtn.userInteractionEnabled = NO;
self.selectedBtn.hidden = YES;
// [self.selectedBtn addTarget:self action:@selector(selectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.selectedBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateSelected)];
[self.selectedBtn setImage:[UIImage imageNamed:@"login_agreement_nor"] forState:(UIControlStateNormal)];
[self.contentView addSubview:self.selectedBtn];
[self.selectedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.equalTo(self);
make.size.mas_equalTo(CGSizeMake(25, 25));
}];
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:effect];
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:effect];
UIVisualEffectView *vibrancyView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
[blurView.contentView addSubview:vibrancyView];
self.blurView = blurView;
self.blurView.hidden = YES;
[self.photoImageView addSubview:blurView];
[blurView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.bottom.equalTo(self.photoImageView);
}];
[vibrancyView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.bottom.equalTo(blurView);
}];
}
@end