                                                multiplier: 1.0,
                                                constant: 30))
         
-        avimg.addConstraint(NSLayoutConstraint(item: avimg,
+        image.addConstraint(NSLayoutConstraint(item: image,
                                                attribute: .height,
                                                relatedBy: .equal,
                                                toItem: nil,

                                               multiplier: 1.0,
                                               constant: 30))
        
        activityView.addConstraint(NSLayoutConstraint(item: avimg,
                                                      attribute: .right,
                                                      relatedBy: .equal,
                                                      toItem: activityView,
                                                      attribute: .right,
                                                      multiplier: 1.0,
                                                      constant: -18))
        
        activityView.addConstraint(NSLayoutConstraint(item: avimg,
                                                      attribute: .centerY,
                                                      relatedBy: .equal,
                                                      toItem: activityView,
                                                      attribute: .centerY,
                                                      multiplier: 1.0,
                                                      constant: 0))

extension EUHomeHeadView{
    
    fileprivate func setupActivityView(){
        let activitytitle = UILabel()
        activitytitle.text = "活动"
        activitytitle.font = UIFont.boldSystemFont(ofSize: 16)
        activitytitle.sizeToFit()
        activitytitle.textColor = UIColor.white
        activityView.addSubview(activitytitle)
        
        let activitydetail = UILabel()
        activitydetail.text = "活出精彩"
        activitydetail.font = UIFont.boldSystemFont(ofSize: 15)
        activitydetail.sizeToFit()
        activitydetail.textColor = UIColor.white
        activityView.addSubview(activitydetail)
        
        let activityimage = UIImageView(image: #imageLiteral(resourceName: "home_activity"))
        activityView.addSubview(activityimage)
        
        setupAutoLayout(title: activitytitle, detail: activitydetail, image: activityimage, superview: activityView)
    }
    
    fileprivate func setupCommunityView(){
        
        
        
    }
    
    fileprivate func setupAutoLayout(title:UILabel,detail:UILabel,image:UIImageView,superview:UIView){
        
        
        // 自动布局
        detail.translatesAutoresizingMaskIntoConstraints = false
        title.translatesAutoresizingMaskIntoConstraints = false
        image.translatesAutoresizingMaskIntoConstraints = false
        
        superview.addConstraint(NSLayoutConstraint(item: title,
                                                      attribute: .top,
                                                      relatedBy: .equal,
                                                      toItem: superview,
                                                      attribute: .top,
                                                      multiplier: 1.0,
                                                      constant: 6))
        
        superview.addConstraint(NSLayoutConstraint(item: title,
                                                      attribute: .left,
                                                      relatedBy: .equal,
                                                      toItem: superview,
                                                      attribute: .left,
                                                      multiplier: 1.0,
                                                      constant: 17))
        
        superview.addConstraint(NSLayoutConstraint(item: detail,
                                                      attribute: .top,
                                                      relatedBy: .equal,
                                                      toItem: title,
                                                      attribute: .bottom,
                                                      multiplier: 1.0,
                                                      constant: 4))
        
        superview.addConstraint(NSLayoutConstraint(item: detail,
                                                      attribute: .left,
                                                      relatedBy: .equal,
                                                      toItem: title,
                                                      attribute: .left,
                                                      multiplier: 1.0,
                                                      constant: 0))
        
        image.addConstraint(NSLayoutConstraint(item: image,
                                               attribute: .width,
                                               relatedBy: .equal,
                                               toItem: nil,
