Commit 5269ea1f authored by Steven杜宇's avatar Steven杜宇

// AI

parent 42a898b1
...@@ -23,14 +23,14 @@ class YHAIChatBannerCollectionCell: UICollectionViewCell { ...@@ -23,14 +23,14 @@ class YHAIChatBannerCollectionCell: UICollectionViewCell {
lazy var titleLabel: UILabel = { lazy var titleLabel: UILabel = {
var label = UILabel() var label = UILabel()
label.font = .PFSC_R(ofSize: 12) label.font = .PFSC_M(ofSize: 12)
label.textAlignment = .left label.textAlignment = .left
label.textColor = UIColor.mainTextColor label.textColor = UIColor(hex: 0x6D788A)
return label return label
}() }()
lazy var shadowView: YHAIChatShadowView = { lazy var shadowView: YHAIFlowMessageShadowView = {
let v = YHAIChatShadowView() let v = YHAIFlowMessageShadowView()
return v return v
}() }()
......
...@@ -182,8 +182,8 @@ class YHAIChatBannerView: UIView { ...@@ -182,8 +182,8 @@ class YHAIChatBannerView: UIView {
addSubview(collectionView) addSubview(collectionView)
collectionView.snp.makeConstraints { make in collectionView.snp.makeConstraints { make in
make.left.equalTo(20) make.left.equalTo(0)
make.right.equalTo(-20) make.right.equalTo(0)
make.height.equalTo(33.0*2+10.0 + 10.0*2.0) make.height.equalTo(33.0*2+10.0 + 10.0*2.0)
make.top.equalTo(bannerView.snp.bottom).offset(6) make.top.equalTo(bannerView.snp.bottom).offset(6)
make.bottom.equalTo(-6) make.bottom.equalTo(-6)
......
...@@ -13,8 +13,8 @@ class YHAIChatCustomFlowLayout: UICollectionViewFlowLayout { ...@@ -13,8 +13,8 @@ class YHAIChatCustomFlowLayout: UICollectionViewFlowLayout {
let cellHeight = 33.0 let cellHeight = 33.0
let verticalGap = 10.0 let verticalGap = 10.0
let horizonalGap = 10.0 let horizonalGap = 10.0
var firstLineX = 0.0 var firstLineX = 20.0
var secondLineX = 0.0 var secondLineX = 20.0
let firstLineY = 10.0 let firstLineY = 10.0
let secondLineY = 10.0 + 33.0 + 10.0 let secondLineY = 10.0 + 33.0 + 10.0
...@@ -46,8 +46,8 @@ class YHAIChatCustomFlowLayout: UICollectionViewFlowLayout { ...@@ -46,8 +46,8 @@ class YHAIChatCustomFlowLayout: UICollectionViewFlowLayout {
var dataSource:[String] = [] { var dataSource:[String] = [] {
didSet { didSet {
attributes.removeAll() attributes.removeAll()
firstLineX = 0.0 firstLineX = 20.0
secondLineX = 0.0 secondLineX = 20.0
for (index, text) in dataSource.enumerated() { for (index, text) in dataSource.enumerated() {
let attribute = UICollectionViewLayoutAttributes(forCellWith: IndexPath(row: index, section: 0)) let attribute = UICollectionViewLayoutAttributes(forCellWith: IndexPath(row: index, section: 0))
let size = self.getSize(index: index) let size = self.getSize(index: index)
...@@ -94,7 +94,7 @@ class YHAIChatCustomFlowLayout: UICollectionViewFlowLayout { ...@@ -94,7 +94,7 @@ class YHAIChatCustomFlowLayout: UICollectionViewFlowLayout {
func getSize(index:Int) -> CGSize { func getSize(index:Int) -> CGSize {
if 0 <= index, index < dataSource.count { if 0 <= index, index < dataSource.count {
let size = self.getwith(font: UIFont.PFSC_R(ofSize: 12), height: cellHeight, string: dataSource[index]) let size = self.getwith(font: UIFont.PFSC_M(ofSize: 12), height: cellHeight, string: dataSource[index])
let gap = 10.0 let gap = 10.0
let width = size.width + gap*2.0 let width = size.width + gap*2.0
return CGSize(width: width, height: cellHeight) return CGSize(width: width, height: cellHeight)
......
...@@ -31,6 +31,35 @@ class YHAIChatShadowView: UIView { ...@@ -31,6 +31,35 @@ class YHAIChatShadowView: UIView {
layer.shadowOffset = CGSize(width: 0, height: 4) layer.shadowOffset = CGSize(width: 0, height: 4)
} }
override func layoutSubviews() {
super.layoutSubviews()
// 确保在布局更新时更新阴影路径
setupShadow()
}
}
class YHAIFlowMessageShadowView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setupShadow()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
setupShadow()
}
private func setupShadow() {
// 创建阴影路径
let shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: 6)
// 设置阴影属性
layer.shadowPath = shadowPath.cgPath
layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.06).cgColor
layer.shadowOpacity = 1
layer.shadowOffset = CGSize(width: 0, height: 2)
}
override func layoutSubviews() { override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
// 确保在布局更新时更新阴影路径 // 确保在布局更新时更新阴影路径
......
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