td>
+    
25
+    @IBOutlet weak var userAvatar: UIImageView!
26
+    @IBOutlet weak var userName: UILabel!
27
+    @IBOutlet weak var photoTime: UILabel!
28
+    
29
+    @IBOutlet weak var thumbupCount: UILabel!
30
+    @IBOutlet weak var thumbupView: UIView!
31
+    
32
+    @IBOutlet weak var commentCount: UILabel!
33
+    @IBOutlet weak var tableView: UITableView!
34
+    
35
+    @IBOutlet weak var commentView: UIView!
36
+    @IBOutlet weak var commentHeight: NSLayoutConstraint!
37
+    @IBOutlet weak var commentTextField: UITextField!
38
+    @IBOutlet weak var sendBtn: UIButton!
39
+    
40
+    @IBOutlet weak var buyView: UIView!
41
+    @IBOutlet weak var waterMarkImage: UIImageView!
42
+    @IBOutlet weak var waterMarkLabel: UILabel!
19 43
 
20
-    // MARK: Storyboard property
21
-    @IBOutlet var tableView: UITableView!
22
-    @IBOutlet var commentView: UIView!
23
-    @IBOutlet var commentHeight: NSLayoutConstraint!
24
-    @IBOutlet var commentTextField: UITextField!
25
-    @IBOutlet var sendBtn: UIButton!
26
-    @IBOutlet var thumbupView: UIView!
27
-    @IBOutlet var buyView: UIView!
28
-    @IBOutlet var shuiyinImage: UIImageView!
29
-    @IBOutlet var shuiyinLabel: UILabel!
30
-    @IBOutlet weak var waterMarkView: UIView!
31
-
32
-    @IBOutlet weak var shuiyinImageLeadingConstarint: NSLayoutConstraint!
33 44
     // MARK: data property
34
-    var detailPageViewModel = DetailPageViewModel()
45
+    var viewModel: PhotoDetailViewModel!
35 46
     lazy var datas = [PhotoItem]()
36 47
     lazy var currentPhotoIndex = 0
37 48
     var isHiddenEnterView = false
38 49
     let disposeBag = DisposeBag()
39
-    static let storyboardCtl = UIStoryboard.photoDetail.instantiateInitialViewController() as! DetailPageController
50
+    static let storyboardCtl = UIStoryboard.photoDetail.instantiateInitialViewController() as! PhotoDetailViewController
40 51
 
41 52
     // MARK: view function
42 53
     override func viewDidLoad() {
43 54
         super.viewDidLoad()
44 55
 //        detailPageViewModel.tipDelegate = self
45 56
 //        tableView.tableFooterView = UIView()
46
-        tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 100, right: 0)
47 57
         configureNotification()
48
-        commentTextField.addLeftPadding(7)
58
+        
49 59
         commentTextField.rx.text
50 60
                         .map {!($0?.isEmpty)!}
51 61
                         .bind(to: sendBtn.rx.isEnabled)
52 62
                         .disposed(by: disposeBag)
53 63
     }
64
+    
65
+    func setupCommentTextField() {
66
+        commentTextField.addLeftPadding(7)
67
+    }
54 68
 
