From: liangzhenying <867174124@qq.com> Date: Tue, 28 Oct 2025 07:24:02 +0000 (+0800) Subject: 录音详情增加popView X-Git-Tag: 1.0.2~83 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=f0813424784095bb4510ace21a73c139204490e6;p=mirrors%2FShenYin.git 录音详情增加popView --- diff --git a/ShenYin/ShenYin.xcodeproj/project.pbxproj b/ShenYin/ShenYin.xcodeproj/project.pbxproj index 43208ce..1a0c3e3 100644 --- a/ShenYin/ShenYin.xcodeproj/project.pbxproj +++ b/ShenYin/ShenYin.xcodeproj/project.pbxproj @@ -187,10 +187,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ShenYin/Pods-ShenYin-frameworks.sh\"\n"; diff --git a/ShenYin/ShenYin/Api/Config.swift b/ShenYin/ShenYin/Api/Config.swift index 7172427..02e7245 100644 --- a/ShenYin/ShenYin/Api/Config.swift +++ b/ShenYin/ShenYin/Api/Config.swift @@ -6,8 +6,7 @@ // class Config{ - static let privacyUrl = "https://app-api.deepchords.com/cmp-page/privacy.html" - static let userUrl = "https://app-api.deepchords.com/cmp-page/user.html" + static var appLanguage = AppSupportLanguage.chinse } diff --git a/ShenYin/ShenYin/Api/HttpClient2.swift b/ShenYin/ShenYin/Api/HttpClient2.swift index 608ebf9..e8d47d1 100644 --- a/ShenYin/ShenYin/Api/HttpClient2.swift +++ b/ShenYin/ShenYin/Api/HttpClient2.swift @@ -36,6 +36,10 @@ enum CommomApi case login(param:[String:Any]) /// 注销 case deactivate + /// 发送回撤验证码 + case revokeCode + /// 退出登录 + case logout(param:[String:Any]) /// 更新密码 case updatePwd(param:[String:Any]) /// 检查令牌 @@ -142,6 +146,10 @@ extension CommomApi{ return "/uc/sign-in" case .deactivate: return "/uc/sign-away" + case .revokeCode: + return "/uc/code/disagree" + case .logout(_): + return "/uc/sign-out" case .updatePwd(_): return "/uc/reset" case .token: @@ -178,7 +186,7 @@ extension CommomApi{ case .uploadVoiceFile(_): return "/res/voice-file/upload" case .getProductList: - return "/dev/product/list/\(BleManager.shared.connectPeripheral?.device.name ?? "")" + return "/dev/product/list?name=\(BleManager.shared.connectPeripheral?.device.name ?? "")" case .productBook(let productId): return "/res/prod-book-file?productId=\(productId)" case .qaCategory: @@ -274,6 +282,9 @@ extension CommomApi{ case let .login(para): params += para break + case let .logout(para): + params += para + break case let .updatePwd(para): params += para break diff --git a/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/Contents.json b/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/Contents.json new file mode 100644 index 0000000..3bc4861 --- /dev/null +++ b/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "上传@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "上传@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git "a/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/\344\270\212\344\274\240@2x.png" "b/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/\344\270\212\344\274\240@2x.png" new file mode 100644 index 0000000..1f8388b Binary files /dev/null and "b/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/\344\270\212\344\274\240@2x.png" differ diff --git "a/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/\344\270\212\344\274\240@3x.png" "b/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/\344\270\212\344\274\240@3x.png" new file mode 100644 index 0000000..93d9301 Binary files /dev/null and "b/ShenYin/ShenYin/Assets.xcassets/mine/cloud_upload.imageset/\344\270\212\344\274\240@3x.png" differ diff --git a/ShenYin/ShenYin/UI/Home/RecordDetail/RecordDetailVC.swift b/ShenYin/ShenYin/UI/Home/RecordDetail/RecordDetailVC.swift index 4ce6925..e012178 100644 --- a/ShenYin/ShenYin/UI/Home/RecordDetail/RecordDetailVC.swift +++ b/ShenYin/ShenYin/UI/Home/RecordDetail/RecordDetailVC.swift @@ -412,11 +412,9 @@ extension RecordDetailVC{ params["fileId"] = fileId params["summary"] = data!.origin Logger.debug(params) - HttpClient.request(.voiceRecord(param: params)) {(model:AppUpdateModelRoot,res) in - YLprogressHUD.hidden() + HttpClient.request(.voiceRecord(param: params)) {[weak self](model:AppUpdateModelRoot,res) in if model.isSuccess{ -// App.shared.popToPage(num: 2) - YLprogressHUD.showAutoHiden("请求成功") + self?.showUploadSuccess() } else{ YLprogressHUD.showAutoHiden(model.msg) @@ -438,5 +436,13 @@ extension RecordDetailVC{ } } } + func showUploadSuccess(){ + CacheManager.shared.user.getStorageSize { result in + YLprogressHUD.hidden() + let pop = PopCloudView() + pop.show() + pop.config(size: CacheManager.shared.user.storageSize) + } + } } diff --git a/ShenYin/ShenYin/UI/Mine/AboutVC.swift b/ShenYin/ShenYin/UI/Mine/AboutVC.swift index 442111e..a68f86f 100644 --- a/ShenYin/ShenYin/UI/Mine/AboutVC.swift +++ b/ShenYin/ShenYin/UI/Mine/AboutVC.swift @@ -8,7 +8,7 @@ import UIKit class AboutVC: BaseVC{ let tableView = UITableView(frame: .zero, style: .plain) - let list:[CustomCellType] = [.update,.userAgreement,.privacyPolicy] + let list:[[CustomCellType]] = [[.update,.userAgreement,.privacyPolicy],[.revoke]] override func viewDidLoad() { super.viewDidLoad() @@ -39,40 +39,54 @@ class AboutVC: BaseVC{ } extension AboutVC:UITableViewDelegate,UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + func numberOfSections(in tableView: UITableView) -> Int{ return list.count } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return list[section].count + } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = CustomCell1.cell(withTableView: tableView, indexPath: indexPath) - cell.type = list[indexPath.row] + cell.type = list[indexPath.section][indexPath.row] let rect = CGRect(x: 0, y: 0, width: kScreenWid - 36, height: 52) if indexPath.row == 0 { cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 8, height: 8)) } - else if indexPath.row == list.count - 1{ + else if indexPath.row == list[indexPath.section].count - 1{ cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.bottomLeft,.bottomRight], cornerRadii: CGSize(width: 8, height: 8)) } else{ cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.allCorners], cornerRadii: CGSize(width: 0, height: 0)) } + if cell.type == .revoke { + cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.allCorners], cornerRadii: CGSize(width: 8, height: 8)) + + } return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let data = list[indexPath.row] + let data = list[indexPath.section][indexPath.row] if data == .privacyPolicy{ - let param = BaseWebViewParams(urlStr: Config.privacyUrl) - let vc = BaseWebViewController(initData: param) - App.shared.goToPage(vc) + App.shared.goToPage(FileDownloadVC(type: .yinsizhengce)) } else if data == .userAgreement{ - let param = BaseWebViewParams(urlStr: Config.userUrl) - let vc = BaseWebViewController(initData: param) - App.shared.goToPage(vc) + App.shared.goToPage(FileDownloadVC(type: .yonghuxieyi)) } else if data == .update{ AppUpdateVM.shared.checkedUpdate() } + else if data == .revoke{ + App.shared.goToPage(RevokeVC()) + } + } + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + return 10 + } + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + let header = CustomSectionHeader.header(withTableView: tableView) + return header } } diff --git a/ShenYin/ShenYin/UI/Mine/Instructions/InstructionsDetailVC.swift b/ShenYin/ShenYin/UI/Mine/Instructions/InstructionsDetailVC.swift index eab06cc..c2a43c5 100644 --- a/ShenYin/ShenYin/UI/Mine/Instructions/InstructionsDetailVC.swift +++ b/ShenYin/ShenYin/UI/Mine/Instructions/InstructionsDetailVC.swift @@ -73,18 +73,7 @@ final class InstructionsDetailVC: BaseVC { } } } - - func loadWebData(){ -// /// 加载URL -// if let requestUrl = initData.urlStr.yc.asUrl { -// let request = URLRequest(url: requestUrl) -// webView.load(request) -// } -// else if let request = initData.request { -// webView.load(request) -// } -// else { return } - } + override func navleftViewTapped() { if webView.canGoBack { diff --git a/ShenYin/ShenYin/UI/Mine/Login/View/AgreeView.swift b/ShenYin/ShenYin/UI/Mine/Login/View/AgreeView.swift index c87c2df..703ac59 100644 --- a/ShenYin/ShenYin/UI/Mine/Login/View/AgreeView.swift +++ b/ShenYin/ShenYin/UI/Mine/Login/View/AgreeView.swift @@ -77,14 +77,10 @@ class AgreeView: BaseView { agreeBtn.isSelected = !agreeBtn.isSelected } @objc func agreementAction(){ - let param = BaseWebViewParams(urlStr: Config.privacyUrl) - let vc = BaseWebViewController(initData: param) - App.shared.goToPage(vc) + App.shared.goToPage(FileDownloadVC(type: .yinsizhengce)) } @objc func useAction(){ - let param = BaseWebViewParams(urlStr: Config.userUrl) - let vc = BaseWebViewController(initData: param) - App.shared.goToPage(vc) + App.shared.goToPage(FileDownloadVC(type: .yonghuxieyi)) } } diff --git a/ShenYin/ShenYin/UI/Mine/ProtocolVC.swift b/ShenYin/ShenYin/UI/Mine/ProtocolVC.swift new file mode 100644 index 0000000..006e5e6 --- /dev/null +++ b/ShenYin/ShenYin/UI/Mine/ProtocolVC.swift @@ -0,0 +1,202 @@ +// +// ProtocolVC.swift +// ShenYin +// +// Created by liangshi on 2025/10/28. +// + + +import UIKit +import WebKit + +enum FileDownloadType:String{ + case yonghuxieyi = "yonghuxieyi" + case yinsizhengce = "yinsizhengce" + case xitongquanxianqingdan = "xitongquanxianqingdan" + case gerenxinxishoujiqingdan = "gerenxinxishoujiqingdan" +} + + +final class FileDownloadVC: BaseVC { + let webView = BaseWebView() + private let progressView = UIProgressView(progressViewStyle: .default) + + let type: FileDownloadType + + init(type: FileDownloadType) { + self.type = type + super.init() +// self.navBar.title = title +// self.fileUrl = "url" + } + + override func setupViews() { + + view.addSubview(webView) + webView.addSubview(progressView) + + view.backgroundColor = .color(.bgColor) + webView.navigationDelegate = self + webView.uiDelegate = self + webView.backgroundColor = .color(.bgColor) + + webView.addObserver(self, forKeyPath: "estimatedProgress", options: .new, context: nil) + webView.addObserver(self, forKeyPath: "canGoBack", options: .new, context: nil) + webView.addObserver(self, forKeyPath: "title", options: .new, context: nil) + webView.evaluateJavaScript("document.getElementsByTagName('body')[0].style.background='#FAFAFA'", completionHandler: nil) + + /// 进度条 + progressView.trackTintColor = .clear + progressView.progressTintColor = .color(.theme) + progressView.isHidden = false + progressView.setProgress(0.05, animated: true) + } + override func setupLayout() { + webView.snp.makeConstraints { (m) in + m.top.equalToSuperview().inset(kNavBtm) + m.bottom.equalToSuperview() + m.leading.trailing.equalToSuperview() + } + progressView.snp.makeConstraints { (m) in + m.top.leading.trailing.equalToSuperview() + m.height.equalTo(2) + } + } + + override func setupData() { + let lan = "zh" + var fileUrl = "https://dc-cloud-pub.tos-cn-guangzhou.volces.com/protocol/\(lan)/\(type.rawValue).pdf" + self.dowmload(url:fileUrl) + } + func dowmload(url:String){ + HttpClient.download(url: url){[weak self] filePath in + guard let self = self else {return} + if let path = filePath{ + let url = URL(fileURLWithPath: path) + let request = URLRequest(url: url) + webView.load(request) + } + } + } + + + override func navleftViewTapped() { + if webView.canGoBack { + webView.goBack() + } + else{ + if let _ = self.presentingViewController { + self.dismiss(animated: true, completion: nil) + } else if let nav = self.navigationController { + nav.popViewController(animated: true) + } + } + + } + override func navRightViewTapped() { + if let _ = self.presentingViewController { + self.dismiss(animated: true, completion: nil) + } else if let nav = self.navigationController { + nav.popViewController(animated: true) + } + } + + deinit { + webView.removeObserver(self, forKeyPath: "canGoBack") + webView.removeObserver(self, forKeyPath: "estimatedProgress") + webView.removeObserver(self, forKeyPath: "title") + } + + override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { + if keyPath == "canGoBack" { + if webView.canGoBack { + self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true + } else { + self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false + } + } else if keyPath == "estimatedProgress" { + progressView.alpha = CGFloat(1.0 - webView.estimatedProgress) + 0.2 + let progerss = max(Float(webView.estimatedProgress), 0.1) + progressView.setProgress(progerss, animated: true) + if webView.estimatedProgress >= 1.0 { + kDelay(0.3) { + self.progressView.alpha = 0.0 + self.progressView.setProgress(0.0, animated: false) + } + } + }else if keyPath == "title" { + navBar.title = webView.title ?? " " + + } else { + super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) + } + } +} + +// MARK: - ********* webview delegate +extension FileDownloadVC: WKNavigationDelegate { + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + webView.evaluateJavaScript( + "document.getElementsByTagName('body')[0].style.background='#FAFAFA'", + completionHandler: nil) + } + func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { + k_log("==== error: \(error)") + } + func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { + k_log("==== error: \(error)") + } + func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { + if (navigationAction.targetFrame == nil) { + webView.load(navigationAction.request) + } + guard let policy = WKNavigationActionPolicy(rawValue: WKNavigationActionPolicy.allow.rawValue + 2) + else { decisionHandler(.allow); return } + decisionHandler(policy) + } +} + +// MARK: - WKUIDelegate 不实现该代理方法 网页内调用弹窗时会抛出异常,导致程序崩溃 +extension FileDownloadVC: WKUIDelegate { + // 获取js 里面的提示 + func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) { + if self.navigationController?.visibleViewController != self { + completionHandler() + return + } + let alert = UIAlertController(title: "提示", message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "确定", style: .default, handler: { (_) -> Void in + completionHandler() + })) + alert.addAction(UIAlertAction(title: "取消", style: .cancel, handler: { (_) -> Void in + completionHandler() + })) + self.present(alert, animated: true, completion: nil) + } + + // js 信息的交流 + func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) { + let alert = UIAlertController(title: "提示", message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "确定", style: .default, handler: { (_) -> Void in + completionHandler(true) + })) + alert.addAction(UIAlertAction(title: "取消", style: .cancel, handler: { (_) -> Void in + completionHandler(false) + })) + self.present(alert, animated: true, completion: nil) + } + + // 交互。可输入的文本。 + func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (String?) -> Void) { + let alert = UIAlertController(title: prompt, message: defaultText, preferredStyle: .alert) + alert.addTextField { (textField: UITextField) -> Void in + textField.textColor = UIColor.red + } + alert.addAction(UIAlertAction(title: "确定", style: .default, handler: { (_) -> Void in + completionHandler(alert.textFields![0].text!) + })) + self.present(alert, animated: true, completion: nil) + } +} + diff --git a/ShenYin/ShenYin/UI/Mine/RevokeCodeVC.swift b/ShenYin/ShenYin/UI/Mine/RevokeCodeVC.swift new file mode 100644 index 0000000..bc6579c --- /dev/null +++ b/ShenYin/ShenYin/UI/Mine/RevokeCodeVC.swift @@ -0,0 +1,95 @@ +// +// Untitled.swift +// ShenYin +// +// Created by liangshi on 2025/10/28. +// + +import UIKit +class RevokeCodeVC:BaseVC{ + + let titleLabel = UILabel() + let codeView = CodeView() + let loginBtn = CustomButton() + + override func viewDidLoad() { + super.viewDidLoad() + } + override func setupViews(){ + self.navBar.title = "撤回同意" + view.backgroundColor = .color(.bgColor) + + titleLabel.do { v in + + v.font = .medium(18) + v.textColor = .hexString("#121212") + v.numberOfLines = 0 + } + codeView.do { v in + v.codeButton.addTarget(self, action: #selector(codeButtonAction), for: .touchUpInside) + } + loginBtn.set(title: "确认撤回", style: .theme4,target: self, action: #selector(loginAction)) + view.addSubviews([titleLabel,codeView,loginBtn]) + + + if CacheManager.shared.user.info.phone.isNotEmpty{ + titleLabel.text = "请使用安全手机\(CacheManager.shared.user.info.phone)获取验证码短信" + } + else{ + titleLabel.text = "请使用安全邮箱\(CacheManager.shared.user.info.email)获取验证码短信" + } + } + override func setupLayout(){ + + titleLabel.snp.makeConstraints { make in + make.top.equalToSuperview().offset(kNavBtm + 30) + make.left.right.equalToSuperview().inset(36) + } + codeView.snp.makeConstraints { make in + make.top.equalTo(titleLabel.snp.bottom).offset(16) + make.left.right.equalToSuperview().inset(36) + } + + loginBtn.snp.makeConstraints { make in + make.top.equalTo(codeView.snp.bottom).offset(40) + make.left.equalToSuperview().inset(50) + make.width.equalTo(kScreenWid - 100) + make.height.equalTo(48) + } + + } + +} + +extension RevokeCodeVC{ + @objc func codeButtonAction(){ + YLprogressHUD.showLoading() + HttpClient.request(CommomApi.revokeCode) {[weak self] (model:ResponseBaseModel, res) in + if model.isSuccess{ + self?.codeView.codeButton.start() + } + YLprogressHUD.showAutoHiden(model.msg) + } + } + @objc func loginAction(){ + guard let code = codeView.textField.value else{ + YLprogressHUD.showAutoHiden("请输入验证码") + return + } + + var params:[String:Any] = [:] + params["smsCode"] = code + + HttpClient.request(CommomApi.logout(param: params)) { (model:ResponseBaseModel, res) in + if model.isSuccess{ + YLprogressHUD.showSuccess { + App.shared.goToLogin() + } + } + else{ + YLprogressHUD.showAutoHiden(model.msg) + } + + } + } +} diff --git a/ShenYin/ShenYin/UI/Mine/RevokeVC.swift b/ShenYin/ShenYin/UI/Mine/RevokeVC.swift new file mode 100644 index 0000000..f28c0d4 --- /dev/null +++ b/ShenYin/ShenYin/UI/Mine/RevokeVC.swift @@ -0,0 +1,54 @@ +// +// Untitled.swift +// ShenYin +// +// Created by liangshi on 2025/10/28. +// + +import UIKit + +class RevokeVC:BaseVC{ + let bgView = UIScrollView() + let label = UILabel() + let btn = CustomButton() + + override func viewDidLoad() { + super.viewDidLoad() + + + } + override func setupViews() { + self.navBar.title = "撤回同意" + view.addSubview(bgView) + bgView.addSubviews([label,btn]) + + label.do { v in + v.font = .regular(14) + v.textColor = .hexString("#666666") + v.numberOfLines = 0 + v.text = "请您确保您是有权进行本撤回同意隐私政策操作的相关当事人。撤回同意隐私政策,您将放弃以下资产或者权益:\n1.数据清空\n将会停止收集您的个人信息。您使用DeepChords应用过程中产生的数据将被清空;手机中DeepChords应用的缓存数据将被清除。\n2.设备解除绑定\nDeepChords账号中,所有设备会与您当前登录的账号解除绑定,并清除设备之前存储在服务器的数据。存储在物理设备中的数据请通过人工本地物理重置来清除。如果您需要重新使用设备,需要您再次进行绑定并且重新授权。\n3.其他\n此举还将撤回您对用户协议的同意,并退出DeepChor ds应用。\n请您知悉,撤回同意隐私政策不代表撤回同意前的相关行为和责任得到豁免或减轻。若您需要重新在该账号管理设备,需要您重新授权并绑定。请谨慎操作!" + } + btn.set(title: "确认撤回", style: .theme4,target: self, action: #selector(btnAction)) + } + override func setupLayout() { + bgView.snp.makeConstraints { make in + make.width.equalTo(kScreenWid) + make.height.equalTo(kScreenHei - kNavBtm) + make.top.equalToSuperview().inset(kNavBtm) + make.left.equalToSuperview() + } + label.snp.makeConstraints { make in + make.top.left.equalToSuperview().inset(18) + make.width.equalTo(kScreenWid - 36) + } + btn.snp.makeConstraints { make in + make.left.equalToSuperview().inset(50) + make.width.equalTo(kScreenWid - 100) + make.height.equalTo(48) + make.top.equalTo(label.snp.bottom).offset(100) + } + } + @objc func btnAction(){ + App.shared.goToPage(RevokeCodeVC()) + } +} diff --git a/ShenYin/ShenYin/UI/Mine/Root/MineHeaderView.swift b/ShenYin/ShenYin/UI/Mine/Root/MineHeaderView.swift index dee5bb1..66a3256 100644 --- a/ShenYin/ShenYin/UI/Mine/Root/MineHeaderView.swift +++ b/ShenYin/ShenYin/UI/Mine/Root/MineHeaderView.swift @@ -118,6 +118,18 @@ class CloudStorageView: BaseView { let titleLabel = UILabel() let nameLabel = UILabel() let progressView = UIProgressView() + func config(size:Int){ + let pro = Float(size)/1024/1024/1024.0 + if pro < 0.01 { + titleLabel.text = "0.01GB/1GB" + } + else if pro > 1 { + titleLabel.text = "1GB/1GB" + } else { + titleLabel.text = "\(String(format: "%.2f", pro))GB/1GB" + } + progressView.progress = pro + } override func setupViews() { addSubview(bgView) bgView.addSubviews([icon,titleLabel,nameLabel,progressView]) @@ -133,7 +145,7 @@ class CloudStorageView: BaseView { v.textColor = .rgb(0x121212) v.font = .bold(14) v.textAlignment = .left - v.text = "0.2GB/1GB" + v.text = "" } nameLabel.do { (v) in v.textColor = .rgb(0x666666) diff --git a/ShenYin/ShenYin/UI/Mine/Root/MineVC.swift b/ShenYin/ShenYin/UI/Mine/Root/MineVC.swift index f2e5ed4..4ba3ff6 100644 --- a/ShenYin/ShenYin/UI/Mine/Root/MineVC.swift +++ b/ShenYin/ShenYin/UI/Mine/Root/MineVC.swift @@ -44,8 +44,9 @@ class MineVC: BaseVC{ loadData() } func loadData(){ - CacheManager.shared.user.getStorageSize { result in - + CacheManager.shared.user.getStorageSize {[weak self] result in + guard let self = self else {return} + headerView.cloud.config(size: result.data) } DeviceVM.shared.refresh { result in diff --git a/ShenYin/ShenYin/UI/Mine/UserInfo/CustomCell1.swift b/ShenYin/ShenYin/UI/Mine/UserInfo/CustomCell1.swift index 36c8a8d..3ff3da4 100644 --- a/ShenYin/ShenYin/UI/Mine/UserInfo/CustomCell1.swift +++ b/ShenYin/ShenYin/UI/Mine/UserInfo/CustomCell1.swift @@ -20,6 +20,7 @@ public enum CustomCellType: Int { case update case userAgreement case privacyPolicy + case revoke case notice case system @@ -53,7 +54,9 @@ public enum CustomCellType: Int { case .userAgreement: return "用户协议" case .privacyPolicy: - return "隐私协议" + return "隐私政策" + case .revoke: + return "撤回同意" case .notice: return "系统消息通知" diff --git a/ShenYin/ShenYin/UI/common/pop/PopCloudView.swift b/ShenYin/ShenYin/UI/common/pop/PopCloudView.swift new file mode 100644 index 0000000..fe45a9c --- /dev/null +++ b/ShenYin/ShenYin/UI/common/pop/PopCloudView.swift @@ -0,0 +1,132 @@ +// +// PopCloudView.swift +// ShenYin +// +// Created by liangshi on 2025/10/28. +// + +import UIKit +import SnapKit + +class PopCloudView: BasePresentView2 { + let contentView = UIView() + let closeBtn = UIButton(type: .custom) + + let icon = UIImageView() + let titleLabel = UILabel() + let storageLabel = UILabel() + let nameLabel = UILabel() + let progressView = UIProgressView() + + func config(size:Int){ + let pro = Float(size)/1024/1024/1024.0 + if pro < 0.01 { + storageLabel.text = "0.01GB/1GB" + } + else if pro > 1 { + storageLabel.text = "1GB/1GB" + } else { + storageLabel.text = "\(String(format: "%.2f", pro))GB/1GB" + } + progressView.progress = pro + } + + override func setupSubView() { + super.setupSubView() + addSubview(contentView) + addSubview(closeBtn) + contentView.addSubviews([icon,titleLabel,storageLabel,nameLabel,progressView]) + + closeBtn.do { v in + v.setImage(UIImage(named: "close_btn_1"), for: .normal) + v.setImage(UIImage(named: "close_btn_1"), for: .selected) + v.addTarget(self, action: #selector(closeAction), for: .touchUpInside) + } + icon.image = UIImage(named: "cloud_upload") + + titleLabel.do { (v) in + v.textColor = .rgb(0x121212) + v.font = .bold(14) + v.textAlignment = .left + } + storageLabel.do { (v) in + v.textColor = .rgb(0x121212) + v.font = .regular(14) + v.textAlignment = .left + } + nameLabel.do { (v) in + v.textColor = .rgb(0x666666) + v.font = .regular(14) + v.textAlignment = .left + v.text = "云储存空间" + } + progressView.do { v in + v.yc.setCornerRadius(2) + } + yc.addTap(target: self, action: #selector(closeAction)) + closeBtn.do { v in + v.setImage(UIImage(named: "close_btn_1"), for: .normal) + v.setImage(UIImage(named: "close_btn_1"), for: .selected) + v.addTarget(self, action: #selector(closeAction), for: .touchUpInside) + } + + } + override func setupLayout() { + super.setupLayout() + contentView.do { (v) in + v.backgroundColor = .white + v.yc.setCornerRadius(20) + } + + closeBtn.snp.makeConstraints { make in + make.size.equalTo(60) + make.right.equalToSuperview() + make.bottom.equalTo(contentView.snp.top).offset(10) + } + + icon.snp.makeConstraints { (m) in + m.width.equalTo(100) + m.height.equalTo(74) + m.centerX.equalToSuperview() + m.top.equalToSuperview().inset(22) + } + titleLabel.snp.makeConstraints { (m) in + m.top.equalToSuperview().inset(100) + m.centerX.equalToSuperview() + } + storageLabel.snp.makeConstraints { (m) in + m.bottom.equalToSuperview().inset(36) + m.left.equalToSuperview().inset(34) + } + nameLabel.snp.makeConstraints { (m) in + m.centerY.equalTo(storageLabel) + m.right.equalToSuperview().inset(34) + } + progressView.snp.makeConstraints { make in + make.left.right.equalToSuperview().inset(34) + make.height.equalTo(6) + make.bottom.equalToSuperview().inset(22) + } + } + + override func setupStyle() { + super.setupStyle() + contentView.snp.makeConstraints { make in + make.left.right.equalToSuperview().inset(18) + make.height.equalTo(200) + make.center.equalToSuperview() + } + titleLabel.do { (v) in + v.textColor = .rgb(0x121212) + v.font = .bold(20) + v.textAlignment = .center + v.text = "已成功更新到云储存空间" + } + + } + @objc func closeAction(){ + hide() + } + +} +