feat: 更新素材管理和举报风险地图

This commit is contained in:
2026-07-09 12:20:02 +08:00
parent 9b92d81902
commit 42aca73588
42 changed files with 6164 additions and 1369 deletions

View File

@ -0,0 +1,67 @@
//
// AgreementWebViewController.swift
// suixinkan
//
import SnapKit
import UIKit
import WebKit
/// H5 使 WebView
final class AgreementWebViewController: BaseViewController {
private let pageTitle: String
private let url: URL
private let webView = WKWebView(frame: .zero)
private let loadingIndicator = UIActivityIndicatorView(style: .medium)
init(title: String, url: URL) {
pageTitle = title
self.url = url
super.init(nibName: nil, bundle: nil)
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setupNavigationBar() {
title = pageTitle
}
override func setupUI() {
view.backgroundColor = AppColor.cardBackground
webView.navigationDelegate = self
view.addSubview(webView)
view.addSubview(loadingIndicator)
loadingIndicator.hidesWhenStopped = true
loadingIndicator.startAnimating()
webView.load(URLRequest(url: url))
}
override func setupConstraints() {
webView.snp.makeConstraints { make in
make.edges.equalTo(view.safeAreaLayoutGuide)
}
loadingIndicator.snp.makeConstraints { make in
make.center.equalToSuperview()
}
}
}
extension AgreementWebViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
loadingIndicator.stopAnimating()
}
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
loadingIndicator.stopAnimating()
showToast(error.localizedDescription)
}
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
loadingIndicator.stopAnimating()
showToast(error.localizedDescription)
}
}