55 69
     override func viewWillAppear(_ animated: Bool) {
56 70
         super.viewWillAppear(true)
@@ -118,28 +132,28 @@ final class DetailPageController: UIViewController {
118 132
         currentPhotoIndex = index
119 133
 //        detailPageViewModel.currentPhoto = datas[index]
120 134
 
121
-        detailPageViewModel.fetchThumbup(success: {[weak self] in
122
-            if let weakself = self {
123
-                var model = weakself.datas[index]
124
-                model.thumbup_num =  weakself.detailPageViewModel.thumbups.count
125
-                weakself.datas[index] = model
126
-//                PhotoLocalStorage.instance.updateLocalData(PhotoItem: model)
127
-                weakself.reloadSection(inter: 3)
128
-            }
129
-        })
130
-        detailPageViewModel.fetchComment(success: {[weak self] in
131
-            if let weakself = self {
132
-
133
-                var model = weakself.datas[index]
134
-                model.comment_num =  weakself.detailPageViewModel.comments.count
135
-                weakself.datas[index] = model
136
-//                PhotoLocalStorage.instance.updateLocalData(PhotoItem: model)
137
-                weakself.reloadSection(inter: 4)
138
-            }
139
-        })
140
-
141
-        reloadSection(inter: 0)
142
-        reloadSection(inter: 2)
135
+//        detailPageViewModel.fetchThumbup(success: {[weak self] in
136
+//            if let weakself = self {
137
+//                var model = weakself.datas[index]
138
+//                model.thumbup_num =  weakself.detailPageViewModel.thumbups.count
139
+//                weakself.datas[index] = model
140
+////                PhotoLocalStorage.instance.updateLocalData(PhotoItem: model)
141
+//                weakself.reloadSection(inter: 3)
142
+//            }
143
+//        })
144
+//        detailPageViewModel.fetchComment(success: {[weak self] in
145
+//            if let weakself = self {
146
+//
147
+//                var model = weakself.datas[index]
148
+//                model.comment_num =  weakself.detailPageViewModel.comments.count
149
+//                weakself.datas[index] = model
150
+////                PhotoLocalStorage.instance.updateLocalData(PhotoItem: model)
151
+//                weakself.reloadSection(inter: 4)
152
+//            }
153
+//        })
154
+
155
+//        reloadSection(inter: 0)
156
+//        reloadSection(inter: 2)
143 157
         showBuyView()
144 158
     }
145 159
 
@@ -157,36 +171,36 @@ final class DetailPageController: UIViewController {
157 171
 
158 172
     // MARK: Storyboard  button function
159 173
     @IBAction func HDPay(_ sender: UIButton) {
160
-        detailPageViewModel.getHD (getPriceSuccess: { [weak self] (isExist) in
161
-            if let weakself = self {
162
-                if isExist {
163
-                    let fullPicCtl = UIStoryboard(name: "Detail", bundle: nil).instantiateController(ShowFullPicController.self)
164
-                    fullPicCtl.datas = [weakself.datas[weakself.currentPhotoIndex]]
165
-                    fullPicCtl.showNomark = true
166
-                    fullPicCtl.currentPhotoIndex = weakself.currentPhotoIndex
167
-                    weakself.navigationController?.pushViewController(fullPicCtl, animated: true)
168
-                } else {
169
-                }
170
-            }
171
-        })
174
+//        detailPageViewModel.getHD (getPriceSuccess: { [weak self] (isExist) in
175
+//            if let weakself = self {
176
+//                if isExist {
177
+//                    let fullPicCtl = UIStoryboard(name: "Detail", bundle: nil).instantiateController(ShowFullPicController.self)
178
+//                    fullPicCtl.datas = [weakself.datas[weakself.currentPhotoIndex]]
179
+//                    fullPicCtl.showNomark = true
180
+//                    fullPicCtl.currentPhotoIndex = weakself.currentPhotoIndex
181
+//                    weakself.navigationController?.pushViewController(fullPicCtl, animated: true)
182
+//                } else {
183
+//                }
184
+//            }
185
+//        })
172 186
     }
173 187
 
174 188
     @IBAction func waterMarkPay(_ sender: UIButton) {
175 189
 
176
-        detailPageViewModel.getWatermark (getPriceSuccess: { [weak self] (isExist) in
177
-            if let weakself = self {
178
-                if isExist {
179
-                    let fullPicCtl = UIStoryboard(name: "Detail", bundle: nil).instantiateController(ShowFullPicController.self)
180
-                    fullPicCtl.datas = weakself.datas
181
-                    fullPicCtl.showNomark = true
182
-                    fullPicCtl.currentPhotoIndex = weakself.currentPhotoIndex
183
-                    weakself.navigationController?.pushViewController(fullPicCtl, animated: true)
184
-                } else {
185
-                    weakself.shuiyinImage.isHidden = true
186
-                    weakself.shuiyinLabel.text = "¥\((weakself.detailPageViewModel.watermarkPrice/100))"
187
-                }
188
-            }
189
-        })
190
+//        detailPageViewModel.getWatermark (getPriceSuccess: { [weak self] (isExist) in
191
+//            if let weakself = self {
192
+//                if isExist {
193
+//                    let fullPicCtl = UIStoryboard(name: "Detail", bundle: nil).instantiateController(ShowFullPicController.self)
194
+//                    fullPicCtl.datas = weakself.datas
195
+//                    fullPicCtl.showNomark = true
196
+//                    fullPicCtl.currentPhotoIndex = weakself.currentPhotoIndex
197
+//                    weakself.navigationController?.pushViewController(fullPicCtl, animated: true)
198
+//                } else {
199
+//                    weakself.shuiyinImage.isHidden = true
200
+//                    weakself.shuiyinLabel.text = "¥\((weakself.detailPageViewModel.watermarkPrice/100))"
201
+//                }
202
+//            }
203
+//        })
190 204
     }
191 205
 
192 206
     @IBAction func share() {
@@ -206,23 +220,23 @@ final class DetailPageController: UIViewController {
206 220
         guard let text = commentTextField.text else {
207 221
             return
208 222
         }
209
-        detailPageViewModel.sendComment(content: text, success: { [weak self] in
210
-            if let weakself = self {
211
-                weakself.commentTextField.text = ""
212
-                weakself.commentTextField.resignFirstResponder()
213
-                weakself.commentView.isHidden = true
214
-                weakself.refreshUI(index: weakself.currentPhotoIndex)
215
-            }
216
-        })
223
+//        detailPageViewModel.sendComment(content: text, success: { [weak self] in
224
+//            if let weakself = self {
225
+//                weakself.commentTextField.text = ""
226
+//                weakself.commentTextField.resignFirstResponder()
227
+//                weakself.commentView.isHidden = true
228
+//                weakself.refreshUI(index: weakself.currentPhotoIndex)
229
+//            }
230
+//        })
217 231
     }
218 232
 
219 233
     @IBAction func thumbup() {
220
-        detailPageViewModel.sendThumbup(success: {[weak self]  in
221
-            if let weakself = self {
222
-                weakself.refreshUI(index: weakself.currentPhotoIndex)
223
-            }
224
-
225
-        })
234
+//        detailPageViewModel.sendThumbup(success: {[weak self]  in
235
+//            if let weakself = self {
236
+//                weakself.refreshUI(index: weakself.currentPhotoIndex)
237
+//            }
238
+//
239
+//        })
226 240
     }
227 241
 
228 242
     // MARK: custom function
@@ -234,19 +248,19 @@ final class DetailPageController: UIViewController {
234 248
     }
235 249
 
236 250
     @objc func showThumps() {
237
-        if detailPageViewModel.thumbupsCount > 0 {
238
-            detailPageViewModel.thumbupsCount = 0
239
-        } else {
240
-            detailPageViewModel.thumbupsCount = detailPageViewModel.thumbups.count
241
-        }
251
+//        if detailPageViewModel.thumbupsCount > 0 {
252
+//            detailPageViewModel.thumbupsCount = 0
253
+//        } else {
254
+//            detailPageViewModel.thumbupsCount = detailPageViewModel.thumbups.count
255
+//        }
242 256
         reloadSection(inter: 3)
243 257
     }
244 258
     @objc func showComments() {
245
-        if detailPageViewModel.commentsCount > 0 {
246
-            detailPageViewModel.commentsCount = 0
247
-        } else {
248
-            detailPageViewModel.commentsCount = detailPageViewModel.comments.count
249
-        }
259
+//        if detailPageViewModel.commentsCount > 0 {
260
+//            detailPageViewModel.commentsCount = 0
261
+//        } else {
262
+//            detailPageViewModel.commentsCount = detailPageViewModel.comments.count
263
+//        }
250 264
         reloadSection(inter: 4)
251 265
     }
252 266
 
@@ -274,7 +288,7 @@ final class DetailPageController: UIViewController {
274 288
 }
275 289
 
276 290
 // MARK: custom delegate function
277
-extension DetailPageController: CellDelegate {
291
+extension PhotoDetailViewController: CellDelegate {
278 292
     func selectIndex(indexpath: IndexPath) {
279 293
         let ctl = UIStoryboard.photoDetail.instantiateController(ShowFullPicController.self)
280 294
         ctl.datas = datas
@@ -295,7 +309,7 @@ extension DetailPageController: CellDelegate {
295 309
 }
296 310
 
297 311
 //MARK textField delegate
298
-extension DetailPageController: UIGestureRecognizerDelegate {
312
+extension PhotoDetailViewController: UIGestureRecognizerDelegate {
299 313
     // MARK: textField
300 314
 
301 315
     func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
@@ -312,33 +326,33 @@ extension DetailPageController: UIGestureRecognizerDelegate {
312 326
 }
313 327
 
314 328
 // MARK: UITableView delegate
315
-extension DetailPageController: UITableViewDataSource, UITableViewDelegate {
329
+extension PhotoDetailViewController: UITableViewDataSource, UITableViewDelegate {
316 330
 
317 331
     func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
318 332
         if section == 3 {
319 333
             let cell = tableView.dequeueReusableCell(withIdentifier: "thumbupHeadCell")
320 334
             if let label = cell?.viewWithTag(1001) as? UILabel {
321
-                label.text = "(\(detailPageViewModel.thumbups.count))"
335
+//                label.text = "(\(detailPageViewModel.thumbups.count))"
322 336
             }
323 337
             if let button = cell?.viewWithTag(1011) as? UIButton {
324 338
                 button.addTarget(self, action: #selector(showThumps), for: .touchUpInside)
325 339
             }
326 340
             if let imageView = cell?.viewWithTag(1008) as? UIImageView {
327
-                let imageName = detailPageViewModel.thumbupsCount <= 0 ? "收起" : "列表箭头"
328
-                imageView.image = UIImage(named : imageName)
341
+//                let imageName = detailPageViewModel.thumbupsCount <= 0 ? "收起" : "list-arrow"
342
+//                imageView.image = UIImage(named : imageName)
329 343
             }
330 344
             return cell?.contentView
331 345
         } else if section == 4 {
332 346
             let cell = tableView.dequeueReusableCell(withIdentifier: "comentHeadCell")
333 347
             if let label = cell?.viewWithTag(1002) as? UILabel {
334
-                label.text = "(\(detailPageViewModel.comments.count))"
348
+//                label.text = "(\(detailPageViewModel.comments.count))"
335 349
             }
336 350
             if let button = cell?.viewWithTag(1012) as? UIButton {
337 351
                 button.addTarget(self, action: #selector(showComments), for: .touchUpInside)
338 352
             }
339 353
             if let imageView = cell?.viewWithTag(1009) as? UIImageView {
340
-                let imageName = detailPageViewModel.commentsCount <= 0 ? "收起" : "列表箭头"
341
-                imageView.image = UIImage(named : imageName)
354
+//                let imageName = detailPageViewModel.commentsCount <= 0 ? "收起" : "list-arrow"
355
+//                imageView.image = UIImage(named : imageName)
342 356
             }
343 357
             return cell?.contentView
344 358
         }
@@ -357,11 +371,11 @@ extension DetailPageController: UITableViewDataSource, UITableViewDelegate {
357 371
     }
358 372
 
359 373
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
360
-        if section == 3 {
361
-            return detailPageViewModel.thumbupsCount > 0 ? 1 : 0
362
-        } else if section == 4 {
363
-            return detailPageViewModel.commentsCount
364
-        }
374
+//        if section == 3 {
375
+//            return detailPageViewModel.thumbupsCount > 0 ? 1 : 0
376
+//        } else if section == 4 {
377
+//            return detailPageViewModel.commentsCount
378
+//        }
365 379
         return 0
366 380
     }
367 381
 
@@ -391,14 +405,14 @@ extension DetailPageController: UITableViewDataSource, UITableViewDelegate {
391 405
             return cell
392 406
         } else if indexPath.section == 3 {
393 407
             let cell = tableView.dequeueReusableCell(withIdentifier: "thumbupCell", for: indexPath) as! DetailthumbupImagesCell
394
-            if detailPageViewModel.thumbups.count > 0 {
395
-                let headers = detailPageViewModel.thumbups.map {$0.avatar}
396
-                cell.setInfo(content: headers)
397
-            }
408
+//            if detailPageViewModel.thumbups.count > 0 {
409
+//                let headers = detailPageViewModel.thumbups.map {$0.avatar}
410
+//                cell.setInfo(content: headers)
411
+//            }
398 412
             return cell
399 413
         } else {
400 414
             let cell = tableView.dequeueReusableCell(withIdentifier: "comentCell", for: indexPath) as! DetailCommentCell
401
-            cell.setInfo(detailPageViewModel.comments[indexPath.row])
415
+//            cell.setInfo(detailPageViewModel.comments[indexPath.row])
402 416
             return cell
403 417
         }
404 418
     }
@@ -418,3 +432,7 @@ extension DetailPageController: UITableViewDataSource, UITableViewDelegate {
418 432
         }
419 433
     }
420 434
 }
435
+
436
+extension PhotoDetailViewController {
437
+    
438
+}

+ 4 - 4
PaiAi/Paiai_iOS/App/PhotoDetail/ShowFullPicController.swift

@@ -13,7 +13,7 @@ import PaiaiUIKit
13 13
 final class ShowFullPicController: UIViewController {
14 14
 
15 15
     // MARK: Storyboard property
16
-    @IBOutlet var collectionView: UICollectionView!
16
+    @IBOutlet weak var collectionView: UICollectionView!
17 17
 //    @IBOutlet weak var progressView: FFProgress!
18 18
    // MARK: parameter property
19 19
     lazy var datas = [PhotoItem]()
@@ -44,11 +44,11 @@ final class ShowFullPicController: UIViewController {
44 44
     // MARK: Storyboard  button function
45 45
     @IBAction  func back() {
46 46
          _ = navigationController?.popViewController(animated: true)
47
-        guard let ctl = navigationController?.viewControllers.last as? DetailPageController else {
47
+        guard let ctl = navigationController?.viewControllers.last as? PhotoDetailViewController else {
48 48
             return
49 49
         }
50
-        ctl.currentPhotoIndex = currentPageIndex
51
-        ctl.tableView.reloadData()
50
+//        ctl.currentPhotoIndex = currentPageIndex
51
+//        ctl.tableView.reloadData()
52 52
     }
53 53
     @IBAction func rotateTheImage(_ sender: UIButton) {
54 54
         guard let cell = collectionView.cellForItem(at: IndexPath(item: currentPageIndex, section: 0)) as? ImageCell else {

+ 21 - 0
PaiAi/Paiai_iOS/App/PhotoDetail/ShareView.swift

@@ -0,0 +1,21 @@
1
+//
2
+//  ShareView.swift
3
+//  Paiai_iOS
4
+//
5
+//  Created by ffib on 2019/3/21.
6
+//  Copyright © 2019 yb. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+class ShareView: UIView {
12
+
13
+    /*
14
+    // Only override draw() if you perform custom drawing.
15
+    // An empty implementation adversely affects performance during animation.
16
+    override func draw(_ rect: CGRect) {
17
+        // Drawing code
18
+    }
19
+    */
20
+
21
+}

Влизане - Gogs: Go Git Service

Влизане