|
|
@@ -331,7 +331,6 @@ class HomeViewController: BaseViewController {
|
|
|
}
|
|
|
|
|
|
group.notify(queue: DispatchQueue.main) {
|
|
|
-
|
|
|
/// stopAnimating
|
|
|
self._anim?.stopAnimating()
|
|
|
/// endRefreshing
|
|
|
@@ -403,7 +402,6 @@ class HomeViewController: BaseViewController {
|
|
|
|
|
|
// MARK: - SFSafariViewControllerDelegate
|
|
|
extension HomeViewController: SFSafariViewControllerDelegate {
|
|
|
-
|
|
|
func safariViewControllerDidFinish(_ controller: SFSafariViewController) {
|
|
|
controller.dismiss(animated: true, completion: {})
|
|
|
}
|
|
|
@@ -439,13 +437,46 @@ extension HomeViewController: SDCycleScrollViewDelegate {
|
|
|
|
|
|
func cycleScrollView(_ cycleScrollView: SDCycleScrollView!, didSelectItemAt index: Int) {
|
|
|
/// 广告跳转
|
|
|
- if self.configs[index].urltype == 1, self.configs[index].url != "" {
|
|
|
- guard let url = URL(string: self.configs[index].url) else { return }
|
|
|
+ if configs[index].urltype == 1,
|
|
|
+ configs[index].url != "" {
|
|
|
+ let urlString = !configs[index].url.lowercased().hasPrefix("http://") ? ("http://"+configs[index].url) : configs[index].url
|
|
|
+ guard let url = URL(string: urlString) else { return }
|
|
|
let safriViewController = SFSafariViewController(url: url)
|
|
|
safriViewController.delegate = self
|
|
|
self.present(safriViewController, animated: true, completion: {})
|
|
|
} else { /// 商品ID
|
|
|
-
|
|
|
+ /// 异常
|
|
|
+ guard let goodsManager = MTP2BusinessCore.shared.goodsManager else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if configs[index].trademode == ETradeMode.TRADEMODE_LISTING_SELECT,
|
|
|
+ let goodsInfo = MTP2BusinessCore.shared.goodsManager?.goodsInfos.first(where: {"\($0.goodsid)" == configs[index].url}) { /// 竞价商品
|
|
|
+ let goodsDetailController = UIStoryboard(name: "Quote", bundle: nil).instantiateViewController(withIdentifier: "GoodsDetail") as! GoodsDetailViewController
|
|
|
+ goodsDetailController.model = goodsInfo
|
|
|
+ self.navigationController?.pushViewController(goodsDetailController, animated: true)
|
|
|
+ } else { /// 商城商品
|
|
|
+ if MTP2BusinessCore.shared.getLoginStatus() { /// 已登录
|
|
|
+ goodsManager.requestQueryHsbyMarketGoodses(goodsManager.getMarketIDs(.TRADEMODE_TRADEMODE_HSBY_SHOP), nil, MTP2BusinessCore.shared.accountManager?.getCurrentTAAccountInfo()?.accountId, configs[index].url, nil, callback: { (isComplete, error, objs) in
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ if isComplete, let goodsInfo = objs?.first(where: {"\($0.goodsid)" == self.configs[index].url}) {
|
|
|
+ let goodsDetailController = UIStoryboard(name: "Quote", bundle: nil).instantiateViewController(withIdentifier: "GoodsDetail") as! GoodsDetailViewController
|
|
|
+ goodsDetailController.model = goodsInfo
|
|
|
+ self.navigationController?.pushViewController(goodsDetailController, animated: true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else { /// 未登录
|
|
|
+ goodsManager.requestQueryHsbyVisitorMarketGoodses(goodsManager.getMarketIDs(.TRADEMODE_TRADEMODE_HSBY_SHOP), nil, configs[index].url, nil, callback: { (isComplete, error, objs) in
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ if isComplete, let goodsInfo = objs?.first(where: {"\($0.goodsid)" == self.configs[index].url}) {
|
|
|
+ let goodsDetailController = UIStoryboard(name: "Quote", bundle: nil).instantiateViewController(withIdentifier: "GoodsDetail") as! GoodsDetailViewController
|
|
|
+ goodsDetailController.model = goodsInfo
|
|
|
+ self.navigationController?.pushViewController(goodsDetailController, animated: true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|