Prechádzať zdrojové kódy

首页背景图,所有人都爱优化

吴彦祖 6 mesiacov pred
rodič
commit
6478ca1a0c

+ 4 - 2
ADHTuanCan.xcodeproj/project.pbxproj

@@ -3649,6 +3649,7 @@
 		C48363D62AC3D96500E3FA1B /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
 				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
@@ -3713,6 +3714,7 @@
 		C48363D72AC3D96500E3FA1B /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
 				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
@@ -3777,7 +3779,7 @@
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1;
+				CURRENT_PROJECT_VERSION = 4;
 				DEVELOPMENT_TEAM = VUHRW5BP4S;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = ADHTuanCan/Info.plist;
@@ -3821,7 +3823,7 @@
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1;
+				CURRENT_PROJECT_VERSION = 4;
 				DEVELOPMENT_TEAM = VUHRW5BP4S;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = ADHTuanCan/Info.plist;

BIN
ADHTuanCan.xcworkspace/xcuserdata/aodeheng.xcuserdatad/UserInterfaceState.xcuserstate


+ 20 - 0
ADHTuanCan/Assets.xcassets/首页/WechatIMG6412.imageset/Contents.json

@@ -0,0 +1,20 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
ADHTuanCan/Assets.xcassets/首页/首页背景.imageset/64601713925485_.pic_hd.jpg


+ 1 - 3
ADHTuanCan/Assets.xcassets/首页/首页背景.imageset/Contents.json

