| | |
| | | init(type:AgreentType,customTitle:String? = nil,content:String? = nil,needBackBtn:Bool = false) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.type = type |
| | | self.customTitle = customTitle |
| | | self.content = content |
| | | self.needBackBtn = needBackBtn |
| | | } |
| | |
| | | } |
| | | |
| | | Services.queryProtocol(type,progress: false).subscribe(onNext: {[weak self] result in |
| | | if let text = result.data?.jq_wrapHtml(){ |
| | | if let text = result.data?.jq_wrapHtml(edge: .init(top: 5, left:0, bottom: 0, right: 0)){ |
| | | self?.webView.loadHTMLString(text, baseURL: nil) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | }else{ |
| | | webView.loadHTMLString(content?.jq_wrapHtml() ?? "", baseURL: nil) |
| | | webView.loadHTMLString(content?.jq_wrapHtml(edge: .init(top: 5, left: 0, bottom: 0, right: 0)) ?? "", baseURL: nil) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { |
| | | |
| | | let js = """ |
| | | 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('head')[0].appendChild(script);var style = document.createElement('style');style.type='text/css';style.innerHTML='body{width:100%;height:auto;margin:auto;background-color:#ffffff}img{max-width:100%}p{word-wrap: break-word;color: #222;list-style-position: inside;list-style-type: square;margin-top: 17px;font-size: 18px;line-height: 1.76;border: none;outline: none;display: block;margin-block-start: 1em;margin-block-end: 1em;margin-inline-start: 0px;margin-inline-end: 0px;} p img {margin-bottom: -9px}';document.body.appendChild(style); |
| | | """ |
| | | webView.evaluateJavaScript(js) |
| | | |
| | | switch type { |
| | | case .user,.safe,.privacy: |
| | | view_btns.isHidden = false |