Commit 1fb75a3e authored by Steven杜宇's avatar Steven杜宇

// AI

parent f3f52283
......@@ -78,11 +78,13 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
height = maxHeight
self.snp.updateConstraints { make in
make.top.equalTo(11)
make.height.equalTo(height)
make.bottom.equalTo(-11)
}
} else {
self.snp.updateConstraints { make in
make.top.equalTo(11-Self.verticalGap)
make.height.equalTo(height)
make.bottom.equalTo(-(11-Self.verticalGap))
}
}
......
......@@ -47,6 +47,7 @@ class YHAIMainChatViewController: YHBaseViewController {
lazy var bottomInputView: YHAITextInputView = {
let v = YHAITextInputView(frame: .zero)
v.backgroundColor = .clear
v.sendBlock = {
[weak self] text in
guard let self = self else { return }
......@@ -82,7 +83,7 @@ class YHAIMainChatViewController: YHBaseViewController {
tableView.snp.makeConstraints { make in
make.left.right.equalTo(0)
make.top.equalTo(0)
make.bottom.equalTo(-64-k_Height_safeAreaInsetsBottom())
make.bottom.equalTo(-66-k_Height_safeAreaInsetsBottom())
}
bottomInputView.snp.makeConstraints { make in
......
......@@ -39,43 +39,13 @@ class YHAIServiceListViewController: YHBaseViewController {
return collectView
}()
lazy var bottomInputView: UIView = {
let v = UIView()
let whiteView = UIView()
whiteView.backgroundColor = .white
whiteView.layer.cornerRadius = 12.0
v.addSubview(whiteView)
let label = UILabel()
label.font = .PFSC_R(ofSize: 14)
label.text = "有什么问题尽管问我"
label.textColor = .init(hex: 0xB3C8E9)
whiteView.addSubview(label)
let sendImgV = UIImageView(image: UIImage(named: "ai_chat_send_gray"))
whiteView.addSubview(sendImgV)
lazy var bottomInputView: YHAITextInputView = {
let v = YHAITextInputView(frame: .zero)
v.backgroundColor = .clear
v.disable = true
let btn = UIButton()
btn.addTarget(self, action: #selector(didInputButtonClicked), for: .touchUpInside)
whiteView.addSubview(btn)
whiteView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
label.snp.makeConstraints { make in
make.left.equalTo(16)
make.height.equalTo(20)
make.centerY.equalToSuperview()
}
sendImgV.snp.makeConstraints { make in
make.right.equalTo(-16)
make.width.height.equalTo(24)
make.centerY.equalToSuperview()
}
v.addSubview(btn)
btn.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
......@@ -102,14 +72,11 @@ class YHAIServiceListViewController: YHBaseViewController {
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalToSuperview()
make.bottom.equalTo(bottomInputView.snp.top).offset(-8)
}
bottomInputView.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(46)
make.bottom.equalTo(-10-k_Height_safeAreaInsetsBottom())
make.top.equalTo(collectionView.snp.bottom).offset(8)
make.left.right.bottom.equalToSuperview()
}
}
}
......
......@@ -241,11 +241,13 @@ extension YHAITabViewController: JXSegmentedViewDelegate {
bgImgView.isHidden = false
headerImgView.isHidden = true
cleanBtn.isHidden = false
mainChatVC.bottomInputView.backgroundColor = mainChatVC.bottomInputView.bgColor
} else { // 港小宝
bgImgView.isHidden = true
headerImgView.isHidden = false
cleanBtn.isHidden = true
mainChatVC.bottomInputView.backgroundColor = .clear
}
}
}
......
......@@ -18,10 +18,12 @@ enum YHAITextInputStatus: Int {
class YHAITextInputView: UIView {
let bgColor = UIColor.init(hex: 0xF8FCFF)
var sendBlock: ((String)->())?
var stopSendBlock: (()->())?
var keyBoardChangeBlock: ((_ isShow: Bool)->())?
var disable: Bool = false
var status: YHAITextInputStatus = .enableSend {
didSet {
if status == .enableSend {
......@@ -145,7 +147,7 @@ class YHAITextInputView: UIView {
func createUI() {
self.backgroundColor = UIColor.init(hex: 0xF8FCFF)
self.backgroundColor = self.bgColor
self.addSubview(whiteView)
whiteView.addSubview(shadowView)
whiteView.addSubview(contentView)
......@@ -183,6 +185,7 @@ class YHAITextInputView: UIView {
textView.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(11-YHAutoTextView.verticalGap)
make.height.equalTo(30)
make.bottom.equalTo(-(11-YHAutoTextView.verticalGap))
make.right.equalTo(sendBtn.snp.left).offset(-5)
}
......@@ -191,6 +194,9 @@ class YHAITextInputView: UIView {
@objc func handleKeyboardNotification(_ notification: Notification) {
if disable {
return
}
if notification.userInfo != nil {
guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue else {return }
......
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