feat: add WeChat sharing and invite flow

This commit is contained in:
2026-07-07 16:53:39 +08:00
parent f1937e23d4
commit a80c181bd7
160 changed files with 7557 additions and 849 deletions

View File

@ -111,6 +111,9 @@ final class AccountSelectionViewController: UIViewController, UITableViewDelegat
private func configureTableView() {
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.contentInset = UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0)
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 92
tableView.delegate = self
tableView.register(AccountSelectionCell.self, forCellReuseIdentifier: AccountSelectionCell.reuseIdentifier)
view.addSubview(tableView)
@ -178,8 +181,9 @@ final class AccountSelectionViewController: UIViewController, UITableViewDelegat
private final class AccountSelectionCell: UITableViewCell {
static let reuseIdentifier = "AccountSelectionCell"
private let avatarView = UIView()
private let avatarLabel = UILabel()
private let card = UIView()
private let avatarView = UIImageView()
private let avatarPlaceholderLabel = UILabel()
private let titleLabel = UILabel()
private let subtitleLabel = UILabel()
private let phoneLabel = UILabel()
@ -191,13 +195,18 @@ private final class AccountSelectionCell: UITableViewCell {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .clear
contentView.backgroundColor = .white
contentView.layer.cornerRadius = 8
contentView.layer.masksToBounds = true
contentView.backgroundColor = .clear
card.backgroundColor = .white
card.layer.cornerRadius = 10
card.layer.masksToBounds = true
avatarView.clipsToBounds = true
avatarView.layer.cornerRadius = 25
avatarView.contentMode = .scaleAspectFill
avatarLabel.font = .systemFont(ofSize: 14, weight: .semibold)
avatarPlaceholderLabel.font = .systemFont(ofSize: 14, weight: .semibold)
avatarPlaceholderLabel.textAlignment = .center
titleLabel.font = .systemFont(ofSize: 16, weight: .semibold)
titleLabel.textColor = AppColor.text333
@ -212,6 +221,7 @@ private final class AccountSelectionCell: UITableViewCell {
typeTag.textAlignment = .center
typeTag.layer.cornerRadius = 4
typeTag.clipsToBounds = true
typeTag.setContentCompressionResistancePriority(.required, for: .horizontal)
currentTag.font = .systemFont(ofSize: 11, weight: .semibold)
currentTag.textAlignment = .center
@ -224,14 +234,19 @@ private final class AccountSelectionCell: UITableViewCell {
checkmark.contentMode = .scaleAspectFit
contentView.addSubview(avatarView)
avatarView.addSubview(avatarLabel)
contentView.addSubview(titleLabel)
contentView.addSubview(subtitleLabel)
contentView.addSubview(phoneLabel)
contentView.addSubview(typeTag)
contentView.addSubview(currentTag)
contentView.addSubview(checkmark)
contentView.addSubview(card)
card.addSubview(avatarView)
avatarView.addSubview(avatarPlaceholderLabel)
card.addSubview(titleLabel)
card.addSubview(subtitleLabel)
card.addSubview(phoneLabel)
card.addSubview(typeTag)
card.addSubview(currentTag)
card.addSubview(checkmark)
card.snp.makeConstraints { make in
make.edges.equalToSuperview().inset(UIEdgeInsets(top: 6, left: 16, bottom: 6, right: 16))
}
avatarView.snp.makeConstraints { make in
make.leading.equalToSuperview().inset(16)
@ -239,18 +254,19 @@ private final class AccountSelectionCell: UITableViewCell {
make.width.height.equalTo(50)
}
avatarLabel.snp.makeConstraints { make in
avatarPlaceholderLabel.snp.makeConstraints { make in
make.center.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().inset(16)
make.leading.equalTo(avatarView.snp.trailing).offset(12)
make.trailing.lessThanOrEqualTo(checkmark.snp.leading).offset(-8)
make.trailing.lessThanOrEqualTo(typeTag.snp.leading).offset(-8)
}
currentTag.snp.makeConstraints { make in
make.leading.equalTo(titleLabel.snp.trailing).offset(6)
make.trailing.lessThanOrEqualTo(typeTag.snp.leading).offset(-8)
make.centerY.equalTo(titleLabel)
make.height.equalTo(18)
}
@ -292,27 +308,32 @@ private final class AccountSelectionCell: UITableViewCell {
phoneLabel.isHidden = account.phone.isEmpty
currentTag.isHidden = !account.isCurrent
let avatarPlaceholderColor: UIColor
let avatarTextColor: UIColor
if account.isStoreUser {
avatarView.backgroundColor = UIColor(hex: 0xE8F8F1)
avatarLabel.text = ""
avatarLabel.textColor = UIColor(hex: 0x0F9F6E)
avatarPlaceholderColor = UIColor(hex: 0xE8F8F1)
avatarTextColor = UIColor(hex: 0x0F9F6E)
avatarPlaceholderLabel.text = ""
typeTag.text = " 门店 "
typeTag.textColor = UIColor(hex: 0x0F9F6E)
typeTag.backgroundColor = UIColor(hex: 0xE8F8F1)
} else {
avatarView.backgroundColor = UIColor(hex: 0xF3ECFF)
avatarLabel.text = ""
avatarLabel.textColor = UIColor(hex: 0x7C3AED)
avatarPlaceholderColor = UIColor(hex: 0xF3ECFF)
avatarTextColor = UIColor(hex: 0x7C3AED)
avatarPlaceholderLabel.text = ""
typeTag.text = " 景区 "
typeTag.textColor = UIColor(hex: 0x7C3AED)
typeTag.backgroundColor = UIColor(hex: 0xF3ECFF)
}
avatarPlaceholderLabel.textColor = avatarTextColor
avatarPlaceholderLabel.isHidden = !account.avatar.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
avatarView.loadRemoteImage(urlString: account.avatar, placeholderColor: avatarPlaceholderColor)
let symbolName = selected ? "checkmark.circle.fill" : "circle"
checkmark.image = UIImage(systemName: symbolName)
checkmark.tintColor = selected ? AppColor.primary : UIColor(hex: 0xB6BECA)
contentView.layer.borderWidth = selected ? 1.4 : 1
contentView.layer.borderColor = (selected ? AppColor.primary : UIColor(hex: 0xE6ECF4)).cgColor
card.layer.borderWidth = selected ? 1.4 : 1
card.layer.borderColor = (selected ? AppColor.primary : UIColor(hex: 0xE6ECF4)).cgColor
}
}