| | |
| | | import com.bumptech.glide.Glide |
| | | import com.example.firstapp.activity.VipActivity |
| | | import com.example.firstapp.database.response.UserInfo |
| | | import com.example.firstapp.utils.PreferencesManager |
| | | |
| | | class NotificationsFragment : Fragment() { |
| | | |
| | |
| | | |
| | | private suspend fun loadUserInfo() { |
| | | try { |
| | | val response = RetrofitClient.apiService.getUserInfo("17586582287") |
| | | // 从本地获取保存的手机号 |
| | | val savedPhone = PreferencesManager.getPhone() |
| | | if (savedPhone.isNullOrEmpty()) { |
| | | Toast.makeText(context, "用户未登录", Toast.LENGTH_SHORT).show() |
| | | return |
| | | } |
| | | |
| | | val response = RetrofitClient.apiService.getUserInfo(savedPhone) |
| | | if (response.code == "0" && response.data != null) { |
| | | // 保存用户信息 |
| | | currentUserInfo = response.data |
| | |
| | | binding.tvUserId.text = "个人账号:${userInfo.contactTel}" |
| | | |
| | | // 设置VIP信息 |
| | | if (userInfo.showed) { |
| | | if (userInfo.isMember) { |
| | | binding.ivVip.visibility = View.VISIBLE |
| | | binding.cardVip.visibility = View.VISIBLE |
| | | binding.tvVipExpire.text = "${userInfo.overTime} 到期" |
| | | binding.tvVipExpire.text = "${userInfo.memberOverDate} 到期" |
| | | } else { |
| | | //非会员信息 |
| | | binding.ivVip.visibility = View.GONE |
| | | binding.cardVip.visibility = View.VISIBLE |
| | | binding.btnRenew.text = "立即开通" |
| | | binding.linearVipContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.gray)) |
| | | binding.cardVip.visibility = View.GONE |
| | | } |
| | | } |
| | | } catch (e: Exception) { |