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

// AI

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