Commit 3ead8fff authored by Steven杜宇's avatar Steven杜宇

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

parents 4b03ddaf 5aea376c
......@@ -2944,7 +2944,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -3145,7 +3145,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......@@ -3187,7 +3187,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
......
......@@ -124,7 +124,10 @@ extension AppDelegate {
//1.设置主窗口
private func setupRootVC() {
let tabBarController = YHTabBarViewController()
let v0 = YHNavigationController(rootVC:YHHomePageViewController())
let homeVC = YHHomePageViewController()
tabBarController.delegate = homeVC
let v0 = YHNavigationController(rootVC:homeVC)
let v1 = YHNavigationController(rootVC:YHServiceViewController())
let v2 = YHNavigationController(rootVC:YHMsgViewController())
let v3 = YHNavigationController(rootVC:YHMyViewController())
......
......@@ -41,7 +41,6 @@ class YHHomePageViewController: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadFirstData()
}
lazy var searchView: YHHomeSearchView = {
......@@ -55,6 +54,10 @@ class YHHomePageViewController: YHBaseViewController {
let view = YHHomeHeadView()
return view
}()
var tapTimestamp : CFAbsoluteTime = -10.0
}
private extension YHHomePageViewController {
......@@ -97,6 +100,11 @@ private extension YHHomePageViewController {
}
self.homeCollectView.reloadData()
// DispatchQueue.main.asyncAfter(deadline: .now() + 3, execute:{
// printLog(YHHomeHeadView.viewH)
// printLog(self.homeCollectView.contentOffset)
// })
}
}
......@@ -104,7 +112,7 @@ private extension YHHomePageViewController {
gk_navigationBar.isHidden = true
view.backgroundColor = .white
NotificationCenter.default.addObserver(self, selector: #selector(homepageRefresh), name:YhConstant.YhNotification.refreshHomePageNotifiction, object: nil)
// NotificationCenter.default.addObserver(self, selector: #selector(homepageRefresh), name:YhConstant.YhNotification.refreshHomePageNotifiction, object: nil)
view.addSubview(searchView)
searchView.snp.makeConstraints { make in
......@@ -160,6 +168,18 @@ extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDa
let vc = YHHomeWebViewController()
vc.url = YHConfigManager.shared.h5Url + "?id=\(model.id)"
vc.id = model.id
vc.block = { item in
if let arr = self.viewModel.arrHomeNewsData {
for (index,targetItem) in arr.enumerated() {
if targetItem.id == item.id {
targetItem.is_like = item.is_like
targetItem.like_count = item.like_count
self.homeCollectView.reloadItems(at: [IndexPath(index: index)])
}
}
}
}
self.navigationController?.pushViewController(vc)
} else if model.type == 1 {
printLog("直接播放视频")
......@@ -173,3 +193,21 @@ extension YHHomePageViewController : CollectionViewWaterfallLayoutDelegate {
return CGSize(width: model.img_width_cell, height: model.img_height_cell)
}
}
extension YHHomePageViewController : UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
let doubleTapInterval : CGFloat = 0.3
if tabBarController.selectedIndex == 0 {
let timestamp = CFAbsoluteTimeGetCurrent()
printLog(timestamp - self.tapTimestamp)
if timestamp - self.tapTimestamp < doubleTapInterval {
UIView.animate(withDuration: 0.25) {
self.homeCollectView.contentOffset = CGPoint(x: 0, y: -YHHomeHeadView.viewH)//置顶功能
}
}
self.tapTimestamp = timestamp
}
}
}
......@@ -10,8 +10,14 @@ import UIKit
import WebKit
class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
var operationFlag:Bool = false
typealias Block = (YHWebModel) -> ()
var block: Block?
var viewModel: YHHomeWebViewModel!
var webview = WKWebView()
var progBar = UIProgressView()
var bottomView: YHHomeWebBottomView!
......@@ -60,16 +66,22 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
self.viewModel.getLike(self.id, 1) {[weak self] success, error in
guard let self = self else { return }
if success {
operationFlag = true
YHHUD.flash(message: "已点赞")
self.getData()
} else {
operationFlag = false
}
}
} else {
self.viewModel.getLike(self.id, 0) {[weak self] success, error in
guard let self = self else { return }
if success {
operationFlag = true
YHHUD.flash(message: "已取消点赞")
self.getData()
} else {
operationFlag = false
}
}
}
......@@ -87,16 +99,22 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
self.viewModel.getStar(self.id, 1) {[weak self] success, error in
guard let self = self else { return }
if success {
operationFlag = true
YHHUD.flash(message: "已收藏")
self.getData()
} else {
operationFlag = false
}
}
} else {
self.viewModel.getStar(self.id, 0) {[weak self] success, error in
guard let self = self else { return }
if success {
operationFlag = true
YHHUD.flash(message: "已取消收藏")
self.getData()
} else {
operationFlag = false
}
}
}
......@@ -132,11 +150,15 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
func getData() {
viewModel.getWebDetail(self.id) {[weak self] success, error in
guard let self = self else { return }
guard let model = self.viewModel.mainModel else { return }
bottomView.likeCount = model.like_count
bottomView.starCount = model.collect_count
bottomView.isStar = model.is_collect
bottomView.isLike = model.is_like
if success {
guard let model = self.viewModel.mainModel else { return }
bottomView.likeCount = model.like_count
bottomView.starCount = model.collect_count
bottomView.isStar = model.is_collect
bottomView.isLike = model.is_like
self.block?(model)
}
}
}
......
......@@ -26,7 +26,7 @@ class YHStartPageViewController: UIViewController {
lazy var closeBtn: UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 12)
button.setTitle("跳过 5", for: .normal)
button.setTitle("跳过 3", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.setBackgroundColor(color: UIColor(red: 0.071, green: 0.102, blue: 0.149, alpha: 0.3), forState: .normal)
return button
......@@ -98,7 +98,9 @@ private extension YHStartPageViewController {
//1.设置主窗口
func setupRootVC() {
let tabBarController = YHTabBarViewController()
let v0 = YHNavigationController(rootVC:YHHomePageViewController())
let homeVC = YHHomePageViewController()
tabBarController.delegate = homeVC
let v0 = YHNavigationController(rootVC:homeVC)
let v1 = YHNavigationController(rootVC:YHServiceViewController())
let v2 = YHNavigationController(rootVC:YHMsgViewController())
let v3 = YHNavigationController(rootVC:YHMyViewController())
......
......@@ -18,12 +18,12 @@ class YHHomeListModel: YHBaseModel {
var id: Int = 0
var title: String = ""
var content: String = ""
var view_count: Int = 0
var view_count: Int = 0 //浏览数量
var img_url: String = ""
var type: Int = 0 //文章类型 '文章类型 1视频 2图文 3图片',
var is_like : Bool = false
var media_url : String = ""
var like_count : Int = 0
var like_count : Int = 0 //点赞梳理
......
......@@ -60,6 +60,9 @@ extension YHServerHKLifeViewController {
let model = item as YHHomeClassifyModel
if model.id == 2 {
self.sectionView.items = model.children
if self.classId == 0 {
return
}
let classifyID = model.children.first?.id ?? 0
self.classId = classifyID
self.homeViewModel.getList(true, classifyID) {[weak self] success, error in
......
......@@ -44,6 +44,9 @@ extension YHServiceListViewController {
let model = item as YHHomeClassifyModel
if model.id == 1 {
self.normalView.sectionView.items = model.children
if self.classId == 0 {
return
}
let classifyID = model.children.first?.id ?? 0
self.classId = classifyID
self.homeViewModel.getList(true, classifyID) {[weak self] success, error in
......
......@@ -200,6 +200,7 @@ extension YHHomeCollectionViewCell {
if success {
YHHUD.flash(message: "已点赞")
listModel.is_like = true
listModel.like_count = listModel.like_count + 1
updataSubViews()
}
}
......@@ -209,12 +210,11 @@ extension YHHomeCollectionViewCell {
if success {
YHHUD.flash(message: "已取消点赞")
listModel.is_like = false
listModel.like_count = listModel.like_count - 1
updataSubViews()
}
}
}
NotificationCenter.default.post(name:YhConstant.YhNotification.refreshHomePageNotifiction, object: nil)
} else {
let vc = UINavigationController(rootVC: YHPhoneLoginViewController())
vc.modalPresentationStyle = .custom
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment