分享友盟

#import <Foundation/Foundation.h>

#import "NDShareModel.h"

typedef NS_ENUM(NSInteger, SharePlace)

{

    SharePlaceChaep,

    SharePlaceUserNorHome,

    SharePlaceUserKolHome,

    SharePlaceKolHome,

    SharePlaceTopicl,

    SharePlaceGoods,

    SharePlacePay,

    SharePlaceCoupe

};

typedef NS_ENUM(NSInteger, ShareContentType){

    ShareContentTypeText,

    ShareContentTypeImage,

    ShareContentTypeApp,

    ShareContentTypeImageAndText

};


@protocol NDShareUmMangerDelegate<NSObject>

@optional

-(void)selectedSharePlatform;

-(void)shareFinished;

@end


@interface NDShareUmManger : NSObject


@property(nonatomic,weak)id<NDShareUmMangerDelegate> shareDelegate;

@property(nonatomic,assign)SharePlace sharePlace;

+ (NDShareUmManger *) shareUmManage;

//系统分享

-(void)shareToUmWithWithController:(id)shareController andShareModel:(NDShareModel *)shareModel andShareSnsTypes:(NSArray *)typesArray;

//分享大图

-(void)shareToUmWithWithController:(id)shareController andShareImage:(UIImage *)shareImage andShareQQZoneTitle:(NSString *)shareQQZoneTitle andShareSnsTypes:(NSArray *)typesArray;

//单分享

-(void)shareToUmWithWithController:(id)shareController andPlatform:(NSString *)platform andSahreModel:(NDShareModel *)shareModel;

//分享大图

-(void)shareToUmWithController:(id)shareController andShareImage:(UIImage *)shareImage andShareQQZoneTitle:(NSString *)shareQQZoneTitle andPlatform:(NSString *)platform;



- (void)snsLoginToWeiboOnViewControlle:(UIViewController *)onViewController callback:(void (^)(id responseObject, NSError *error))snsLoginBack;

- (void)snsLoginToQQOnViewControlle:(UIViewController *)onViewController calback:(void (^)(id responseObject, NSError *error))snsLoginBack;

- (void)snsLoginToWechatOnViewControlle:(UIViewController *)onViewController callback:(void (^)(id responseObject, NSError *error))snsLoginBack;


@end

#import "NDShareUmManger.h"


#import "UMSocialDataService.h"

#import "UMSocial.h"

#import "WXApi.h"


#import "NDSNSModel.h"


@interface NDShareUmManger()

{

    NDShareModel * _shareUmModel;

    UIImage * _shareImage;

    NSString * shareQZoneTitle;

    UIViewController * shareUmController;

}

@property(nonatomic,assign)ShareContentType shareType;

@end

@implementation NDShareUmManger


+(NDShareUmManger *)shareUmManage

{

    static NDShareUmManger * shareManger = nil;

    static dispatch_once_t onceToken;

    dispatch_once(&onceToken, ^{

        shareManger = [[self alloc]init];

    });

    return shareManger;

    

}

#pragma mark - 原生分享(文字加图片)

-(void)shareToUmWithWithController:(id)shareController andShareModel:(NDShareModel *)shareModel  andShareSnsTypes:(NSArray *)typesArray

{

    self.shareType = ShareContentTypeImageAndText;

    

    _shareUmModel = shareModel;

    shareUmController = shareController;

    [UMSocialSnsService presentSnsIconSheetView:shareController appKey:UMeng_APIKey shareText:nil  shareImage:nil shareToSnsNames:typesArray delegate:(id)self];

}

#pragma mark - 原生大图分享

-(void)shareToUmWithWithController:(id)shareController andShareImage:(UIImage *)shareImage andShareQQZoneTitle:(NSString *)shareQQZoneTitle andShareSnsTypes:(NSArray *)typesArray

