Commit d139be80 authored by Steven杜宇's avatar Steven杜宇

Merge branch '630-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into 630-dev

# Conflicts:
#	galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
parents 9cf30beb f4eea97a
...@@ -300,6 +300,8 @@ ...@@ -300,6 +300,8 @@
04AD31772C22DE6600DF5655 /* YHEditInterestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD31762C22DE6600DF5655 /* YHEditInterestViewController.swift */; }; 04AD31772C22DE6600DF5655 /* YHEditInterestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD31762C22DE6600DF5655 /* YHEditInterestViewController.swift */; };
04AD31792C23FFC700DF5655 /* YHInterestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD31782C23FFC700DF5655 /* YHInterestModel.swift */; }; 04AD31792C23FFC700DF5655 /* YHInterestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD31782C23FFC700DF5655 /* YHInterestModel.swift */; };
04AD317B2C2428CB00DF5655 /* YHPeopleSuccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */; }; 04AD317B2C2428CB00DF5655 /* YHPeopleSuccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */; };
04AD317D2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */; };
04AD317F2C295C0300DF5655 /* YHChangeHeadModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */; };
04AF514E2BEB585C00009E3A /* YHVideoPlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */; }; 04AF514E2BEB585C00009E3A /* YHVideoPlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */; };
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; }; 04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; };
04AF82D62C25542D0028CE2A /* YHInterestTopicLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */; }; 04AF82D62C25542D0028CE2A /* YHInterestTopicLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */; };
...@@ -859,6 +861,8 @@ ...@@ -859,6 +861,8 @@
04AD31762C22DE6600DF5655 /* YHEditInterestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEditInterestViewController.swift; sourceTree = "<group>"; }; 04AD31762C22DE6600DF5655 /* YHEditInterestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHEditInterestViewController.swift; sourceTree = "<group>"; };
04AD31782C23FFC700DF5655 /* YHInterestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestModel.swift; sourceTree = "<group>"; }; 04AD31782C23FFC700DF5655 /* YHInterestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestModel.swift; sourceTree = "<group>"; };
04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPeopleSuccessView.swift; sourceTree = "<group>"; }; 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPeopleSuccessView.swift; sourceTree = "<group>"; };
04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUserInfoSettingViewModel.swift; sourceTree = "<group>"; };
04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChangeHeadModel.swift; sourceTree = "<group>"; };
04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerVC.swift; sourceTree = "<group>"; }; 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerVC.swift; sourceTree = "<group>"; };
04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; }; 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; };
04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestTopicLayout.swift; sourceTree = "<group>"; }; 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestTopicLayout.swift; sourceTree = "<group>"; };
...@@ -1957,6 +1961,7 @@ ...@@ -1957,6 +1961,7 @@
children = ( children = (
0468D4352B57752F00CFB916 /* YHUserModel.swift */, 0468D4352B57752F00CFB916 /* YHUserModel.swift */,
044D0BF92C215C6F00C5CF5E /* YHSettingItem.swift */, 044D0BF92C215C6F00C5CF5E /* YHSettingItem.swift */,
04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1965,6 +1970,7 @@ ...@@ -1965,6 +1970,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0468D4392B579EAC00CFB916 /* YHLoginViewModel.swift */, 0468D4392B579EAC00CFB916 /* YHLoginViewModel.swift */,
04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */,
); );
path = VM; path = VM;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3359,6 +3365,7 @@ ...@@ -3359,6 +3365,7 @@
045EEF1E2B9F171A0022A143 /* YHBottomNextView.swift in Sources */, 045EEF1E2B9F171A0022A143 /* YHBottomNextView.swift in Sources */,
A567E59E2BD7643D00D5D5A0 /* YHHomePageViewController.swift in Sources */, A567E59E2BD7643D00D5D5A0 /* YHHomePageViewController.swift in Sources */,
045EEEBA2B9F171A0022A143 /* YHWorkResponsibilitiesTableViewCell.swift in Sources */, 045EEEBA2B9F171A0022A143 /* YHWorkResponsibilitiesTableViewCell.swift in Sources */,
04AD317F2C295C0300DF5655 /* YHChangeHeadModel.swift in Sources */,
A5ACE9552B4564F7002C94D2 /* YHTabBarViewController.swift in Sources */, A5ACE9552B4564F7002C94D2 /* YHTabBarViewController.swift in Sources */,
045EEF0A2B9F171A0022A143 /* YHBasicInfoSessionModel.swift in Sources */, 045EEF0A2B9F171A0022A143 /* YHBasicInfoSessionModel.swift in Sources */,
045EEF022B9F171A0022A143 /* YHFormItemDegreeInfoCell.swift in Sources */, 045EEF022B9F171A0022A143 /* YHFormItemDegreeInfoCell.swift in Sources */,
...@@ -3445,6 +3452,7 @@ ...@@ -3445,6 +3452,7 @@
045EEEA92B9F171A0022A143 /* YHWorkExperienceListViewController.swift in Sources */, 045EEEA92B9F171A0022A143 /* YHWorkExperienceListViewController.swift in Sources */,
04A7BD132BA42F4200BD35A2 /* YHMyDocumentsDetailViewController.swift in Sources */, 04A7BD132BA42F4200BD35A2 /* YHMyDocumentsDetailViewController.swift in Sources */,
04A671622BA058DE00C1FB91 /* YHCertificateEditSheetView.swift in Sources */, 04A671622BA058DE00C1FB91 /* YHCertificateEditSheetView.swift in Sources */,
04AD317D2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift in Sources */,
04FD85682C21277800BEF9C5 /* YHMyNameCardAvatarInfoCell.swift in Sources */, 04FD85682C21277800BEF9C5 /* YHMyNameCardAvatarInfoCell.swift in Sources */,
A566A79A2C219FA400980D06 /* YHHomeSalonAreaView.swift in Sources */, A566A79A2C219FA400980D06 /* YHHomeSalonAreaView.swift in Sources */,
A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */, A5ACE9432B4564F7002C94D2 /* UILable+Extension.swift in Sources */,
......
...@@ -12,7 +12,7 @@ import Alamofire ...@@ -12,7 +12,7 @@ import Alamofire
class YHBaseViewModel { class YHBaseViewModel {
// 上传方法 // 上传方法
func uploadImage(_ image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func uploadImage(_ image: UIImage, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
#if DEBUG #if DEBUG
let size = image.imageSize() let size = image.imageSize()
YHHUD.flash(message: "\(Float(size/1024/1024))M") YHHUD.flash(message: "\(Float(size/1024/1024))M")
...@@ -44,7 +44,7 @@ class YHBaseViewModel { ...@@ -44,7 +44,7 @@ class YHBaseViewModel {
return return
} }
YHOSSManager.share.updateToken { YHOSSManager.share.updateToken {
YHOSSManager.share.putObject(image: image) {[weak self] success, error in YHOSSManager.share.putObject(image: image, isPublic) {[weak self] success, error in
guard let _ = self else { return } guard let _ = self else { return }
DispatchQueue.main.async { DispatchQueue.main.async {
// 在这里执行需要在主线程上完成的任务 // 在这里执行需要在主线程上完成的任务
...@@ -54,8 +54,7 @@ class YHBaseViewModel { ...@@ -54,8 +54,7 @@ class YHBaseViewModel {
} }
} }
//换取一张 func getPublicImageUrl(_ url: String, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
func getPublicImageUrl(_ url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
// let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.getPublicApi // let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.getPublicApi
// let param: [String: Any] = ["fileUrl": url] // let param: [String: Any] = ["fileUrl": url]
// let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in // let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
...@@ -80,7 +79,7 @@ class YHBaseViewModel { ...@@ -80,7 +79,7 @@ class YHBaseViewModel {
return return
} }
YHOSSManager.share.updateToken { YHOSSManager.share.updateToken {
YHOSSManager.share.getPublic(url: url, callBackBlock: { [weak self] success, error in YHOSSManager.share.getPublic(url: url, isPublic, callBackBlock: { [weak self] success, error in
guard let _ = self else { return } guard let _ = self else { return }
DispatchQueue.main.async { DispatchQueue.main.async {
// 在这里执行需要在主线程上完成的任务 // 在这里执行需要在主线程上完成的任务
...@@ -109,7 +108,7 @@ class YHBaseViewModel { ...@@ -109,7 +108,7 @@ class YHBaseViewModel {
} }
// 上传方法 // 上传方法
func uploadFile(_ url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func uploadFile(_ url: String, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
// let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.uploadApi // let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.uploadApi
// printLog("\(url)") // printLog("\(url)")
// let boundary = UUID().uuidString // let boundary = UUID().uuidString
...@@ -138,7 +137,7 @@ class YHBaseViewModel { ...@@ -138,7 +137,7 @@ class YHBaseViewModel {
return return
} }
YHOSSManager.share.updateToken { YHOSSManager.share.updateToken {
YHOSSManager.share.putFile(file: url, callBackBlock: {[weak self] success, error in YHOSSManager.share.putFile(file: url, isPublic, callBackBlock: {[weak self] success, error in
guard let _ = self else { return } guard let _ = self else { return }
DispatchQueue.main.async { DispatchQueue.main.async {
// 在这里执行需要在主线程上完成的任务 // 在这里执行需要在主线程上完成的任务
......
...@@ -21,13 +21,26 @@ class YHActivityTitleItemView: UIView { ...@@ -21,13 +21,26 @@ class YHActivityTitleItemView: UIView {
lazy var nameLabel:UILabel = { // lazy var nameLabel:UILabel = {
let nameLabel = UILabel() // let nameLabel = UILabel()
nameLabel.textColor = UIColor.mainTextColor // nameLabel.textColor = UIColor.mainTextColor
nameLabel.textAlignment = .left // nameLabel.textAlignment = .left
nameLabel.font = UIFont.PFSC_B(ofSize:24) // nameLabel.font = UIFont.PFSC_B(ofSize:24)
nameLabel.text = "哈佛爸爸线下教育沙龙" // nameLabel.text = "哈佛爸爸线下教育沙龙哈佛爸爸线下教育沙龙"
return nameLabel // return nameLabel
// }()
private lazy var nameTextView : UITextView = {
let lable0 = UITextView()
lable0.textColor = UIColor.mainTextColor
lable0.textAlignment = .left
lable0.font = UIFont.PFSC_B(ofSize:24)
lable0.isScrollEnabled = false
lable0.isEditable = false
lable0.isSelectable = false
return lable0
}() }()
...@@ -83,20 +96,21 @@ class YHActivityTitleItemView: UIView { ...@@ -83,20 +96,21 @@ class YHActivityTitleItemView: UIView {
extension YHActivityTitleItemView { extension YHActivityTitleItemView {
func setupUI() { func setupUI() {
addSubview(nameLabel) // addSubview(nameLabel)
addSubview(nameTextView)
addSubview(timeStaticLable) addSubview(timeStaticLable)
addSubview(timeLable) addSubview(timeLable)
addSubview(addressStaticLable) addSubview(addressStaticLable)
addSubview(addressLable) addSubview(addressLable)
addSubview(navAddressLable) addSubview(navAddressLable)
nameLabel.snp.makeConstraints { make in nameTextView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview() make.top.left.right.equalToSuperview()
} }
timeStaticLable.snp.makeConstraints { make in timeStaticLable.snp.makeConstraints { make in
make.left.equalToSuperview() make.left.equalToSuperview()
make.top.equalTo(nameLabel.snp.bottom).offset(24) make.top.equalTo(nameTextView.snp.bottom).offset(24)
make.height.equalTo(20) make.height.equalTo(20)
make.width.equalTo(28) make.width.equalTo(28)
} }
...@@ -129,5 +143,8 @@ extension YHActivityTitleItemView { ...@@ -129,5 +143,8 @@ extension YHActivityTitleItemView {
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
nameTextView.attributed.text = """
\("哈佛爸爸线哈 ", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_B(ofSize:24)))\(.image(UIImage(named: "activity_vip_icon2")!,.custom(.offset(CGPoint(x: 0, y: -7)), size: .init(width: 44, height: 34))))
"""
} }
} }
...@@ -12,6 +12,8 @@ class YHAllowUseMyInfoViewController: YHBaseViewController { ...@@ -12,6 +12,8 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
var tableView: UITableView! var tableView: UITableView!
var nextButton: UIButton! var nextButton: UIButton!
let items: [YHSettingItem] = [YHSettingItem(type: .normal, title: "允许您的信息在名片中使用", subTitle: "开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见", isSelect: true, isShowAlert: false)] let items: [YHSettingItem] = [YHSettingItem(type: .normal, title: "允许您的信息在名片中使用", subTitle: "开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见", isSelect: true, isShowAlert: false)]
var viewModel: YHUserInfoSettingViewModel = YHUserInfoSettingViewModel()
var isOpen: Bool = true
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -65,8 +67,14 @@ class YHAllowUseMyInfoViewController: YHBaseViewController { ...@@ -65,8 +67,14 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
} }
@objc func nextStep() { @objc func nextStep() {
let vc = YHInformationAuthorizationStepOneViewController() var open = 1
self.navigationController?.pushViewController(vc) if isOpen {
open = 2
}
viewModel.requestAuthorizationSubmit(agress: open) {[weak self] success, error in
guard let self = self else { return }
self.dismiss(animated: true)
}
} }
} }
...@@ -78,6 +86,10 @@ extension YHAllowUseMyInfoViewController: UITableViewDelegate, UITableViewDataSo ...@@ -78,6 +86,10 @@ extension YHAllowUseMyInfoViewController: UITableViewDelegate, UITableViewDataSo
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHAllowSettingTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHAllowSettingTableViewCell.self)
cell.item = items[indexPath.row] cell.item = items[indexPath.row]
cell.block = { [weak self] model in
guard let self = self else { return }
self.isOpen = !self.isOpen
}
return cell return cell
} }
......
...@@ -169,8 +169,13 @@ class YHCodeSueecssViewController: YHBaseViewController { ...@@ -169,8 +169,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?() YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功") YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self.dismiss(animated: true) self.dismiss(animated: true) {
self.navigationController?.popToRootViewController(animated: true) if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
}
} }
}) })
} }
...@@ -185,8 +190,13 @@ class YHCodeSueecssViewController: YHBaseViewController { ...@@ -185,8 +190,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?() YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功") YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self.dismiss(animated: true) self.dismiss(animated: true) {
self.navigationController?.popToRootViewController(animated: true) if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
}
} }
}) })
} }
...@@ -207,8 +217,13 @@ class YHCodeSueecssViewController: YHBaseViewController { ...@@ -207,8 +217,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager.shared.loginSuccessActionBlock?() YHLoginManager.shared.loginSuccessActionBlock?()
YHHUD.flash(message: "登录成功") YHHUD.flash(message: "登录成功")
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
self?.dismiss(animated: true) self?.dismiss(animated: true) {
self?.navigationController?.popToRootViewController(animated: true) if YHLoginManager.shared.userModel?.is_first_login == 1 {
let vc = UINavigationController(rootVC: YHUserInfoSettingViewController())
vc.modalPresentationStyle = .fullScreen
UIViewController.current?.present(vc, animated: true)
}
}
} }
} }
} }
......
...@@ -15,10 +15,14 @@ class YHUserInfoSettingViewController: YHBaseViewController { ...@@ -15,10 +15,14 @@ class YHUserInfoSettingViewController: YHBaseViewController {
var nameLabel: UILabel! var nameLabel: UILabel!
var nameTextField: UITextField! var nameTextField: UITextField!
var nextButton: UIButton! var nextButton: UIButton!
var viewModel: YHUserInfoSettingViewModel = YHUserInfoSettingViewModel()
var headUrl: String = ""
var name: String = ""
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setView() setView()
changeHead()
} }
func setView() { func setView() {
...@@ -125,11 +129,20 @@ class YHUserInfoSettingViewController: YHBaseViewController { ...@@ -125,11 +129,20 @@ class YHUserInfoSettingViewController: YHBaseViewController {
YHImagePickerView.show() {[weak self] image in YHImagePickerView.show() {[weak self] image in
guard let self = self else { return } guard let self = self else { return }
self.photoImageView.image = image self.photoImageView.image = image
self.viewModel.uploadImage(image, true) {[weak self] success, error in
guard let self = self else { return }
self.headUrl = success ?? ""
}
} }
} }
@objc func changeHead() { @objc func changeHead() {
viewModel.requestChangeHead {[weak self] success, error in
guard let self = self else { return }
self.headUrl = self.viewModel.headUrl
let url = URL(string: self.headUrl)
self.photoImageView.kf.setImage(with: url)
}
} }
@objc func nextStep() { @objc func nextStep() {
...@@ -137,7 +150,12 @@ class YHUserInfoSettingViewController: YHBaseViewController { ...@@ -137,7 +150,12 @@ class YHUserInfoSettingViewController: YHBaseViewController {
YHHUD.flash(message: "请填写您的真实姓名") YHHUD.flash(message: "请填写您的真实姓名")
return return
} }
let vc = YHAllowUseMyInfoViewController() self.name = nameTextField.text ?? ""
self.navigationController?.pushViewController(vc) // 请求接口逻辑
viewModel.requestSaveUserInfo(head: headUrl, name: name) {[weak self] success, error in
guard let self = self else { return }
let vc = YHAllowUseMyInfoViewController()
self.navigationController?.pushViewController(vc)
}
} }
} }
//
// YHChangeHeadModel.swift
// galaxy
//
// Created by EDY on 2024/6/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHChangeHeadModel: YHBaseModel {
var avatar: String = ""
}
...@@ -16,6 +16,7 @@ struct YHUserModel: SmartCodable { ...@@ -16,6 +16,7 @@ struct YHUserModel: SmartCodable {
var headpic: String? var headpic: String?
var sex: Int? var sex: Int?
var token: String? var token: String?
var is_first_login: Int = 0
} }
struct YHDeviceTokenModel { struct YHDeviceTokenModel {
......
//
// YHUserInfoSettingViewModel.swift
// galaxy
//
// Created by EDY on 2024/6/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHUserInfoSettingViewModel: YHBaseViewModel {
var headUrl: String = ""
func requestChangeHead(callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.change
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
let dic = json.data
guard let result = YHChangeHeadModel.deserialize(from: dic as? Dictionary) else {
callBackBlock(false,nil)
return
}
self.headUrl = result.avatar
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestSaveUserInfo(head: String, name: String, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String: Any] = ["avatar": head,
"username": name]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.userSubmit
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
func requestAuthorizationSubmit(agress: Int, callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let params: [String: Any] = ["information_to_card": agress]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.People.authorizationSubmit
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let _ = self else { return }
if json.code == 200 {
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false, err)
}
}
}
...@@ -17,7 +17,7 @@ class YHAnalytics { ...@@ -17,7 +17,7 @@ class YHAnalytics {
#if DEBUG #if DEBUG
let options = SAConfigOptions.init(serverURL: YhConstant.SensorsAnalytics.urlForTest, launchOptions: launchOptions) let options = SAConfigOptions.init(serverURL: YhConstant.SensorsAnalytics.urlForTest, launchOptions: launchOptions)
//开启log //开启log
options.enableLog = true options.enableLog = false
SensorsAnalyticsSDK.sharedInstance()?.set(["evn" : "test"]) SensorsAnalyticsSDK.sharedInstance()?.set(["evn" : "test"])
#elseif TESTENV #elseif TESTENV
let options = SAConfigOptions.init(serverURL: YhConstant.SensorsAnalytics.urlForTest, launchOptions: launchOptions) let options = SAConfigOptions.init(serverURL: YhConstant.SensorsAnalytics.urlForTest, launchOptions: launchOptions)
......
...@@ -316,5 +316,10 @@ class YHAllApiName { ...@@ -316,5 +316,10 @@ class YHAllApiName {
static let receiveFriendRequestApi = "super-app/community/process-friend-requests" static let receiveFriendRequestApi = "super-app/community/process-friend-requests"
// 好友列表 // 好友列表
static let friendListApi = "super-app/community/my-friends" static let friendListApi = "super-app/community/my-friends"
static let change = "super-app/avatar/change"
static let userSubmit = "super-app/user-base/submit"
static let authorizationSubmit = "super-app/authorization/submit"
} }
} }
...@@ -68,7 +68,7 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -68,7 +68,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
} }
} }
func putObject(image: UIImage, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func putObject(image: UIImage, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let request = OSSPutObjectRequest() let request = OSSPutObjectRequest()
let size = Int(2 * 1024 * 1024) let size = Int(2 * 1024 * 1024)
guard let imageData = image.compressOriginalImage(size) else { guard let imageData = image.compressOriginalImage(size) else {
...@@ -86,7 +86,11 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -86,7 +86,11 @@ class YHOSSManager: NSObject, URLSessionDelegate {
dateFormatter.dateFormat = "yyyyMMdd" dateFormatter.dateFormat = "yyyyMMdd"
let currentDateMMdd = dateFormatter.string(from: Date()) let currentDateMMdd = dateFormatter.string(from: Date())
self.fileName.append(name) self.fileName.append(name)
request.objectKey = "4001001" + "/" + currentDateMMdd + "/" + "\(name)" if isPublic {
request.objectKey = "5000000" + "/" + currentDateMMdd + "/" + "\(name)"
} else {
request.objectKey = "4001001" + "/" + currentDateMMdd + "/" + "\(name)"
}
request.contentDisposition = "inline" request.contentDisposition = "inline"
request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in
printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)") printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)")
...@@ -102,9 +106,13 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -102,9 +106,13 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyyMMdd" dateFormatter.dateFormat = "yyyyMMdd"
let currentDateMMdd = dateFormatter.string(from: Date()) let currentDateMMdd = dateFormatter.string(from: Date())
let string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "4001001" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")" var string = ""
if isPublic {
string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "5000000" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")"
} else {
string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "4001001" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")"
}
self.fileName.removeFirst() self.fileName.removeFirst()
print("------------\(string)")
callBackBlock(string, YHErrorModel()) callBackBlock(string, YHErrorModel())
} }
return return
...@@ -112,7 +120,7 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -112,7 +120,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
} }
} }
func putFile(file: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func putFile(file: String, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let request = OSSPutObjectRequest() let request = OSSPutObjectRequest()
guard let fileData = try? Data(contentsOf: URL(string: file) ?? URL(fileURLWithPath: "")) else { guard let fileData = try? Data(contentsOf: URL(string: file) ?? URL(fileURLWithPath: "")) else {
callBackBlock(nil, YHErrorModel()) callBackBlock(nil, YHErrorModel())
...@@ -129,7 +137,11 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -129,7 +137,11 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyyMMdd" dateFormatter.dateFormat = "yyyyMMdd"
let currentDateMMdd = dateFormatter.string(from: Date()) let currentDateMMdd = dateFormatter.string(from: Date())
request.objectKey = "4001001" + "/" + currentDateMMdd + "/" + "\(name)" if isPublic {
request.objectKey = "5000000" + "/" + currentDateMMdd + "/" + "\(name)"
} else {
request.objectKey = "4001001" + "/" + currentDateMMdd + "/" + "\(name)"
}
request.contentDisposition = "inline" request.contentDisposition = "inline"
request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in
printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)") printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)")
...@@ -147,7 +159,12 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -147,7 +159,12 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyyMMdd" dateFormatter.dateFormat = "yyyyMMdd"
let currentDateMMdd = dateFormatter.string(from: Date()) let currentDateMMdd = dateFormatter.string(from: Date())
let string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "4001001" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")" var string = ""
if isPublic {
string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "5000000" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")"
} else {
string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + "4001001" + "/" + currentDateMMdd + "/" + "\(self.fileName.first ?? "")"
}
self.fileName.removeFirst() self.fileName.removeFirst()
callBackBlock(string, YHErrorModel()) callBackBlock(string, YHErrorModel())
} }
...@@ -156,7 +173,7 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -156,7 +173,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
} }
} }
func getPublic(url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func getPublic(url: String, _ isPublic: Bool = false, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
DispatchQueue.global().async { DispatchQueue.global().async {
let bucketName = self.getBucket(url) let bucketName = self.getBucket(url)
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "v专享@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "v专享@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment