From b53b5c8a6abf4d582dff9c619fc286b5436bfa5f Mon Sep 17 00:00:00 2001 From: liyuhua <15626451870@163.com> Date: Thu, 28 Mar 2024 19:56:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=9E=E5=90=8D=E5=8F=8A?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yinmeng-ios.xcodeproj/project.pbxproj | 4 +- .../Base/Request/YMNetworkHelper.swift | 2 +- yinmeng-ios/Base/Utils/AppKeys.swift | 2 + yinmeng-ios/Base/Utils/H5Utils.swift | 1 + yinmeng-ios/Base/Utils/Utils.swift | 2 +- yinmeng-ios/Base/Web/WebViewController.swift | 102 ++++++++++++++++-- .../Modules/Auth/VM/AuthViewModel.swift | 4 +- .../Modules/Pay/UserPayViewManager.swift | 12 ++- .../Modules/Room/Model/RoomDataModel.swift | 4 +- .../Room/Tool/YinRoomTRTCManager.swift | 2 +- .../Cell/NormalMicSeatCell.swift | 5 + .../NormalMicSeatSuperView.swift | 100 +++++++++++------ .../SubView/NormalMicSeatView.swift | 22 +++- .../Star/PlanetStarClickItemView.swift | 2 +- .../Modules/User/VC/BindMobileVC.swift | 12 ++- yinmeng-ios/Modules/User/VC/UserInfoVC.swift | 70 +++++++++--- yinmeng-ios/Modules/User/VM/UserObject.swift | 2 + 17 files changed, 281 insertions(+), 67 deletions(-) diff --git a/yinmeng-ios.xcodeproj/project.pbxproj b/yinmeng-ios.xcodeproj/project.pbxproj index 9727489..10b34c2 100644 --- a/yinmeng-ios.xcodeproj/project.pbxproj +++ b/yinmeng-ios.xcodeproj/project.pbxproj @@ -1667,7 +1667,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.3; + MARKETING_VERSION = 1.0.4; PRODUCT_BUNDLE_IDENTIFIER = "linyudan.yinmeng-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -1711,7 +1711,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.3; + MARKETING_VERSION = 1.0.4; PRODUCT_BUNDLE_IDENTIFIER = "linyudan.yinmeng-ios"; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/yinmeng-ios/Base/Request/YMNetworkHelper.swift b/yinmeng-ios/Base/Request/YMNetworkHelper.swift index 85e1308..dd1d90d 100644 --- a/yinmeng-ios/Base/Request/YMNetworkHelper.swift +++ b/yinmeng-ios/Base/Request/YMNetworkHelper.swift @@ -22,7 +22,7 @@ class YMNetworkHelper: NSObject { parameters["ispType"] = "1" parameters["channel"] = APPUtils.currentChannle parameters["netType"] = "2" - parameters["app"] = "yinmeng" + parameters["app"] = "mew" parameters["appVersion"] = APPUtils.appVersion parameters["deviceId"] = APPUtils.currentDeveiceId return parameters diff --git a/yinmeng-ios/Base/Utils/AppKeys.swift b/yinmeng-ios/Base/Utils/AppKeys.swift index 090526c..6d71bdb 100644 --- a/yinmeng-ios/Base/Utils/AppKeys.swift +++ b/yinmeng-ios/Base/Utils/AppKeys.swift @@ -11,9 +11,11 @@ enum AppKeys { static let nimAppid = "5d5a833a2d0ff1304a5d8bed53d2af5b" static let api = "http://beta.api.ymlive.fun/" static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c" + static let H5_URL = "http://beta.api.ymlive.fun" #else static let nimAppid = "5e76ec47632d86c30ce18eabfa332b6a" static let api = "https://api.ymlive.fun/" static let agoraKey = "5b4d929b6c4e4af190550c4a2ec5cd4c" + static let H5_URL = "https://h5.ymlive.fun" #endif } diff --git a/yinmeng-ios/Base/Utils/H5Utils.swift b/yinmeng-ios/Base/Utils/H5Utils.swift index d9dd488..d2e69c2 100644 --- a/yinmeng-ios/Base/Utils/H5Utils.swift +++ b/yinmeng-ios/Base/Utils/H5Utils.swift @@ -13,4 +13,5 @@ enum H5Utils:String { case logoff = "modules/logout/index.html" case pay = "mew/modules/rule/rechargeAgreement.html" case rank = "modules/roomRank/index.html" + case autonym = "modules/identity/new.html" } diff --git a/yinmeng-ios/Base/Utils/Utils.swift b/yinmeng-ios/Base/Utils/Utils.swift index 162cbe8..4f9d94f 100644 --- a/yinmeng-ios/Base/Utils/Utils.swift +++ b/yinmeng-ios/Base/Utils/Utils.swift @@ -21,7 +21,7 @@ let keyWindow = UIApplication.shared.windows.first! let DesKey = "1ea53d260ecf11e7b56e00163e046a26" -let H5_URL = "http://beta.h5.ymlive.fun" + diff --git a/yinmeng-ios/Base/Web/WebViewController.swift b/yinmeng-ios/Base/Web/WebViewController.swift index f88763a..948b4f0 100644 --- a/yinmeng-ios/Base/Web/WebViewController.swift +++ b/yinmeng-ios/Base/Web/WebViewController.swift @@ -7,12 +7,14 @@ import UIKit import WebKit +import MJExtension class WebViewWeakScriptMessage: NSObject, WKScriptMessageHandler { private(set) weak var target: WKScriptMessageHandler? required init(target: WKScriptMessageHandler?) { self.target = target + } @@ -30,8 +32,20 @@ class WebViewController: BaseViewController { private(set) var progressView = UIProgressView() - private lazy var userContentController = WKUserContentController() - + + private lazy var userContentController:WKUserContentController = { + let scriptMessage = WebViewWeakScriptMessage(target: self); + + let _userContentController = WKUserContentController() + _userContentController.add(self, name: "getUid") + _userContentController.add(self, name: "getDeviceId") + _userContentController.add(self, name: "getTicket") + _userContentController.add(self, name: "getDeviceInfo") + _userContentController.add(self, name: "initShowNav") + _userContentController.add(self, name: "closeWebView") + _userContentController.add(self, name: "cancelAccount") + return _userContentController + }() private var callbacks: [String: [OnReceiveMessage]] = [:] private(set) weak var navigationDelegate: WKNavigationDelegate? @@ -47,7 +61,7 @@ class WebViewController: BaseViewController { self.isHalf = isHalf if var url = url { if !url.hasPrefix("http") { - url = "\(H5_URL)/\(url)" + url = "\(AppKeys.H5_URL)/\(url)" } self.url = url } @@ -59,7 +73,9 @@ class WebViewController: BaseViewController { loadSubViews() loadWebView() } - + deinit{ + print("1111") + } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) addObserve() @@ -157,8 +173,11 @@ class WebViewController: BaseViewController { } webview.load(URLRequest(url: theUrl)) + } - + + + func reloadWebViewWithUrl(_ url: String) { self.url = url loadWebView() @@ -170,8 +189,18 @@ class WebViewController: BaseViewController { configuration.allowsInlineMediaPlayback = true configuration.allowsPictureInPictureMediaPlayback = true configuration.selectionGranularity = .character - configuration.userContentController = userContentController - + + let cookie = "uid=\(AuthManager.userUid)" + let cookieScript = WKUserScript.init(source: "document.cookie = '\(cookie)';", injectionTime: .atDocumentStart, forMainFrameOnly: false) + self.userContentController.addUserScript(cookieScript) + + let scale = "$('meta[name=description]').remove(); $('head').append( '' );" + + let scaleScript = WKUserScript.init(source: scale, injectionTime: .atDocumentEnd, forMainFrameOnly: false) + self.userContentController.addUserScript(scaleScript) + configuration.userContentController = self.userContentController + + let preferences = WKPreferences() if #available(iOS 14, *) { let webpagePreferences = WKWebpagePreferences() @@ -185,6 +214,18 @@ class WebViewController: BaseViewController { configuration.preferences = preferences let webview = WKWebView(frame: UIScreen.main.bounds, configuration: configuration) webview.navigationDelegate = self + webview.evaluateJavaScript("navigator.userAgent") {[weak self] res, error in + guard let self = self else{return} + if let text = res as? NSString{ + if !text.contains("tutuAppIos erbanAppIos"){ + let newText = (text as String) + "tutuAppIos erbanAppIos" + let dic = ["UserAgent":newText] + UserDefaults.standard.register(defaults: dic) + UserDefaults.standard.synchronize() + self.webview.customUserAgent = newText + } + } + } return webview } @@ -200,10 +241,54 @@ extension WebViewController: WKScriptMessageHandler { func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { //TODO: 拦截一些h5的事件 + webview.evaluateJavaScript("document.location.href") {[weak self] res, error in + guard let self = self else{return} + if let curUrl = res{ + if message.name == "getUid"{ + let uid = "getMessage(\"uid\",\(AuthManager.userUid))" + self.webview.evaluateJavaScript(uid) { other, error in + + } + }else if message.name == "getTicket"{ + let ticket = "getMessage(\"ticket\",\"\(AuthManager.ticket)\")" + self.webview.evaluateJavaScript(ticket) { other, error in + + } + }else if message.name == "getDeviceId"{ + let deviceId = "getMessage(\"deviceId\",\"\(APPUtils.currentDeveiceId)\")" + self.webview.evaluateJavaScript(deviceId) { other, error in + + } + }else if message.name == "getDeviceInfo"{ + let info = NSDictionary(dictionary: YMNetworkHelper.share.baseParameters) + if let infoText = info.mj_JSONString() { + let text = "getMessage(\"deviceInfo\",\(infoText))" + self.webview.evaluateJavaScript(text) { other, error in + + } + } + + }else if message.name == "initShowNav"{ + if let body = message.body as? Int,body == 0{ + if self.navigationController != nil{ + self.navigationController?.setNavigationBarHidden(true, animated: false) + } + } + }else if message.name == "closeWebView"{ + if let body = message.body as? Int,body == 0{ + if self.navigationController != nil{ + self.navigationController?.popViewController(animated: true) + } + } + }else if message.name == "cancelAccount"{ + AuthViewModel.authVM.logout() + } + } + } } } -extension WebViewController: WKNavigationDelegate { +extension WebViewController: WKNavigationDelegate{ func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { progressView.alpha = 1 @@ -224,4 +309,5 @@ extension WebViewController: WKNavigationDelegate { } navigationDelegate?.webView?(webView, didFailProvisionalNavigation: navigation, withError: error) } + } diff --git a/yinmeng-ios/Modules/Auth/VM/AuthViewModel.swift b/yinmeng-ios/Modules/Auth/VM/AuthViewModel.swift index d7b0cc5..29e1983 100644 --- a/yinmeng-ios/Modules/Auth/VM/AuthViewModel.swift +++ b/yinmeng-ios/Modules/Auth/VM/AuthViewModel.swift @@ -41,9 +41,9 @@ class AuthViewModel: NSObject { if let token = token { let params = ["auaccess_token": token] RequestPost(path: "acc/logout", parma: params) { data in - print("你好") + } fail: { code, msg in - print("de") + } } self.loginSuccess.onNext(false) diff --git a/yinmeng-ios/Modules/Pay/UserPayViewManager.swift b/yinmeng-ios/Modules/Pay/UserPayViewManager.swift index 01ac69c..eeb1ba5 100644 --- a/yinmeng-ios/Modules/Pay/UserPayViewManager.swift +++ b/yinmeng-ios/Modules/Pay/UserPayViewManager.swift @@ -219,7 +219,17 @@ public class UserPayViewManager: NSObject { _ConditionBlock(StoreConditionResult.VerifiedServer,dic) } } - + // 退订 + @objc public func refunRequest(view: UIView,transactionId:UInt64) async{ + do { + if let scene = await view.window?.windowScene{ + try await Transaction.beginRefundRequest(for:transactionId , in: scene) + } + + }catch{ + print("iap error") + } + } // 支付监听事件 func _listenForTransactions() -> Task { return Task.detached { diff --git a/yinmeng-ios/Modules/Room/Model/RoomDataModel.swift b/yinmeng-ios/Modules/Room/Model/RoomDataModel.swift index 28d4097..601d58a 100644 --- a/yinmeng-ios/Modules/Room/Model/RoomDataModel.swift +++ b/yinmeng-ios/Modules/Room/Model/RoomDataModel.swift @@ -25,5 +25,7 @@ struct RoomDataModel : HandyJSON { var type:Int = 3 var audioSdkType = "" var showGiftValue = false - + var leaveMode = false + var gender:UserSexType? = .Boy + var isReselect = false } diff --git a/yinmeng-ios/Modules/Room/Tool/YinRoomTRTCManager.swift b/yinmeng-ios/Modules/Room/Tool/YinRoomTRTCManager.swift index daf0fd1..57e80f1 100644 --- a/yinmeng-ios/Modules/Room/Tool/YinRoomTRTCManager.swift +++ b/yinmeng-ios/Modules/Room/Tool/YinRoomTRTCManager.swift @@ -30,7 +30,7 @@ class YinRoomTRTCManager: NSObject { cloud.enableAudioVolumeEvaluation(true, with: params) let yinParams = TRTCParams() if AuthViewModel.authVM.appId.isEmpty{ - yinParams.sdkAppId = UInt32("1400798783") ?? 0 + yinParams.sdkAppId = UInt32("1400820672") ?? 0 }else{ yinParams.sdkAppId = UInt32(AuthViewModel.authVM.appId) ?? 0 } diff --git a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/Cell/NormalMicSeatCell.swift b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/Cell/NormalMicSeatCell.swift index f5e0c77..4b2503e 100644 --- a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/Cell/NormalMicSeatCell.swift +++ b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/Cell/NormalMicSeatCell.swift @@ -31,6 +31,11 @@ class NormalMicSeatCell: UICollectionViewCell { } } + var isShowGiftValue = false{ + didSet{ + micSeatView.isShowGiftValue = isShowGiftValue + } + } var user:UserObject? = nil{ didSet{ micSeatView.user = user diff --git a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/NormalMicSeatSuperView.swift b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/NormalMicSeatSuperView.swift index ce395b2..ce88ec2 100644 --- a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/NormalMicSeatSuperView.swift +++ b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/NormalMicSeatSuperView.swift @@ -95,8 +95,6 @@ class NormalMicSeatSuperView: MicSeatSuperView { addSubview(roomOwnerView) addSubview(collectionView) roomOwnerView.snp.makeConstraints { make in - - make.height.equalTo(UIDevice.scaleWidth(width: 103)) make.top.leading.trailing.equalTo(UIDevice.scaleWidth(width: 0)) } @@ -123,28 +121,41 @@ class NormalMicSeatSuperView: MicSeatSuperView { } if roomOwnerView.user != nil{ - if roomOwnerView.user!.uid == AuthManager.userUid{ - let popUpView = PlanetStarPopUpView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight)) - keyWindow.addSubview(popUpView) - popUpView.textView.text = "确定下麦旁听吗?" - popUpView.senderView.setTitle("确定", for: .normal) - popUpView.bgPointView.isHidden = true - popUpView.pointTextView.isHidden = true - popUpView.clickSendBlcok = { - let downRequest = NIMChatroomQueueRemoveRequest() - downRequest.key = "\(-1)" - downRequest.roomId = roomid - NIMSDK.shared().chatroomManager.removeChatroomQueueObject(downRequest) { (error, info) in - - + if let leaveMode = self.roomData?.leaveMode,leaveMode == false{ + if roomOwnerView.user!.uid == AuthManager.userUid{ + + let popUpView = PlanetStarPopUpView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight)) + keyWindow.addSubview(popUpView) + popUpView.textView.text = "确定下麦旁听吗?" + popUpView.senderView.setTitle("确定", for: .normal) + popUpView.bgPointView.isHidden = true + popUpView.pointTextView.isHidden = true + popUpView.clickSendBlcok = { + let downRequest = NIMChatroomQueueRemoveRequest() + downRequest.key = "\(-1)" + downRequest.roomId = roomid + NIMSDK.shared().chatroomManager.removeChatroomQueueObject(downRequest) { (error, info) in + + + } } + return + } + if let showUserInfoBlock = self.showUserInfoBlock,let user = roomOwnerView.user{ + showUserInfoBlock(["-1":user]) } return } - - if let showUserInfoBlock = self.showUserInfoBlock,let user = roomOwnerView.user{ - showUserInfoBlock(["-1":user]) + + if roomOwnerView.user!.uid == AuthManager.userUid{ + HUDTool.show(with: "请关闭离开模式") + }else{ + if let showUserInfoBlock = self.showUserInfoBlock,let user = roomOwnerView.user{ + showUserInfoBlock(["-1":user]) + } } + + return } @@ -172,7 +183,11 @@ class NormalMicSeatSuperView: MicSeatSuperView { func setMicList(){ if let roomid = self.roomData?.roomId{ - NIMSDK.shared().chatroomManager.fetchChatroomQueue(roomid) { error, data in + if let showGiftValue = self.roomData?.showGiftValue{ + roomOwnerView.isShowGiftValue = showGiftValue; + } + NIMSDK.shared().chatroomManager.fetchChatroomQueue(roomid) {[weak self] error, data in + guard let self = self else { return} if error == nil,let _data = data{ for item in _data { @@ -188,12 +203,20 @@ class NormalMicSeatSuperView: MicSeatSuperView { } } - - - } } + + if let leaveMode = self.roomData?.leaveMode,leaveMode == true{ + var obj = UserObject() + obj.avatar = self.roomData?.avatar + obj.nick = self.roomData?.nick; + obj.uid = Int(self.roomData?.uid ?? "") + obj.gender = self.roomData?.gender + self.roomOwnerView.user = obj + self.roomOwnerView.isLeaveMode = true + } + self.collectionView.reloadData() } } @@ -249,6 +272,9 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "NormalMicSeatCell", for: indexPath) as! NormalMicSeatCell let user = roomUserList[indexPath.row ] cell.text = "\(indexPath.row + 1)" + if let showGiftValue = self.roomData?.showGiftValue{ + cell.isShowGiftValue = showGiftValue; + } if user.user != nil{ cell.user = user.user @@ -260,7 +286,10 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - + if let leaveMode = self.roomData?.leaveMode,leaveMode == true,roomData?.uid == "\(AuthManager.userUid)"{ + HUDTool.show(with: "请关闭离开模式") + return + } guard let roomUid = self.roomData?.roomId else { return } let user = roomUserList[indexPath.row] var index:Int = -2 @@ -298,6 +327,9 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo } }else{ + + + if (index == -2){ upMicAction(index: "\(indexPath.row)") return @@ -347,11 +379,12 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo if let pos = data[NIMChatroomEventInfoQueueChangeItemKey] as? String,let value = data[NIMChatroomEventInfoQueueChangeItemValueKey],let userData = Deserialized.toModel(with: value) ,let changeType = data[NIMChatroomEventInfoQueueChangeTypeKey] as? Int{ if pos == "-1"{ if changeType == 1{ + roomOwnerView.user = userData - if userData.uid == AuthManager.userUid,let showGiftValue = roomData?.showGiftValue,showGiftValue == true{ - upMicAction(index: pos) - } +// if userData.uid == AuthManager.userUid{ +// upMicAction(index: pos) +// } }else if changeType == 2{ roomOwnerView.user = nil @@ -361,9 +394,9 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo if changeType == 1,let i = Int(pos){ let user = roomUserList[i] user.user = userData - if userData.uid == AuthManager.userUid,let showGiftValue = roomData?.showGiftValue,showGiftValue == true{ - upMicAction(index: pos) - } +// if userData.uid == AuthManager.userUid{ +// upMicAction(index: pos) +// } }else if changeType == 2,let i = Int(pos){ let user = roomUserList[i] if collectionView.cellForItem(at: IndexPath(row: i, section: 0)) is NormalMicSeatCell{ @@ -401,7 +434,12 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo default: break } - updateGiftNumber() + if let showGiftValue = roomData?.showGiftValue,showGiftValue == true{ + updateGiftNumber() + }else{ + self.collectionView.reloadData() + } + } } diff --git a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/SubView/NormalMicSeatView.swift b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/SubView/NormalMicSeatView.swift index ef0e586..c60e528 100644 --- a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/SubView/NormalMicSeatView.swift +++ b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/SubView/NormalMicSeatView.swift @@ -21,6 +21,17 @@ class NormalMicSeatView: UIView { setUILayout() } + var isShowGiftValue = false{ + didSet{ + giftValueView.isHidden = !isShowGiftValue + } + } + var isLeaveMode:Bool = false { + didSet{ + leaveView.isHidden = !isLeaveMode + } + } + var user:UserObject? = nil{ didSet{ @@ -52,7 +63,7 @@ class NormalMicSeatView: UIView { addSubview(speakView) addSubview(avatarView) addSubview(nameStackView) - + addSubview(leaveView) nameStackView.addArrangedSubview(postionView) nameStackView.addArrangedSubview(nameView) @@ -68,6 +79,9 @@ class NormalMicSeatView: UIView { make.top.equalTo(UIDevice.scaleWidth(width: 5)) make.centerX.equalTo(self) } + leaveView.snp.makeConstraints { make in + make.edges.equalTo(avatarView) + } nameStackView.snp.makeConstraints { make in make.top.equalTo(avatarView.snp.bottom).offset(UIDevice.scaleWidth(width: 10)) make.width.lessThanOrEqualTo(self) @@ -189,6 +203,12 @@ class NormalMicSeatView: UIView { return _speakParser }() var isPlay = false + + private lazy var leaveView:UILabel = { + let _leaveView = UILabel.getCustomLabel(text: "离开",font: UIFont.getScaleFont(ofSize: 16, weight: .regular),color: .white,textAlignment: .center,backgroundColor: ThemeColor(hexStr: "#000000",alpha: 0.45),masksToBounds: true,cornerRadius: UIDevice.scaleWidth(width: 50)/2) + _leaveView.isHidden = true + return _leaveView + }() } extension NormalMicSeatView:SVGAPlayerDelegate{ func svgaPlayerDidFinishedAnimation(_ player: SVGAPlayer!) { diff --git a/yinmeng-ios/Modules/Star/PlanetStarClickItemView.swift b/yinmeng-ios/Modules/Star/PlanetStarClickItemView.swift index fde8242..cea7673 100644 --- a/yinmeng-ios/Modules/Star/PlanetStarClickItemView.swift +++ b/yinmeng-ios/Modules/Star/PlanetStarClickItemView.swift @@ -204,7 +204,7 @@ class PlanetStarClickItemView: UIView { self.isStop = true self.vapView.transform = CGAffineTransformIdentity let j = view.tag - 100 - self.chooseModel = self.dataList[j] + self.chooseModel = self.dataList[safe: j] if let _chooseModel = self.chooseModel{ self.sexImageVeiw.image = _chooseModel.gender == 1 ? UIImage(named: "yin_plane_star_man") : UIImage(named: "yin_plane_star__woman") self.nameLabelView.text = _chooseModel.nick diff --git a/yinmeng-ios/Modules/User/VC/BindMobileVC.swift b/yinmeng-ios/Modules/User/VC/BindMobileVC.swift index f7b6523..e657c84 100644 --- a/yinmeng-ios/Modules/User/VC/BindMobileVC.swift +++ b/yinmeng-ios/Modules/User/VC/BindMobileVC.swift @@ -26,13 +26,17 @@ class BindMobileVC: BaseViewController, HiddenNavigationBarProtocol { view.addSubview(phoneNumView) view.addSubview(backBtn) view.addSubview(titleLb) + view.addSubview(codeView) + phoneNumView.addSubview(areaLb) phoneNumView.addSubview(phonetextFiled) codeView.addSubview(codetextFiled) codeView.addSubview(sepView) codeView.addSubview(getCodeBtn) - + + view.addSubview(confirmBtn) + backImgView.snp.makeConstraints { make in make.edges.equalTo(view) } @@ -44,14 +48,14 @@ class BindMobileVC: BaseViewController, HiddenNavigationBarProtocol { } titleLb.snp.makeConstraints { make in -make.centerX.equalToSuperview() + make.centerX.equalToSuperview() make.centerY.equalTo(backBtn) } phoneNumView.snp.makeConstraints { make in make.left.right.equalToSuperview().inset(36) make.height.equalTo(52) - make.top.equalToSuperview().offset(60) + make.top.equalToSuperview().offset(NavHeight + 20) } areaLb.snp.makeConstraints { make in @@ -87,7 +91,7 @@ make.centerX.equalToSuperview() } confirmBtn.snp.makeConstraints { make in -make.left.right.equalToSuperview().inset(36) + make.left.right.equalToSuperview().inset(36) make.top.equalTo(codeView.snp.bottom).offset(30) make.height.equalTo(52) } diff --git a/yinmeng-ios/Modules/User/VC/UserInfoVC.swift b/yinmeng-ios/Modules/User/VC/UserInfoVC.swift index 6f87909..0d597c2 100644 --- a/yinmeng-ios/Modules/User/VC/UserInfoVC.swift +++ b/yinmeng-ios/Modules/User/VC/UserInfoVC.swift @@ -37,6 +37,7 @@ class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol { view.addSubview(aboutView) view.addSubview(logOffView) view.addSubview(logoutBtn) + view.addSubview(autonymView) backImgView.snp.makeConstraints { make in make.edges.equalTo(view) @@ -51,17 +52,25 @@ class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol { rechargeView.snp.makeConstraints { make in make.left.equalTo(view).inset(28) make.height.equalTo(68) - make.right.equalTo(myRoomView.snp.left).offset(-11) + make.right.equalTo(-28) make.top.equalTo(view).offset(NavHeight + 20) } + let width = (ScreenWidth - 56 - 11)/2 myRoomView.snp.makeConstraints { make in - make.centerY.height.width.equalTo(rechargeView) - make.right.equalTo(view).offset(-28) + make.height.equalTo(rechargeView) + make.width.equalTo(width) + make.top.equalTo(rechargeView.snp.bottom).offset(12) + make.left.equalTo(view).inset(28) + } + autonymView.snp.makeConstraints { make in + make.height.width.equalTo(myRoomView) + make.top.equalTo(rechargeView.snp.bottom).offset(12) + make.right.equalTo(view).inset(28) } mobileView.snp.makeConstraints { make in make.left.equalTo(view).offset(28) make.height.equalTo(68) - make.top.equalTo(rechargeView.snp.bottom).offset(12) + make.top.equalTo(myRoomView.snp.bottom).offset(12) make.right.equalTo(passwordView.snp.left).offset(-11) } @@ -85,13 +94,15 @@ class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol { make.height.equalTo(48) make.top.equalTo(logOffView.snp.bottom).offset(48) } - + + + } + @objc func logoutBtnAction() { AuthViewModel.authVM.logout() } - private lazy var backImgView: UIImageView = { let imageView = UIImageView() imageView.image = UIImage(named: "auth_login_bg") @@ -122,6 +133,13 @@ class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol { let item = UserFunctionItem(title: "我的房间", isHiddenIcon: true ,itmeType: .myRoom) _myRoomView.item = item return _myRoomView + }() + private lazy var autonymView: UserFunctionView = { + let _autonymView = UserFunctionView() + _autonymView.delegate = self + let item = UserFunctionItem(title: "实名认证", isHiddenIcon: true ,itmeType: .autonym) + _autonymView.item = item + return _autonymView }() private lazy var mobileView: UserFunctionView = { let view = UserFunctionView() @@ -181,12 +199,34 @@ extension UserInfoVC: UserFunctionViewProtocol{ self.navigationController?.pushViewController(vc, animated: true) print("aaa") case .myRoom: - - let vc = RoomVC(roomUid: "\(AuthManager.userUid)") - vc.roomText = (self.info?.nick ?? "") + "的房间" - let nav = BaseNavigationViewController.init(rootViewController: vc) - nav.modalPresentationStyle = .fullScreen - self.present(nav, animated: true, completion: nil) + let params = ["uid":"\(AuthManager.userUid)","intoUid":"\(AuthManager.userUid)"] + RequestGet(path: "room/get", parma: params) { data in + if let info = Deserialized.toModel(with: data) { + if info.isReselect{ + if let isCertified = self.info?.isCertified,isCertified == false{ + let popUpView = PlanetStarPopUpView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight)) + self.view.addSubview(popUpView) + popUpView.textView.text = "为了营造更安全的网络环境\n在 开通个人房间前\n需要先进行实名认证" + popUpView.senderView.setTitle("去认证", for: .normal) + popUpView.bgPointView.isHidden = true + popUpView.pointTextView.isHidden = true + popUpView.clickSendBlcok = {[weak self] in + let web = WebViewController(url: "mew/\(H5Utils.autonym.rawValue)") + self?.navigationController?.pushViewController(web, animated: true) + } + } + }else{ + let vc = RoomVC(roomUid: "\(AuthManager.userUid)") + vc.roomText = (self.info?.nick ?? "") + "的房间" + let nav = BaseNavigationViewController.init(rootViewController: vc) + nav.modalPresentationStyle = .fullScreen + self.present(nav, animated: true, completion: nil) + } + } + } fail: { code, message in + HUDTool.show(with: message) + } + case .mobile: if self.info?.isBindPhone == true { HUDTool.show(with: "您已绑定手机号") @@ -202,12 +242,16 @@ extension UserInfoVC: UserFunctionViewProtocol{ } else { self.navigationController?.pushViewController(BindMobileVC(), animated: true) } - print("aaa") + case .logoff: let web = WebViewController(url: "yinmeng/\(H5Utils.logoff.rawValue)") self.navigationController?.pushViewController(web, animated: true) case .about: self.navigationController?.pushViewController(AboutUsVC(), animated: true) + case .autonym: + let web = WebViewController(url: "mew/\(H5Utils.autonym.rawValue)") + self.navigationController?.pushViewController(web, animated: true) + } } } diff --git a/yinmeng-ios/Modules/User/VM/UserObject.swift b/yinmeng-ios/Modules/User/VM/UserObject.swift index abd6908..311a71e 100644 --- a/yinmeng-ios/Modules/User/VM/UserObject.swift +++ b/yinmeng-ios/Modules/User/VM/UserObject.swift @@ -14,6 +14,7 @@ enum UserFunctionType:Int { case password case about case logoff + case autonym } struct UserFunctionItem { @@ -37,6 +38,7 @@ struct UserObject: HandyJSON { var userLevelVo:userLevelModel? var userVoice = "" var voiceDura = "" + var isCertified = false } struct userLevelModel:HandyJSON{