{

    self.shareType = ShareContentTypeImage;

    _shareImage = shareImage;

    shareQZoneTitle = shareQQZoneTitle;

    shareUmController = shareController;

    

    [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeImage;

    [UMSocialData defaultData].extConfig.qqData.qqMessageType = UMSocialQQMessageTypeImage; //QQ空间不支持纯图片分享


    [UMSocialSnsService presentSnsIconSheetView:shareController appKey:UMeng_APIKey shareText:nil  shareImage:nil shareToSnsNames:typesArray delegate:(id)self];

}

#pragma mark - 自定义分享到某一开放平台(文字加图片)微信

-(void)shareToUmWithWithController:(id)shareController andPlatform:(NSString *)platform andSahreModel:(NDShareModel *)shareModel

{

    self.shareType = ShareContentTypeImageAndText;

    

    if([WXApi isWXAppInstalled])

    {

        _shareUmModel = shareModel;

        shareUmController = shareController;

        [[UMSocialControllerService defaultControllerService] setShareText:nil shareImage:nil  socialUIDelegate:(id)self];        //设置分享内容和回调对象

        [UMSocialSnsPlatformManager getSocialPlatformWithName:platform].snsClickHandler((id)self,[UMSocialControllerService defaultControllerService],YES);

    }else

    {

        [self alterViewWithStr:@"您还未安装微信"];

    }

}

#pragma mark - 仅分享图片(微信,QQ)

-(void)shareToUmWithController:(id)shareController andShareImage:(UIImage *)shareImage  andShareQQZoneTitle:(NSString *)shareQQZoneTitle andPlatform:(NSString *)platform

{

    self.shareType = ShareContentTypeImage;

    

    _shareImage = shareImage;

    shareQZoneTitle = shareQQZoneTitle;

    shareUmController = shareController;

    

    [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeImage;

    [UMSocialData defaultData].extConfig.qqData.qqMessageType = UMSocialQQMessageTypeImage; //QQ空间不支持纯图片分享

    [[UMSocialControllerService defaultControllerService] setShareText:nil shareImage:nil  socialUIDelegate:(id)self];        //设置分享内容和回调对象

    [UMSocialSnsPlatformManager getSocialPlatformWithName:platform].snsClickHandler((id)self,[UMSocialControllerService defaultControllerService],YES);

    

}

#pragma mark - um Delegate

//下面可以设置根据点击不同的分享平台,设置不同的分享文字

-(void)didSelectSocialPlatform:(NSString *)platformName withSocialData:(UMSocialData *)socialData

{

    if (self.shareDelegate && [self.shareDelegate respondsToSelector:@selector(selectedSharePlatform)]) {

        [self.shareDelegate selectedSharePlatform];

    }

   // [UMSocialConfig setFinishToastIsHidden:NO  position:UMSocialiToastPositionCenter];

    

    if (self.shareType == ShareContentTypeImageAndText) {

        socialData.extConfig.wechatSessionData.url = _shareUmModel.shareUrl;  //微信好友

        socialData.extConfig.wechatTimelineData.url = _shareUmModel.shareUrl; //朋友圈

        socialData.extConfig.qqData.url = _shareUmModel.shareUrl;             //QQ好友

        socialData.extConfig.qzoneData.url = _shareUmModel.shareUrl;           //QQ空间

        //分享图片

        socialData.shareImage = _shareUmModel.shareImage;

        

        if ([platformName isEqualToString:UMShareToWechatTimeline]||[platformName isEqualToString:UMShareToQzone]) {  //朋友圈 qq空间

            socialData.extConfig.title = _shareUmModel.shareTitle;

            

        }else if([platformName isEqualToString:UMShareToSina])

        {

            socialData.shareText = [NSString stringWithFormat:@"%@, %@, %@",_shareUmModel.shareTitle,_shareUmModel.shareContent,_shareUmModel.shareUrl];

        }else

        {

            //标题,用于指定微信分享标题,qzone分享的标题和邮件分享的标题。

            socialData.extConfig.title =_shareUmModel.shareTitle;

            socialData.shareText = _shareUmModel.shareContent;

        }

        

    }else if(self.shareType == ShareContentTypeImage)

    {

        if ([platformName isEqualToString:UMShareToQzone]) {  //朋友圈 qq空间

            

            socialData.extConfig.title = shareQZoneTitle;;

            

        }

            socialData.shareImage = _shareImage;

        

    }

}

//下面得到分享完成的回调

-(void)didFinishGetUMSocialDataInViewController:(UMSocialResponseEntity *)response

{

    NSLog(@"didFinishGetUMSocialDataInViewController with response is %@",response);

    if(response.responseCode == UMSResponseCodeSuccess)

    {

        if (self.shareDelegate && [self.shareDelegate respondsToSelector:@selector(shareFinished)]) {

             [self.shareDelegate shareFinished];

        }

       // [self alterViewWithStr:@"分享成功"];

    }

}

-(void)alterViewWithStr:(NSString *)str

{

    UILabel * alterLabel = [[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth/2-55, ScreenHeight/2-15, 110, 30)];

    alterLabel.textAlignment = NSTextAlignmentCenter;

    [shareUmController.view addSubview:alterLabel];

    alterLabel.text = str;

    alterLabel.layer.cornerRadius = 10;

    alterLabel.alpha = 0.7;

    alterLabel.clipsToBounds = YES;

    alterLabel.font = [UIFont systemFontOfSize:14.0f];

    alterLabel.backgroundColor = [UIColor blackColor];

    alterLabel.textColor = [UIColor whiteColor];

    [UIView animateWithDuration:2.5f animations:^{

        

        alterLabel.alpha = 0.0f;

        

    }];

}


#pragma mark - 微博登陆

- (void)snsLoginToWeiboOnViewControlle:(UIViewController *)onViewController callback:(void (^)(id, NSError *))snsLoginBack

{

    UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToSina];

    

    snsPlatform.loginClickHandler(onViewController,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){

        

        //          获取微博用户名、uidtoken

        

        if (response.responseCode == UMSResponseCodeSuccess) {

            

            UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToSina];

            

            NDSNSModel *snsUser = [[NDSNSModel alloc] init];

            snsUser.snsNickName = snsAccount.userName;

            snsUser.snsID = snsAccount.usid;

            snsUser.snsType = SNSWeiBo;

            snsLoginBack(snsUser,nil);

            NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL);

            

        }});

}


- (void)obtainWeiboUserInfo

{

    //获取accestoken以及QQ用户信息,得到的数据在回调Block对象形参responedata属性

    [[UMSocialDataService defaultDataService] requestSnsInformation:UMShareToSina  completion:^(UMSocialResponseEntity *response){

        NSLog(@"SnsInformation is %@",response.data);

    }];

}


#pragma mark - QQ登陆

- (void)snsLoginToQQOnViewControlle:(UIViewController *)onViewController calback:(void (^)(id responseObject, NSError * error))snsLoginBack

{

    UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToQQ];

    

    snsPlatform.loginClickHandler(onViewController,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){

        

        //          获取微博用户名、uidtoken

        

        if (response.responseCode == UMSResponseCodeSuccess) {

            

            UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToQQ];

            

            NDSNSModel *snsUser = [[NDSNSModel alloc] init];

            snsUser.snsNickName = snsAccount.userName;

            snsUser.snsID = snsAccount.usid;

            snsUser.snsType = SNSQQ;

            snsLoginBack(snsUser,nil);

            NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL);

            

        }});

}

- (void)obtainQQUserInfo

{

    //获取accestoken以及QQ用户信息,得到的数据在回调Block对象形参responedata属性

    [[UMSocialDataService defaultDataService] requestSnsInformation:UMShareToQQ  completion:^(UMSocialResponseEntity *response){

        NSLog(@"SnsInformation is %@",response.data);

    }];

}

#pragma mark - 微信登陆


- (void)snsLoginToWechatOnViewControlle:(UIViewController *)onViewController callback:(void (^)(id responseObject , NSError * error))snsLoginBack

{

    UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatSession];

    

    snsPlatform.loginClickHandler(onViewController,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){

        

        if (response.responseCode == UMSResponseCodeSuccess) {

            

            UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary]valueForKey:UMShareToWechatSession];

            NDSNSModel *snsUser = [[NDSNSModel alloc] init];

            snsUser.snsNickName = snsAccount.userName;

            snsUser.snsID = snsAccount.usid;

            snsUser.snsType = SNSWeChat;

            

            snsLoginBack(snsUser,nil);

            

            NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL);

            

        }

        

    });

}


- (void)obtainWechatUserInfo

{

    //得到的数据在回调Block对象形参responedata属性

    [[UMSocialDataService defaultDataService] requestSnsInformation:UMShareToWechatSession  completion:^(UMSocialResponseEntity *response){

        NSLog(@"SnsInformation is %@",response.data);

    }];

}


#pragma mark - 

- (void)unbindingOauth

{

    [[UMSocialDataService defaultDataService] requestUnOauthWithType:UMShareToSina  completion:^(UMSocialResponseEntity *response){

        NSLog(@"response is %@",response);

    }];

}

@end

#import <UIKit/UIKit.h>


@protocol NDShareFeedViewDelegate<NSObject>

@optional

-(void)shareSinaFeedClick:(UIImage *)image;

@end


@interface NDShareFeedView : UIView


@property(nonatomic,weak)id<NDShareFeedViewDelegate>delegate;

@property(nonatomic,strong)UIImage * shareFeedImage;

@property(nonatomic,strong)NSString * shareQQTitle;

@property(nonatomic,strong)NSString * feedId;

@property(nonatomic,strong)UIViewController * controller;


-(instancetype)initWithFrame:(CGRect)frame shareController:(id)controller andIsDelete:(BOOL)isDelete;

@end



@interface NDShareItemView : UIView

@property(nonatomic,strong)UIButton * shareImageBtn;

@property(nonatomic,strong)UILabel * sharePlateLabel;

-(instancetype)initWithShareImage:(NSString *)imageName andShareTitle:(NSString*)shareTitle;

@end

const static float shareImageWH = 33;


#import "NDShareFeedView.h"

#import "UMSocial.h"

#import "UIButton+EnlargeEdge.h"

#import "NDShareUmManger.h"

#import "NDBaseUserModel.h"


@interface NDShareFeedView()<UIAlertViewDelegate,NDShareUmMangerDelegate>

{

    UIAlertView * reportAlterView;

    UIAlertView * deleteAlterView;

}

@end


@implementation NDShareFeedView

-(instancetype)initWithFrame:(CGRect)frame shareController:(id)controller andIsDelete:(BOOL)isDelete

{

    self = [super initWithFrame:frame];

    if (self) {

        

        self.controller = controller;

        

        CGFloat sizeScaleX = [DeviceManage deviceManage].widthScaleRatio;

        CGFloat sizeScaleY = [DeviceManage deviceManage].heighScaleRatio;

        

        UIView * backView = [[UIView alloc]init];

        backView.alpha = 0.5;

        backView.backgroundColor = kBackgroudGrayColor;

        [self addSubview:backView];

        [backView mas_makeConstraints:^(MASConstraintMaker *make) {

            make.top.equalTo(self.mas_top);

            make.left.equalTo(self.mas_left);

            make.size.mas_equalTo(CGSizeMake([DeviceManage deviceManage].screenWidth,CGRectGetHeight(frame)-183*sizeScaleY));

        }];

        backView.userInteractionEnabled = YES;

        UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dealTap)];

        [backView addGestureRecognizer:tap];

        

        UIView * shareView = [[UIView alloc]init];

        shareView.backgroundColor = [UIColor whiteColor];

        [self addSubview:shareView];

        [shareView mas_makeConstraints:^(MASConstraintMaker *make) {

            make.top.equalTo(backView.mas_bottom);

            make.left.equalTo(self.mas_left);

            make.size.mas_equalTo(CGSizeMake([DeviceManage deviceManage].screenWidth,183*sizeScaleY));

        }];


        

        UILabel * shareLabel = [[UILabel alloc]init];

        shareLabel.font = [UIFont systemFontOfSize:12.0f];

        shareLabel.textColor = kMainBlackColor;

        shareLabel.text = @"分享到";

        [shareView addSubview:shareLabel];

        CGSize titleSize = [CustomSize returnSize:shareLabel.text fontSize:12.0f];

        [shareLabel mas_makeConstraints:^(MASConstraintMaker *make) {

            make.top.equalTo(shareView.mas_top).offset(11*sizeScaleY);

            make.left.equalTo(shareView.mas_left).offset(20*sizeScaleX);

            make.size.mas_equalTo(CGSizeMake(titleSize.width, titleSize.height));

        }];

        

        UILabel * sepLabel = [[UILabel alloc]init];

        sepLabel.backgroundColor = kSeparatorLineColor;

        [shareView addSubview:sepLabel];

        [sepLabel mas_makeConstraints:^(MASConstraintMaker *make) {

            make.top.equalTo(shareView.mas_top).offset(110*sizeScaleY);

            make.left.equalTo(shareView.mas_left);

            make.size.mas_equalTo(CGSizeMake([DeviceManage deviceManage].screenWidth, kSeparatorLineWidth));

        }];


        NSArray * shareBtnImageArray = @[@"goodsdetails_wechat_qq_bt",@"friends-circle",@"goodsdetails_share_qq_bt",@"goodsdetails_share_qq_bt",@"goodsdetails_share_weibo_bt",@"goodsdetails_share_weibo_bt",@"goodsdetails_share_weibo_bt"];

        NSArray * shareTitleArray = @[@"微信",@"朋友圈",@"QQ",@"Qzone",@"微博",@"举报",@"删除"];

        

        CGFloat itemWidth = [DeviceManage deviceManage].screenWidth/4 ;

        CGFloat itemHieght = 61*sizeScaleY;

        for (int i = 0; i<6; i++) {

            NDShareItemView * itemView;

            if (i<=4) {

                itemView = [[NDShareItemView alloc]initWithShareImage:shareBtnImageArray[i] andShareTitle:shareTitleArray[i]];

                [shareView addSubview:itemView];

                if (i<=3) {

                   

                    [itemView mas_makeConstraints:^(MASConstraintMaker *make) {

                        make.top.equalTo(shareLabel.mas_bottom).offset(17*sizeScaleY);

                        make.left.equalTo(shareView.mas_left).offset(itemWidth*i);

                        make.size.mas_equalTo(CGSizeMake(itemWidth, itemHieght));

                    }];

                    

                }else

                {

                    [itemView mas_makeConstraints:^(MASConstraintMaker *make) {

                        make.top.equalTo(sepLabel.mas_bottom).offset(17*sizeScaleY);

                        make.left.equalTo(shareView.mas_left).offset(itemWidth*(i-4));

                        make.size.mas_equalTo(CGSizeMake(itemWidth, itemHieght));

                    }];

                    

                }

                itemView.shareImageBtn.tag = i;

                

            }else

            {

                if (isDelete) {

                    itemView = [[NDShareItemView alloc]initWithShareImage:shareBtnImageArray[i+1] andShareTitle:shareTitleArray[i+1]];

                     itemView.shareImageBtn.tag = i+1;


                }else

                {

                    itemView = [[NDShareItemView alloc]initWithShareImage:shareBtnImageArray[i] andShareTitle:shareTitleArray[i]];

                    itemView.shareImageBtn.tag = i;

                }

               

                [shareView addSubview:itemView];


                [itemView mas_makeConstraints:^(MASConstraintMaker *make) {

                    make.top.equalTo(sepLabel.mas_bottom).offset(17*sizeScaleY);

                    make.left.equalTo(shareView.mas_left).offset(itemWidth*(i-4));

                    make.size.mas_equalTo(CGSizeMake(itemWidth, itemHieght));

                }];

        }

        

        [itemView.shareImageBtn addTarget:self action:@selector(tapShare:) forControlEvents:UIControlEventTouchUpInside];

    }

}

    return self;

}