@@ -1,17 +1,15 @@
 {
   "images" : [
     {
-      "filename" : "编组 3.png",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
-      "filename" : "编组 3@2x.png",
+      "filename" : "64601713925485_.pic_hd.jpg",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "编组 3@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

BIN
ADHTuanCan/Assets.xcassets/首页/首页背景.imageset/编组 3.png


BIN
ADHTuanCan/Assets.xcassets/首页/首页背景.imageset/编组 3@2x.png


BIN
ADHTuanCan/Assets.xcassets/首页/首页背景.imageset/编组 3@3x.png


+ 16 - 4
ADHTuanCan/Class/首页/HomeViewController.swift

@@ -204,7 +204,7 @@ class HomeViewController: ADHBaseVC {
         self.searchView!.mas_remakeConstraints { make in
             make?.left.mas_equalTo()(self.backImageView)?.offset()(24)
             make?.right.mas_equalTo()(self.backImageView)?.offset()(-24)
-            make?.top.mas_equalTo()(self.backImageView)?.offset()(self.backImageView.frame.size.height - 100)
+            make?.top.mas_equalTo()(self.backImageView)?.offset()(self.backImageView.frame.size.height - 130)
             make?.height.offset()(48)
         }
         ///
@@ -384,6 +384,18 @@ class HomeViewController: ADHBaseVC {
         })
     }
     
+    func getEveryBodyLoveTitle(){
+        self.hud.showLoading()
+
+        self.viewModel.signalHomeGetFoodTitleRequsetl()?.on(success: { dd in
+            self.hud.hidden()
+            self.everyBodyLove?.configTitleStr(title: self.viewModel.homeFoodTitle?.name ?? "")
+         
+        }, error: { error in
+            self.hud.showFailure(error.msg ?? LanguagesUtil.createTextBy(Ctext: "网络错误", Etext: "network error"))
+        })
+    }
+    
     //MARK: 获取时间范围
     func getTimeRangDetail(){
         self.viewModel.HomeTimeGetModel.shopType = self.shopType
@@ -424,7 +436,7 @@ class HomeViewController: ADHBaseVC {
             }else{
                 self.createUI()
             }
-            
+            self.getEveryBodyLoveTitle()
             self.getShopCarPrice()
             self.reloadDateView()
             self.resetConstraint()
@@ -587,9 +599,9 @@ class HomeViewController: ADHBaseVC {
     lazy var collectionView : UICollectionView = {
         //设置布局
         let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout.init()
-        let itemSpac = (kSCREEN_WIDTH - 323) / 3
+        let itemSpac = (kSCREEN_WIDTH - 320) / 3
         layout.scrollDirection = .vertical //竖直
-        layout.itemSize = CGSize.init(width: 161.5, height: 206.5)
+        layout.itemSize = CGSize.init(width: 160, height: 206.5)
         //行距
         layout.minimumInteritemSpacing = 20
         layout.minimumLineSpacing = itemSpac

+ 18 - 0
ADHTuanCan/Class/首页/model/TCHomeGetDataModel.swift

@@ -399,3 +399,21 @@ class HomeEditorTimeRangModel: MCBaseRequestModel {
         "/app/meal/updateShopcartTime"
     }
 }
+
+
+//MARK: 获取所有人都爱标签
+class HomeGetFoodTitleModel: MCBaseRequestModel {
+    
+    override func requestMethod() -> MCHttpMethod {
+        .get
+    }
+    override func requestUrl() -> String {
+        "/app/meal/getReferrals"
+    }
+}
+
+class HomeFoodTitleModel : MCBaseModel{
+    
+    /// 所有人都爱标签
+    var name : String?
+}

+ 1 - 0
ADHTuanCan/Class/首页/view/大家都爱点/Base.lproj/EverybodyLoveView.xib

@@ -75,6 +75,7 @@
             <connections>
                 <outlet property="scroBackView" destination="fSk-br-6uO" id="jzn-ou-ERy"/>
                 <outlet property="scrollBackHeight" destination="5Oc-Df-XmL" id="2v4-ZR-qCM"/>
+                <outlet property="titleLab" destination="dic-H0-slO" id="RXo-xZ-57p"/>
                 <outlet property="titleScrollView" destination="tvP-5g-Uue" id="jeN-Yf-lLZ"/>
             </connections>
             <point key="canvasLocation" x="325.95419847328242" y="-232.74647887323945"/>

+ 5 - 2
ADHTuanCan/Class/首页/view/大家都爱点/EverybodyLoveView.swift

@@ -17,7 +17,8 @@ class EverybodyLoveView: UIView {
     @IBOutlet weak var scroBackView: UIView!
     
     @IBOutlet weak var scrollBackHeight: NSLayoutConstraint!
-    
+    //所有人都爱
+    @IBOutlet weak var titleLab: UIButton!
     var interspace : CGFloat = 10
     
     let itemWeight : CGFloat = (kSCREEN_WIDTH - 30)/2
@@ -55,7 +56,9 @@ class EverybodyLoveView: UIView {
 
     }
     
-    
+    func configTitleStr(title : String){
+        self.titleLab.setTitle(title, for: .normal)
+    }
     
     func configTitle(model : SupplyTypeListModel){
         

+ 30 - 0
ADHTuanCan/Class/首页/viewModel/HomeViewModel.swift

@@ -243,4 +243,34 @@ class HomeViewModel: MCBaseViewModel {
             return Disposables.create()
         }
     }
+    
+    
+    //MARK: - 获取所有人都爱标签
+    /// 获取所有人都爱标签Model
+    var  homeGetFoodTitleModel : HomeGetFoodTitleModel = HomeGetFoodTitleModel.init()
+    var  homeGetFoodTitleRequset : MCDataRequest?
+    /// 获取所有人都爱标签
+    var homeFoodTitle : HomeFoodTitleModel?
+    ///
+    func signalHomeGetFoodTitleRequsetl() -> Observable<Int>? {
+       
+        if let _ = homeGetFoodTitleRequset{
+            return nil
+        }
+
+       
+        return Observable.create {(disposable) -> Disposable in
+            self.homeGetFoodTitleRequset = MCHttpUtil.request(self.homeGetFoodTitleModel, responseClass: HomeFoodTitleModel.self, success: {[unowned self] (data) in
+                self.homeFoodTitle = data.data
+                self.homeGetFoodTitleRequset = nil
+                
+                disposable.onNext(data.responseData?.count ?? 0)
+                disposable.onCompleted()
+            }, error: {[weak self] (error) in
+                self?.homeGetFoodTitleRequset = nil
+                disposable.onError(error)
+            })
+            return Disposables.create()
+        }
+    }
 }

+ 22 - 4
ADHTuanCan/Class/首页/普团首页/HomeSecondViewController.swift

@@ -181,7 +181,7 @@ class HomeSecondViewController: ADHBaseVC {
         self.searchView!.mas_remakeConstraints { make in
             make?.left.mas_equalTo()(self.backImageView)?.offset()(24)
             make?.right.mas_equalTo()(self.backImageView)?.offset()(-24)
-            make?.top.mas_equalTo()(self.backImageView)?.offset()(self.backImageView.frame.size.height - 100)
+            make?.top.mas_equalTo()(self.backImageView)?.offset()(self.backImageView.frame.size.height - 130)
             make?.height.offset()(48)
         }
         //
@@ -370,6 +370,18 @@ class HomeSecondViewController: ADHBaseVC {
         })
     }
     
+    func getEveryBodyLoveTitle(){
+        self.hud.showLoading()
+
+        self.viewModel.signalHomeGetFoodTitleRequsetl()?.on(success: { dd in
+            self.hud.hidden()
+            self.everyBodyLove?.configTitleStr(title: self.viewModel.homeFoodTitle?.name ?? "")
+         
+        }, error: { error in
+            self.hud.showFailure(error.msg ?? LanguagesUtil.createTextBy(Ctext: "网络错误", Etext: "network error"))
+        })
+    }
+    
     //MARK: 获取时间范围
     func getTimeRangDetail(){
         self.viewModel.HomeTimeGetModel.shopType = self.shopType
@@ -392,6 +404,7 @@ class HomeSecondViewController: ADHBaseVC {
                 self.createUI()
             }
             
+            self.getEveryBodyLoveTitle()
             self.getShopCarPrice()
             self.reloadDateView()
             self.resetConstraint()
@@ -543,13 +556,18 @@ class HomeSecondViewController: ADHBaseVC {
     lazy var collectionView : UICollectionView = {
         //设置布局
         let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout.init()
-        let itemSpac = (kSCREEN_WIDTH - 323) / 3
+        let itemSpac = (kSCREEN_WIDTH - 320) / 3
         layout.scrollDirection = .vertical //竖直
-        layout.itemSize = CGSize.init(width: 161.5, height: 206.5)
+        layout.itemSize = CGSize.init(width: 160, height: 206.5)
         //行距
         layout.minimumInteritemSpacing = 20
         layout.minimumLineSpacing = itemSpac
-        layout.sectionInset = .init(top: 0, left: itemSpac, bottom: 0, right: itemSpac)
+//        layout.sectionInset = .init(top: 0, left: itemSpac, bottom: 0, right: itemSpac)
+        if kIsIphoneX {
+            layout.sectionInset = .init(top: 0, left: itemSpac, bottom: 0, right: itemSpac)
+        }else{
+            layout.sectionInset = .init(top: 0, left: 10, bottom: 0, right: 10)
+        }
         
         let collectView = UICollectionView.init(frame: .zero, collectionViewLayout: layout)
         collectView.delegate = self