Commit 20b901f6f9ef70ab2109e266200344823b2b5cd8
1 parent
5400af31
添加物流详情及注销账号
Showing
12 changed files
with
395 additions
and
36 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -112,6 +112,7 @@ |
| 112 | 112 | 79BB96AA2AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */; }; |
| 113 | 113 | 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */; }; |
| 114 | 114 | 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */; }; |
| 115 | + 79E672032AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E672022AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift */; }; | |
| 115 | 116 | 79EABB892AB4497700F3A4E2 /* CNLiveSaveStandDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */; }; |
| 116 | 117 | 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */; }; |
| 117 | 118 | 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */; }; |
| ... | ... | @@ -276,6 +277,7 @@ |
| 276 | 277 | 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyDetailView.swift; sourceTree = "<group>"; }; |
| 277 | 278 | 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+CNLiveExtension.swift"; sourceTree = "<group>"; }; |
| 278 | 279 | 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMutableAttributedString+CNLiveExtensions.swift"; sourceTree = "<group>"; }; |
| 280 | + 79E672022AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineSignOutViewController.swift; sourceTree = "<group>"; }; | |
| 279 | 281 | 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveStandDB.swift; sourceTree = "<group>"; }; |
| 280 | 282 | 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoViewController.swift; sourceTree = "<group>"; }; |
| 281 | 283 | 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineNickViewController.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -517,6 +519,7 @@ |
| 517 | 519 | 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */, |
| 518 | 520 | 7905BB482AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift */, |
| 519 | 521 | 79803E262AD68D3100F05F68 /* CNLiveMineShopViewController.swift */, |
| 522 | + 79E672022AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift */, | |
| 520 | 523 | ); |
| 521 | 524 | path = Controller; |
| 522 | 525 | sourceTree = "<group>"; |
| ... | ... | @@ -1147,6 +1150,7 @@ |
| 1147 | 1150 | 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */, |
| 1148 | 1151 | 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */, |
| 1149 | 1152 | 19BB202B2AF382150094D962 /* CNLiveAdaptTool.swift in Sources */, |
| 1153 | + 79E672032AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift in Sources */, | |
| 1150 | 1154 | 19565ECD2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift in Sources */, |
| 1151 | 1155 | 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */, |
| 1152 | 1156 | 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */, | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveInfoShowViewController.swift
| ... | ... | @@ -13,6 +13,7 @@ enum ListShowInfoType { |
| 13 | 13 | case privacy |
| 14 | 14 | case yinsi |
| 15 | 15 | case safety |
| 16 | + case cancel | |
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | class CNLiveInfoShowViewController: CNLiveBaseViewController, WKNavigationDelegate, WKUIDelegate { |
| ... | ... | @@ -68,6 +69,9 @@ class CNLiveInfoShowViewController: CNLiveBaseViewController, WKNavigationDelega |
| 68 | 69 | case .safety: |
| 69 | 70 | titleName = "内容安全协议" |
| 70 | 71 | attrString = "https://wjj.ys1.cnliveimg.com/term/cnBNraqxy.html" |
| 72 | + case .cancel: | |
| 73 | + titleName = "账号注销须知" | |
| 74 | + attrString = "https://wjjh5.cnlive.com/yuanmaLogout.html" | |
| 71 | 75 | case .none: |
| 72 | 76 | break |
| 73 | 77 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineShopViewController.swift
| ... | ... | @@ -408,7 +408,6 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat |
| 408 | 408 | self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(StandListModel.init(), show_type: .detail_shop), animated: true) |
| 409 | 409 | } |
| 410 | 410 | } else { |
| 411 | - self.navigationController | |
| 412 | 411 | } |
| 413 | 412 | }) |
| 414 | 413 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineSignOutViewController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveMineSignOutViewController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by open on 2023/11/10. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import WebKit | |
| 10 | +import APButton | |
| 11 | + | |
| 12 | +class CNLiveMineSignOutViewController: CNLiveBaseViewController, WKNavigationDelegate, WKUIDelegate, UITextViewDelegate { | |
| 13 | + | |
| 14 | + lazy var webView: WKWebView = { | |
| 15 | + let config = WKWebViewConfiguration.init() | |
| 16 | + config.preferences = WKPreferences() | |
| 17 | + config.preferences.javaScriptEnabled = true | |
| 18 | + config.preferences.javaScriptCanOpenWindowsAutomatically = false | |
| 19 | + config.userContentController = WKUserContentController.init() | |
| 20 | + | |
| 21 | + let userController = WKUserContentController.init() | |
| 22 | + let js = "var script = document.createElement('meta'); script.name = 'viewport'; script.content=\"width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, user-scalable=no\"; document.getElementsByTagName('div')[0].appendChild(script);" | |
| 23 | + let script = WKUserScript.init(source: js, injectionTime: .atDocumentEnd, forMainFrameOnly: false) | |
| 24 | + | |
| 25 | + let javascript = NSMutableString.init() | |
| 26 | + javascript.append("document.documentElement.style.webkitTouchCallout='none';") | |
| 27 | + javascript.append("document.documentElement.style.webkitUserSelect='none';") | |
| 28 | + let noneSelectScript = WKUserScript.init(source: javascript as String, injectionTime: .atDocumentEnd, forMainFrameOnly: true) | |
| 29 | + userController.addUserScript(script) | |
| 30 | + userController.addUserScript(noneSelectScript) | |
| 31 | + config.userContentController = userController | |
| 32 | + | |
| 33 | + let webView = WKWebView.init(frame: CGRect.zero, configuration: config) | |
| 34 | + webView.navigationDelegate = self | |
| 35 | + webView.uiDelegate = self | |
| 36 | + webView.scrollView.bounces = false | |
| 37 | + webView.scrollView.showsVerticalScrollIndicator = false | |
| 38 | + webView.scrollView.showsHorizontalScrollIndicator = false | |
| 39 | + webView.load(URLRequest.init(url: URL(string: "https://wjjh5.cnlive.com/yuanmaLogoutApplication.html")!)) | |
| 40 | + return webView | |
| 41 | + }() | |
| 42 | + | |
| 43 | + lazy var selectButton: HotButton = { | |
| 44 | + let selectButton = HotButton(type: .custom) | |
| 45 | + selectButton.backgroundColor = .clear | |
| 46 | + selectButton.setImage(UIImage(named: "Login_body_choose_btn_nomal"), for: .normal) | |
| 47 | + selectButton.setImage(UIImage(named: "Login_body_choose_btn_nomal"), for: .highlighted) | |
| 48 | + selectButton.setImage(UIImage(named: "Login_body_choose_btn_select"), for: .selected) | |
| 49 | + selectButton.contentMode = .scaleAspectFill | |
| 50 | + selectButton.addTarget(self, action: #selector(changeSelectBtnMothod), for: .touchUpInside) | |
| 51 | + return selectButton | |
| 52 | + }() | |
| 53 | + | |
| 54 | + lazy var textView: UITextView = { | |
| 55 | + let attributedString = NSMutableAttributedString(string: "我已阅读并同意《注销协议》", | |
| 56 | + attributes: [.foregroundColor: HexColor("#999999") as Any, .font: regular_adapt_font(pointSize: 12)]) | |
| 57 | + let p_Range = NSRange(attributedString.string.range(of: "《注销协议》")!, in: attributedString.string) | |
| 58 | + attributedString.addAttribute(.link, value: "delegate://", range: p_Range) | |
| 59 | + let textView: UITextView = UITextView.init() | |
| 60 | + textView.backgroundColor = .clear | |
| 61 | + textView.isEditable = false | |
| 62 | + textView.isScrollEnabled = false | |
| 63 | + textView.delegate = self | |
| 64 | + textView.attributedText = attributedString | |
| 65 | + return textView | |
| 66 | + }() | |
| 67 | + | |
| 68 | + lazy var doneButton: APButton = { | |
| 69 | + let doneButton = APButton() | |
| 70 | + doneButton.setTitle("确认注销", for: .normal) | |
| 71 | + doneButton.setTitleColor(.white, for: .normal) | |
| 72 | + doneButton.titleLabel?.font = BoldFont_16_Fit | |
| 73 | + doneButton.layer.cornerRadius = adapt_length(length: 20) | |
| 74 | + doneButton.activityIndicator.color = .white | |
| 75 | + doneButton.layer.masksToBounds = true | |
| 76 | + doneButton.addTarget(self, action: #selector(sendDoneActionMothod), for: .touchUpInside) | |
| 77 | + return doneButton | |
| 78 | + }() | |
| 79 | + | |
| 80 | + var is_agree: Bool! | |
| 81 | + override func viewDidLoad() { | |
| 82 | + super.viewDidLoad() | |
| 83 | + navigationBarHidden = false | |
| 84 | + view.backgroundColor = .white | |
| 85 | + titleName = "审核申请" | |
| 86 | + | |
| 87 | + view.addSubview(webView) | |
| 88 | + webView.snp.makeConstraints { make in | |
| 89 | + make.top.equalToSuperview().offset(KNavigationHeight) | |
| 90 | + make.right.left.equalToSuperview() | |
| 91 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 110) + get_system_tabbar_ui_offsetHeight()) | |
| 92 | + } | |
| 93 | + | |
| 94 | + view.addSubview(doneButton) | |
| 95 | + doneButton.snp.makeConstraints { make in | |
| 96 | + make.centerX.equalToSuperview() | |
| 97 | + make.bottom.equalToSuperview().offset(-(get_system_tabbar_ui_offsetHeight()+adapt_length(length: 10))) | |
| 98 | + make.left.equalToSuperview().offset(adapt_length(length: 20)) | |
| 99 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | |
| 100 | + make.height.equalTo(adapt_length(length: 40)) | |
| 101 | + } | |
| 102 | + | |
| 103 | + view.addSubview(textView) | |
| 104 | + textView.snp.makeConstraints { make in | |
| 105 | + make.left.equalToSuperview().offset(adapt_length(length: 40)) | |
| 106 | + make.bottom.equalTo(doneButton.snp.top).offset(-adapt_length(length: 10)) | |
| 107 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | |
| 108 | + } | |
| 109 | + | |
| 110 | + view.addSubview(selectButton) | |
| 111 | + selectButton.snp.makeConstraints { make in | |
| 112 | + make.centerY.equalTo(textView) | |
| 113 | + make.left.equalToSuperview().offset(adapt_length(length: 20)) | |
| 114 | + make.size.equalTo(adapt_length(length: 25)) | |
| 115 | + } | |
| 116 | + | |
| 117 | + doneButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 0.3),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | |
| 118 | + } | |
| 119 | + | |
| 120 | + @objc func changeSelectBtnMothod(sender : UIButton) { | |
| 121 | + sender.isSelected = !sender.isSelected | |
| 122 | + is_agree = sender.isSelected | |
| 123 | + if is_agree { | |
| 124 | + doneButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | |
| 125 | + } else { | |
| 126 | + doneButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 0.3),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 0.3)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | |
| 127 | + } | |
| 128 | + } | |
| 129 | + | |
| 130 | + private func setupWithSendBtnStatue(statue: Bool) { | |
| 131 | + var alpha = 0.3 | |
| 132 | + if statue { | |
| 133 | + alpha = 1 | |
| 134 | + } | |
| 135 | + doneButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: alpha),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: alpha)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | |
| 136 | + } | |
| 137 | + | |
| 138 | + @objc func sendDoneActionMothod(sender: APButton) { | |
| 139 | + if !is_agree { | |
| 140 | + showMessage(message: "请先阅读并同意协议") | |
| 141 | + return | |
| 142 | + } | |
| 143 | + AlertTool.showSystemAlert(title: "注销将会清除您在元码上的个人信息和购买的所有权益,且不可恢复,确定注销吗?", message: "", actionTitles: ["确定","取消"], style: .alert) { index in | |
| 144 | + if index == 1 { | |
| 145 | + sender.startAnimating() | |
| 146 | + CNLiveMineViewModel.requestSignOut { [weak self] result, respStatue in | |
| 147 | + sender.stopAnimating() | |
| 148 | + if respStatue == .success { | |
| 149 | + let message = result as! String | |
| 150 | + if message == "455" { | |
| 151 | + showMessage(message: "账号已经在注销中,请等待") | |
| 152 | + self!.navigationController?.popViewController(animated: true) | |
| 153 | + } else { | |
| 154 | + UserDefaults.standard.set(false,forKey: "is_login") | |
| 155 | + UserInfoManager.clearUserInfo() | |
| 156 | + let window = UIApplication.shared.delegate?.window | |
| 157 | + window??.rootViewController = CNLiveLoginViewController.init() | |
| 158 | + } | |
| 159 | + } | |
| 160 | + } | |
| 161 | + } | |
| 162 | + } | |
| 163 | + } | |
| 164 | + | |
| 165 | + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
| 166 | + hiddenLoading() | |
| 167 | + } | |
| 168 | + | |
| 169 | + func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { | |
| 170 | + loadHTMLString() | |
| 171 | + hiddenLoading() | |
| 172 | + } | |
| 173 | + | |
| 174 | + func loadHTMLString() { | |
| 175 | + let htmlContent = "<div style=\"padding:0 5px;\"><p style=\"font-size:1.0625em;\"><strong>我们对你注销元码账号的决定深表遗憾。如果你仍执意注销账号,你的账号需同时满足以下条件:</strong></p><hr style=\"background-color:#EEEEEE;height:1px;border:none;\"/><p style=\"font-size:1em;\">1.账号处于安全状态: 最近1个月内无绑定手机/修改手机号、无找回密码/修改密码等操作,账号为正常使用中且在1年内无任何账号被限制的记录。</p><hr style=\"background-color:#EEEEEE;height:1px;border:none;\"/><p style=\"font-size:1em;\">2.账号财产已结清,没有未完成和/或存在争议的服务: 账号中没有资产、欠款、未结清的资金和虚拟权益;本账号及通过本账号接入的第三方中没有未完成和/或存在争议的服务。</p><hr style=\"background-color:#EEEEEE;height:1px;border:none;\"/><p style=\"font-size:1em;\">3.账号权限解除: 账号已解除与其他产品、网站授权登录或绑定关系。</p><hr style=\"background-color:#EEEEEE;height:1px;border:none;\"/><p style=\"font-size:1em;\">4.账号无任何纠纷,包括投诉举报或被投诉举报。</p></div>" | |
| 176 | + webView.loadHTMLString(htmlContent, baseURL: URL(string: "")) | |
| 177 | + } | |
| 178 | +} | |
| 179 | +extension CNLiveMineSignOutViewController { | |
| 180 | + func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { | |
| 181 | + return false | |
| 182 | + } | |
| 183 | + func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { | |
| 184 | + if URL.absoluteString == "delegate://" { | |
| 185 | + self.navigationController?.pushViewController(CNLiveInfoShowViewController.init(show_type: .cancel, is_login: true), animated: true) | |
| 186 | + return false | |
| 187 | + } | |
| 188 | + return true | |
| 189 | + } | |
| 190 | +} | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
| ... | ... | @@ -46,7 +46,7 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, |
| 46 | 46 | dataArray.add(array03) |
| 47 | 47 | |
| 48 | 48 | |
| 49 | - dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]]) | |
| 49 | +// dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]]) | |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | return dataArray | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveTypeFeedBackViewController.swift
| ... | ... | @@ -45,6 +45,7 @@ class CNLiveTypeFeedBackViewController : CNLiveBaseViewController, UITableViewDe |
| 45 | 45 | if _show_type == .setting { |
| 46 | 46 | dataArray.add(["icon":"mine_list_sub_set_privacy","name":"隐私"]) |
| 47 | 47 | dataArray.add(["icon":"mine_list_sub_set_about","name":"关于我们"]) |
| 48 | + dataArray.add(["icon":"mine_list_sub_set_about","name":"注销账号"]) | |
| 48 | 49 | } |
| 49 | 50 | if _show_type == .privacy { |
| 50 | 51 | dataArray.add(["icon":"","name":"系统权限管理"]) |
| ... | ... | @@ -276,6 +277,9 @@ extension CNLiveTypeFeedBackViewController { |
| 276 | 277 | if indexPath.section == 1 { |
| 277 | 278 | self.navigationController?.pushViewController(CNLiveTypeFeedBackViewController.init(show_type: .about), animated: true) |
| 278 | 279 | } |
| 280 | + if indexPath.section == 2 { | |
| 281 | + self.navigationController?.pushViewController(CNLiveMineSignOutViewController.init(), animated: true) | |
| 282 | + } | |
| 279 | 283 | } |
| 280 | 284 | if _show_type == .privacy { |
| 281 | 285 | if indexPath.section == 0 { | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -938,6 +938,43 @@ class CNLiveMineViewModel: NSObject { |
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | + /// 注销账号 | |
| 942 | + /// - Parameter resultBlock: 返回结果 | |
| 943 | + static func requestSignOut(resultBlock: @escaping resultNewsBlock) { | |
| 944 | + let param = NSMutableDictionary() | |
| 945 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "loginSid") | |
| 946 | + let custom_param = NSMutableDictionary() | |
| 947 | + custom_param.setValue(APPId_wjj, forKey: "appId") | |
| 948 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | |
| 949 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 950 | + CNLiveNetworking.setupShowDataResult(false) | |
| 951 | + CNLiveNetworking.setupSignRequestKey(APPKey_wjj) | |
| 952 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 953 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjUrl+"/Daren/common/cancellationAccount.action", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in | |
| 954 | + hiddenLoading() | |
| 955 | + if (error == nil) { | |
| 956 | + let resp = result as! NSDictionary | |
| 957 | + let errorCode = "\(resp["errorCode"] ?? "0")" | |
| 958 | + if (errorCode == "0") { | |
| 959 | + resultBlock("提交成功",.success) | |
| 960 | + } else if (errorCode == "455") { | |
| 961 | + resultBlock("455",.success) | |
| 962 | + } else { | |
| 963 | + showMessage(message: resp["errorMessage"] as! String) | |
| 964 | + resultBlock(NSNull(),.failed) | |
| 965 | + } | |
| 966 | + } else { | |
| 967 | + if CNLiveNetworking.isNetworking() { | |
| 968 | + showMessage(message: "获取失败") | |
| 969 | + resultBlock(NSNull(),.failed) | |
| 970 | + } else { | |
| 971 | + showMessage(message: "似乎与网络断开链接") | |
| 972 | + resultBlock(NSNull(),.noNetwork) | |
| 973 | + } | |
| 974 | + } | |
| 975 | + } | |
| 976 | + } | |
| 977 | + | |
| 941 | 978 | static func log(resp: Any) { |
| 942 | 979 | do { |
| 943 | 980 | let jsonData = try JSONSerialization.data(withJSONObject: resp, options: .prettyPrinted) | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderDetailViewController.swift
| ... | ... | @@ -197,7 +197,7 @@ extension CNLiveShopOrderDetailViewController { |
| 197 | 197 | if detailModel.send_num > 1 || detailModel.is_send == "0" { |
| 198 | 198 | self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: detailModel.id! as NSString), animated: true) |
| 199 | 199 | } else { |
| 200 | - | |
| 200 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: "1000021749", expId: "0", express_num: "1234556789012345", show_type: .orderExpress, progress: .Zero), animated: true) | |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressDetailViewController.swift
| ... | ... | @@ -18,17 +18,17 @@ enum CNLiveShopOrderExpressDetailYBYProgress { |
| 18 | 18 | } |
| 19 | 19 | class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate { |
| 20 | 20 | |
| 21 | - | |
| 21 | + let kShopBodyOrderExpressDetailTableViewCellIdentifier = "kShopBodyOrderExpressDetailTableViewCellIdentifier" | |
| 22 | 22 | lazy var tableView : UITableView = { |
| 23 | 23 | let tableView = UITableView(frame: .zero, style: .plain) |
| 24 | 24 | tableView.dataSource = self |
| 25 | 25 | tableView.delegate = self |
| 26 | 26 | tableView.emptyDataSetSource = self |
| 27 | 27 | tableView.emptyDataSetDelegate = self |
| 28 | - tableView.backgroundColor = HexColor("#f1f2f6") | |
| 28 | + tableView.backgroundColor = .white | |
| 29 | 29 | tableView.tableFooterView = UIView.init() |
| 30 | 30 | tableView.separatorStyle = .none |
| 31 | - tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCellIdentifier") | |
| 31 | + tableView.register(ShopBodyOrderExpressDetailTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderExpressDetailTableViewCellIdentifier) | |
| 32 | 32 | return tableView |
| 33 | 33 | }() |
| 34 | 34 | |
| ... | ... | @@ -37,19 +37,25 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa |
| 37 | 37 | return dataArray |
| 38 | 38 | }() |
| 39 | 39 | |
| 40 | + lazy var temp_array: NSMutableArray = { | |
| 41 | + let temp_array = NSMutableArray.init() | |
| 42 | + return temp_array | |
| 43 | + }() | |
| 44 | + | |
| 40 | 45 | var _expId: NSString! |
| 41 | 46 | var _orderId: NSString! |
| 42 | 47 | var _refundId: NSString! |
| 43 | 48 | var _express_num: NSString! |
| 44 | - var expressModel: ShopOrderExpressDetailModel! | |
| 49 | + var expressModel: ShopOrderExpressModel! | |
| 45 | 50 | var _show_type: CNLiveShopOrderExpressDetailShowType! |
| 46 | 51 | var _progress: CNLiveShopOrderExpressDetailYBYProgress! |
| 47 | 52 | var network_type: CNLiveMineResponseType! |
| 48 | - init(orderId: NSString, expId: NSString, show_type: CNLiveShopOrderExpressDetailShowType, progress: CNLiveShopOrderExpressDetailYBYProgress) { | |
| 53 | + init(orderId: NSString, expId: NSString, express_num: NSString, show_type: CNLiveShopOrderExpressDetailShowType, progress: CNLiveShopOrderExpressDetailYBYProgress) { | |
| 49 | 54 | _orderId = orderId |
| 50 | 55 | _expId = expId |
| 51 | 56 | _show_type = show_type |
| 52 | 57 | _progress = progress |
| 58 | + _express_num = express_num | |
| 53 | 59 | super.init(nibName:nil, bundle:nil) |
| 54 | 60 | } |
| 55 | 61 | |
| ... | ... | @@ -73,19 +79,20 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa |
| 73 | 79 | } |
| 74 | 80 | |
| 75 | 81 | func loadDataSourceAction() { |
| 76 | - CNLiveShopViewModel.requestExpressDetail(orderId: _orderId, expId: _expId, networkType: _show_type) { [weak self] result, respStatue in | |
| 77 | - if respStatue == .success { | |
| 78 | - let expressModel = result as! ShopOrderExpressDetailModel | |
| 79 | - self!.dataArray.addObjects(from: expressModel.data) | |
| 80 | - self!.tableView.reloadData() | |
| 81 | - }else if (respStatue == .noNetwork) { | |
| 82 | - self!.network_type = .noNetwork | |
| 83 | - self!.tableView.reloadEmptyDataSet() | |
| 84 | - } else { | |
| 85 | - self!.network_type = .failed | |
| 86 | - self!.tableView.reloadEmptyDataSet() | |
| 87 | - } | |
| 88 | - } | |
| 82 | +// showLoading(message: "") | |
| 83 | +// CNLiveShopViewModel.requestExpressDetail(orderId: _orderId, expId: _expId, networkType: _show_type) { [weak self] result, respStatue in | |
| 84 | +// if respStatue == .success { | |
| 85 | +// self!.expressModel = (result as! ShopOrderExpressDetailModel).express | |
| 86 | +// self!.dataArray.addObjects(from: (result as! ShopOrderExpressDetailModel).data) | |
| 87 | +// self!.tableView.reloadData() | |
| 88 | +// }else if (respStatue == .noNetwork) { | |
| 89 | +// self!.network_type = .noNetwork | |
| 90 | +// self!.tableView.reloadEmptyDataSet() | |
| 91 | +// } else { | |
| 92 | +// self!.network_type = .failed | |
| 93 | +// self!.tableView.reloadEmptyDataSet() | |
| 94 | +// } | |
| 95 | +// } | |
| 89 | 96 | } |
| 90 | 97 | } |
| 91 | 98 | |
| ... | ... | @@ -94,16 +101,42 @@ extension CNLiveShopOrderExpressDetailViewController { |
| 94 | 101 | return 1 |
| 95 | 102 | } |
| 96 | 103 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| 97 | - return self.dataArray.count | |
| 104 | +// if _show_type == .orderExpress || _show_type == .refundExpress { | |
| 105 | +// return dataArray.count == 0 ? 0 : dataArray.count + 1 | |
| 106 | +// } else { | |
| 107 | + return self.dataArray.count | |
| 108 | +// } | |
| 98 | 109 | } |
| 99 | 110 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 100 | - guard let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCellIdentifier") else { | |
| 101 | - return UITableViewCell() | |
| 102 | - } | |
| 103 | - return cell | |
| 111 | + return UITableViewCell.init() | |
| 112 | +// guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderExpressDetailTableViewCellIdentifier) as? ShopBodyOrderExpressDetailTableViewCell else { | |
| 113 | +// return ShopBodyOrderExpressDetailTableViewCell() | |
| 114 | +// } | |
| 115 | +// var isLastRow: Bool = false | |
| 116 | +// var detailModel: ShopOrderExpressDetailDateModel! | |
| 117 | +// if _show_type == .orderExpress || _show_type == .refundExpress { | |
| 118 | +// if indexPath.row == 0 { | |
| 119 | +// detailModel = ShopOrderExpressDetailDateModel() | |
| 120 | +// } else { | |
| 121 | +// detailModel = (dataArray[indexPath.row - 1] as! ShopOrderExpressDetailDateModel) | |
| 122 | +// } | |
| 123 | +// if indexPath.row == dataArray.count { | |
| 124 | +// isLastRow = true | |
| 125 | +// } | |
| 126 | +// } else { | |
| 127 | +// detailModel = (dataArray[indexPath.row] as! ShopOrderExpressDetailDateModel) | |
| 128 | +// if indexPath.row == dataArray.count - 1 { | |
| 129 | +// isLastRow = true | |
| 130 | +// } | |
| 131 | +// } | |
| 132 | +// cell.setupDataSource(dataModel: detailModel, row: indexPath.row, isLastRow: isLastRow, type: _show_type, address: expressModel.address! as NSString, express_state: expressModel.state! as NSString, temp_array: temp_array) | |
| 133 | +// return cell | |
| 104 | 134 | } |
| 135 | +// func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { | |
| 136 | +// return adapt_length(length: 80) | |
| 137 | +// } | |
| 105 | 138 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| 106 | - return adapt_length(length: 0.01) | |
| 139 | + return 0.01 | |
| 107 | 140 | } |
| 108 | 141 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 109 | 142 | } | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderListViewController.swift
| ... | ... | @@ -280,10 +280,10 @@ extension CNLiveShopOrderListViewController { |
| 280 | 280 | /// - Parameter detailModel: 数据源 |
| 281 | 281 | private func pushExpressVC(listModel: ShopOrderListModel) { |
| 282 | 282 | if listModel.send_num > 1 || listModel.is_send == "0" { |
| 283 | -// self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true) | |
| 284 | - self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true) | |
| 283 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true) | |
| 284 | +// self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true) | |
| 285 | 285 | } else { |
| 286 | -// self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(), animated: true) | |
| 286 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: "1000021749", expId: "0", express_num: "1234556789012345", show_type: .orderExpress, progress: .Zero), animated: true) | |
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | ... | ... |
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyExpressView.swift
| ... | ... | @@ -168,7 +168,7 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | @objc func pushExpressDetail() { |
| 171 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: _listModel.id! as NSString, expId: _listModel.express_num! as NSString, show_type: .orderExpress, progress: .Zero), animated: true) | |
| 171 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: _listModel.id! as NSString, expId: _listModel.express_num! as NSString, express_num: _listModel.express_num! as NSString, show_type: .orderExpress, progress: .Zero), animated: true) | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | @objc func actionClick(sender: UIButton) { |
| ... | ... | @@ -256,7 +256,7 @@ class ShopBodyOrderExpressDetailHeaderView: UIView { |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
| 259 | -class ShopBodyOrderExpressDetailTableView: UITableViewCell, UITextViewDelegate { | |
| 259 | +class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelegate { | |
| 260 | 260 | |
| 261 | 261 | lazy var lineLabel: UILabel = { |
| 262 | 262 | let lineLabel = UILabel.init() |
| ... | ... | @@ -295,12 +295,15 @@ class ShopBodyOrderExpressDetailTableView: UITableViewCell, UITextViewDelegate { |
| 295 | 295 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 296 | 296 | contentView.backgroundColor = .white |
| 297 | 297 | selectionStyle = .none |
| 298 | + _have_layout = false | |
| 298 | 299 | |
| 299 | 300 | addSubview(lineLabel) |
| 300 | 301 | addSubview(pointImageView) |
| 301 | 302 | addSubview(titleTextView) |
| 302 | 303 | addSubview(timeLabel) |
| 303 | 304 | addSubview(bottomLine) |
| 305 | + | |
| 306 | + initLayout() | |
| 304 | 307 | } |
| 305 | 308 | |
| 306 | 309 | func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { |
| ... | ... | @@ -319,14 +322,14 @@ class ShopBodyOrderExpressDetailTableView: UITableViewCell, UITextViewDelegate { |
| 319 | 322 | return false |
| 320 | 323 | } |
| 321 | 324 | |
| 322 | - | |
| 325 | + var _have_layout: Bool! | |
| 323 | 326 | var _dataModel: ShopOrderExpressDetailDateModel! |
| 324 | 327 | var _row: NSInteger! |
| 325 | 328 | var _isLastRow: Bool! |
| 326 | 329 | var _type: CNLiveShopOrderExpressDetailShowType! |
| 327 | 330 | var _address: NSString! |
| 328 | 331 | var _express_state: NSString! |
| 329 | - func setupDataSource(dataModel: ShopOrderExpressDetailDateModel, row: NSInteger, isLastRow: Bool, type: CNLiveShopOrderExpressDetailShowType, address: NSString, express_state: NSString) { | |
| 332 | + func setupDataSource(dataModel: ShopOrderExpressDetailDateModel, row: NSInteger, isLastRow: Bool, type: CNLiveShopOrderExpressDetailShowType, address: NSString, express_state: NSString, temp_array: NSMutableArray) { | |
| 330 | 333 | _dataModel = dataModel |
| 331 | 334 | _row = row |
| 332 | 335 | _isLastRow = isLastRow |
| ... | ... | @@ -362,6 +365,18 @@ class ShopBodyOrderExpressDetailTableView: UITableViewCell, UITextViewDelegate { |
| 362 | 365 | pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15)) |
| 363 | 366 | pointImageView.layer.cornerRadius = 0 |
| 364 | 367 | pointImageView.layer.masksToBounds = false |
| 368 | + } else { | |
| 369 | + let title = NSMutableAttributedString.init(string: dataModel.AcceptStation!, attributes: [.font:medium_adapt_font(pointSize: 12),.foregroundColor:HexColor("#b4b4b4")!,.paragraphStyle:para.copy()]) | |
| 370 | + titleTextView.attributedText = setHyperlinksAttrStr(attrStr: title) | |
| 371 | + timeLabel.text = dataModel.AcceptTime | |
| 372 | + | |
| 373 | + pointImageView.image = nil | |
| 374 | + pointImageView.backgroundColor = backgroundColor | |
| 375 | + pointImageView.size = CGSize(width: adapt_length(length: 5), height: adapt_length(length: 5)) | |
| 376 | + pointImageView.layer.cornerRadius = pointImageView.height/2 | |
| 377 | + pointImageView.layer.masksToBounds = true | |
| 378 | + pointImageView.layer.borderColor = HexColor("#d2d2d2")?.cgColor | |
| 379 | + pointImageView.layer.borderWidth = adapt_length(length: 1) | |
| 365 | 380 | } |
| 366 | 381 | } else { |
| 367 | 382 | titleTextView.font = medium_adapt_font(pointSize: 14) |
| ... | ... | @@ -389,7 +404,80 @@ class ShopBodyOrderExpressDetailTableView: UITableViewCell, UITextViewDelegate { |
| 389 | 404 | } |
| 390 | 405 | titleTextView.sizeToFit() |
| 391 | 406 | |
| 392 | - | |
| 407 | +// if !temp_array.contains(dataModel.AcceptTime!) { | |
| 408 | + | |
| 409 | +// temp_array.add(dataModel.AcceptTime!) | |
| 410 | +// } | |
| 411 | + } | |
| 412 | + | |
| 413 | + func initLayout() { | |
| 414 | + lineLabel.snp.makeConstraints { make in | |
| 415 | + make.centerX.equalTo(pointImageView) | |
| 416 | + make.top.bottom.equalToSuperview() | |
| 417 | + make.width.equalTo(adapt_length(length: 1)) | |
| 418 | + } | |
| 419 | + pointImageView.snp.makeConstraints { make in | |
| 420 | + make.top.equalToSuperview().offset(adapt_length(length: 16)) | |
| 421 | + make.left.equalTo(adapt_length(length: 20)) | |
| 422 | + make.size.equalTo(pointImageView.size) | |
| 423 | + } | |
| 424 | + } | |
| 425 | + | |
| 426 | + func setupLayout() { | |
| 427 | + if _row == 0 { | |
| 428 | + lineLabel.snp.updateConstraints { make in | |
| 429 | +// make.centerX.equalTo(pointImageView) | |
| 430 | + make.top.equalTo(pointImageView.snp.bottom) | |
| 431 | +// make.bottom.equalToSuperview() | |
| 432 | +// make.width.equalTo(adapt_length(length: 1)) | |
| 433 | + } | |
| 434 | + } else if _isLastRow { | |
| 435 | + lineLabel.snp.updateConstraints { make in | |
| 436 | +// make.centerX.equalTo(pointImageView) | |
| 437 | +// make.top.equalToSuperview() | |
| 438 | + make.bottom.equalTo(pointImageView.snp.top) | |
| 439 | +// make.width.equalTo(adapt_length(length: 1)) | |
| 440 | + } | |
| 441 | + } | |
| 442 | +// else { | |
| 443 | +// lineLabel.snp.makeConstraints { make in | |
| 444 | +// make.centerX.equalTo(pointImageView) | |
| 445 | +// make.top.bottom.equalToSuperview() | |
| 446 | +// make.width.equalTo(adapt_length(length: 1)) | |
| 447 | +// } | |
| 448 | +// } | |
| 449 | + if ((_type == .orderExpress || _type == .refundExpress) && _row == 1) || (_type == .byYourself && _row == 0) { | |
| 450 | + pointImageView.snp.makeConstraints { make in | |
| 451 | + make.top.equalToSuperview().offset(adapt_length(length: 16)) | |
| 452 | + make.left.equalTo(adapt_length(length: 20)) | |
| 453 | + make.size.equalTo(pointImageView.size) | |
| 454 | + } | |
| 455 | + } else { | |
| 456 | + pointImageView.snp.makeConstraints { make in | |
| 457 | + make.top.equalToSuperview().offset(adapt_length(length: 21)) | |
| 458 | + make.left.equalTo(adapt_length(length: 25)) | |
| 459 | + make.size.equalTo(pointImageView.size) | |
| 460 | + } | |
| 461 | + } | |
| 462 | + titleTextView.snp.makeConstraints { make in | |
| 463 | + make.top.equalToSuperview().offset(adapt_length(length: 15)) | |
| 464 | + make.left.equalToSuperview().offset(adapt_length(length: 48)) | |
| 465 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | |
| 466 | + make.height.equalTo(titleTextView.height) | |
| 467 | + } | |
| 468 | + let top = timeLabel.text!.isNotBlank() ? adapt_length(length: 15) : 0 | |
| 469 | + timeLabel.snp.makeConstraints { make in | |
| 470 | + make.top.equalTo(titleTextView.snp.bottom).offset(adapt_length(length: top)) | |
| 471 | + make.left.equalTo(titleTextView.snp.left) | |
| 472 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | |
| 473 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | |
| 474 | + } | |
| 475 | + bottomLine.snp.makeConstraints { make in | |
| 476 | + make.left.equalTo(titleTextView.snp.left) | |
| 477 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | |
| 478 | + make.bottom.equalToSuperview() | |
| 479 | + make.height.equalTo(adapt_length(length: 1)) | |
| 480 | + } | |
| 393 | 481 | } |
| 394 | 482 | |
| 395 | 483 | func setHyperlinksAttrStr(attrStr: NSMutableAttributedString) -> NSAttributedString { | ... | ... |
metaCode/Classes/Other/AppDelegate.swift
| ... | ... | @@ -71,7 +71,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { |
| 71 | 71 | |
| 72 | 72 | let shop_dic : Dictionary = ["Phone-Model":"iPhone","Uid":UserInfoManager.shared.userInfo.uid ,"CFBundleShortVersionString":ver,"Shop-Version":"0.6.2"] |
| 73 | 73 | CNLiveNetworking.setupDSShopParam(shop_dic) |
| 74 | - CNLiveNetworking.setRequestTimeoutInterval(10) | |
| 74 | + CNLiveNetworking.setRequestTimeoutInterval(20) | |
| 75 | 75 | CNLiveNetworking.setupShowDataResult(false) |
| 76 | 76 | CNLiveNetworking.setupSignKey(APPKey) |
| 77 | 77 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | ... | ... |