#pragma mark - action

-(void)dealTap

{

    [self removeFromSuperview];


}

-(void)tapShare:(UIButton *)btn{

    

    [NDShareUmManger shareUmManage].shareDelegate = self;

    switch (btn.tag) {

        case 0:

            [[NDShareUmManger shareUmManage]shareToUmWithController:self.controller andShareImage:self.shareFeedImage andShareQQZoneTitle:@"" andPlatform:UMShareToWechatSession];

            break;

        case 1:

            [[NDShareUmManger shareUmManage]shareToUmWithController:self.controller andShareImage:self.shareFeedImage andShareQQZoneTitle:@"" andPlatform:UMShareToWechatTimeline];

            break;

        case 2:

            [[NDShareUmManger shareUmManage]shareToUmWithController:self.controller andShareImage:self.shareFeedImage andShareQQZoneTitle:@"" andPlatform:UMShareToQQ];

            break;

        case 3:

            [[NDShareUmManger shareUmManage]shareToUmWithController:self.controller andShareImage:self.shareFeedImage andShareQQZoneTitle:self.shareQQTitle andPlatform:UMShareToQzone];

            break;

        case 4:

            [self.delegate shareSinaFeedClick:self.shareFeedImage];

            break;

        case 5:

        {

            reportAlterView = [[UIAlertView alloc] initWithTitle:@"是否举报?" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];

           [reportAlterView setAlertViewStyle:UIAlertViewStylePlainTextInput];

           [reportAlterView show];

        }

            

            break;

        case 6:

        {

            deleteAlterView = [[UIAlertView alloc] initWithTitle:@"是否删除?" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];

            [deleteAlterView show];

        }


            break;

        default:

            break;

    }

}

#pragma mark - alterViewDelegate

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{

    if (buttonIndex == 1) {

        if (alertView == reportAlterView) {

            UITextField *tf=[alertView textFieldAtIndex:0];//获得输入框

            NSString * text=tf.text;//获得值

          [[NDHttpRequestManage requestManage]reportId:self.feedId withUserId:[NDBaseUserModel new].userID withContent:text complete:^(id completeObject, NSError *error) {

               [self removeFromSuperview];

              if (error == nil) {

                  UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"举报成功" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];

                  [alertView show];

                  [self performSelector:@selector(dimissAlertView:) withObject:alertView afterDelay:3.0f];

              }

              

          }];

            

        }else if (alertView == deleteAlterView)

        {

            

            [[NDHttpRequestManage requestManage] deleteFeed:self.feedId WithUserID:[NDBaseUserModel new].userID complete:^(id  _Nullable completeObject, NSError * _Nullable error) {

                [self removeFromSuperview];

                if (error == nil) {

                    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"删除成功" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];

                    [alertView show];

                    [self performSelector:@selector(dimissAlertView:) withObject:alertView afterDelay:3.0f];

                }


            }];

        }

    }

}

- (void)dimissAlertView:(UIAlertView *)alertView

{

    [alertView dismissWithClickedButtonIndex:0 animated:YES];

   

}

#pragma mark - shareUMDelegate

-(void)shareFinished

{

     //[self removeFromSuperview];

}

-(void)selectedSharePlatform

{

    [self removeFromSuperview];

}


@end



@implementation NDShareItemView


-(instancetype)initWithShareImage:(NSString *)imageName andShareTitle:(NSString*)shareTitle;

{

    self = [super init];

    if (self) {

        

        CGFloat sizeScaleX = [DeviceManage deviceManage].widthScaleRatio;

        CGFloat sizeScaleY = [DeviceManage deviceManage].heighScaleRatio;

        

        [self addSubview:self.shareImageBtn];

        [self addSubview:self.sharePlateLabel];

        

        self.sharePlateLabel.text = shareTitle;

        [self.shareImageBtn setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];

        

        [self.shareImageBtn setEnlargeEdgeWithTop:10 right:20 bottom:20 left:20];

        [self.shareImageBtn mas_makeConstraints:^(MASConstraintMaker *make) {

            make.top.equalTo(self.mas_top);

            make.centerX.equalTo(self.mas_centerX);

            make.size.mas_equalTo(CGSizeMake(shareImageWH*sizeScaleX, shareImageWH*sizeScaleX));

        }];

        CGSize titleSize = [CustomSize returnSize:shareTitle fontSize:12.0f];

        [self.sharePlateLabel mas_makeConstraints:^(MASConstraintMaker *make) {

            make.top.equalTo(self.shareImageBtn.mas_bottom).offset(5*sizeScaleY);

            make.centerX.equalTo(self.shareImageBtn.mas_centerX);

            make.size.mas_equalTo(CGSizeMake(titleSize.width, titleSize.height));

        }];

        

        

    }

    return self;

}


-(UIButton *)shareImageBtn

{

    if (_shareImageBtn == nil) {

        _shareImageBtn = [[UIButton alloc]init];

    }

    return _shareImageBtn;

}

-(UILabel *)sharePlateLabel

{

    if (_sharePlateLabel == nil) {

        _sharePlateLabel = [[UILabel alloc]init];

        _sharePlateLabel.font = [UIFont systemFontOfSize:12.0f];

        _sharePlateLabel.textColor = kMainBlackColor;

    }

    return _sharePlateLabel;

}

@end




【基于QT的调色板】是一个使用Qt框架开发的色彩选择工具,类似于Windows操作系统中常见的颜色选取器。Qt是一个跨平台的应用程序开发框架,广泛应用于桌面、移动和嵌入式设备,支持C++和QML语言。这个调色板功能提供了横竖两种渐变模式,用户可以方便地选取所需的颜色值。 在Qt中,调色板(QPalette)是一个关键的类,用于管理应用程序的视觉样式。QPalette包含了一系列的颜色角色,如背景色、前景色、文本色、高亮色等,这些颜色可以根据用户的系统设置或应用程序的需求进行定制。通过自定义QPalette,开发者可以创建具有独特视觉风格的应用程序。 该调色板功能可能使用了QColorDialog,这是一个标准的Qt对话框,允许用户选择颜色。QColorDialog提供了一种简单的方式来获取用户的颜色选择,通常包括一个调色板界面,用户可以通过滑动或点击来选择RGB、HSV或其他色彩模型中的颜色。 横渐变取色可能通过QGradient实现,QGradient允许开发者创建线性或径向的色彩渐变。线性渐变(QLinearGradient)沿直线从一个点到另一个点过渡颜色,而径向渐变(QRadialGradient)则以圆心为中心向外扩散颜色。在调色板中,用户可能可以通过滑动条或鼠标拖动来改变渐变的位置,从而选取不同位置的颜色。 竖渐变取色则可能是通过调整QGradient的方向来实现的,将原本水平的渐变方向改为垂直。这种设计可以提供另一种方式来探索颜色空间,使得选取颜色更为直观和便捷。 在【colorpanelhsb】这个文件名中,我们可以推测这是与HSB(色相、饱和度、亮度)色彩模型相关的代码或资源。HSB模型是另一种常见且直观的颜色表示方式,与RGB或CMYK模型不同,它以人的感知为基础,更容易理解。在这个调色板中,用户可能可以通过调整H、S、B三个参数来选取所需的颜色。 基于QT的调色板是一个利用Qt框架和其提供的色彩管理工具,如QPalette、QColorDialog、QGradient等,构建的交互式颜色选择组件。它不仅提供了横竖渐变的色彩选取方式,还可能支持HSB色彩模型,使得用户在开发图形用户界面时能更加灵活和精准地控制色彩。
标题基于Spring Boot的二手物品交易网站系统研究AI更换标题第1章引言阐述基于Spring Boot开发二手物品交易网站的研究背景、意义、现状及本文方法与创新点。1.1研究背景与意义介绍二手物品交易的市场需求和Spring Boot技术的适用性。1.2国内外研究现状概述当前二手物品交易网站的发展现状和趋势。1.3论文方法与创新点说明本文采用的研究方法和在系统设计中的创新之处。第2章相关理论与技术介绍开发二手物品交易网站所涉及的相关理论和关键技术。2.1Spring Boot框架解释Spring Boot的核心概念和主要特性。2.2数据库技术讨论适用的数据库技术及其在系统中的角色。2.3前端技术阐述与后端配合的前端技术及其在系统中的应用。第3章系统需求分析详细分析二手物品交易网站系统的功能需求和性能需求。3.1功能需求列举系统应实现的主要功能模块。3.2性能需求明确系统应满足的性能指标和安全性要求。第4章系统设计与实现具体描述基于Spring Boot的二手物品交易网站系统的设计和实现过程。4.1系统架构设计给出系统的整体架构设计和各模块间的交互方式。4.2数据库设计详细阐述数据库的结构设计和数据操作流程。4.3界面设计与实现介绍系统的界面设计和用户交互的实现细节。第5章系统测试与优化说明对系统进行测试的方法和性能优化的措施。5.1测试方法与步骤测试环境的搭建、测试数据的准备及测试流程。5.2测试结果分析对测试结果进行详细分析,验证系统是否满足需求。5.3性能优化措施提出针对系统性能瓶颈的优化建议和实施方案。第6章结论与展望总结研究成果,并展望未来可能的研究方向和改进空间。6.1研究结论概括本文基于Spring Boot开发二手物品交易网站的主要发现和成果。6.2展望与改进讨论未来可能的系统改进方向和新的功能拓展。
1. 用户与权限管理模块 角色管理: 学生:查看个人住宿信息、提交报修申请、查看卫生检查结果、请假外出登记 宿管人员:分配宿舍床位、处理报修申请、记录卫生检查结果、登记晚归情况 管理员:维护楼栋与房间信息、管理用户账号、统计住宿数据、发布宿舍通知 用户操作: 登录认证:对接学校统一身份认证(模拟实现,用学号 / 工号作为账号),支持密码重置 信息管理:学生完善个人信息(院系、专业、联系电话),管理员维护所有用户信息 权限控制:不同角色仅可见对应功能(如学生无法修改床位分配信息) 2. 宿舍信息管理模块 楼栋与房间管理: 楼栋信息:名称(如 "1 号宿舍楼")、层数、性别限制(男 / 女 / 混合)、管理员(宿管) 房间信息:房间号(如 "101")、户型(4 人间 / 6 人间)、床位数量、已住人数、可用状态 设施信息:记录房间内设施(如空调、热水器、桌椅)的配置与完好状态 床位管理: 床位编号:为每个床位设置唯一编号(如 "101-1" 表示 101 房间 1 号床) 状态标记:标记床位为 "空闲 / 已分配 / 维修中",支持批量查询空闲床位 历史记录:保存床位的分配变更记录(如从学生 A 调换到学生 B 的时间与原因) 3. 住宿分配与调整模块 住宿分配: 新生分配:管理员导入新生名单后,宿管可按专业集中、性别匹配等规则批量分配床位 手动分配:针对转专业、复学学生,宿管手动指定空闲床位并记录分配时间 分配结果公示:学生登录后可查看自己的宿舍信息(楼栋、房间号、床位号、室友列表) 调整管理: 调宿申请:学生提交调宿原因(如室友矛盾、身体原因),选择意向宿舍(需有空位) 审批流程:宿管审核申请,通过后执行床位调换,更新双方住宿信息 换宿记录:保存调宿历史(申请人、原床位、新床位、审批人、时间) 4. 报修与安全管理模块 报修管理: 报修提交:学生选择宿舍、设施类型(如 "
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值